bool ICommand.Parse(string[] args) { for (int i = 1; i < args.Length; i++) { if (args[i] == "-debug") { Program.debug = true; } else if (args[i].ToLowerInvariant() == "-type=simple") { ClassComparator.GetInstance().TypeFormat = TypeFormat.SIMPLE; } else if (args[i].ToLowerInvariant() == "-type=full") { ClassComparator.GetInstance().TypeFormat = TypeFormat.FULL; } else if (args[i].ToLowerInvariant() == "-type=none") { ClassComparator.GetInstance().TypeFormat = TypeFormat.NONE; } else if (_filename1 == null) { _filename1 = TryExpand(args[i]); } else if (_filename2 == null) { _filename2 = TryExpand(args[i]); } else if (_filename3 == null) { _filename3 = TryExpand(args[i]); } else { return(false); } } if (_filename1 == null || _filename2 == null) { return(false); } if (_filename3 != null) { if (Directory.Exists(_filename1) && Directory.Exists(_filename2)) { return(false); } } return(true); }
public void Run() { _typefmt = ClassComparator.GetInstance().TypeFormat; _activitiesDeleted = new List <ClassRecord>(); _activitiesAdded = new List <ClassRecord>(); _activitiesModified = new List <ClassRecord>(); _propertiesDeleted = new List <PropertyRecord>(); _propertiesAdded = new List <PropertyRecord>(); _currentActivityName = null; _modified = false; var db1 = new ClassDatabase(); var db2 = new ClassDatabase(); db1.ReadFromPackage(_filename1, Program.PrintError); db2.ReadFromPackage(_filename2, Program.PrintError); if (_filename3 != null) { db2.ReadFromPackage(_filename3, Program.PrintError); } Program.errors += ClassComparator.GetInstance().Run(db1, db2, this); Console.WriteLine(""); Console.WriteLine("SUMMARY:"); Console.WriteLine(" ---: {0}", _filename1); Console.WriteLine(" +++: {0}", _filename2); if (_filename3 != null) { Console.WriteLine(" +++: {0}", _filename3); } Console.WriteLine(" DELETED classes: {0}", _activitiesDeleted.Count); foreach (var a in _activitiesDeleted) { Console.WriteLine(" {0}", a.Name); } Console.WriteLine(" ADDED classes: {0}", _activitiesAdded.Count); foreach (var a in _activitiesAdded) { Console.WriteLine(" {0}", a.Name); } Console.WriteLine(" MODIFIED classes: {0}", _activitiesModified.Count); foreach (var a in _activitiesModified) { Console.WriteLine(" {0}", a.Name); } }