示例#1
0
        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
        }
示例#2
0
 public void ReadPadBits()
 {
     MsgReader.ReadPadBits(buf, ref seekPos);
 }
示例#3
0
 public bool ReadBoolean()
 {
     return(MsgReader.ReadBoolean(buf, ref seekPos));
 }
示例#4
0
 public byte[] ReadBytes(int numberOfBytes)
 {
     return(MsgReader.ReadBytes(buf, ref seekPos, numberOfBytes));
 }
示例#5
0
 public Single ReadRangedSingle(Single min, Single max, int bitCount)
 {
     return(MsgReader.ReadRangedSingle(buf, ref seekPos, min, max, bitCount));
 }
示例#6
0
 public int ReadRangedInteger(int min, int max)
 {
     return(MsgReader.ReadRangedInteger(buf, ref seekPos, min, max));
 }
示例#7
0
 public Color ReadColorR8G8B8A8()
 {
     return(MsgReader.ReadColorR8G8B8A8(buf, ref seekPos));
 }
示例#8
0
 public String ReadString()
 {
     return(MsgReader.ReadString(buf, ref seekPos));
 }
示例#9
0
 public UInt32 ReadVariableUInt32()
 {
     return(MsgReader.ReadVariableUInt32(buf, ref seekPos));
 }
示例#10
0
 public Double ReadDouble()
 {
     return(MsgReader.ReadDouble(buf, ref seekPos));
 }
示例#11
0
 public Single ReadSingle()
 {
     return(MsgReader.ReadSingle(buf, ref seekPos));
 }
示例#12
0
 public Int64 ReadInt64()
 {
     return(MsgReader.ReadInt64(buf, ref seekPos));
 }
示例#13
0
 public Int32 ReadInt32()
 {
     return(MsgReader.ReadInt32(buf, ref seekPos));
 }
示例#14
0
 public Int16 ReadInt16()
 {
     return(MsgReader.ReadInt16(buf, ref seekPos));
 }
示例#15
0
 public byte ReadByte()
 {
     return(MsgReader.ReadByte(buf, ref seekPos));
 }