public void TestSaveFiles()
        {
            // Make backups
            File.Copy(@"TestData\test.props", @"TestData\test_backup.props", true);
            File.Copy(@"TestData\A.csproj", @"TestData\A_backup.csproj", true);
            File.Copy(@"TestData\B.csproj", @"TestData\B_backup.csproj", true);
            File.Copy(@"TestData\C.csproj", @"TestData\C_backup.csproj", true);

            extractor.PropertySheetPath = @"TestData\test.props";
            extractor.Move("TheType", "foobar");
            extractor.SaveAll();

            // DO it a second time to make sure that the import doesn't get attached twice
            extractor.SaveAll();

            // Restore the files
            File.Delete(@"TestData\A.csproj");
            File.Delete(@"TestData\B.csproj");
            File.Delete(@"TestData\C.csproj");
            File.Delete(@"TestData\test.props");
            File.Move(@"TestData\A_backup.csproj", @"TestData\A.csproj");
            File.Move(@"TestData\B_backup.csproj", @"TestData\B.csproj");
            File.Move(@"TestData\C_backup.csproj", @"TestData\C.csproj");
            File.Move(@"TestData\test_backup.props", @"TestData\test.props");
        }
Пример #2
0
 public void SaveAllProjects()
 {
     model.SaveAll();
 }
Пример #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));
        }