Exemple #1
0
        public static (long, long) FindSig(IReader rdr)
        {
            byte     prev0 = 0;
            byte     prev1 = 0;
            long     ix    = 0;
            long     start;
            Data32LE length = new Data32LE();

            while (true)
            {
                Data8 d = new Data8();
                d.Read(rdr);

                if (prev0 == 0x23 && d.Value == 0xA3)
                {
                    string code = prev1.ToString("X2");
                    Parser.Dumper.OnInfo($"Found sig with code: {code}");

                    var pos = rdr.Position;
                    start = pos - (4 + 4 + 4 + 3); // Lenght, Filing, Type + 3 bytes from signature
                    rdr.GoTo(start);

                    length.Read(rdr);
                    rdr.GoTo(start);

                    return(start, length.Value);
                }

                if (prev1 == 0x50 && prev0 == 0x3B && d.Value == 0xC1)
                {
                    Parser.Dumper.OnInfo($"Found sig for Long Message format");

                    var pos = rdr.Position;
                    start = pos - (4 + 4 + 4 + 3); // Lenght, Filing, Type + 3 bytes from signature
                    rdr.GoTo(start);

                    length.Read(rdr);
                    rdr.GoTo(start);

                    return(start, length.Value);
                }

                // Go on scanning
                prev1 = prev0;
                prev0 = d.Value;
                ix++;

                if (ix % 256 * 16 == 0)
                {
                    Parser.Dumper.OnInfo("");
                }
            }
        }
Exemple #2
0
        public DatPageHeader()
        {
            Magic = new Magic(new byte[] { 201, 0, 0, 0,
                                           0, 0, 0, 0,
                                           0, 0, 0, 0,
                                           0, 0, 0, 0,
//                                             0, 0, 0, 0,
                                           0, 0, 0, 0, });
            Next         = new Data32LE();
            Unknown0     = new Data32LE();
            BytesPerSlot = new Data32LE();
            Fragments    = new Data32LE();
            EmptySlots   = new Data32LE();

            Unknown10Zeroes        = new Chararray();
            Unknown10Zeroes.Length = (4 * 10);

            AllocationBitmapBytes        = new ByteArray();
            AllocationBitmapBytes.Length = 125;

            Slot        = new ByteArray();
            Slot.Length = 64;

            //SetupChunkFields();
            AutomaticFields = new List <ChunkField>()
            {
                Magic,
                Next,
                Unknown0,
                BytesPerSlot,
                Fragments,
                EmptySlots,
                Unknown10Zeroes,
                AllocationBitmapBytes,
            };
        }
Exemple #3
0
        public override void AfterAutomaticRead(IReader rdr)
        {
            // Repeat
            Data16LE separator4 = new Data16LE();;
            Data32LE properties = new Data32LE();;

            // Repeat-repeat
            AsciiZ name     = new AsciiZ();
            Data8  propType = new Data8();

            Data8     data8    = new Data8();
            Data16LE  data16   = new Data16LE();
            Data32LE  data32   = new Data32LE();
            AsciiZ    textData = new AsciiZ();
            ByteArray binData  = new ByteArray();

            for (int block = 0; block < propertyBlocks.Value; block++)
            {
                separator4.Read(rdr);
                properties.Read(rdr);
                for (int i = 0; i < properties.Value; i++)
                {
                    name.Read(rdr);
                    var propName = name.Value;

                    propType.Read(rdr);

                    string value;

                    switch (propType.Value)
                    {
                    case 0x64:
                    case 0x65:
                        data8.Read(rdr);
                        value = data8.Value.ToString("X2");
                        break;

                    case 0x66:
                    case 0x67:
                        data16.Read(rdr);
                        value = data16.Value.ToString("D");
                        break;

                    case 0x68:
                    case 0x69:
                        data32.Read(rdr);

                        if (propName == "UIN")
                        {
                            UIN = data32.Value;
                        }
                        value = data32.Value.ToString("D");
                        break;

                    case 0x6B:
                        textData.Read(rdr);
                        value = textData.Value;
                        if (propName == "NickName" || propName == "MyDefinedHandle")
                        {
                            Nickname = value;
                        }

                        break;

                    case 0x6D:
                        data32.Read(rdr);    // Count
                        data8.Read(rdr);     // Type
                        value = "(sublist) : ";
                        if (data8.Value == 0x6B)
                        {
                            for (int j = 0; j < data32.Value; j++)
                            {
                                textData.Read(rdr);
                                value += textData.Value + ", ";
                            }
                        }
                        else
                        {
                            if (Parser.Debug)
                            {
                                Parser.Dumper.OnInfo($"Property type sublist, subtype 6D-{data8.Value.ToString("X2")} is Not Yet Implemented");
                            }
//                                throw new NotImplementedException($"Property type sublist, subtype 6D-{data8.Value.ToString("X2")} is Not Yet Implemented");
                        }
                        break;

                    case 0x6F:
                        data32.Read(rdr);     // Length
                        binData.Length = data32.Value;
                        binData.Read(rdr);
                        value = "(blob)";
                        break;

                    default:
                        value = "";
                        break;
                    }

                    if (string.IsNullOrEmpty(propName))
                    {
                        if (Parser.Debug)
                        {
                            Parser.Dumper.OnInfo($"(empty propname)");
                        }
                        continue;
                    }

                    Properties.Add(propName, value);
                    if (Parser.Debug)
                    {
                        Parser.Dumper.OnInfo($"'{propName}' : " + propType.Value.ToString("X2") + $" Value: {value}");
                    }
                }
            }

            Parser.Dumper.OnInfo($"Contact UIN: {UIN} Nick: {Nickname}");
            base.AfterAutomaticRead(rdr);
        }