Ejemplo n.º 1
0
        public void RefreshImplicits()
        {
            string logJson = FileExt.ReadAllText(RootConfig.LogJsonFileLocation);

            logJson = "[" + logJson.Replace('\n', ',') + "]";

            var loadedLog = JsonConvert.DeserializeObject(logJson) as JArray;

            ParsedJsonLog = new JArray();

            foreach (var log in loadedLog)
            {
                string callerMethod = log["Properties"]?["CallerMethodName"]?.ToString();
                if (callerMethod != null && !callerMethod.Contains("uhttpsharp"))
                {
                    ParsedJsonLog.Add(log);
                }
            }

            List <string> logLines = new List <string>();

            foreach (var entry in ParsedJsonLog.Reverse())
            {
                string logText = entry["RenderedMessage"].ToString();
                logLines.Add(logText);
            }

            TextLog = string.Join("\n", logLines);

            TextLogHtml = string.Join("\n", from log in logLines
                                      select $"<p>{log.Replace("\n", "<br>")}</p>");

            string tabHtml = "<span style='display:inline-block;width:2em;'></span>";

            TextLogHtml = TextLogHtml.Replace("\t", tabHtml);
            TextLogHtml = TextLogHtml.Replace("  ", tabHtml);

            RefreshedAt = DateTime.Now;
        }