예제 #1
0
        public override bool Load(BinaryReader reader)
        {
            Entries = new List <assIDChunk>();

            Start(reader);
            if (!ReadHeader(reader) || !IsValidVersion(1, 2))
            {
                return(false);
            }

            Hash = reader.ReadUInt32();

            UInt32 count = reader.ReadUInt32();

            for (UInt32 i = 0; i < count; i++)
            {
                assIDChunk idChunk = new assIDChunk();
                if (!idChunk.Load(reader))
                {
                    return(false);
                }

                if (Header.Version == 2)
                {
                    UInt32 hash = reader.ReadUInt32();
                    LogInfo("hash: " + hash);
                }

                Entries.Add(idChunk);
            }

            End(reader);
            return(true);
        }
예제 #2
0
        public override bool Load(BinaryReader reader)
        {
            Start(reader);

            Chunk child = new assIDChunk(); // inception

            ChunkType nextChunk = ChunkUtils.PeekNextChunk(reader);

            switch (nextChunk)
            {
            case ChunkType.assIDNone:
                child = new INONChunk();
                if (!child.Load(reader))
                {
                    return(false);
                }
                break;

            case ChunkType.assIDInteger:
                child = new IINTChunk();
                if (!child.Load(reader))
                {
                    return(false);
                }
                ID1 = (child as IINTChunk).ID;
                break;

            case ChunkType.assIDString:
                child = new ISTRChunk();
                if (!child.Load(reader))
                {
                    return(false);
                }
                ID2 = (child as ISTRChunk).ID;
                break;

            default:
                Debugger.Break();
                break;
            }

            Header = child.Header;

            End(reader);
            return(true);
        }
예제 #3
0
        public override bool Load(BinaryReader reader)
        {
            parms = new List <PARMChunk>();

            Start(reader);
            if (!ReadHeader(reader) || !IsValidVersion(2, 3))
            {
                return(false);
            }

            if (Header.Version == 2)
            {
                string id = reader.ReadCString();
            }
            else if (Header.Version == 3)
            {
                assID = new assIDChunk();
                if (!assID.Load(reader))
                {
                    return(false);
                }
            }

            ChunkType nextChunk = ChunkUtils.PeekNextChunk(reader);

            while (nextChunk == ChunkType.pfxParameter)
            {
                PARMChunk parm = new PARMChunk();
                if (!parm.Load(reader))
                {
                    return(false);
                }
                parms.Add(parm);
                nextChunk = ChunkUtils.PeekNextChunk(reader);
            }

            End(reader);
            return(true);
        }
예제 #4
0
        public override bool Load(BinaryReader reader)
        {
            Values = new List <object>();

            Start(reader);
            if (!ReadHeader(reader) || !IsValidVersion(1, 2))
            {
                return(false);
            }

            Key       = reader.ReadCString();
            ValueType = (ParamType)reader.ReadInt32();

            // there seems to be no other versions than 2 in the files
            switch (Header.Version)
            {
            case 2:
                switch (ValueType)
                {
                case ParamType.Bool:
                {
                    bool value = reader.ReadUInt32() == 1 ? true : false;
                    Values.Add(value);
                }
                break;

                case ParamType.Integer:
                {
                    Int32 value = reader.ReadInt32();
                    Values.Add(value);
                }
                break;

                case ParamType.Vector:
                {
                    Int32 count = reader.ReadInt32();
                    for (Int32 i = 0; i < count; i++)
                    {
                        Values.Add(reader.ReadSingle());
                    }
                }
                break;

                case ParamType.String:
                {
                    string value = reader.ReadCString();
                    Values.Add(value);
                }
                break;

                case ParamType.assID:
                case ParamType.assID2:
                {
                    assIDChunk value = new assIDChunk();
                    if (!value.Load(reader))
                    {
                        return(false);
                    }
                    Values.Add(value);
                }
                break;

                default:
                    Debugger.Break();
                    break;
                }
                break;

            default:
                Debugger.Break();
                break;
            }

            LogInfo("key: " + Key + " values count: " + Values.Count);

            End(reader);
            return(true);
        }