/// <summary> /// Close an existing project /// </summary> /// <param name="save">Should we save the project data before closing?</param> /// <param name="proj">Project object in question</param> private static void Close(bool save, BlamLib.CheApe.Project proj) { if (save) { Save(null, proj); } proj.Dispose(); }
void OnFileNew(object sender, EventArgs e) { if (FileClosed() && SaveProjDialog.ShowDialog(this) == DialogResult.OK) { Project = ProjectInterface.Create(SaveProjDialog.FileName); this.Text = string.Format("Che Ape [{0}]", Project.FileName); SetState(true); } }
/// <summary> /// Open an existing project file /// </summary> /// <param name="file">Path to the project file</param> /// <returns>Project using data loaded from <paramref name="file"/></returns> private static BlamLib.CheApe.Project Open(string file) { BlamLib.CheApe.Project proj = new BlamLib.CheApe.Project(BlamVersion.Halo1_CE, file); Managers.FileManager fm = new Managers.FileManager(file); fm.OpenForRead(); fm.Manage(proj); fm.Read(); fm.Close(); return(new ProjectState(proj).Project); }
/// <summary> /// Create a new project file and object /// </summary> /// <param name="file">Path to the project file</param> /// <returns>Read to use Project object</returns> private static BlamLib.CheApe.Project Create(string file) { BlamLib.CheApe.Project proj = new BlamLib.CheApe.Project(BlamVersion.Halo2, file); Managers.FileManager fm = new Managers.FileManager(file); fm.CreateForWrite(); fm.Manage(proj); fm.Write(); fm.Close(); return new ProjectState(proj).Project; }
/// <summary> /// Create a new project file and object /// </summary> /// <param name="file">Path to the project file</param> /// <returns>Read to use Project object</returns> private static BlamLib.CheApe.Project Create(string file) { BlamLib.CheApe.Project proj = new BlamLib.CheApe.Project(BlamVersion.Halo2, file); Managers.FileManager fm = new Managers.FileManager(file); fm.CreateForWrite(); fm.Manage(proj); fm.Write(); fm.Close(); return(new ProjectState(proj).Project); }
/// <summary> /// Save an existing project /// </summary> /// <param name="save_as">If not null, then it saves the project to this file and updates the project settings</param> /// <param name="proj">Project object in question</param> private static void Save(string save_as, BlamLib.CheApe.Project proj) { Managers.FileManager fm; if (save_as == null) { fm = new Managers.FileManager(proj.FileName); fm.OpenForWrite(); } else { fm = new Managers.FileManager(proj.FileName = save_as); fm.CreateForWrite(); } fm.Manage(proj); fm.Write(); fm.Close(); }
bool FileClosed() { if (Project == null) { return(true); } DialogResult result = PromptSaveDialog(); if (result != DialogResult.Cancel) { ProjectInterface.Close(result == DialogResult.Yes ? true : false, Project); FileViewRoot.Nodes.Clear(); Project = null; } this.Text = "Che Ape"; SetState(false); return(result != DialogResult.Cancel); }
void OnFileOpen(object sender, EventArgs e) { if (FileClosed() && OpenProjDialog.ShowDialog(this) == DialogResult.OK) { this.Text = string.Format("Che Ape [{0}]", "Opening..."); Project = ProjectInterface.Open(OpenProjDialog.FileName); this.Text = string.Format("Che Ape [{0}]", Project.FileName); SetState(true); TreeNode node = null; FileView.SuspendLayout(); foreach (string s in Project.Files) { node = new TreeNode(System.IO.Path.GetFileNameWithoutExtension(s)); node.Tag = s; node.BackColor = System.Drawing.SystemColors.ControlDarkDark; node.ForeColor = System.Drawing.Color.LightGreen; node.ContextMenuStrip = this.FileViewMenu; FileViewRoot.Nodes.Add(node); } FileView.ResumeLayout(); } }
void OnFormClosing(object sender, FormClosingEventArgs e) { if (Project == null) { return; } DialogResult result = PromptSaveDialog(); if (result == DialogResult.Yes) { ProjectInterface.Close(true, Project); Project = null; } else if (result == DialogResult.Cancel) { e.Cancel = true; } else { ProjectInterface.Close(false, Project); Project = null; } }
void OnFileNew(object sender, EventArgs e) { if (FileClosed() && SaveProjDialog.ShowDialog(this) == DialogResult.OK) { Project = ProjectInterface.Create(SaveProjDialog.FileName); this.Text = string.Format("Che Ape [{0}]", Project.FileName); SetState(true); } }
/// <summary> /// Close an existing project /// </summary> /// <param name="save">Should we save the project data before closing?</param> /// <param name="project">Project object in question</param> public void Close(bool save, BlamLib.CheApe.Project project) { Project.Close(save, project); }
/// <summary> /// Save an existing project /// </summary> /// <param name="save_as">If not null, then it saves the project to this file and updates the project settings</param> /// <param name="project">Project object in question</param> public void Save(string save_as, BlamLib.CheApe.Project project) { Project.Save(save_as, project); }
/// <summary> /// Implementation constructor /// </summary> /// <param name="proj">Project which this state will work with</param> public ProjectState(BlamLib.CheApe.Project proj) : base(BlamVersion.Halo2_PC, proj) { importer = new Import(); compiler = new Compiler(this); }
void OnFormClosing(object sender, FormClosingEventArgs e) { if (Project == null) return; DialogResult result = PromptSaveDialog(); if (result == DialogResult.Yes) { ProjectInterface.Close(true, Project); Project = null; } else if (result == DialogResult.Cancel) e.Cancel = true; else { ProjectInterface.Close(false, Project); Project = null; } }
bool FileClosed() { if (Project == null) return true; DialogResult result = PromptSaveDialog(); if (result != DialogResult.Cancel) { ProjectInterface.Close(result == DialogResult.Yes ? true : false, Project); FileViewRoot.Nodes.Clear(); Project = null; } this.Text = "Che Ape"; SetState(false); return result != DialogResult.Cancel; }
/// <summary> /// Open an existing project file /// </summary> /// <param name="file">Path to the project file</param> /// <returns>Project using data loaded from <paramref name="file"/></returns> private static BlamLib.CheApe.Project Open(string file) { BlamLib.CheApe.Project proj = new BlamLib.CheApe.Project(BlamVersion.Halo2, file); Managers.FileManager fm = new Managers.FileManager(file); fm.OpenForRead(); fm.Manage(proj); fm.Read(); fm.Close(); return new ProjectState(proj).Project; }
void OnFileOpen(object sender, EventArgs e) { if (FileClosed() && OpenProjDialog.ShowDialog(this) == DialogResult.OK) { this.Text = string.Format("Che Ape [{0}]", "Opening..."); Project = ProjectInterface.Open(OpenProjDialog.FileName); this.Text = string.Format("Che Ape [{0}]", Project.FileName); SetState(true); TreeNode node = null; FileView.SuspendLayout(); foreach (string s in Project.Files) { node = new TreeNode(System.IO.Path.GetFileNameWithoutExtension(s)); node.Tag = s; node.BackColor = System.Drawing.SystemColors.ControlDarkDark; node.ForeColor = System.Drawing.Color.LightGreen; node.ContextMenuStrip = this.FileViewMenu; FileViewRoot.Nodes.Add(node); } FileView.ResumeLayout(); } }