Exemple #1
0
 public void PutInt16(int offset, Int16 value)
 {
     ms.Position = offset;
     if (BitConverter.IsLittleEndian && isBigEndian)
     {
         bw.Write(BigEndianTransfer.ToBytes(value));
     }
     else
     {
         bw.Write(value);
     }
 }
Exemple #2
0
 public Int16 GetInt16(int offset)
 {
     if (offset + 2 > writeOffset)
     {
         throw new IndexOutOfRangeException();
     }
     ms.Position = offset;
     if (BitConverter.IsLittleEndian && isBigEndian)
     {
         return(BigEndianTransfer.ToInt16(br.ReadBytes(2)));
     }
     return(br.ReadInt16());
 }
Exemple #3
0
 public UInt32 GetUInt32(int offset)
 {
     if (offset + 4 > writeOffset)
     {
         throw new IndexOutOfRangeException();
     }
     ms.Position = offset;
     if (BitConverter.IsLittleEndian && isBigEndian)
     {
         return(BigEndianTransfer.ToUInt32(br.ReadBytes(4)));
     }
     return(br.ReadUInt32());
 }
Exemple #4
0
 public Int64 ReadInt64(int offset)
 {
     if (offset + 8 > writeOffset)
     {
         throw new IndexOutOfRangeException();
     }
     ms.Position = offset;
     readOffset  = offset + 8;
     if (BitConverter.IsLittleEndian && isBigEndian)
     {
         return(BigEndianTransfer.ToInt64(br.ReadBytes(8)));
     }
     return(br.ReadInt64());
 }
Exemple #5
0
 public void WriteInt64(int offset, Int64 value)
 {
     if (offset + 8 > ms.Capacity)
     {
         throw new IndexOutOfRangeException();
     }
     ms.Position = offset;
     writeOffset = offset + 8;
     if (BitConverter.IsLittleEndian && isBigEndian)
     {
         bw.Write(BigEndianTransfer.ToBytes(value));
     }
     else
     {
         bw.Write(value);
     }
 }