示例#1
0
        public InternalDataBlock Decode(BinaryData encodedData)
        {
            var parser = BinaryDataParser.OfValue(encodedData);

            var blockType       = parser.TakeAndSkip(1).ToInt32();
            var blockLevel      = parser.TakeAndSkip(1).ToInt32();
            var numberOfEntries = parser.TakeAndSkip(2).ToInt32();
            var totalByteCount  = parser.TakeAndSkip(4).ToInt32();
            var entries         = parser.TakeAndSkip(numberOfEntries * 8);
            var padding         = BinaryData.Empty();

            var remainingTo64Boundary = Utilities.GetRemainingToNextMultipleOf(numberOfEntries * 8 + 8, 64);

            if (remainingTo64Boundary > 0)
            {
                padding = parser.TakeAndSkip(remainingTo64Boundary);
            }

            var trailer = parser.TakeAndSkip(16, trailerDecoder);

            return(new InternalDataBlock(
                       blockType,
                       blockLevel,
                       numberOfEntries,
                       totalByteCount,
                       entries,
                       padding,
                       trailer));
        }
示例#2
0
        public Header Decode(BinaryData encodedData)
        {
            var parser = BinaryDataParser.OfValue(encodedData);

            return
                (new Header(
                     parser.TakeAndSkip(4),
                     parser.TakeAndSkip(4).ToInt32(),
                     parser.TakeAndSkip(2),
                     parser.TakeAndSkip(2).ToInt32(),
                     parser.TakeAndSkip(2).ToInt32(),
                     parser.TakeAndSkip(1).ToInt32(),
                     parser.TakeAndSkip(1).ToInt32(),
                     parser.TakeAndSkip(4),
                     parser.TakeAndSkip(4),
                     parser.TakeAndSkip(8),
                     parser.TakeAndSkip(8).ToInt64(),
                     parser.TakeAndSkip(4).ToInt32(),
                     parser.TakeAndSkip(32, 4, new FuncBasedDecoder <NID>(NID.OfValue)),
                     parser.TakeAndSkip(8),
                     parser.TakeAndSkip(72, rootDecoder),
                     parser.TakeAndSkip(4),
                     parser.TakeAndSkip(128),
                     parser.TakeAndSkip(128),
                     parser.TakeAndSkip(1).ToInt32(),
                     parser.TakeAndSkip(1).ToInt32(),
                     parser.TakeAndSkip(2),
                     parser.TakeAndSkip(8).ToInt64(),
                     parser.TakeAndSkip(4).ToInt32(),
                     parser.TakeAndSkip(3),
                     parser.TakeAndSkip(1),
                     parser.TakeAndSkip(32)));
        }
示例#3
0
文件: HNBITMAPHDR.cs 项目: phx255/PST
        public static HNBITMAPHDR OfValue(BinaryData encodedData)
        {
            var parser = BinaryDataParser.OfValue(encodedData);

            return
                (new HNBITMAPHDR(
                     parser.TakeAndSkip(2).ToInt32(),
                     parser.TakeAndSkip(64)));
        }
示例#4
0
        public INBTEntry Decode(BinaryData encodedData)
        {
            var parser = BinaryDataParser.OfValue(encodedData);

            return
                (INBTEntry.OfValue(
                     NID.OfValue(parser.TakeAndSkip(4)),
                     parser.TakeAtWithoutChangingStreamPosition(8, 16, brefDecoder)));
        }
示例#5
0
        public IndexRecord Decode(BinaryData encodedData)
        {
            var parser = BinaryDataParser.OfValue(encodedData);

            return
                (new IndexRecord(
                     parser.TakeAndSkip(keySize),
                     parser.TakeAndSkip(4, hidDecoder)));
        }
示例#6
0
        public DataRecord Decode(BinaryData encodedData)
        {
            var parser = BinaryDataParser.OfValue(encodedData);

            return
                (new DataRecord(
                     parser.TakeAndSkip(keySize),
                     parser.TakeAndSkip(dataSize)));
        }
示例#7
0
        public AMap Decode(BinaryData encodedData)
        {
            var parser = BinaryDataParser.OfValue(encodedData);

            return
                (new AMap(
                     parser.TakeAndSkip(496),
                     parser.TakeAndSkip(16, pageTrailerDecoder)));
        }
示例#8
0
        public IBBTEntry Decode(BinaryData encodedData)
        {
            var parser = BinaryDataParser.OfValue(encodedData);

            return
                (IBBTEntry.OfValue(
                     parser.TakeAndSkip(8, bidDecoder),
                     parser.TakeAndSkip(16, brefDecoder)));
        }
示例#9
0
        public BREF Decode(BinaryData encodedData)
        {
            var parser = BinaryDataParser.OfValue(encodedData);

            return
                (BREF.OfValue(
                     parser.TakeAndSkip(8, bidDecoder),
                     parser.TakeAndSkip(8, biDecoder)));
        }
示例#10
0
        public static HNPAGEMAP OfValue(BinaryData encodedData)
        {
            var parser = BinaryDataParser.OfValue(encodedData);

            var allocationCount = parser.TakeAndSkip(2).ToInt32();
            var freeCount       = parser.TakeAndSkip(2).ToInt32();
            var allocationTable = parser.TakeAndSkip((allocationCount + 1) * 2);

            return(new HNPAGEMAP(allocationCount, freeCount, allocationTable));
        }
示例#11
0
文件: EntryId.cs 项目: phx255/PST
        public static EntryId OfValue(BinaryData encodedData)
        {
            var parser = BinaryDataParser.OfValue(encodedData);

            return
                (new EntryId(
                     parser.TakeAndSkip(4).ToInt32(),
                     parser.TakeAndSkip(16).Value,
                     NID.OfValue(parser.TakeAndSkip(4))));
        }
示例#12
0
        public LBBTEntry Decode(BinaryData encodedData)
        {
            var parser = BinaryDataParser.OfValue(encodedData);

            return
                (new LBBTEntry(
                     parser.TakeAndSkip(16, brefDecoder),
                     parser.TakeAndSkip(2).ToInt32(),
                     parser.TakeAndSkip(2).ToInt32(),
                     parser.TakeAndSkip(4)));
        }
示例#13
0
        public BlockTrailer Decode(BinaryData encodedData)
        {
            var parser = BinaryDataParser.OfValue(encodedData);

            return
                (new BlockTrailer(
                     parser.TakeAndSkip(2).ToInt32(),
                     parser.TakeAndSkip(2).ToInt32(),
                     parser.TakeAndSkip(4).ToInt32(),
                     parser.TakeAndSkip(8, bidDecoder)));
        }
示例#14
0
        public SIEntry Decode(BinaryData encodedData)
        {
            var parser = BinaryDataParser.OfValue(encodedData);

            var nodeId = parser.TakeAndSkip(8);

            return
                new SIEntry(
                    NID.OfValue(nodeId.Take(4)),
                    parser.TakeAndSkip(8, bidDecoder));
        }
示例#15
0
文件: TCOLDESC.cs 项目: phx255/PST
        public static TCOLDESC OfValue(BinaryData encodedData)
        {
            var parser = BinaryDataParser.OfValue(encodedData);

            return
                (new TCOLDESC(
                     parser.TakeAndSkip(4).ToInt32(),
                     parser.TakeAndSkip(2).ToInt32(),
                     parser.TakeAndSkip(1).ToInt32(),
                     parser.TakeAndSkip(1).ToInt32()));
        }
示例#16
0
        public static HID OfValue(BinaryData encodedData)
        {
            var parser = BinaryDataParser.OfValue(encodedData);

            var value = parser.TakeAndSkip(4).ToInt32();

            return
                (new HID(
                     value & 0x0000001F,
                     (value >> 5) & 0x000003FF,
                     (value >> 16) & 0x0000FFFF));
        }
示例#17
0
        public static BTHHEADER OfValue(BinaryData encodedData)
        {
            var parser = BinaryDataParser.OfValue(encodedData);

            return
                (new BTHHEADER(
                     parser.TakeAndSkip(1).ToInt32(),
                     parser.TakeAndSkip(1).ToInt32(),
                     parser.TakeAndSkip(1).ToInt32(),
                     parser.TakeAndSkip(1).ToInt32(),
                     HID.OfValue(parser.TakeAndSkip(4))));
        }
示例#18
0
        public BTPage Decode(BinaryData encodedData)
        {
            var parser = BinaryDataParser.OfValue(encodedData);

            return
                (new BTPage(
                     parser.TakeAndSkip(488),
                     parser.TakeAndSkip(1).ToInt32(),
                     parser.TakeAndSkip(1).ToInt32(),
                     parser.TakeAndSkip(1).ToInt32(),
                     parser.TakeAndSkip(1).ToInt32(),
                     parser.TakeAndSkip(4),
                     parser.TakeAndSkip(16, pageTrailerDecoder)));
        }
示例#19
0
        public SLEntry Decode(BinaryData encodedData)
        {
            var parser = BinaryDataParser.OfValue(encodedData);

            var localNID = parser.TakeAndSkip(8);

            var subnodeBID = parser.TakeAndSkip(8);

            var subnodeNID = parser.TakeAndSkip(8);

            return
                (new SLEntry(
                     NID.OfValue(localNID.Take(4)),
                     bidDecoder.Decode(subnodeBID),
                     bidDecoder.Decode(subnodeNID)));
        }
示例#20
0
        public LNBTEntry Decode(BinaryData encodedData)
        {
            var parser = BinaryDataParser.OfValue(encodedData);

            var nid = NID.OfValue(parser.TakeAndSkip(4));

            parser.TakeAndSkip(4);

            return
                (new LNBTEntry(
                     nid,
                     parser.TakeAndSkip(8, bidDecoder),
                     parser.TakeAndSkip(8, bidDecoder),
                     NID.OfValue(parser.TakeAndSkip(4)),
                     parser.TakeAndSkip(4)));
        }
示例#21
0
文件: RootDecoder.cs 项目: phx255/PST
        public Root Decode(BinaryData encodedData)
        {
            var parser = BinaryDataParser.OfValue(encodedData);

            return
                (new Root(
                     parser.TakeAndSkip(4).ToInt32(),
                     parser.TakeAndSkip(8).ToInt64(),
                     parser.TakeAndSkip(8).ToInt64(),
                     parser.TakeAndSkip(8).ToInt64(),
                     parser.TakeAndSkip(8).ToInt64(),
                     parser.TakeAndSkip(16, brefDecoder),
                     parser.TakeAndSkip(16, brefDecoder),
                     parser.TakeAndSkip(1).ToInt32(),
                     parser.TakeAndSkip(1).ToInt32(),
                     parser.TakeAndSkip(2).ToInt32()));
        }
示例#22
0
        public static NAMEID OfValue(BinaryData encodedData)
        {
            var parser = BinaryDataParser.OfValue(encodedData);

            var propertyId = parser.TakeAndSkip(4).ToInt32();

            var typeNameGuidIndex = parser.TakeAndSkip(2).ToInt32();

            var propertyIndex = parser.TakeAndSkip(2).ToInt32();

            return
                (new NAMEID(
                     propertyId,
                     typeNameGuidIndex & 0x0001,
                     (typeNameGuidIndex & 0xFFFE) >> 1,
                     propertyIndex));
        }
示例#23
0
文件: TCINFO.cs 项目: phx255/PST
        public static TCINFO OfValue(BinaryData encodedData)
        {
            var parser = BinaryDataParser.OfValue(encodedData);

            var type              = parser.TakeAndSkip(1).ToInt32();
            var numberOfColumns   = parser.TakeAndSkip(1).ToInt32();
            var groupsOffsets     = parser.Slice(4, 2).Select(s => s.ToInt32()).ToArray();
            var rowIndex          = HID.OfValue(parser.TakeAndSkip(4));
            var rowMatrix         = parser.TakeAndSkip(4);
            var deprecated        = parser.TakeAndSkip(4);
            var columnDescriptors = parser.TakeAndSkip(numberOfColumns, 8, new FuncBasedDecoder <TCOLDESC>(TCOLDESC.OfValue));

            return
                (new TCINFO(
                     type,
                     numberOfColumns,
                     groupsOffsets,
                     rowIndex,
                     rowMatrix,
                     deprecated,
                     columnDescriptors));
        }
示例#24
0
        public SubnodeBlock Decode(BinaryData encodedData)
        {
            var parser = BinaryDataParser.OfValue(encodedData);

            var blockType  = parser.TakeAndSkip(1).ToInt32();
            var blockLevel = parser.TakeAndSkip(1).ToInt32();

            var entrySize =
                blockLevel == 1
                ? 16
                : 24;

            var numberOfEntries = parser.TakeAndSkip(2).ToInt32();
            var padding         = parser.TakeAndSkip(4);
            var entries         = parser.TakeAndSkip(numberOfEntries * entrySize);
            var entriesPadding  = BinaryData.Empty();

            var remainingTo64Boundary = Utilities.GetRemainingToNextMultipleOf(numberOfEntries * entrySize + 8, 64);

            if (remainingTo64Boundary > 0)
            {
                entriesPadding = parser.TakeAndSkip(remainingTo64Boundary);
            }

            var trailer = parser.TakeAndSkip(16, trailerDecoder);

            return
                (new SubnodeBlock(
                     blockType,
                     blockLevel,
                     numberOfEntries,
                     padding,
                     entries,
                     entriesPadding,
                     trailer));
        }
示例#25
0
        public PropertyType Decode(BinaryData encodedData)
        {
            var parser = BinaryDataParser.OfValue(encodedData);

            return(new PropertyType(parser.TakeAndSkip(2, int32Decoder)));
        }