private static void VisualStudio2Uml(IEnumerable<string> paths, string target)
{
if (target.Length > 0) {
try {
Console.WriteLine ("Read: " + target);
IUmlObject[] readObjs = new UmlParser ().Parse (target).ToArray ();
Console.WriteLine ("Read: " + target);
} catch (FileNotFoundException ex) {
Console.WriteLine (ex.ToString ());
}
List<IUmlObject> objects = new List<IUmlObject> ();
for (int _try = 0; _try <= 3 && objects.Count == 0; ++_try) {
foreach (string _path in paths) {
string path = _path;
for (int p = 0; p < _try; ++p)
path += "/../";
Console.WriteLine (path);
Action<string> processFile = (filename) => {
if (filename.Contains ("ModelDefinition") && !filename.Contains ("ModelingProject")) {
Console.WriteLine ("Read: " + filename);
IParser parser = new VSParser ();
objects.AddRange (parser.Parse (filename));
}
};
Files.SearchFiles (path, new string[]{".uml"}, processFile);
}
}
objects.Sort ();
Console.WriteLine ("Write: " + target);
List<string> lines = new List<string> ();
foreach (IUmlObject obj in objects.Where ((o) => !IsBlacklisted(o.Name))) {
lines.Add (obj.ToUmlCode ());
lines.Add ("");
}
Files.WriteLines (target, lines);
} else {
Console.WriteLine ("Error! No target file specified!");
}
}