public ScratchAreaController(SaveableClipboard clipboard)
        {
            this.clipboard = clipboard;

            rootFolder = new ScratchAreaRootFolder("Scratch Area", MedicalConfig.UserDocRoot);
            rootFolder.loadInfo();
        }
Пример #2
0
        public void removeFolder(String name)
        {
            ScratchAreaFolder folder = null;

            foreach (ScratchAreaFolder currentFolder in children)
            {
                if (currentFolder.folderName == name)
                {
                    folder = currentFolder;
                    break;
                }
            }
            removeFolder(folder);
        }
Пример #3
0
 private void removeFolder(ScratchAreaFolder folder)
 {
     if (folder != null && children.Remove(folder))
     {
         String folderPath = folder.FilesystemPath;
         try
         {
             if (Directory.Exists(folderPath))
             {
                 Directory.Delete(folderPath, true);
             }
             onFolderRemoved(folder);
         }
         catch (Exception e)
         {
             Log.Error("Could not delete ScratchAreaFolder {0} at path {1} because {2}", folder.folderName, folderPath, e.Message);
         }
     }
 }
Пример #4
0
        public void loadInfo()
        {
            String path = FilesystemPath;

            foreach (String directory in Directory.GetDirectories(path, "*", SearchOption.TopDirectoryOnly))
            {
                DirectoryInfo info = new DirectoryInfo(directory);
                if ((info.Attributes & FileAttributes.Hidden) == 0)
                {
                    ScratchAreaFolder folder = addFolder(info.Name);
                    folder.loadInfo();
                }
            }

            foreach (String file in Directory.GetFiles(path, "*.sav", SearchOption.TopDirectoryOnly))
            {
                addExistingItem(Path.GetFileNameWithoutExtension(file));
            }
        }
Пример #5
0
        public ScratchAreaFolder addFolder(String name)
        {
            ScratchAreaFolder folder = new ScratchAreaFolder(name, this);
            String            path   = Path.Combine(FilesystemPath, name);

            try
            {
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                children.Add(folder);
                onFolderAdded(folder);
            }
            catch (Exception e)
            {
                Log.Error("Could not create ScratchAreaFolder {0} in path {1} because {2}", name, path, e.Message);
            }
            return(folder);
        }
Пример #6
0
 public ScratchAreaFolder(String folderName, ScratchAreaFolder parent)
 {
     this.folderName   = folderName;
     this.parentFolder = parent;
 }
Пример #7
0
 public ScratchAreaItem(String name, ScratchAreaFolder parent)
 {
     this.name   = name;
     this.parent = parent;
 }