public override void Write(byte[] Data, int Offset, int Count) { if (!IsOpen || IsDisposed) { throw new Exception("XboxMemoryStream.Write: The XMS stream is not open."); } if (Position < 0 || Position > uint.MaxValue) { throw new Exception("XboxMemoryStream.Writes: Invalid position specified. It must be greater than or equal to 0 and less than uint.MaxValue."); } if (Data == null) { throw new Exception("XboxMemoryStream.Write: No data array specified."); } if (Offset < 0) { throw new Exception("XboxMemoryStream.Write: Invalid offset specified. It must be greater than or equal to 0."); } if (Count < 0) { throw new Exception("XboxMemoryStream.Write: Invalid count specified. It must be greater than or equal to 0."); } if (Count == 0) { return; } if (Offset + Count > Data.Length) { throw new Exception("XboxMemoryStream.Write: Invalid offset/count specified. They must fit within the size of the data."); } uint bytesWritten; target.SetMemory((uint)Position, (uint)Count, Data, out bytesWritten); Position += bytesWritten; }
public static void WriteInt32(this IXboxDebugTarget xdt, uint offset, int input, bool bigEndien = true) { BitConverter.GetBytes(input).CopyTo(myBuffer, 0); if (bigEndien) { Array.Reverse(myBuffer, 0, 4); } xdt.SetMemory(offset, 4, myBuffer, out outInt); }
public static void MW2Float(this IXboxDebugTarget xdt, uint offset, float input) { BitConverter.GetBytes(input).CopyTo(myBuffer, 0); Array.Reverse(myBuffer, 0, 4); xdt.SetMemory(offset, 4, myBuffer, out outInt); }
public static void WriteString(this IXboxDebugTarget xdt, uint offset, string input) { Encoding.ASCII.GetBytes(input).CopyTo(myBuffer2, 0); xdt.SetMemory(offset, 16, myBuffer2, out outInt); }
public static void WriteDouble(this IXboxDebugTarget xdt, uint offset, double input) { BitConverter.GetBytes(input).CopyTo(myBuffer, 0); Array.Reverse(myBuffer, 0, 8); xdt.SetMemory(offset, 8, myBuffer, out outInt); }
public static void WriteUInt16(this IXboxDebugTarget xdt, uint offset, ushort input) { BitConverter.GetBytes(input).CopyTo(myBuffer, 0); Array.Reverse(myBuffer, 0, 2); xdt.SetMemory(offset, 2, myBuffer, out outInt); }
public static void WriteByte(this IXboxDebugTarget xdt, uint offset, byte input) { myBuffer[0] = input; xdt.SetMemory(offset, 1, myBuffer, out outInt); }
public static void WriteBool(this IXboxDebugTarget xdt, uint offset, bool input) { myBuffer[0] = input ? (byte)1 : (byte)0; xdt.SetMemory(offset, 1, myBuffer, out outInt); }