public bool addfile(string pathname,bool copy=true,EditorWindow ew=null) { string filename = Path.GetFileName(pathname); string target = details.filefolder + Path.DirectorySeparatorChar + filename; if(File.Exists(target)) { return false; } if (copy==true) { File.Copy(pathname, target); } file f = new file(filename,""); details.files.Add(f); solutionchanged(); isDirty = true; if (ew != null) { ewlink.Add(filename, ew); } return true; }
public void loadfile(string name) { EditorWindow ew = new EditorWindow(name,solution); string data = solution.loadfile(name,ew); ew.EditorClosing += new EditorWindow.EditorClosingHandler(ew_Closing); ew.settext(data); ew.MdiParent = this; ew.DockPanel = this.dockPanel; ew.Show(); editors.Add(name, ew); }
private void newfile() { int index = 0; String filename = "New"; while (solution.isnameused(filename) == true) { index++; filename = string.Format("New {0}", index); } EditorWindow ew = new EditorWindow(filename,solution); ew.MdiParent = this; ew.DockPanel = this.dockPanel; ew.Show(); editors.Add(filename,ew); ew.EditorClosing += new EditorWindow.EditorClosingHandler(ew_Closing); solution.addfile(filename,false,ew); }
public void unlink(EditorWindow ew) { if (ewlink.ContainsKey(ew.filename)) { ewlink.Remove(ew.filename); } }
public string loadfile(string name,EditorWindow ew=null) { StreamReader sr = new StreamReader(details.filefolder + System.IO.Path.DirectorySeparatorChar + name); string data = sr.ReadToEnd(); sr.Close(); if (ew != null) { ew.settext(data); ewlink.Add(name, ew); } return data; }