CSharpUML.UmlParser.Parse C# (CSharp) Метод

Parse() публичный Метод

public Parse ( IEnumerable lines ) : IEnumerable
lines IEnumerable
Результат IEnumerable
        public IEnumerable<IUmlObject> Parse(IEnumerable<string> lines)
        {
            if (lines.Count () > 0) {
                int i = 0;
                UmlBlock[] blocks = ParseBlocks (lines.Where (FilterIgnoreLines).ToArray (), ref i, -1);

                foreach (UmlBlock block in blocks) {
                    if (UmlClass.Matches (block)) {
                        yield return new UmlClass (block);
                    } else if (UmlEnum.Matches (block)) {
                        yield return new UmlEnum (block);
                    }
                }
            }
        }

Same methods

UmlParser::Parse ( string filename ) : IEnumerable

Usage Example

Пример #1
0
        private static void Uml2Diagram(IEnumerable <string> paths, string target)
        {
            foreach (string path in paths)
            {
                Console.WriteLine(path);
                string graphdir = target.Length > 0 ? target + "/" : path + "/graphs/";

                List <IUmlObject> allObjects  = new List <IUmlObject> ();
                Action <string>   processFile = (filename) => {
                    if (!filename.Contains("graphs") && !filename.Contains("ModelDefinition"))
                    {
                        IParser parser = new UmlParser();
                        Console.WriteLine("Read: " + filename);
                        allObjects.AddRange(parser.Parse(filename));
                        //foreach (IUmlObject obj in objects) {
                        //	Console.WriteLine (obj);
                        //}
                    }
                };
                Files.SearchFiles(path, new string[] { ".uml" }, processFile);

                Console.WriteLine("Write: " + "classes.dot");
                ClassDiagram allDia = new ClassDiagram(allObjects);
                Files.WriteLines(graphdir + "classes.dot", allDia.DotCode());
                GraphViz.Dot("svg", graphdir + "classes.dot", graphdir + "classes.svg");
                GraphViz.Dot("png", graphdir + "classes.dot", graphdir + "classes.png");

                foreach (UmlClass obj in allObjects.OfType <UmlClass>())
                {
                    string filename = "class-" + obj.Name.Clean();
                    Console.WriteLine("Write: " + filename + ".svg");

                    IEnumerable <IUmlObject> relatedObjects = obj.FindRelated(allObjects);

                    // write class diagram
                    ClassDiagram dia = new ClassDiagram(relatedObjects);
                    Files.WriteLines(graphdir + filename + ".dot", dia.DotCode());
                    GraphViz.Dot("svg", graphdir + filename + ".dot", graphdir + filename + ".svg");

                    // write uml code
                    List <string> lines = new List <string> ();
                    foreach (IUmlObject relObj in relatedObjects)
                    {
                        lines.Add(relObj.ToUmlCode() + "\n");
                    }
                    Files.WriteLines(graphdir + filename + ".uml", lines);
                }
            }
        }
All Usage Examples Of CSharpUML.UmlParser::Parse