public void ReadFrom(BinaryReader reader)
        {
            var readerOffset = reader.BaseStream.Position;

            LinkInfoSize       = reader.ReadInt32();
            LinkInfoHeaderSize = reader.ReadInt32();
            FormatChecker.CheckExpression(() => LinkInfoHeaderSize < LinkInfoSize);

            Item.LinkInfoFlags = (LinkInfoFlags)(reader.ReadInt32());

            VolumeIDOffset = reader.ReadInt32();
            FormatChecker.CheckExpression(() => VolumeIDOffset < LinkInfoSize);

            LocalBasePathOffset = reader.ReadInt32();
            FormatChecker.CheckExpression(() => LocalBasePathOffset < LinkInfoSize);

            CommonNetworkRelativeLinkOffset = reader.ReadInt32();
            FormatChecker.CheckExpression(() => CommonNetworkRelativeLinkOffset < LinkInfoSize);

            CommonPathSuffixOffset = reader.ReadInt32();
            FormatChecker.CheckExpression(() => CommonPathSuffixOffset < LinkInfoSize);

            if (LinkInfoHeaderSize > MinimumLinkInfoHeaderSize)
            {
                LocalBasePathOffsetUnicode = reader.ReadInt32();
                FormatChecker.CheckExpression(() => LocalBasePathOffsetUnicode < LinkInfoSize);

                CommonPathSuffixOffsetUnicode = reader.ReadInt32();
                FormatChecker.CheckExpression(() => CommonPathSuffixOffsetUnicode < LinkInfoSize);
            }
            else
            {
                FormatChecker.CheckExpression(() => LinkInfoHeaderSize == MinimumLinkInfoHeaderSize);
            }

            if ((Item.LinkInfoFlags & LinkInfoFlags.VolumeIDAndLocalBasePath) != 0)
            {
                EnsurePosition(reader, readerOffset, VolumeIDOffset);
                Item.VolumeID = new VolumeID();
                var vidReader = new VolumeIDHandler(Item.VolumeID);
                vidReader.ReadFrom(reader);
                Item.LocalBasePath = reader.ReadASCIIZ(readerOffset, LocalBasePathOffset, LocalBasePathOffsetUnicode);
            }

            if ((Item.LinkInfoFlags & LinkInfoFlags.CommonNetworkRelativeLinkAndPathSuffix) != 0)
            {
                EnsurePosition(reader, readerOffset, CommonNetworkRelativeLinkOffset);
                Item.CommonNetworkRelativeLink = new CommonNetworkRelativeLink();
                var cnrlReader = new CommonNetworkRelativeLinkHandler(Item.CommonNetworkRelativeLink);
                cnrlReader.ReadFrom(reader);
            }

            Item.CommonPathSuffix = reader.ReadASCIIZ(readerOffset, CommonPathSuffixOffset, CommonPathSuffixOffsetUnicode);
        }
        public void ReadFrom(BinaryReader reader)
        {
            long readerOffset = reader.BaseStream.Position;

            LinkInfoSize = reader.ReadInt32();
            LinkInfoHeaderSize = reader.ReadInt32();
            FormatChecker.CheckExpression(() => LinkInfoHeaderSize < LinkInfoSize);

            Item.LinkInfoFlags = (LinkInfoFlags) (reader.ReadInt32());

            VolumeIDOffset = reader.ReadInt32();
            FormatChecker.CheckExpression(() => VolumeIDOffset < LinkInfoSize);

            LocalBasePathOffset = reader.ReadInt32();
            FormatChecker.CheckExpression(() => LocalBasePathOffset < LinkInfoSize);

            CommonNetworkRelativeLinkOffset = reader.ReadInt32();
            FormatChecker.CheckExpression(() => CommonNetworkRelativeLinkOffset < LinkInfoSize);

            CommonPathSuffixOffset = reader.ReadInt32();
            FormatChecker.CheckExpression(() => CommonPathSuffixOffset < LinkInfoSize);

            if (LinkInfoHeaderSize > MinimumLinkInfoHeaderSize)
            {
                LocalBasePathOffsetUnicode = reader.ReadInt32();
                FormatChecker.CheckExpression(() => LocalBasePathOffsetUnicode < LinkInfoSize);

                CommonPathSuffixOffsetUnicode = reader.ReadInt32();
                FormatChecker.CheckExpression(() => CommonPathSuffixOffsetUnicode < LinkInfoSize);
            }
            else
            {
                FormatChecker.CheckExpression(() => LinkInfoHeaderSize == MinimumLinkInfoHeaderSize);
            }

            if ((Item.LinkInfoFlags & LinkInfoFlags.VolumeIDAndLocalBasePath) != 0)
            {
                EnsurePosition(reader, readerOffset, VolumeIDOffset);
                Item.VolumeID = new VolumeID();
                VolumeIDHandler vidReader = new VolumeIDHandler(Item.VolumeID);
                vidReader.ReadFrom(reader);
                Item.LocalBasePath = reader.ReadASCIIZ(readerOffset, LocalBasePathOffset, LocalBasePathOffsetUnicode);
            }

            if ((Item.LinkInfoFlags & LinkInfoFlags.CommonNetworkRelativeLinkAndPathSuffix) != 0)
            {
                EnsurePosition(reader, readerOffset, CommonNetworkRelativeLinkOffset);
                Item.CommonNetworkRelativeLink = new CommonNetworkRelativeLink();
                CommonNetworkRelativeLinkHandler cnrlReader = new CommonNetworkRelativeLinkHandler(Item.CommonNetworkRelativeLink);
                cnrlReader.ReadFrom(reader);
            }

            Item.CommonPathSuffix = reader.ReadASCIIZ(readerOffset, CommonPathSuffixOffset, CommonPathSuffixOffsetUnicode);
        }