public static CheckDiscStorageResult CheckDiscStorage(Storage _storage, string path)
        {
            var checksumData = _storage.ReadFileBytes(path + ".checksums");

            if (checksumData != null)
            {
                var checksum = new ChecksumInfo(checksumData);
                var error    = false;
                using (var headerStream = _storage.FileReadStream(path + ".header"))
                {
                    var valid = checksum.Valid("header", headerStream);
                    if (!valid)
                    {
                        error = true;
                    }
                }

                using (var headerStream = _storage.FileReadStream(path + ".data"))
                {
                    var valid = checksum.Valid("data", headerStream);
                    if (!valid)
                    {
                        error = true;
                    }
                }

                if (checksum.Get("lookup") != null)
                {
                    using (var headerStream = _storage.FileReadStream(path + ".lookup"))
                    {
                        var valid = checksum.Valid("lookup", headerStream);
                        if (!valid)
                        {
                            error = true;
                        }
                    }
                }

                if (error)
                {
                    return(CheckDiscStorageResult.CheckumFailed);
                }
            }
            else
            {
                var error  = false;
                var header = GetHeader(_storage, path);
                if (header == null)
                {
                    return(CheckDiscStorageResult.HeaderNotFound);
                }

                using (var storage = new DiscStorage(_storage, path, header.BlockSize, header.UserData.Length, header.Flags | DiscStorageFlags.Readonly))
                {
                    for (var i = storage.StartIndex; i <= storage.EndIndex; i++)
                    {
                        if (!storage.BlockDataCrcValidRawIndex(i))
                        {
                            error = true;
                            break;
                        }
                    }
                }

                if (error)
                {
                    return(CheckDiscStorageResult.DataCrcError);
                }
                return(CheckDiscStorageResult.MissingChecksum);
            }

            return(CheckDiscStorageResult.Ok);
        }
 public static int GetHeaderSize(DiscStorage storage)
 {
     return(((4 + 4 + 8) + (8 + 8 + 8) + (8 + 8)) + 4 + storage._header.UserData.Length);
 }
 public static int GetEntrySize(DiscStorage storage)
 {
     return(8 + 4 + 2 + 2);
 }