internal static void Write(ref byte[] buf, ref int bitPos, bool val) { #if DEBUG int resetPos = bitPos; #endif EnsureBufferSize(ref buf, bitPos + 1); int bytePos = bitPos / 8; int bitOffset = bitPos % 8; byte bitFlag = (byte)(1 << bitOffset); byte bitMask = (byte)((~bitFlag) & 0xff); buf[bytePos] &= bitMask; if (val) { buf[bytePos] |= bitFlag; } bitPos++; #if DEBUG bool testVal = MsgReader.ReadBoolean(buf, ref resetPos); if (testVal != val || resetPos != bitPos) { DebugConsole.ThrowError("Boolean written incorrectly! " + testVal + ", " + val + "; " + resetPos + ", " + bitPos); } #endif }
public void ReadPadBits() { MsgReader.ReadPadBits(buf, ref seekPos); }
public bool ReadBoolean() { return(MsgReader.ReadBoolean(buf, ref seekPos)); }
public byte[] ReadBytes(int numberOfBytes) { return(MsgReader.ReadBytes(buf, ref seekPos, numberOfBytes)); }
public Single ReadRangedSingle(Single min, Single max, int bitCount) { return(MsgReader.ReadRangedSingle(buf, ref seekPos, min, max, bitCount)); }
public int ReadRangedInteger(int min, int max) { return(MsgReader.ReadRangedInteger(buf, ref seekPos, min, max)); }
public Color ReadColorR8G8B8A8() { return(MsgReader.ReadColorR8G8B8A8(buf, ref seekPos)); }
public String ReadString() { return(MsgReader.ReadString(buf, ref seekPos)); }
public UInt32 ReadVariableUInt32() { return(MsgReader.ReadVariableUInt32(buf, ref seekPos)); }
public Double ReadDouble() { return(MsgReader.ReadDouble(buf, ref seekPos)); }
public Single ReadSingle() { return(MsgReader.ReadSingle(buf, ref seekPos)); }
public Int64 ReadInt64() { return(MsgReader.ReadInt64(buf, ref seekPos)); }
public Int32 ReadInt32() { return(MsgReader.ReadInt32(buf, ref seekPos)); }
public Int16 ReadInt16() { return(MsgReader.ReadInt16(buf, ref seekPos)); }
public byte ReadByte() { return(MsgReader.ReadByte(buf, ref seekPos)); }