Exemple #1
0
        private List <AFPNode> BuildTreeView(List <AFPNode> raw)
        {
            List <AFPNode> r = new List <AFPNode>();

            Nodes = new List <AFPNode>();
            for (int j = 0; j < raw.Count;)
            {
                // If current line SFI matches a start tag, build into interior list
                if (AFPDefinitions.ObjectPairs.StandardFieldElementPairs.ContainsKey(raw[j].Code))
                {
                    // Add Current line as Node
                    AFPNode newNode = raw[j];
                    // Pass in list and index for next creation as children
                    int index;
                    newNode.Nodes = BuildChildGroup(raw, j + 1, raw[j].Code, out index);
                    Nodes.Add(newNode);
                    j = index;
                }
                else
                {
                    Nodes.Add(raw[j]);
                    j++;
                }
            }

            return(r);
        }
Exemple #2
0
        private static List <AFPNode> BuildChildGroup(List <AFPNode> dl, int sIndex, string SFI, out int index)
        {
            index = 0;
            string         EndKey = AFPDefinitions.ObjectPairs.StandardFieldElementPairs[SFI];
            List <AFPNode> Nodes  = new List <AFPNode>();

            for (int i = sIndex; i < dl.Count;)
            {
                if (dl[i].Code == EndKey)
                {
                    Nodes.Add(new AFPNode(dl[i]));
                    i++;
                    index = i;
                    break;
                }
                // If current line SFI matches a start tag, build into interior list
                else if (AFPDefinitions.ObjectPairs.StandardFieldElementPairs.ContainsKey(dl[i].Code))
                {
                    // Add Current line as Node
                    AFPNode newNode = new AFPNode(dl[i]);
                    // Pass in list and index for next creation as children
                    newNode.Nodes = BuildChildGroup(dl, i + 1, dl[i].Code, out index);
                    Nodes.Add(newNode);
                    i = index;
                }
                else
                {
                    Nodes.Add(new AFPNode(dl[i]));
                    i++;
                }
            }

            return(Nodes);
        }
Exemple #3
0
 public AFPNode(AFPNode data)
 {
     new AFPNode(data.RawData.ToArray(), 0, (RawData.Count - 1));
 }