internal void SumUpDeltas(PreproNode ppNode)
        {
            ppNode.LineDelta = (TotalLines - ppNode.LineCounter);

            foreach (PreproNode ppSearch in LinearNodeList)
            {
                if (ppSearch.Depth == 1)
                {
                    ppSearch.UIExpanded = true;
                }

                if (ppSearch.Depth <= ppNode.Depth)
                {
                    if (ppSearch.LineCounter > ppNode.LineCounter)
                    {
                        ppNode.LineDelta = (ppSearch.LineCounter - ppNode.LineCounter);
                        break;
                    }
                }
            }

            foreach (PreproNode ppChildNode in ppNode.Children)
            {
                SumUpDeltas(ppChildNode);
            }
        }
    public PreproNode()
    {
      Path = "";
      LineCounter = 1;
      LineDelta = 0;

      LinearIndex = -1;
      Depth = 0;
      Parent = null;
      Children = new List<PreproNode>();

      UIVisible = true;
      UIExpanded = false;
    }
        public PreproNode Add(string path)
        {
            var newNode = new PreproNode();

            newNode.Parent = this;
            newNode.Path   = path;

            for (var parentWalk = newNode.Parent; parentWalk != null; parentWalk = parentWalk.Parent)
            {
                newNode.Depth++;
            }

            Children.Add(newNode);

            return(newNode);
        }
    public PreproNode Add(string path)
    {
      PreproNode NewNode = new PreproNode();

      NewNode.Parent = this;
      NewNode.Path = path;

      PreproNode ParentWalk = NewNode.Parent;
      while (ParentWalk != null)
      {
        NewNode.Depth++;
        ParentWalk = ParentWalk.Parent;
      }

      Children.Add(NewNode);

      return NewNode;
    }
Example #5
0
        internal void ConvertPPNodeToTreeNode(PreproNode ppNode, Node treeNode)
        {
            if ( ppNode.UIVisible )
              {
            PreproTreeNode NewNode = new PreproTreeNode();

            NewNode.DataNode = ppNode;
            NewNode.Text = ppNode.Path;
            NewNode.Line = ppNode.LineCounter.ToString();
            NewNode.LineDelta = ppNode.LineDelta.ToString();

            treeNode.Nodes.Add(NewNode);
            hwPreproTree.Model = _model;

            var poot = hwPreproTree.FindNode(GetPath(NewNode));
            poot.IsExpanded = ppNode.UIExpanded;

            foreach (PreproNode ppChildNode in ppNode.Children)
            {
              ConvertPPNodeToTreeNode(ppChildNode, NewNode);
            }
              }
        }
Example #6
0
        void UpdateFilter()
        {
            string matchString = hwFilterBox.Text.ToLower();
            bool   doMatch     = matchString.Length > 0;

            foreach (PreproNode ppChildNode in PreproOutput.LinearNodeList)
            {
                if (!doMatch || ppChildNode.Path.Contains(matchString))
                {
                    PreproNode ppNode = ppChildNode;
                    while (ppNode != null)
                    {
                        ppNode.UIVisible = true;
                        ppNode           = ppNode.Parent;
                    }
                }
                else
                {
                    ppChildNode.UIVisible = false;
                }
            }

            BuildModelFromOutput();
        }
Example #7
0
        void ConvertPPNodeToTreeNode(PreproNode ppNode, Node treeNode)
        {
            if (ppNode.UIVisible)
            {
                var newNode = new PreproTreeNode()
                {
                    DataNode  = ppNode,
                    Text      = ppNode.Path,
                    Line      = ppNode.LineCounter.ToString(),
                    LineDelta = ppNode.LineDelta.ToString(),
                };

                treeNode.Nodes.Add(newNode);
                hwPreproTree.Model = _model;

                var poot = hwPreproTree.FindNode(GetPath(newNode));
                poot.IsExpanded = ppNode.UIExpanded;

                foreach (PreproNode ppChildNode in ppNode.Children)
                {
                    ConvertPPNodeToTreeNode(ppChildNode, newNode);
                }
            }
        }
    internal void SumUpDeltas( PreproNode ppNode )
    {
      ppNode.LineDelta = (TotalLines - ppNode.LineCounter);
      
      foreach (PreproNode ppSearch in LinearNodeList)
      {
        if (ppSearch.Depth == 1)
          ppSearch.UIExpanded = true;

        if ( ppSearch.Depth <= ppNode.Depth )
        {
          if ( ppSearch.LineCounter > ppNode.LineCounter )
          {
            ppNode.LineDelta = (ppSearch.LineCounter - ppNode.LineCounter);
            break;
          }
        }
      }

      foreach( PreproNode ppChildNode in ppNode.Children )
      {
        SumUpDeltas(ppChildNode);
      }
    }
    public async Task<bool> ParseFromFile(string filename)
    {
      RootNode = new PreproNode();
      NumFiles = 0;
      TotalLines = 0;

      PreproNode lNode = RootNode;

      int lLastLineNumber = -1;
      string lLastLinePath = "";

      LinearNodeList = new List<PreproNode>();
      Dictionary<String, Queue<PreproNode>> NodePathLookup = new Dictionary<string, Queue<PreproNode>>();

      foreach (string line in File.ReadLines(filename))
      {
        TotalLines++;

        string InputLine = line.Trim().Replace("\\\\", "\\").Replace("\\", "/");
        if (InputLine.Length == 0)
          continue;

        if (InputLine.StartsWith("#line "))
        {
          var lStringBits = InputLine.Split(new char[] { ' ' }, 3);

          int lLineNum = Int32.Parse(lStringBits[1]);

          string lFilePath = lStringBits[2].Trim(new char[] { ' ', '\"' }).ToLower();

          if (lLineNum == 1)
          {
            lNode = lNode.Add(lFilePath);
            NumFiles++;

            lNode.LinearIndex = LinearNodeList.Count;
            LinearNodeList.Add(lNode);

            lNode.LineCounter = TotalLines;

            if (NodePathLookup.ContainsKey(lFilePath))
            {
              NodePathLookup[lFilePath].Enqueue(lNode);
            }
            else
            {
              Queue<PreproNode> lNewQ = new Queue<PreproNode>();
              lNewQ.Enqueue(lNode);

              NodePathLookup.Add(lFilePath, lNewQ);

              await Task.Yield();
            }
          }
          else
          {
            lNode = NodePathLookup[lFilePath].Peek();
          }

          lLastLinePath = lFilePath;
          lLastLineNumber = lLineNum;
        }
        else
        {
          lLastLinePath = "";
          lLastLineNumber = -1;
        }
      }

      SumUpDeltas(RootNode);

      return true;
    }
        public bool ParseFromFile(string filename)
        {
            PreproNode lNode = RootNode;

            int    lastLineNumber = -1;
            string lastLinePath   = "";

            var nodePathLookup = new Dictionary <string, Queue <PreproNode> >();

            foreach (string line in File.ReadLines(filename))
            {
                TotalLines++;

                string inputLine = line.Trim().Replace("\\\\", "\\").Replace("\\", "/");
                if (inputLine.Length == 0)
                {
                    continue;
                }

                if (inputLine.StartsWith("#line "))
                {
                    var lineStringBits = inputLine.Split(kSpaceCharArray, 3);

                    int lineLineNum = int.Parse(lineStringBits[1]);

                    string lineFilePath = lineStringBits[2].Trim(kSpaceThenQuoteCharArray).ToLowerInvariant();

                    if (lineLineNum == 1)
                    {
                        lNode = lNode.Add(lineFilePath);
                        NumFiles++;

                        lNode.LinearIndex = LinearNodeList.Count;
                        LinearNodeList.Add(lNode);

                        lNode.LineCounter = TotalLines;

                        if (nodePathLookup.ContainsKey(lineFilePath))
                        {
                            nodePathLookup[lineFilePath].Enqueue(lNode);
                        }
                        else
                        {
                            var lineNewQueue = new Queue <PreproNode>();
                            lineNewQueue.Enqueue(lNode);

                            nodePathLookup.Add(lineFilePath, lineNewQueue);
                        }
                    }
                    else
                    {
                        lNode = nodePathLookup[lineFilePath].Peek();
                    }

                    lastLinePath   = lineFilePath;
                    lastLineNumber = lineLineNum;
                }
                else
                {
                    lastLinePath   = "";
                    lastLineNumber = -1;
                }
            }

            SumUpDeltas(RootNode);

            return(true);
        }