Repository: microsoft/ApplicationInspector
File: AppInspector.CLI/Writers/AnalyzeHtmlWriter.cs (C#)

Code before:
        {
            KeyedTagInfoLists = new Dictionary<string, List<TagInfo>>();
            KeyedSortedTagInfoLists = new Dictionary<string, List<TagInfo>>();
        }

        /// <summary>
        /// Pre: AnalyzeCommand GetResults created and populated from RulesEngine
        /// </summary>
        /// <param name="result"></param>
        /// <param name="cLICommandOptions"></param>
        /// <param name="autoClose"></param>
        public override void WriteResults(Result result, CLICommandOptions cLICommandOptions, bool autoClose = true)
        {
            //recover metadata results from prior analyzecommand GetResults()
            _analyzeResult = (AnalyzeResult)result;
            _appMetaData = _analyzeResult.Metadata;

            PopulateTagGroups();
            WriteJsonResult();//dep link from html content
            WriteHtmlResult();
        }

        private void WriteHtmlResult()
        {
            //Grab any local css and js files that are needed i.e. don't have hosted URL's or are proprietary
            string allCSS = "<style>\n" + MergeResourceFiles(Path.Combine(Utils.GetPath(Utils.AppPath.basePath), "html/resources/css"));
            string allJS = "<script type=\"text/javascript\">\n" + MergeResourceFiles(Path.Combine(Utils.GetPath(Utils.AppPath.basePath),"html/resources/js"));

            //Prepare html template merge
            string htmlTemplateText = File.ReadAllText(Path.Combine(Utils.GetPath(Utils.AppPath.basePath), "html/index.html"));
            Template.FileSystem = new EmbeddedFileSystem(Assembly.GetEntryAssembly(), "Microsoft.ApplicationInspector.CLI.html.partials");

            //Update template with local aggregated code for easy relocation of output file
            htmlTemplateText = htmlTemplateText.Replace("<script type=\"text/javascript\">", allJS);
            htmlTemplateText = htmlTemplateText.Replace("<link rel=\"stylesheet\" type=\"text/css\" href=\"html/resources/css/appinspector.css\" />", allCSS+"</style>");

            RegisterSafeType(typeof(MetaData));

            //Prepare data for use in appinspector.js and html partials resources
            var htmlTemplate = Template.Parse(htmlTemplateText);
            var data = new Dictionary<string, object>();
            data["MetaData"] = _appMetaData;

            var hashData = new Hash();
            hashData["json"] = JsonConvert.SerializeObject(data);//json serialization required for [js] access to objects
            hashData["application_version"] = Utils.GetVersionString();

            //add dynamic sets of groups of taginfo read from preferences for Profile page
            List<TagGroup> tagGroupList = GetCategoryTagGroups("profile");
            hashData["groups"] = tagGroupList;


Review comment (suggestion):
```suggestion
            string allCSS = "<style>\n" + MergeResourceFiles(Path.Combine(Utils.GetPath(Utils.AppPath.basePath), "html","resources","css"));
```

Code after:
        {
            KeyedTagInfoLists = new Dictionary<string, List<TagInfo>>();
            KeyedSortedTagInfoLists = new Dictionary<string, List<TagInfo>>();
        }

        /// <summary>
        /// Pre: AnalyzeCommand GetResults created and populated from RulesEngine
        /// </summary>
        /// <param name="result"></param>
        /// <param name="cLICommandOptions"></param>
        /// <param name="autoClose"></param>
        public override void WriteResults(Result result, CLICommandOptions cLICommandOptions, bool autoClose = true)
        {
            //recover metadata results from prior analyzecommand GetResults()
            _analyzeResult = (AnalyzeResult)result;
            _appMetaData = _analyzeResult.Metadata;

            PopulateTagGroups();
            WriteJsonResult();//dep link from html content
            WriteHtmlResult();
        }

        private void WriteHtmlResult()
        {
            //Grab any local css and js files that are needed i.e. don't have hosted URL's or are proprietary
            string allCSS = "<style>\n" + MergeResourceFiles(Path.Combine(Utils.GetPath(Utils.AppPath.basePath), "html","resources","css"));
            string allJS = "<script type=\"text/javascript\">\n" + MergeResourceFiles(Path.Combine(Utils.GetPath(Utils.AppPath.basePath),"html","resources","js"));

            //Prepare html template merge
            string htmlTemplateText = File.ReadAllText(Path.Combine(Utils.GetPath(Utils.AppPath.basePath), "html/index.html"));
            Template.FileSystem = new EmbeddedFileSystem(Assembly.GetEntryAssembly(), "Microsoft.ApplicationInspector.CLI.html.partials");

            //Update template with local aggregated code for easy relocation of output file
            htmlTemplateText = htmlTemplateText.Replace("<script type=\"text/javascript\">", allJS);
            htmlTemplateText = htmlTemplateText.Replace("<link rel=\"stylesheet\" type=\"text/css\" href=\"html/resources/css/appinspector.css\" />", allCSS+"</style>");

            RegisterSafeType(typeof(MetaData));

            //Prepare data for use in appinspector.js and html partials resources
            var htmlTemplate = Template.Parse(htmlTemplateText);
            var data = new Dictionary<string, object>();
            data["MetaData"] = _appMetaData;

            var hashData = new Hash();
            hashData["json"] = JsonConvert.SerializeObject(data);//json serialization required for [js] access to objects
            hashData["application_version"] = Utils.GetVersionString();

            //add dynamic sets of groups of taginfo read from preferences for Profile page
            List<TagGroup> tagGroupList = GetCategoryTagGroups("profile");
            hashData["groups"] = tagGroupList;