Exemplo n.º 1
0
        public void AddCustomSubfolder()
        {
            AddDirectoryForm adf = new AddDirectoryForm((name, directory) =>
            {
                Subfolders.Add(new SubfolderInfo(name, directory, true));
            });

            adf.ShowDialog();
        }
Exemplo n.º 2
0
        private void GetDirectories()
        {
            var dirs = Directory.GetDirectories(NormalizedPath);

            foreach (var dir in dirs)
            {
                var dirName = System.IO.Path.GetFileName(dir);
                if (!dirName.StartsWith("_"))
                {
                    Subfolders.Add(new Folder(dir));
                }
            }
        }
Exemplo n.º 3
0
 public void Copy(Resource rl)
 {
     foreach (Resource item in rl.Embedded)
     {
         if (item.Type == YandexDiskSharp.Type.dir)
         {
             Subfolders.Add(new CloudFolder(item));
         }
         else
         {
             CloudFile r = new CloudFile(item);
             Files.Add(r);
             Size += r.Size;
         }
     }
     SizeTopDirectoryOnly = Size;
 }
Exemplo n.º 4
0
        private void LoadDirectory(DirectoryInfo dirInfo)
        {
            ShowLoading();

            form.SuspendLayout();

            var loadedTags = (Settings.Default.Tags != null) ? Settings.Default.Tags : new List <string>();

            form.tagPanel.ReorderButtons = false;

            // Remove all tags that aren't included in the loaded tags.
            Tags.RemoveRange(Tags.Where(t => !loadedTags.Contains(t)));

            // Add all tags that are in loaded tags but not in current tags.
            //Tags.AddRange(loadedTags.Where(t => !Tags.Contains(t)).ToList());
            for (int i = 0; i < loadedTags.Count; i++)
            {
                if (!Tags.Contains(loadedTags[i]))
                {
                    Tags.Add(loadedTags[i]);
                }
            }

            form.tagPanel.ReorderButtons = true;
            form.tagPanel.ReorderTagButtons();

            // Empty all Subfolders and load custom ones from settings.
            //while (Subfolders.Count > 0)
            //Subfolders.RemoveAt(0);
            Subfolders.Clear();

            var sfnames       = Settings.Default.SubfolderNames ?? new List <string>();
            var sfdirectories = Settings.Default.SubfolderDirectories ?? new List <string>();

            for (int i = 0; i < Math.Min(sfnames.Count, sfdirectories.Count); i++)
            {
                Subfolders.Add(new SubfolderInfo(sfnames[i], sfdirectories[i], true));
            }

            // Load info specific to chosen directory.

            if (dirInfo == null)
            {
                Logs.Log("Directory open cancelled.");
                this.files = new List <string>();
            }
            else
            {
                this.directory = dirInfo.FullName;
                this.files     = dirInfo.GetFileNamesList();

                string[] folders = dirInfo.GetFolderNames();
                for (int i = 0; i < folders.Length; i++)
                {
                    Subfolders.Add(new SubfolderInfo(folders[i], Path.Combine(directory, folders[i]), false));
                }

                fileIndex = 0;

                Logs.Log($"Opened '{directory}' and found {files.Count} files and {folders.Length} subdirectories.");
            }

            form.ResumeLayout();

            HideLoading();
        }
 public void AddSubFolder(Folder name)
 {
     Subfolders.Add(name);
     name.RootFolder = this;
     name.level      = this.level + 1;
 }
 //Not sure if we need some other SubFolder recursive thing
 public void AddSubFolder(string name)
 {
     Subfolders.Add(new Folder(name));
     Subfolders.Last().RootFolder = this;
     Subfolders.Last().level      = this.level + 1;
 }