コード例 #1
0
        static void Main(string[] args)
        {
            //System.Diagnostics.Debugger.Launch();

            if (args.Length == 0 || args[0] == string.Empty)
            {
                Console.Out.WriteLine(
                    "Usage: CommentRemover.ConsoleApplication {solution or project file}");
            }

            var file = args[0];

            if (!File.Exists(file))
            {
                Console.Out.WriteLine($"File {file} does not exist.");
            }
            else
            {
                if (Path.GetExtension(file) == ".sln")
                {
                    WorkspaceCommentRemover.RemoveCommentsFromSolutionAsync(file).Wait();
                }
                else if (Path.GetExtension(file) == ".csproj")
                {
                    WorkspaceCommentRemover.RemoveCommentsFromProjectAsync(file).Wait();
                }
                else
                {
                    Console.Out.WriteLine("Only .sln and .csproj files are supported.");
                }
            }
        }
コード例 #2
0
        public override bool Execute()
        {
            Log.LogMessage(
                $"Removing comments for project {ProjectFilePath}...");
            var stopwatch = Stopwatch.StartNew();

            WorkspaceCommentRemover.RemoveCommentsFromProjectAsync(ProjectFilePath).Wait();
            stopwatch.Stop();
            Log.LogMessage(
                $"Removing comments for project {ProjectFilePath} complete - total time: {stopwatch.Elapsed}");

            return(true);
        }