Fixed up Ram Watch file loading

This commit is contained in:
andres.delikat 2011-01-19 04:05:01 +00:00
parent bdbd3ebb8b
commit 255c272342
2 changed files with 31 additions and 19 deletions

View File

@ -59,6 +59,7 @@
this.toolStripButton2 = new System.Windows.Forms.ToolStripButton();
this.toolStripButton3 = new System.Windows.Forms.ToolStripButton();
this.listBox1 = new System.Windows.Forms.ListBox();
this.WatchCountLabel = new System.Windows.Forms.Label();
this.menuStrip1.SuspendLayout();
this.toolStrip1.SuspendLayout();
this.SuspendLayout();
@ -233,16 +234,15 @@
//
// WatchListView
//
this.WatchListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.WatchListView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.WatchListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.Address,
this.Value,
this.Notes});
this.WatchListView.Location = new System.Drawing.Point(34, 52);
this.WatchListView.Location = new System.Drawing.Point(34, 76);
this.WatchListView.Name = "WatchListView";
this.WatchListView.Size = new System.Drawing.Size(232, 403);
this.WatchListView.Size = new System.Drawing.Size(232, 436);
this.WatchListView.TabIndex = 1;
this.WatchListView.UseCompatibleStateImageBehavior = false;
//
@ -300,17 +300,29 @@
//
// listBox1
//
this.listBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.listBox1.FormattingEnabled = true;
this.listBox1.Location = new System.Drawing.Point(311, 88);
this.listBox1.Name = "listBox1";
this.listBox1.Size = new System.Drawing.Size(120, 355);
this.listBox1.TabIndex = 3;
//
// WatchCountLabel
//
this.WatchCountLabel.AutoSize = true;
this.WatchCountLabel.Location = new System.Drawing.Point(34, 57);
this.WatchCountLabel.Name = "WatchCountLabel";
this.WatchCountLabel.Size = new System.Drawing.Size(56, 13);
this.WatchCountLabel.TabIndex = 4;
this.WatchCountLabel.Text = "0 watches";
//
// RamWatch
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(485, 467);
this.ClientSize = new System.Drawing.Size(485, 524);
this.Controls.Add(this.WatchCountLabel);
this.Controls.Add(this.listBox1);
this.Controls.Add(this.toolStrip1);
this.Controls.Add(this.WatchListView);
@ -360,5 +372,6 @@
private System.Windows.Forms.ColumnHeader Value;
private System.Windows.Forms.ColumnHeader Notes;
private System.Windows.Forms.ListBox listBox1;
private System.Windows.Forms.Label WatchCountLabel;
}
}

View File

@ -50,6 +50,7 @@ namespace BizHawk.MultiClient
using (StreamReader sr = file.OpenText())
{
int count = 0;
string s = "";
string temp = "";
watchList.Clear(); //Wipe existing list and read from file
@ -70,7 +71,7 @@ namespace BizHawk.MultiClient
}
else if (z != 4)
continue; //If not 4, something is wrong with this line, ignore it
count++;
Watch w = new Watch();
temp = s.Substring(0, s.IndexOf('\t'));
@ -95,11 +96,11 @@ namespace BizHawk.MultiClient
w.notes = s.Substring(2, s.Length - 2); //User notes
watchList.Add(w);
//Debug
for (int x = 0; x < watchList.Count; x++)
TempDisplayWatchInTempList(watchList[x]);
}
//Update the number of watches
listBox1.Items.Clear();
WatchCountLabel.Text = count.ToString() + " watches";
}
return true;
@ -154,6 +155,10 @@ namespace BizHawk.MultiClient
var file = new FileInfo(ofd.FileName);
Global.Config.LastRomPath = file.DirectoryName;
LoadWatchFile(file.FullName);
//Debug
for (int x = 0; x < watchList.Count; x++)
TempDisplayWatchInTempList(watchList[x]);
}
private void saveToolStripMenuItem_Click(object sender, EventArgs e)
@ -213,17 +218,11 @@ namespace BizHawk.MultiClient
private void RamWatch_Load(object sender, EventArgs e)
{
//TODO: Debug
Watch watch1 = new Watch();
watch1.notes = "Test1";
watchList.Add(watch1);
Watch watch2 = new Watch(0x00FF, 256, atype.BYTE, asigned.SIGNED, true, "This is a test");
Watch watch3 = new Watch(0x00FE, 256, atype.BYTE, asigned.SIGNED, true, "This is a test too");
Watch watch4 = new Watch(0x00FD, 256, atype.BYTE, asigned.SIGNED, true, "Stuff");
watchList.Add(watch2);
watchList.Add(watch3);
watchList.Add(watch4);
ListViewItem item1 = new ListViewItem(watch1.address.ToString(), 0);
WatchListView.Items.Add(item1);