Saving and minor fixes

This commit is contained in:
Kurt
2015-01-19 20:58:48 -08:00
parent 8e07e81cc8
commit 1ded5b10b4
2 changed files with 9 additions and 4 deletions

View File

@@ -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);

View File

@@ -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);
}
}
}