示例#1
0
        private static void Main(string[] args)
        {
            if (args == null || args.Length == 0)
            {
#if DEBUG
                args = new string[] { @"..\..\..\.." };
#else
                args = new string[] { Environment.CurrentDirectory };
#endif
            }

            string dirPath = args[0];

            RefactoringDescriptor[] refactorings = RefactoringDescriptor
                                                   .LoadFromFile(Path.Combine(dirPath, @"Refactorings\Refactorings.xml"))
                                                   .ToArray();

            var writer = new CodeFileWriter();

            var refactoringIdentifiersGenerator = new RefactoringIdentifiersGenerator();
            writer.SaveCode(
                Path.Combine(dirPath, @"Refactorings\RefactoringIdentifiers.Generated.cs"),
                refactoringIdentifiersGenerator.Generate(refactorings));

            var optionsPagePropertiesGenerator = new OptionsPagePropertiesGenerator();
            writer.SaveCode(
                Path.Combine(dirPath, @"VisualStudio.Core\RefactoringsOptionsPage.Generated.cs"),
                optionsPagePropertiesGenerator.Generate(refactorings));

#if DEBUG
            Console.WriteLine("DONE");
            Console.ReadKey();
#endif
        }
示例#2
0
        private static void Main(string[] args)
        {
            if (args == null || args.Length == 0)
            {
#if DEBUG
                args = new string[] { @"..\..\..\.." };
#else
                args = new string[] { Environment.CurrentDirectory };
#endif
            }

            string dirPath = args[0];

            SortRefactoringsInFile(Path.Combine(dirPath, @"Refactorings\Refactorings.xml"));

            RefactoringDescriptor[] refactorings = RefactoringDescriptor
                                                   .LoadFromFile(Path.Combine(dirPath, @"Refactorings\Refactorings.xml"))
                                                   .OrderBy(f => f.Identifier, StringComparer.InvariantCulture)
                                                   .ToArray();

            Console.WriteLine($"number of refactorings: {refactorings.Length}");

            AnalyzerDescriptor[] analyzers = AnalyzerDescriptor
                                             .LoadFromFile(Path.Combine(dirPath, @"Analyzers\Analyzers.xml"))
                                             .OrderBy(f => f.Id, StringComparer.InvariantCulture)
                                             .ToArray();

            Console.WriteLine($"number of analyzers: {analyzers.Length}");

            SaveFile(
                Path.Combine(dirPath, @"Analyzers\Analyzers.xml"),
                CreateAnalyzersXml(analyzers));

            var htmlGenerator = new HtmlGenerator();

            SaveFile(
                Path.Combine(dirPath, @"VisualStudio\description.txt"),
                File.ReadAllText(@"..\text\RoslynatorDescription.txt", Encoding.UTF8) + htmlGenerator.CreateRoslynatorDescription(analyzers, refactorings));

            SaveFile(
                Path.Combine(dirPath, @"VisualStudio.Refactorings\description.txt"),
                File.ReadAllText(@"..\text\RoslynatorRefactoringsDescription.txt", Encoding.UTF8) + htmlGenerator.CreateRoslynatorRefactoringsDescription(refactorings));

            var markdownGenerator = new MarkdownGenerator();

            SaveFile(
                Path.Combine(Path.GetDirectoryName(dirPath), @"README.md"),
                markdownGenerator.CreateReadMeMarkDown(analyzers, refactorings));

            foreach (string imagePath in MarkdownGenerator.FindMissingImages(refactorings, Path.Combine(Path.GetDirectoryName(dirPath), @"images\refactorings")))
            {
                Console.WriteLine($"missing image: {imagePath}");
            }

            SaveFile(
                Path.Combine(dirPath, @"Refactorings\Refactorings.md"),
                markdownGenerator.CreateRefactoringsMarkDown(refactorings));

            SaveFile(
                Path.Combine(dirPath, @"Refactorings\README.md"),
                markdownGenerator.CreateRefactoringsReadMe(refactorings));

            SaveFile(
                Path.Combine(dirPath, @"Analyzers\README.md"),
                markdownGenerator.CreateAnalyzersReadMe(analyzers));

            SaveFile(
                Path.Combine(dirPath, @"Analyzers\AnalyzersByCategory.md"),
                markdownGenerator.CreateAnalyzersByCategoryMarkDown(analyzers));

#if DEBUG
            Console.WriteLine("DONE");
            Console.ReadKey();
#endif
        }