public void Import(string path, Node <IProjectElement> node) { if (node.IsSelected) { switch (node.Object.TypeName) { case "FolderTool": FolderTool newFolder = this.Folders.Find(a => { return(a.Name == node.Object.ElementTitle); }); if (newFolder == null) { newFolder = new FolderTool(); newFolder.Path = path; newFolder.Name = node.Object.ElementTitle; this.Folders.Add(newFolder); } else { newFolder = newFolder.Clone() as FolderTool; } foreach (Node <IProjectElement> subNode in node) { newFolder.Import(path + System.IO.Path.AltDirectorySeparatorChar + node.Object.ElementTitle, subNode); } break; case "HTMLTool": this.Tools.Add(node.Object as HTMLTool); break; } } }
private FolderTool(FolderTool ft) { this.name = ExtensionMethods.CloneThis(ft.name); this.path = ExtensionMethods.CloneThis(ft.path); foreach (FolderTool subFolder in ft.folders) { this.folders.Add(subFolder.Clone() as FolderTool); } foreach (HTMLTool tool in ft.tools) { this.tools.Add(tool.Clone() as HTMLTool); } }
public void Import(string oldPath, FolderTool from) { foreach (FolderTool folder in from.Folders) { FolderTool newFolder = this.Folders.Find(a => { return(a.Name == folder.Name); }); if (newFolder == null) { newFolder = new FolderTool(); newFolder.Path = oldPath; newFolder.Name = folder.Name; this.Folders.Add(newFolder); } newFolder.Import(oldPath + System.IO.Path.AltDirectorySeparatorChar + folder.Name, folder); } foreach (HTMLTool tool in from.Tools) { HTMLTool newTool = tool.Clone() as HTMLTool; this.Tools.Add(newTool); } }
public object Clone() { FolderTool newObject = new FolderTool(this); return(newObject); }