public void addChild(mSectionNode child)
 {
     child.parent = this;
     children.Add(child);
 }
 public mSectionNode(String letter, double value, String chars)
 {
     parent = null;
     children = new List<mSectionNode>();
     SectionLetter = letter;
     SectoinValue = value;
     this.chars = chars;
 }
        public void dataUpdated()
        {
            root = new mSectionNode("", 0, "");
            root2 = new mSectionNode2("", 0, ' ', false);

            List<String> total = new List<String>();
            List<String> LetterNodeStrings = new List<String>();
            mSectionNode2[] roots = new mSectionNode2[alphabet.Length];
            for (int i = 0; i < alphabet.Length; i++)
            {
                pullData(alphabet[i]);
                roots[i] = new mSectionNode2("", 0, ' ', false);
                ((TextBlock)dataView[i].Children[0]).Text = alphabet[i] + ": " + elements.Count;
                LetterNodeStrings = new List<String>();
                for (int j = 0; j < elements.Count; j++)
                {
                    LetterNodeStrings.Add(new mLetterSections(minimumLines( cleanSections(Dominique(elements[j].cleanedData)))).getString(true, .01));
                }
                LetterNodeStrings = LetterNodeStrings.Distinct().ToList();

                for (int j = 0; j < LetterNodeStrings.Count; j++)
                {
                    addToThisTree(roots[i], LetterNodeStrings[j], alphabet[i]);
                    combineTree(roots[i]);
                }

                if (LetterNodeStrings.Count == 0)
                {
                    ((TextBlock)dataView[i].Children[2]).Text = "No Data";
                }
                else
                {
                    String thisText = roots[i].getString();
                    ((TextBlock)dataView[i].Children[2]).Text = thisText;
                }
            }
            for (int i = 0; i < roots.Length; i++)
            {
                root2 = new mSectionNode2(root2, roots[i]);
                combineTree(root2);
            }
                //combineTree();
            manager.updateTree(root2);
        }
        public dataStuff(mainWindows myManager)
        {
            if (!File.Exists(file))
            {
                File.Create(file).Dispose();
            }
            manager = myManager;
            root = new mSectionNode("", 0.0, "");
            currentChar = ' ';
            dataView = new List<StackPanel>();
            content = new ScrollViewer();
            content.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
            content.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible;
            container = new StackPanel();
            container.Orientation = Orientation.Vertical;
            content.Content = container;
            for (int i = 0; i < alphabet.Length; i++)
            {
                Border currentBorder = new Border();
                currentBorder.BorderBrush = Brushes.Black;
                currentBorder.BorderThickness = new Thickness(1);

                StackPanel current = new StackPanel();
                current.Orientation = Orientation.Horizontal;
                TextBlock part1 = new TextBlock();
                part1.Margin = new Thickness(10, 10, 10, 10);
                part1.MinWidth = 30;
                part1.FontSize = 12;
                part1.Text = alphabet[i] + " : 0";
                TextBlock part2 = new TextBlock();
                part2.Margin = new Thickness(10, 10, 10, 10);
                part2.FontSize = 12;
                part2.FontFamily = new FontFamily("Courier New");
                part2.Text = "Something for the breakdown";

                Rectangle toSeperate = new Rectangle();
                toSeperate.VerticalAlignment = VerticalAlignment.Stretch;
                toSeperate.Width = 2;
                toSeperate.Stroke = Brushes.Black;

                current.Children.Add(part1);
                current.Children.Add(toSeperate);
                current.Children.Add(part2);

                dataView.Add(current);

                currentBorder.Child = current;
                container.Children.Add(currentBorder);
            }

            getData();
        }
        public void addToTree(String newInfo, char associatedLetter)
        {
            int chunkAt = 0;
            int chunkLength = 6;
            mSectionNode current = root;
            bool toContinue = true;
            while(toContinue){
                if (newInfo.Length >= (chunkAt + 1) * chunkLength)
                {
                    string chunk = newInfo.Substring(chunkAt * chunkLength, chunkLength);
                    string sectionString;
                    double value = 0.0;
                    if (chunk.Equals("Line00"))
                    {
                        sectionString = chunk;
                    }
                    else
                    {
                        sectionString = chunk.Substring(0, 1);
                        value = Double.Parse(chunk.Substring(1));
                    }

                    current.addChar(associatedLetter);
                    bool found = false;
                    for (int i = 0; i < current.children.Count && !found; i++)
                    {
                        mSectionNode child = current.children[i];
                        if (child.SectionLetter.Equals(sectionString) && child.SectoinValue == value)
                        {
                            child.addChar(associatedLetter);
                            current = child;
                            chunkAt++;
                            found = true;
                        }
                    }
                    if (!found)
                    {
                        mSectionNode child = new mSectionNode(sectionString, value, ""+associatedLetter);
                        current.addChild(child);
                        current = child;
                        chunkAt++;
                    }
                }
                else
                {
                    current.addFinalChar(associatedLetter);
                    toContinue = false;
                }
            }
        }