public void TestRemoveOneProject()
        {
            // Remove one property that exists in one project only
            extractor.Remove("UniqueforDebug");
            Assert.AreEqual(5, extractor.AllFoundProperties.Count());
            var allprops = (from p in extractor.AllFoundProperties
                            let pl = p.Key
                                     orderby pl ascending
                                     select pl).ToList();

            Assert.AreEqual("AssemblyName", allprops[0]);
            Assert.AreEqual("Configuration", allprops[1]);
            Assert.AreEqual("OutputPath", allprops[2]);
            Assert.AreEqual("Platform", allprops[3]);
            Assert.AreEqual("TheType", allprops[4]);
        }
示例#2
0
 /// <summary>
 /// Deletes one property across all projects for the current configuration and current platform
 /// </summary>
 /// <param name="key"></param>
 public void DeleteProperty(string key)
 {
     model.Remove(key);
     OnPropertyChanged("FoundProperties");
 }
示例#3
0
        static void Main(string[] args)
        {
            var timer = new Stopwatch();

            timer.Start();
            if (args.Length != 4)
            {
                Console.WriteLine("RefactorConsole <input_dir> <property_sheet> <config> <platform>");
                return;
            }

            string inputDir = args[0];

            if (!Directory.Exists(inputDir))
            {
                Console.WriteLine("Input directory doesn't exist: {0}", inputDir);
                return;
            }
            string propSheet = args[1];

            if (!File.Exists(propSheet))
            {
                Console.WriteLine("Input property sheet file doesn't exist: {0}", propSheet);
                return;
            }
            string config   = args[2];
            string platform = args[3];

            bool verbose  = true;
            var  refactor = new PropertyExtractor(inputDir, config, platform, verbose);

            refactor.PropertySheetPath = propSheet;
            timer.Stop();
            Console.WriteLine("{0} files", refactor.CountFoundFiles);
            Console.WriteLine("{0} files valid", refactor.Count);
            Utils.WL(ConsoleColor.DarkYellow, String.Format("Elapsed Time: {0}\n", timer.Elapsed));

            Console.WriteLine("Change configuration property");
            timer.Restart();
            refactor.SetGlobalProperty("Configuration", "Release");
            timer.Stop();
            Utils.WL(ConsoleColor.DarkYellow, String.Format("Elapsed Time: {0}\n", timer.Elapsed));

            Console.WriteLine("Moving a property");
            timer.Restart();
            refactor.Move("OutputPath", "$(BuildDir)");
            timer.Stop();
            Utils.WL(ConsoleColor.DarkYellow, String.Format("Elapsed Time: {0}\n", timer.Elapsed));

            Console.WriteLine("Change configuration property");
            timer.Restart();
            refactor.SetGlobalProperty("Configuration", "Debug");
            timer.Stop();
            Utils.WL(ConsoleColor.DarkYellow, String.Format("Elapsed Time: {0}\n", timer.Elapsed));

            Console.WriteLine("Moving a property");
            timer.Restart();
            refactor.Move("OutputPath", "$(BuildDir)");
            timer.Stop();
            Utils.WL(ConsoleColor.DarkYellow, String.Format("Elapsed Time: {0}\n", timer.Elapsed));

            Console.WriteLine("Removing a random property");
            timer.Restart();
            refactor.Remove("Optimize");
            refactor.Move("ProjectType", "local");
            timer.Stop();
            Utils.WL(ConsoleColor.DarkYellow, String.Format("Elapsed Time: {0}\n", timer.Elapsed));

            Console.WriteLine("Saving the files");
            timer.Restart();
            refactor.SaveAll();
            timer.Stop();
            Utils.WL(ConsoleColor.DarkYellow, String.Format("Elapsed Time: {0}\n", timer.Elapsed));

            Console.WriteLine("Print Found Properties");
            timer.Restart();
            refactor.PrintFoundProperties();
            timer.Stop();
            Utils.WL(ConsoleColor.DarkYellow, String.Format("Elapsed Time: {0}\n", timer.Elapsed));
        }