示例#1
0
        public DeltaFragment(IStorage delta)
        {
            Delta = delta;

            if (Delta.GetSize() < 0x40)
            {
                throw new InvalidDataException("Delta file is too small.");
            }

            Header = new DeltaFragmentHeader(delta.AsFile(OpenMode.Read));

            if (Header.Magic != Ndv0Magic)
            {
                throw new InvalidDataException("NDV0 magic value is missing.");
            }

            long fragmentSize = Header.FragmentHeaderSize + Header.FragmentBodySize;

            if (Delta.GetSize() < fragmentSize)
            {
                throw new InvalidDataException($"Delta file is smaller than the header indicates. (0x{fragmentSize} bytes)");
            }

            ParseDeltaStructure();
        }