Esempio n. 1
0
 public void SetRange(int bitIndex, int bitLength, BitBlock value)
 {
     for (int i = 0; i < bitLength; i++)
     {
         Bits[bitIndex + i] = value[i];
     }
 }
        public static uint Calculate32BitChecksum(BitBlock bits, int startIndex, int endIndex)
        {
            ulong sum = 0;

            for (int i = startIndex; i <= endIndex; i += 4)
            {
                sum += bits.GetUInt(i, 0, 32) & 0xFFFFFFFF;
            }
            return((uint)(sum & 0xFFFFFFFF));
        }
Esempio n. 3
0
        public virtual async Task OpenFile(string filename, IFileSystem provider)
        {
            Filename          = filename;
            CurrentFileSystem = provider;
            using (var f = new GenericFile())
            {
                f.EnableInMemoryLoad = true;
                f.IsReadOnly         = true;
                await f.OpenFile(filename, provider);

                Bits = new BitBlock(0);
                ProcessRawData(f);
            }
        }
Esempio n. 4
0
 public BitBlockFile(IEnumerable <byte> rawData)
 {
     Bits = new BitBlock(rawData);
 }
Esempio n. 5
0
 public BitBlockFile()
 {
     Bits = new BitBlock(0);
 }
Esempio n. 6
0
 public BitBlock(BitBlock source)
 {
     Position = 0;
     Bits     = source.Bits.ToList(); // Clone the source
 }
Esempio n. 7
0
 public void SetNextRange(BitBlock value)
 {
     SetNextRange(value.Count, value);
 }
Esempio n. 8
0
 public void SetNextRange(int bitLength, BitBlock value)
 {
     SetRange(Position, bitLength, value);
     Position += bitLength;
 }
Esempio n. 9
0
 public void SetRange(int bitIndex, BitBlock value)
 {
     SetRange(bitIndex, value.Count, value);
 }