void tsbtnPeek_CheckedChanged(object sender, System.EventArgs e)
{
// Update any changes to our backup before loading Peek values
if (CurrentControl != null)
CurrentControl.BaseField_Leave(null, null);
reflexiveData rd = (reflexiveData)treeViewTagReflexives.SelectedNode.Tag;
int ofs = rd.baseOffset;// CurrentControl.offsetInMap - CurrentControl.meta.offset;
int chunkSize = 0;
if (rd.reflexive == null)
chunkSize = meta.headersize;
else
chunkSize = rd.reflexive.chunkSize;
if (this.tsbtnPeek.Checked)
{
if (!HaloMap.RealTimeHalo.RTH_Imports.IsConnected)
{
// Add update info here //
tsbtnPeek.Checked = false;
foreach (Control c in this.panelMetaEditor.Controls)
{
c.Controls[1].ForeColor = Color.Black;
}
showInfoBox("Debug xbox not connected!", 2000);
return;
}
// Backup out data
byte[] b = new byte[chunkSize];
meta.MS.Position = ofs;
meta.MS.Read(b, 0, b.Length);
msDebug.Position = ofs;
msDebug.Write(b, 0, b.Length);
// Read from our debug box
uint offset = (uint)(meta.offset + meta.magic + ofs);
b = (byte[])HaloMap.RealTimeHalo.RTH_Imports.Peek(offset, (uint)chunkSize);
meta.MS.Position = ofs;
meta.MS.Write(b, 0, b.Length);
}
else
{
try
{
// Write our Backed up data
byte[] b = new byte[chunkSize];
msDebug.Position = ofs;
msDebug.Read(b, 0, b.Length);
meta.MS.Position = ofs;
meta.MS.Write(b, 0, b.Length);
}
catch
{
}
}
foreach (Control c in this.panelMetaEditor.Controls)
{
if (c is Bitmask)
{
for (int i = 0; i < c.Controls[0].Controls.Count; i++)
c.Controls[0].Controls[i].ForeColor = this.tsbtnPeek.Checked ? Color.Red : Color.Black;
}
else
{
if (c is Ident)
c.Controls[2].ForeColor = this.tsbtnPeek.Checked ? Color.Red : Color.Black;
c.Controls[1].ForeColor = this.tsbtnPeek.Checked ? Color.Red : Color.Black;
}
}
ReloadMetaForSameReflexive(((reflexiveData)treeViewTagReflexives.SelectedNode.Tag).baseOffset);
if (CurrentControl != null)
CurrentControl.Focus();
}