Example #1
0
        public static void ExportJson(TraceTree root, string filename)
        {
            var settings = new JsonSerializerSettings
            {
                ContractResolver = ShouldSerializeContractResolver.Instance
            };
            var res = JsonConvert.SerializeObject(root, Formatting.Indented, settings);

            File.WriteAllText(filename, res);
        }
Example #2
0
 private void openFile(string filename)
 {
     // Avoid the path or filename is tooooooo long
     StatusLabel.Content = "Loading file: " + filename.Ellipsize(100, true);
     Task.Factory.StartNew(async() =>
     {
         var options = new ParserOptions
         {
             ParseAsTree = true,
             Parallel    = RunParsingInParallel
         };
         var parser = Parser.FromFile(filename, options);
         SetProgress(0);
         await parser.PreParseAsync();
         using (var t = new Timer((s) => SetProgress(parser.ParsingProgress), null, 1, 100))
         {
             parseResult = await parser.ParseAsync() as TraceTree;
             SetProgress(100);
         }
         Dispatcher.Invoke(() =>
         {
             try
             {
                 traceBox = new TraceBox(parseResult.RootTrace)
                 {
                     ProfileInfoVisible = ProfileButton.IsChecked ?? false
                 };
                 StatusLabel.Content = $"Done parsing {parser.SourceLineCount} lines({parser.SourceLengthBytes} bytes) in {parseResult.ParseDuration}";
                 rootNode            = new FlexibleTraceNode(parseResult.RootTrace)
                 {
                     UiNode = traceBox
                 };
                 TraceViewer.Content = traceBox;
                 Title = WindowTitle + " - " + filename.Ellipsize(100, true);
             }
             catch (Exception ex)
             {
                 StatusLabel.Content = "Failed to load file because: " + ex;
             }
         });
     }, default, TaskCreationOptions.LongRunning, TaskScheduler.Current);
Example #3
0
 public static void ExportXml(TraceTree root, string filename)
 {
     //TODO: implement this maybe
 }