Beispiel #1
0
 public void ReadUInt32_Sequence()
 {
     using (var f = new GenericFile())
     {
         f.CreateFile(new byte[] { 42, 00, 00, 00, 255, 255, 255, 255 });
         Assert.AreEqual((UInt32)42, f.ReadUInt32());
         Assert.AreEqual(UInt32.MaxValue, f.ReadUInt32());
     }
 }
        public static uint Calculate32BitChecksum(GenericFile file, int startIndex, int endIndex)
        {
            ulong sum = 0;

            for (int i = startIndex; i <= endIndex; i += 4)
            {
                sum += file.ReadUInt32(i) & 0xFFFFFFFF;
            }
            return((uint)(sum & 0xFFFFFFFF));
        }