Exemple #1
0
 private void LoadTreeView(LFTreeNode parent, LFNode child)
 {
     LFTreeNode newNode = new LFTreeNode(child);
     newNode.Tag = child;
     parent.Nodes.Add(newNode);
     foreach (string s in child.Children)
     {
         if (child.Children.Count != 0)
         {
             LoadTreeView(newNode, lfDict[s]);
         }
     }
 }
Exemple #2
0
        private void LoadTreeView(LFTreeNode parent, LFNode child)
        {
            LFTreeNode newNode = new LFTreeNode(child);

            newNode.Tag = child;
            parent.Nodes.Add(newNode);
            foreach (string s in child.Children)
            {
                if (child.Children.Count != 0)
                {
                    LoadTreeView(newNode, lfDict[s]);
                }
            }
        }
Exemple #3
0
        private void ReadConcentraFileV2(string file)
        {
            /// Code provided by Doug Cullum
            // string firstNodeText = "";
            StreamReader freader = null;

            string[] splitStuff = { "template=\"", "text=\"", "ID=\"", "Log=\"", "ShowCheckBox=\"", "EndLevel2Code=\"", "PID=\"", "Doc_Link=\"", "Tree=\"", "Productline=\"", "Node=\"", "CID=\"", "Book=\"" };
            string   template = "", text = "", id = "", log = "", showCheckBox = "", endLevel2Code = "", pid = "", doc_Link = "", cid = "", tree = "", productLine = "", node = "", book = "";

            try
            {
                freader = File.OpenText(file);

                string text_line;

                string[] words = null;
                // bool firstNode = true;

                while ((text_line = freader.ReadLine()) != null)
                {
                    template      = "";
                    text          = "";
                    id            = "";
                    log           = "";
                    showCheckBox  = "";
                    endLevel2Code = "";
                    pid           = "";
                    doc_Link      = "";
                    book          = "";
                    cid           = "";
                    tree          = "";
                    productLine   = "";
                    node          = "";

                    int endPos = 0;
                    for (int i = 0; i < splitStuff.Length && text_line.StartsWith("<node "); i++)
                    {
                        string[] split = new string[] { splitStuff[i] };

                        words = text_line.Split(split, StringSplitOptions.None);
                        string temp = "";
                        if (words.Length > 1)
                        {
                            endPos = words[1].IndexOf("=\""); //locate the next occurance of the =" string which indicates the next XML attribute
                            if (endPos < 0)                   //When this is less than 0, it means that it hit the end of the text_Line
                            {
                                endPos = words[1].IndexOf("\"  />");
                                temp   = words[1].Substring(0, endPos);
                                //will contain actual needed text, so skip to switch from here
                            }
                            else
                            {
                                temp   = words[1].Substring(0, endPos);
                                endPos = temp.LastIndexOf("\" ");
                            }
                            if (endPos < 0)
                            {
                                endPos = 0;
                            }
                        }
                        else
                        {
                            endPos = 0;
                        }

                        switch (splitStuff[i])
                        {
                        case "template=\"":
                            template = temp.Substring(0, endPos);
                            break;

                        case "text=\"":
                            text = temp.Substring(0, endPos);
                            break;

                        case "ID=\"":
                            id = temp.Substring(0, endPos);
                            break;

                        case "Log=\"":
                            log = temp.Substring(0, endPos);
                            break;

                        case "ShowCheckBox=\"":
                            showCheckBox = temp.Substring(0, endPos);
                            break;

                        case "EndLevel2Code=\"":
                            endLevel2Code = temp.Substring(0, endPos);
                            break;

                        case "PID=\"":
                            pid = temp.Substring(0, endPos);
                            break;

                        case "Doc_Link=\"":
                            doc_Link = temp.Substring(0, endPos);
                            break;

                        case "Book=\"":
                            book = temp.Substring(0, endPos);
                            break;

                        case "CID=\"":
                            cid = temp.Substring(0, endPos);
                            break;

                        case "Tree=\"":
                            tree = temp.Substring(0, endPos);
                            break;

                        case "Productline=\"":
                            productLine = temp.Substring(0, endPos);
                            break;

                        case "Node=\"":
                            node = temp.Substring(0, endPos);
                            break;
                        }
                    }

                    //if the row is formatted correctly, add to data table
                    //each row is split into the individual elements then put into their appropriate column within the DataTable
                    if (text_line.Split(splitStuff, StringSplitOptions.RemoveEmptyEntries).Length >= 7)
                    {
                        LFNode lf = new LFNode(template, text, id, log, showCheckBox, endLevel2Code, pid, doc_Link, cid, book, tree, productLine, node);
                        lfList.Add(lf);
                        if (lf.ID != "")
                        {
                            try
                            {
                                lfDict.Add(lf.ID, lf);
                            }
                            catch (Exception e)
                            {
                                MessageBox.Show(e.ToString());
                            }
                        }
                    }
                }
            }
            catch (FileLoadException ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                // must explicitly close the readers
                freader.Close();
            }
        }
Exemple #4
0
        private void ReadConcentraFileV2(string file)
        {
            /// Code provided by Doug Cullum
            // string firstNodeText = "";
            StreamReader freader = null;
            string[] splitStuff = { "template=\"", "text=\"", "ID=\"", "Log=\"", "ShowCheckBox=\"", "EndLevel2Code=\"", "PID=\"", "Doc_Link=\"", "Tree=\"", "Productline=\"", "Node=\"", "CID=\"", "Book=\"" };
            string template = "", text = "", id = "", log = "", showCheckBox = "", endLevel2Code = "", pid = "", doc_Link = "", cid = "", tree = "", productLine = "", node = "", book = "";

            try
            {
                freader = File.OpenText(file);

                string text_line;

                string[] words = null;
                // bool firstNode = true;

                while ((text_line = freader.ReadLine()) != null)
                {
                    template = "";
                    text = "";
                    id = "";
                    log = "";
                    showCheckBox = "";
                    endLevel2Code = "";
                    pid = "";
                    doc_Link = "";
                    book = "";
                    cid = "";
                    tree = "";
                    productLine = "";
                    node = "";

                    int endPos = 0;
                    for (int i = 0; i < splitStuff.Length && text_line.StartsWith("<node "); i++)
                    {
                        string[] split = new string[] { splitStuff[i] };

                        words = text_line.Split(split, StringSplitOptions.None);
                        string temp = "";
                        if (words.Length > 1)
                        {
                            endPos = words[1].IndexOf("=\""); //locate the next occurance of the =" string which indicates the next XML attribute
                            if (endPos < 0) //When this is less than 0, it means that it hit the end of the text_Line
                            {
                                endPos = words[1].IndexOf("\"  />");
                                temp = words[1].Substring(0, endPos);
                                //will contain actual needed text, so skip to switch from here
                            }
                            else
                            {
                                temp = words[1].Substring(0, endPos);
                                endPos = temp.LastIndexOf("\" ");
                            }
                            if (endPos < 0)
                            {
                                endPos = 0;
                            }
                        }
                        else
                        {
                            endPos = 0;
                        }

                        switch (splitStuff[i])
                        {
                            case "template=\"":
                                template = temp.Substring(0, endPos);
                                break;
                            case "text=\"":
                                text = temp.Substring(0, endPos);
                                break;
                            case "ID=\"":
                                id = temp.Substring(0, endPos);
                                break;
                            case "Log=\"":
                                log = temp.Substring(0, endPos);
                                break;
                            case "ShowCheckBox=\"":
                                showCheckBox = temp.Substring(0, endPos);
                                break;
                            case "EndLevel2Code=\"":
                                endLevel2Code = temp.Substring(0, endPos);
                                break;
                            case "PID=\"":
                                pid = temp.Substring(0, endPos);
                                break;
                            case "Doc_Link=\"":
                                doc_Link = temp.Substring(0, endPos);
                                break;
                            case "Book=\"":
                                book = temp.Substring(0, endPos);
                                break;
                            case "CID=\"":
                                cid = temp.Substring(0, endPos);
                                break;
                            case "Tree=\"":
                                tree = temp.Substring(0, endPos);
                                break;
                            case "Productline=\"":
                                productLine = temp.Substring(0, endPos);
                                break;
                            case "Node=\"":
                                node = temp.Substring(0, endPos);
                                break;
                        }
                    }

                    //if the row is formatted correctly, add to data table
                    //each row is split into the individual elements then put into their appropriate column within the DataTable
                    if (text_line.Split(splitStuff, StringSplitOptions.RemoveEmptyEntries).Length >= 7)
                    {

                        LFNode lf = new LFNode(template, text, id, log, showCheckBox, endLevel2Code, pid, doc_Link, cid, book, tree, productLine, node);
                        lfList.Add(lf);
                        if (lf.ID != "")
                        {
                            try
                            {
                                lfDict.Add(lf.ID, lf);
                            }
                            catch (Exception e)
                            {
                                MessageBox.Show(e.ToString());
                            }
                        }
                    }
                }
            }
            catch (FileLoadException ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                // must explicitly close the readers
                freader.Close();
            }
        }
 public LFTreeNode(LFNode lf)
 {
     this.Text = lf.Text;
     m_logicFlow = lf;
     this.Tag = lf;
 }
 public LFTreeNode(LFNode lf)
 {
     this.Text   = lf.Text;
     m_logicFlow = lf;
     this.Tag    = lf;
 }