コード例 #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));
 }