コード例 #1
0
        public void ReadColiObjects(Coli coli)
        {
            this.BaseStream.Seek(coli.ContentOffset, SeekOrigin.Begin);
            while (this.BaseStream.Position < (coli.ContentOffset + coli.Size))
            {
                ColiObject newColiObj;
                uint       coliLayer = this.ReadUInt32();
                uint       coliShape = this.ReadUInt32();
                switch (coliShape)
                {
                case 0x01:
                    newColiObj = new ColiType1(coliLayer, this);
                    break;

                case 0x02:
                    newColiObj = new ColiType2(coliLayer, this);
                    break;

                case 0x03:
                    newColiObj = new ColiType3(coliLayer, this);
                    break;

                case 0x05:
                    newColiObj = new ColiType5(coliLayer, this);
                    break;

                default:
                    newColiObj = new ColiObject(coliLayer, coliShape);
                    break;
                }
                coli.ColiDatas.Add(newColiObj);
                // skip the terminator
                this.BaseStream.Seek(4, SeekOrigin.Current);
            }
        }
コード例 #2
0
            public void ReadColiObjsNew(Stream s)
            {
                using (BinaryReader r = new BinaryReader(s))
                {
                    while (r.BaseStream.Position < this.ContentOffset + this.Size)
                    {
                        ColiObject coli;
                        uint       coliLayer = r.ReadUInt32();
                        uint       coliShape = r.ReadUInt32();
                        // Console.WriteLine($"Creating coli with layer {coliLayer.ToString("X2")} shape: {coliShape.ToString("X2")}");
                        switch (coliShape)
                        {
                        case 0x01:
                            coli = new ColiType1(coliLayer, r);
                            break;

                        case 0x02:
                            coli = new ColiType2(coliLayer, r);
                            break;

                        case 0x03:
                            coli = new ColiType3(coliLayer, r);
                            break;

                        case 0x05:
                            coli = new ColiType5(coliLayer, r);
                            break;

                        default:
                            coli = new ColiObject(coliLayer, coliShape);
                            break;
                            //throw new Exception($"Got an unexpected coli type: 0x{coliShape.ToString("X2")}");
                        }
                        this.ColiDatas.Add(coli);
                        // skip the terminator
                        r.BaseStream.Seek(4, SeekOrigin.Current);
                    }
                }
            }