Construct() 공개 메소드

public Construct ( BinaryEndianReader br, QbItemType type ) : void
br BinaryEndianReader
type QbItemType
리턴 void
예제 #1
0
        public override void Construct(BinaryEndianReader br, QbItemType type)
        {
            //System.Diagnostics.Debug.WriteLine(string.Format("{0} - 0x{1}", type.ToString(), (base.StreamPos(br) - 4).ToString("X").PadLeft(8, '0')));

            base.Construct(br, type);

            QbItemBase qib;
            QbItemType headerType;
            uint       headerValue;

            for (int i = 0; i < base.ItemCount; i++)
            {
                if (base.StreamPos(br) != base.Pointers[i]) //pointer test
                {
                    throw new ApplicationException(QbFile.FormatBadPointerExceptionMessage(this, base.StreamPos(br), base.Pointers[i]));
                }

                headerValue = br.ReadUInt32(this.Root.PakFormat.EndianType);
                headerType  = this.Root.PakFormat.GetQbItemType(headerValue);

                switch (headerType)
                {
                case QbItemType.StructHeader:
                    qib = new QbItemStruct(this.Root);
                    break;

                default:
                    throw new ApplicationException(string.Format("Location 0x{0}: Not a struct header type 0x{1}", (base.StreamPos(br) - 4).ToString("X").PadLeft(8, '0'), headerValue.ToString("X").PadLeft(8, '0')));
                }
                qib.Construct(br, headerType);
                AddItem(qib);
            }

            base.ConstructEnd(br);
        }
예제 #2
0
        public override void Construct(BinaryEndianReader br, QbItemType type)
        {
            //System.Diagnostics.Debug.WriteLine(string.Format("{0} - 0x{1}", type.ToString(), (base.StreamPos(br) - 4).ToString("X").PadLeft(8, '0')));

            base.Construct(br, type);

            QbItemBase qib = null;
            QbItemType arrayType;
            uint arrayValue;

            for (int i = 0; i < base.ItemCount; i++)
            {
                arrayValue = br.ReadUInt32(this.Root.PakFormat.EndianType);
                arrayType = this.Root.PakFormat.GetQbItemType(arrayValue);

                switch (arrayType)
                {
                    case QbItemType.Floats:
                        qib = new QbItemFloats(this.Root);
                        break;
                    case QbItemType.ArrayStruct:
                        qib = new QbItemStructArray(this.Root);
                        break;
                    case QbItemType.ArrayFloat:
                        qib = new QbItemFloat(this.Root);
                        break;
                    case QbItemType.ArrayString:
                    case QbItemType.ArrayStringW:
                        qib = new QbItemString(this.Root);
                        break;
                    case QbItemType.ArrayFloatsX2:
                    case QbItemType.ArrayFloatsX3:
                        qib = new QbItemFloatsArray(this.Root);
                        break;
                    case QbItemType.ArrayStringPointer:
                    case QbItemType.ArrayInteger:
                        qib = new QbItemInteger(this.Root);
                        break;
                    case QbItemType.ArrayArray:
                        qib = new QbItemArray(this.Root);
                        break;
                    case QbItemType.ArrayQbKey:
                    case QbItemType.ArrayQbKeyString:
                    case QbItemType.ArrayQbKeyStringQs: //GH:GH
                        qib = new QbItemQbKey(this.Root);
                        break;
                    case QbItemType.StructHeader:
                        qib = new QbItemStruct(this.Root);
                        break;
                    default:
                        throw new ApplicationException(string.Format("Location 0x{0}: Unknown array type 0x{1}", (base.StreamPos(br) - 4).ToString("X").PadLeft(8, '0'), arrayValue.ToString("X").PadLeft(8, '0')));
                }
                qib.Construct(br, arrayType);
                AddItem(qib);

            }
            base.ConstructEnd(br);
        }
예제 #3
0
        public override void Construct(BinaryEndianReader br, QbItemType type)
        {
            //System.Diagnostics.Debug.WriteLine(string.Format("{0} - 0x{1}", type.ToString(), (base.StreamPos(br) - 4).ToString("X").PadLeft(8, '0')));

            base.Construct(br, type);

            QbItemBase qib = null;
            QbItemType arrayType;
            uint       arrayValue;

            for (int i = 0; i < base.ItemCount; i++)
            {
                arrayValue = br.ReadUInt32(this.Root.PakFormat.EndianType);
                arrayType  = this.Root.PakFormat.GetQbItemType(arrayValue);

                switch (arrayType)
                {
                case QbItemType.Floats:
                    qib = new QbItemFloats(this.Root);
                    break;

                case QbItemType.ArrayStruct:
                    qib = new QbItemStructArray(this.Root);
                    break;

                case QbItemType.ArrayFloat:
                    qib = new QbItemFloat(this.Root);
                    break;

                case QbItemType.ArrayString:
                case QbItemType.ArrayStringW:
                    qib = new QbItemString(this.Root);
                    break;

                case QbItemType.ArrayFloatsX2:
                case QbItemType.ArrayFloatsX3:
                    qib = new QbItemFloatsArray(this.Root);
                    break;

                case QbItemType.ArrayStringPointer:
                case QbItemType.ArrayInteger:
                    qib = new QbItemInteger(this.Root);
                    break;

                case QbItemType.ArrayArray:
                    qib = new QbItemArray(this.Root);
                    break;

                case QbItemType.ArrayQbKey:
                case QbItemType.ArrayQbKeyString:
                case QbItemType.ArrayQbKeyStringQs:     //GH:GH
                    qib = new QbItemQbKey(this.Root);
                    break;

                case QbItemType.StructHeader:
                    qib = new QbItemStruct(this.Root);
                    break;

                default:
                    throw new ApplicationException(string.Format("Location 0x{0}: Unknown array type 0x{1}", (base.StreamPos(br) - 4).ToString("X").PadLeft(8, '0'), arrayValue.ToString("X").PadLeft(8, '0')));
                }
                qib.Construct(br, arrayType);
                AddItem(qib);
            }
            base.ConstructEnd(br);
        }