Exemple #1
0
 public uint ReadWord()
 {
     try
     {
         return(!isSubPacket?Convertation.ReverseBytes((uint)Data.ReadInt16()) : (uint)Data.ReadInt16());
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         return(0);
     }
 }
Exemple #2
0
        public static uint ReadCUInt32(ref BinaryReader data)
        {
            byte code = data.ReadByte();

            switch (code & 0xE0)
            {
            case 0xE0:
                return(Convertation.ReverseBytes(data.ReadUInt32()));

            case 0xC0:
                byte[] bt = data.ReadBytes(3);
                Array.Reverse(bt);
                return(BitConverter.ToUInt32(new byte[] { bt[2], bt[1], bt[0], code }, 0) & 0x1FFFFFFF);

            case 0x80:
            case 0xA0:
                return((uint)(BitConverter.ToUInt16(new byte[] { data.ReadByte(), code }, 0) & 0x3FFF));
            }
            return((uint)code);
        }
Exemple #3
0
 public void WriteDword(int value, bool swap = false)
 {
     Data.AddRange(swap ? Convertation.ReverseBytes(BitConverter.GetBytes(value)) : BitConverter.GetBytes(value));
 }