コード例 #1
0
        private static void SearchInFile(string binlogFilePath, string searchText)
        {
            var build = Serialization.Read(binlogFilePath);

            BuildAnalyzer.AnalyzeBuild(build);

            var search = new Search(
                new[] { build },
                build.StringTable.Instances,
                5000,
                false
                //, Build.StringTable // disable validation in production
                );
            var results = search.FindNodes(searchText, CancellationToken.None);

            if (!results.Any())
            {
                return;
            }

            Log.WriteLine(binlogFilePath, ConsoleColor.Cyan);

            var resultTree = ResultTree.BuildResultTree(results);

            PrintTree(resultTree);
            Log.WriteLine("====================================", ConsoleColor.Green);
            Log.WriteLine("");
        }
コード例 #2
0
 public void SetContext(BattleContext c)
 {
     m_context = c;
     if (m_tree == null)
     {
         m_tree = new ResultTree(m_context);
     }
 }
コード例 #3
0
 static IEnumerable <ResultTree> concat(ResultTree head, IEnumerable <ResultTree> tail)
 {
     if (head is null)
     {
         return(tail);
     }
     else if (head is StructureResultTree c)
     {
         return(EnumerableExt.Yield(new StructureResultTree(c.Name,
                                                            c.FirstChild,
                                                            c.NextSibling.SelectMany(x => concat(x, tail)))));
     }
     else
     {
         throw new NotImplementedException();
     }
 }
コード例 #4
0
        public IEnumerable BuildResultTree(object resultsObject, bool moreAvailable = false)
        {
            var folder = ResultTree.BuildResultTree(resultsObject, moreAvailable, Elapsed);

            if (moreAvailable)
            {
                var showAllButton = new ButtonNode
                {
                    Text = $"Showing first {folder.Children.Count} results. Show all results instead (slow)."
                };

                showAllButton.OnClick = () =>
                {
                    showAllButton.IsEnabled = false;
                    searchLogControl.TriggerSearch(searchLogControl.SearchText, int.MaxValue);
                };

                folder.AddChildAtBeginning(showAllButton);
            }

            return(folder.Children);
        }
コード例 #5
0
 //Строка с результатами парсинга для тестов
 public string ToTestString()
 {
     return((ResultTree == null ? "" : ResultTree.ToTestString()) + Environment.NewLine + ErrMess);
 }