예제 #1
0
        public void Execute()
        {
            SettingsValidator.Validate();

            var directory = SettingsEvaluator.GetApTwoDirectory();

            var files = DirectoryDescendentFilesEvaluator.Evaluate(directory).OrderBy(x => x).ToList();

            var loop = true;

            while (loop)
            {
                Ux.WriteLine(string.Format("Analysing: {0}", directory));

                Ux.AddOption("Exit", () => loop = false);

                Ux.AddOptionWithHeadingSpace("View all file extensions", () => FileExtensionPresenter.Present(files));
                Ux.AddOption("View all files", () => ListPresenter.Present(files));
                Ux.AddOption("View filtered extensions", () => FilteredFilesPresenter.PresentFilteredExtensions());
                Ux.AddOption("View filtered files", () => FilteredFilesPresenter.PresentFilteredFiles(files));
                Ux.AddOption("View filtered file statistics", () => FilteredFilesStatsPresenter.Present(files));

                Ux.AddOptionWithHeadingSpace("Count inline CSS on filtered files", () =>
                {
                    var results = CssStatsPresenter.Present(FilteredFilesEvaluator.Evaluate(files));
                    Ux.DisplayBoolOption("Store detailed CSS results to disk?", () => CssStatsStorageService.Store(results, string.Empty), null);
                });

                Ux.AddOptionWithHeadingSpace("Count inline Javascript on filtered files", () =>
                {
                    var results = JavaScriptStatsPresenter.Present(FilteredFilesEvaluator.Evaluate(files));
                    Ux.DisplayBoolOption("Store detailed JavaScript results to disk?", () => JavaScriptStatsStorageService.Store(results, string.Empty), null);
                });

                Ux.AddOptionWithHeadingSpace("Count inline Javascript and CSS on specific file...", () => JavaScriptFileStatsPresenter.Present());

                Ux.DisplayOptions("Please choose an option");
            }
        }