Esempio n. 1
0
        private void SetRoot2()
        {
            //FTPConnection FTPConnection = new FTPConnection();
            List <string> getFtpFolder = new List <string>();
            List <string> getFtpFile   = new List <string>();

            string rootPath = ftpConnectionLocation + "DB_Family_Library_FTP/";

            getFtpFolder = GetDirFile.FTPGetDirctory(rootPath, ftpUserName, ftpPassword);
            getFtpFile   = GetDirFile.FTPGetFile(rootPath, ftpUserName, ftpPassword);

            List <TreeNode> tnodes  = new List <TreeNode>();
            List <string>   pathsss = new List <string>();

            getFtpFolder.Remove("paracast");
            getFtpFolder.Remove("pics");
            getFtpFolder.Remove("precast");

            foreach (string ProDirName in getFtpFolder)
            {
                TreeNode tnode = new TreeNode(ProDirName);
                tnode.Name = ProDirName;
                tnode.Tag  = tnode.Name;
                tnodes.Add(tnode);
                pathsss.Add(rootPath + ProDirName + "/");
                this.tvw_Family.Nodes.Add(tnode);
            }
            SetBrench2(pathsss, tnodes);
        }
Esempio n. 2
0
        private void SetBrench2(List <string> newPaths, List <TreeNode> xnode)
        {
            List <TreeNode> tnodes  = new List <TreeNode>();
            List <string>   pathsss = new List <string>();

            for (int i = 0; i < newPaths.Count() || i < xnode.Count(); i++)
            //for (int i = 0; i <3; i++)
            {
                List <string> getNewFolder = new List <string>();
                List <string> getNewFile   = new List <string>();
                getNewFolder = GetDirFile.FTPGetDirctory(newPaths[i], ftpUserName, ftpPassword);
                getNewFile   = GetDirFile.FTPGetFile(newPaths[i], ftpUserName, ftpPassword);
                if (getNewFolder == null)
                {
                    break;
                }
                else if (getNewFolder != null)
                {
                    getNewFolder.Remove("paracast");
                    getNewFolder.Remove("pics");
                    getNewFolder.Remove("precast");
                    foreach (string TypeDirName in getNewFolder)
                    {
                        TreeNode tnode = new TreeNode(TypeDirName);
                        tnode.Name = TypeDirName;
                        tnode.Tag  = tnode.Name;
                        pathsss.Add(newPaths[i] + TypeDirName + "/");
                        tnodes.Add(tnode);

                        xnode[i].Nodes.Add(tnode);
                    }
                    SetBrench(pathsss, tnodes);
                }
            }
        }
        //------------------------------------------------------
        #region 树状结构2
        private void SetTreeRoot()
        {
            //tvw_Family2.LabelEdit = true;

            //FTPConnection FTPConnection = new FTPConnection();
            List <string> getFtpFolder  = new List <string>();
            List <string> getFtpFile    = new List <string>();
            List <string> getFtpFolderX = new List <string>();

            string rootPath = ftpConnectionLocation + "DB_Family_Library_FTP/";

            getFtpFolder = GetDirFile.FTPGetDirctory(rootPath, ftpUserName, ftpPassword);
            getFtpFile   = GetDirFile.FTPGetFile(rootPath, ftpUserName, ftpPassword);

            getFtpFolder.Remove("paracast");
            getFtpFolder.Remove("pics");
            getFtpFolder.Remove("precast");

            foreach (string porName in getFtpFolder.Distinct())
            {
                TreeNode treeNode = new TreeNode();
                treeNode.Text = porName;
                //tvw_Family2.Nodes.Add(treeNode);
                getFtpFolderX = GetDirFile.FTPGetDirctory(rootPath + porName + "/", ftpUserName, ftpPassword);
                foreach (string catName in getFtpFolderX)
                {
                    TreeNode treeNodeX = new TreeNode();
                    treeNodeX.Text = catName;
                    treeNode.Nodes.Add(treeNodeX);
                }
                //this.tvw_Family2.Nodes.Add(treeNode);
            }
        }