internal bool LoadMsil()
{
if (MsilPos == 0 || MsilLines == 0)
{
return(false);
}
if (Msil != null)
{
return(true);
}
using (FileStream DatStream = new FileStream(XRay.DatPath, FileMode.Open, FileAccess.Read, FileShare.Read))
{
DatStream.Position = MsilPos;
Msil = new List <XInstruction>();
var code = new StringBuilder();
for (int i = 0; i < MsilLines; i++)
{
var inst = new XInstruction();
inst.Offset = BitConverter.ToInt32(DatStream.Read(4), 0);
inst.OpCode = XNodeIn.ReadString(DatStream);
inst.Line = XNodeIn.ReadString(DatStream);
inst.RefId = BitConverter.ToInt32(DatStream.Read(4), 0);
if (inst.RefId != 0 && !inst.Line.StartsWith("goto "))
{
inst.Line = Utilities.GetMethodName(this, inst.RefId);
}
Msil.Add(inst);
code.Append(inst.Offset.ToString("X") + ": " + inst.OpCode + " " + inst.Line + "\r\n");
}
PlainMsil = code.ToString();
}
return(true);
}