Esempio n. 1
0
        internal static SpecialFolderDataBlock Parse(BinaryReader reader)
        {
            var r = new SpecialFolderDataBlock();

            r.SpecialFolderID = reader.ReadInt32();
            r.Offset          = reader.ReadUInt32();
            return(r);
        }
Esempio n. 2
0
        internal static IEnumerable <DataBlock> Parse(BinaryReader reader, ref byte[] bytes, ref StringBuilder sb)
        {
            var l = new List <DataBlock>(1);

            for (var bs = reader.ReadInt32(); bs > 4; bs = reader.ReadInt32())
            {
                var sig = reader.ReadUInt32();

                DataBlock db;
                switch (sig)
                {
                case EnvironmentVariableDataBlock.SIGNATURE:
                    db = EnvironmentVariableDataBlock.Parse(reader, ref bytes, ref sb);
                    break;

                case ConsoleDataBlock.SIGNATURE:
                    db = ConsoleDataBlock.Parse(reader, ref sb);
                    break;

                case ConsoleFEDataBlock.SIGNATURE:
                    db = ConsoleFEDataBlock.Parse(reader);
                    break;

                case DarwinDataBlock.SIGNATURE:
                    db = DarwinDataBlock.Parse(reader, ref bytes, ref sb);
                    break;

                case IconEnvironmentDataBlock.SIGNATURE:
                    db = IconEnvironmentDataBlock.Parse(reader, ref bytes, ref sb);
                    break;

                case KnownFolderDataBlock.SIGNATURE:
                    db = KnownFolderDataBlock.Parse(reader);
                    break;

                case PropertyStoreDataBlock.SIGNATURE:
                    db = PropertyStoreDataBlock.Parse(reader, ref bytes, ref sb);
                    break;

                case ShimDataBlock.SIGNATURE:
                    db = ShimDataBlock.Parse(reader, bs, ref sb);
                    break;

                case SpecialFolderDataBlock.SIGNATURE:
                    db = SpecialFolderDataBlock.Parse(reader);
                    break;

                case TrackerDataBlock.SIGNATURE:
                    db = TrackerDataBlock.Parse(reader, bs, ref bytes);
                    break;

                case VistaAndAboveIDListDataBlock.SIGNATURE:
                    db = VistaAndAboveIDListDataBlock.Parse(reader);
                    break;

                default:
                    db = new UnknownDataBlock()
                    {
                        Signature = sig,
                        Data      = reader.ReadBytes(bs - 8)
                    };
                    break;
                }

                l.Add(db);
            }
            return(l);
        }