Exemplo n.º 1
0
        public static Dictionary <int, byte[]> SearchFixup(ILogFileRecord record, byte[] data)
        {
            var offset_dict = new Dictionary <int, byte[]>();
            var offset      = record.SectorSize - 2;
            var fixup_value = record.Header.FixupValue;
            var count       = 0;

            //start at 510, read 2 bytes, repeat every 512.
            for (int x = offset; x < data.Length; x += record.SectorSize)
            {
                if (ByteExtensions.CompareTo(data, record.Header.FixupValue, x))
                {
                    count += 1;
                    var start = (x / offset - 1) << 1;
                    var stop  = (x / offset) << 1;
                    offset_dict[x] = record.Header.FixupArray.SubBytes(x, 2);
                }
                else
                {
                    LoggerService.WriteCallerLine($"'Data: {data.SubBytes(x,2).BytesToHexString()} at offset {x} is not fixup_value: {fixup_value}");
                }
            }

            return(count == record.SectorAmount?offset_dict:null);
        }