From 1ded5b10b4996db7d3be9ee4f0c15fd230faef3e Mon Sep 17 00:00:00 2001 From: Kurt Date: Mon, 19 Jan 2015 20:58:48 -0800 Subject: [PATCH] Saving and minor fixes --- pk3DS/Subforms/Mart.Designer.cs | 8 +++++--- pk3DS/Subforms/Mart.cs | 5 ++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/pk3DS/Subforms/Mart.Designer.cs b/pk3DS/Subforms/Mart.Designer.cs index 9846124..15a4b97 100644 --- a/pk3DS/Subforms/Mart.Designer.cs +++ b/pk3DS/Subforms/Mart.Designer.cs @@ -42,7 +42,7 @@ private void InitializeComponent() this.CB_Location.FormattingEnabled = true; this.CB_Location.Location = new System.Drawing.Point(69, 6); this.CB_Location.Name = "CB_Location"; - this.CB_Location.Size = new System.Drawing.Size(236, 21); + this.CB_Location.Size = new System.Drawing.Size(243, 21); this.CB_Location.TabIndex = 0; this.CB_Location.SelectedIndexChanged += new System.EventHandler(this.changeIndex); // @@ -58,7 +58,7 @@ private void InitializeComponent() this.dgv.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dgv.Location = new System.Drawing.Point(12, 33); this.dgv.Name = "dgv"; - this.dgv.Size = new System.Drawing.Size(293, 317); + this.dgv.Size = new System.Drawing.Size(300, 317); this.dgv.TabIndex = 1; // // L_Mart @@ -74,10 +74,12 @@ private void InitializeComponent() // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(317, 362); + this.ClientSize = new System.Drawing.Size(324, 362); this.Controls.Add(this.L_Mart); this.Controls.Add(this.dgv); this.Controls.Add(this.CB_Location); + this.MaximumSize = new System.Drawing.Size(340, 400); + this.MinimumSize = new System.Drawing.Size(340, 400); this.Name = "Mart"; this.Text = "Mart Editor"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.formClosing); diff --git a/pk3DS/Subforms/Mart.cs b/pk3DS/Subforms/Mart.cs index 5bebeb1..b9b651c 100644 --- a/pk3DS/Subforms/Mart.cs +++ b/pk3DS/Subforms/Mart.cs @@ -20,11 +20,13 @@ public Mart() if (!File.Exists(files[0]) || !Path.GetFileNameWithoutExtension(files[0]).Contains("code")) { Util.Alert("No .code.bin detected."); this.Close(); } data = File.ReadAllBytes(files[0]); if (data.Length % 0x200 != 0) { Util.Alert(".code.bin not decompressed. Aborting."); this.Close(); } + codebin = files[0]; itemlist[0] = ""; setupDGV(); foreach (string s in locations) CB_Location.Items.Add(s); CB_Location.SelectedIndex = 0; } + string codebin = null; string[] itemlist = Main.getText((Main.oras) ? 114 : 96); byte[] data; byte[] entries = { 7, 6, 4, 3, 8, @@ -72,7 +74,7 @@ private void changeIndex(object sender, EventArgs e) { if (entry > -1) setList(); entry = CB_Location.SelectedIndex; - getList(); + getList(); } private void getList() { @@ -97,6 +99,7 @@ private void setList() private void formClosing(object sender, FormClosingEventArgs e) { if (entry > -1) setList(); + File.WriteAllBytes(codebin, data); } } }