public ScratchAreaController(SaveableClipboard clipboard) { this.clipboard = clipboard; rootFolder = new ScratchAreaRootFolder("Scratch Area", MedicalConfig.UserDocRoot); rootFolder.loadInfo(); }
public void removeFolder(String name) { ScratchAreaFolder folder = null; foreach (ScratchAreaFolder currentFolder in children) { if (currentFolder.folderName == name) { folder = currentFolder; break; } } removeFolder(folder); }
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); } } }
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)); } }
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); }
public ScratchAreaFolder(String folderName, ScratchAreaFolder parent) { this.folderName = folderName; this.parentFolder = parent; }
public ScratchAreaItem(String name, ScratchAreaFolder parent) { this.name = name; this.parent = parent; }