public T GetStruct <T>(int offset, int num) where T : struct { int size = Marshal.SizeOf(typeof(T)); byte[] data = ReadBytes(offset, num, size); return((T)StructsUtil.ByteToStruct(data, typeof(T))); }
public Object GetStruct(int offset, int num, Type type) { int size = Marshal.SizeOf(type); byte[] data = ReadBytes(offset, num, size); return(StructsUtil.ByteToStruct(data, type)); }
private Evo[] getEvo(ReadAndWrite rw, int num) { //Console.WriteLine(Operation.Hex(rw.getStructOffset(typeof(Evo), evo_table, num * EVO_PER_POKE))); rw.Seek(rw.getStructOffset(typeof(Evo), evo_table, num * EVO_PER_POKE)); for (int x = 0; x < EVO_PER_POKE; x++) { byte[] data = rw.Br.ReadBytes(8); evo[x] = (Evo)StructsUtil.ByteToStruct(data, typeof(Evo)); } return(evo); }
public void Save(ReadAndWrite rw, int num) { rw.Seek(rw.getStructOffset(typeof(Evo), evo_table, num * EVO_PER_POKE)); for (int i = 0; i < EVO_PER_POKE; i++) { Evo e = evo[i]; DataGridViewCellCollection cell = grid.Rows[i].Cells; e.method = (byte)(int)cell[0].Value; e.padd0 = Operation.ParseByte((string)cell[1].Value); e.parameter = (ushort)Operation.ParseShort((string)cell[3].Value); e.padd1 = Operation.ParseShort((string)cell[4].Value); rw.Bw.Write(StructsUtil.StructToByte(e)); } }
public void Save(int offset, int num, ValueType obj) { byte[] data = StructsUtil.StructToByte(obj); WriteBytes(offset, num, data); }