Exemplo n.º 1
0
 // Add new child.
 public void addNewChild(VDirs child)
 {
     if (child != null)
     {
         this.subdirs.Add(child);
     }
 }
Exemplo n.º 2
0
        public MoveFilesToDir(VDirs[] dirs, VDirs selected)
        {
            InitializeComponent();

            comboBoxMoveToDir.Items.AddRange(dirs);
            comboBoxMoveToDir.SelectedItem = selected;
        }
Exemplo n.º 3
0
        public NewVDir(VDirs[] pathNames, VDirs vds)
        {
            InitializeComponent();

            comboBoxMainDir.Items.AddRange(pathNames);
            comboBoxMainDir.SelectedItem = vds;
        }
Exemplo n.º 4
0
        public MoveVDirs(VDirs[] dirs, string moveDir)
        {
            InitializeComponent();

            labelMoveableDir.Text = moveDir;
            comboBoxMoveInto.Items.AddRange(dirs);
        }
Exemplo n.º 5
0
 // Add new child.
 public void addNewChild(VDirs child)
 {
     if (child != null)
     {
         this.subdirs.Add(child);
     }
 }
Exemplo n.º 6
0
 // Build up the Custom dirs. (children)
 private TreeNode[] generateCustomVDirsRecursive(VDirs actualPack)
 {
     if (actualPack != null)
     {
         TreeNode[] tn = new TreeNode[actualPack.Subdirs.Count];
         int actIndex = 0;
         foreach (VDirs actualItem in actualPack.Subdirs)
         {
             TreeNode tnsub = new TreeNode(actualItem.Name, generateCustomVDirsRecursive(actualItem));
             tnsub.Tag = actualItem;
             tn[actIndex] = tnsub;
             actIndex++;
         }
         return tn;
     }
     return null;
 }
Exemplo n.º 7
0
        // Returns a VDir tree from the db.
        public VDirs getVDirs()
        {
            VDirs returnVdir = new VDirs(-1, "root");

            SQLiteCommand sqlc = new SQLiteCommand("SELECT * FROM vdirs WHERE parentdir_id IS NULL", dbConnection);
            SQLiteDataReader sqldr = sqlc.ExecuteReader();
            while (sqldr.Read())
            {
                returnVdir.addNewChild(getVDirsById(Convert.ToInt32(sqldr["id"])));
            }

            return returnVdir;
        }
Exemplo n.º 8
0
        // Generate tree object in recursive mode.
        private VDirs recursiveBuildVDirs(ref List<VDirs> treeList, ref List<int> idEnd, int actualId)
        {
            int index = idEnd.FindIndex(a => a == actualId);
            if (treeList.Count == 0 || index > 0)
            {
                return null;
            }
            else
            {
                VDirs tmp = null;
                VDirs tmp2 = null;

                foreach (VDirs item in treeList)
                {
                    if (item.ParentId == actualId)
                    {
                        tmp = new VDirs(item.Id, item.Name, item.ParentId);
                        tmp2 = item;
                        break;
                    }
                }

                if (tmp2 != null)
                {
                    treeList.Remove(tmp2);
                }

                if (tmp != null)
                {
                    VDirs tmp3 = null;
                    do
                    {
                        tmp3 = recursiveBuildVDirs(ref treeList, ref idEnd, tmp.Id);
                        if (tmp3 != null)
                        {
                            tmp.addNewChild(tmp3);
                        }
                    } while (tmp3 != null);
                }

                return tmp;
            }
        }