예제 #1
0
 /// <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();
 }
예제 #2
0
파일: CheApe.cs 프로젝트: yumiris/OpenSauce
 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);
     }
 }
예제 #3
0
        /// <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);
        }
예제 #4
0
		/// <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;
		}
예제 #5
0
        /// <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);
        }
예제 #6
0
        /// <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();
        }
예제 #7
0
파일: CheApe.cs 프로젝트: yumiris/OpenSauce
        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);
        }
예제 #8
0
파일: CheApe.cs 프로젝트: yumiris/OpenSauce
        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();
            }
        }
예제 #9
0
파일: CheApe.cs 프로젝트: yumiris/OpenSauce
        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;
            }
        }
예제 #10
0
		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);
			}
		}
예제 #11
0
 /// <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);
 }
예제 #12
0
 /// <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);
 }
예제 #13
0
 /// <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);
 }
예제 #14
0
		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;
			}
		}
예제 #15
0
		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;
		}
예제 #16
0
		/// <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;
		}
예제 #17
0
		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();
			}
		}