void ReloadList()
 {
     FolderString = Common.MLS.Get(MLSConst, "Папка");
     lbMainList.Items.Clear();
     Folders.Clear();
     Methods.Clear();
     string[] folders = Folder.GetFolderList(DbFDriver.FolderMask, DbFDriver.CutException);
     for (int i = 0; i < folders.Length; i++)
     {
         lbMainList.Items.Add(folders[i] + "                " +
                              FolderString);
         Folders.Add(folders[i]);
         Methods.Add(null);
     }
     string[] elems = Folder.GetFolderList(DbFDriver.ElementMask, DbFDriver.CutException);
     for (int i = 0; i < elems.Length; i++)
     {
         lbMainList.Items.Add(" " + elems[i]);
         Folders.Add(null);
         Methods.Add(elems[i]);
     }
 }
Beispiel #2
0
        }//*/

        void UpdateNodeList(TreeNodeCollection nodes, DbFolder folder)
        {
            string[] fnames = folder.GetFolderList();
            for (int i = 0; i < fnames.Length; i++)
            {
                TreeNode cur_node = null;
                for (int j = 0; j < nodes.Count; j++)
                {
                    if (((CSTreeNodeTag)nodes[j].Tag).SpName == null && nodes[j].Text.Equals(fnames[i]))
                    {
                        cur_node = nodes[i];
                        break;
                    }
                }
                if (cur_node == null)
                {
                    cur_node = nodes.Add(fnames[i]);
                }
                cur_node.Tag = new CSTreeNodeTag(new DbFolder(fnames[i], folder), null);
                cur_node.SelectedImageIndex = 1;
                cur_node.StateImageIndex    = 0;
                UpdateNodeList(cur_node.Nodes, new DbFolder(fnames[i], folder));
            }

            string[] names = folder.GetRecordList("ss", true);
            //for (int i = 0; i < names.Length; i++)
            //    names[i] = names[i].Substring(0, names[i].Length - 3);
            for (int i = 0; i < names.Length; i++)
            {
                bool found = false;
                for (int j = 0; j < nodes.Count; j++)
                {
                    if (((CSTreeNodeTag)nodes[j].Tag).SpName != null && nodes[j].Text.Equals(names[i]))
                    {
                        found = true;
                        break;
                    }
                }
                if (found == false)
                {
                    TreeNode nd = nodes.Add(names[i]);
                    nd.Tag = new CSTreeNodeTag(folder, names[i]);
                    nd.SelectedImageIndex = 3;
                    nd.ImageIndex         = 2;
                }
            }

            for (int i = 0; i < nodes.Count; i++)
            {
                bool found = false;
                for (int j = 0; j < fnames.Length; j++)
                {
                    if (fnames[j].Equals(nodes[i].Text) == true)
                    {
                        found = true;
                        break;
                    }
                }
                for (int j = 0; found == false && j < names.Length; j++)
                {
                    if (names[j].Equals(nodes[i].Text) == true)
                    {
                        found = true;
                        break;
                    }
                }
                if (found == false)
                {
                    nodes.RemoveAt(i);
                    i--;
                }
            }
        }