Ejemplo n.º 1
0
        private void Import(string[] files)
        {
            foreach (string filePath in files)
            {
                AddContents(_curDirectory, filePath);
            }
            _curDirectory.Commit();

            PopulateExplorerList(_curDirectory);
            PopulateExplorerTree();
        }
Ejemplo n.º 2
0
 // Requires caller to commit changes to parent
 private void AddContents(BobFsNode parent, string path)
 {
     if (File.Exists(path))
     {
         BobFsNode newFile      = parent.NewFile(Path.GetFileName(path));
         byte[]    fileContents = File.ReadAllBytes(path);
         newFile.WriteAll(0, fileContents, 0, fileContents.Length);
         newFile.Commit();
     }
     else if (Directory.Exists(path))
     {
         BobFsNode newDir = parent.NewDirectory(Path.GetFileName(path));
         foreach (string dirEntry in Directory.EnumerateFileSystemEntries(path))
         {
             AddContents(newDir, dirEntry);
         }
         newDir.Commit();
     }
 }