コード例 #1
0
        public override void Unmarshal(DataInputStream dis)
        {
            base.Unmarshal(dis);

            if (dis != null)
            {
                try
                {
                    this._minefieldID.Unmarshal(dis);
                    this._minefieldSequence       = dis.ReadUnsignedShort();
                    this._forceID                 = dis.ReadUnsignedByte();
                    this._numberOfPerimeterPoints = dis.ReadUnsignedByte();
                    this._minefieldType.Unmarshal(dis);
                    this._numberOfMineTypes = dis.ReadUnsignedShort();
                    this._minefieldLocation.Unmarshal(dis);
                    this._minefieldOrientation.Unmarshal(dis);
                    this._appearance   = dis.ReadUnsignedShort();
                    this._protocolMode = dis.ReadUnsignedShort();

                    for (int idx = 0; idx < this.NumberOfPerimeterPoints; idx++)
                    {
                        Point anX = new Point();
                        anX.Unmarshal(dis);
                        this._perimeterPoints.Add(anX);
                    }

                    for (int idx = 0; idx < this.NumberOfMineTypes; idx++)
                    {
                        EntityType anX = new EntityType();
                        anX.Unmarshal(dis);
                        this._mineType.Add(anX);
                    }
                }
                catch (Exception e)
                {
                    if (PduBase.TraceExceptions)
                    {
                        Trace.WriteLine(e);
                        Trace.Flush();
                    }

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
コード例 #2
0
        public override void Unmarshal(DataInputStream dis)
        {
            base.Unmarshal(dis);

            if (dis != null)
            {
                try
                {
                    this._aggregateID.Unmarshal(dis);
                    this._forceID        = dis.ReadUnsignedByte();
                    this._aggregateState = dis.ReadUnsignedByte();
                    this._aggregateType.Unmarshal(dis);
                    this._formation = dis.ReadUnsignedInt();
                    this._aggregateMarking.Unmarshal(dis);
                    this._dimensions.Unmarshal(dis);
                    this._orientation.Unmarshal(dis);
                    this._centerOfMass.Unmarshal(dis);
                    this._velocity.Unmarshal(dis);
                    this._numberOfDisAggregates        = dis.ReadUnsignedShort();
                    this._numberOfDisEntities          = dis.ReadUnsignedShort();
                    this._numberOfSilentAggregateTypes = dis.ReadUnsignedShort();
                    this._numberOfSilentEntityTypes    = dis.ReadUnsignedShort();

                    for (int idx = 0; idx < this.NumberOfDisAggregates; idx++)
                    {
                        AggregateID anX = new AggregateID();
                        anX.Unmarshal(dis);
                        this._aggregateIDList.Add(anX);
                    }

                    for (int idx = 0; idx < this.NumberOfDisEntities; idx++)
                    {
                        EntityID anX = new EntityID();
                        anX.Unmarshal(dis);
                        this._entityIDList.Add(anX);
                    }

                    this._pad2 = dis.ReadUnsignedByte();

                    for (int idx = 0; idx < this.NumberOfSilentAggregateTypes; idx++)
                    {
                        EntityType anX = new EntityType();
                        anX.Unmarshal(dis);
                        this._silentAggregateSystemList.Add(anX);
                    }

                    for (int idx = 0; idx < this.NumberOfSilentEntityTypes; idx++)
                    {
                        EntityType anX = new EntityType();
                        anX.Unmarshal(dis);
                        this._silentEntitySystemList.Add(anX);
                    }

                    this._numberOfVariableDatumRecords = dis.ReadUnsignedInt();

                    for (int idx = 0; idx < this.NumberOfVariableDatumRecords; idx++)
                    {
                        VariableDatum anX = new VariableDatum();
                        anX.Unmarshal(dis);
                        this._variableDatumList.Add(anX);
                    }
                }
                catch (Exception e)
                {
                    if (PduBase.TraceExceptions)
                    {
                        Trace.WriteLine(e);
                        Trace.Flush();
                    }

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }