Пример #1
0
        public uint GetUint32(int index)
        {
            if (index > 1)
            {
                throw new IndexOutOfRangeException("Max index for a GetUInt32 operation is 1");
            }

            int pos = 22 + (4 * index);

            return(BitConverter.ToUInt32(EndianCorrectArray(RawBytes.Skip(pos).Take(4).ToArray()), 0));
        }
Пример #2
0
        public float GetFloat(int index)
        {
            if (index > 1)
            {
                throw new IndexOutOfRangeException("Max index for a SetFloat operation is 1");
            }

            int pos = 22 + (4 * index);

            return(BitConverter.ToSingle(EndianCorrectArray(RawBytes.Skip(pos).Take(4).ToArray()), 0));
        }
Пример #3
0
        public int GetInt16(int index)
        {
            if (index > 3)
            {
                throw new IndexOutOfRangeException("Max index for a GetInt16 operation is 3");
            }

            int pos = 22 + (2 * index);

            return(BitConverter.ToInt16(EndianCorrectArray(RawBytes.Skip(pos).Take(2).ToArray()), 0));
        }
Пример #4
0
        public uint GetUint8(int index)
        {
            if (index > 7)
            {
                throw new IndexOutOfRangeException("Max index for a setUInt8 operation is 7");
            }

            int pos = 22 + index;

            return(MyExtensions.ByteToUInt8(RawBytes.Skip(pos).Take(1).ToArray()));
        }
Пример #5
0
        public string GetByteString(int index)
        {
            if (index > 7)
            {
                throw new IndexOutOfRangeException("Max index for a GetByteString operation is 7");
            }

            int pos = 22 + index;

            return(MyExtensions.ByteArrayToString(RawBytes.Skip(pos).Take(1).ToArray()));
        }
Пример #6
0
        public byte GetByte(int index)
        {
            if (index > 7)
            {
                throw new IndexOutOfRangeException("Max index for a getByte operation is 7");
            }

            int pos = 22 + index;

            return(RawBytes.Skip(pos).Take(1).ToArray()[0]);
        }
Пример #7
0
        public int GetInt8(int index)
        {
            if (index > 7)
            {
                throw new IndexOutOfRangeException("Max index for a GetInt8 operation is 7");
            }

            int pos = 22 + index;

            return(CanUtilities.ByteToInt8(RawBytes.Skip(pos).Take(1).ToArray()));
        }