Exemple #1
0
        public override void Reflection(StringBuilder sb)
        {
            sb.AppendLine("<EntityStateUpdatePdu>");
            base.Reflection(sb);
            try
            {
                sb.AppendLine("<entityID>");
                this._entityID.Reflection(sb);
                sb.AppendLine("</entityID>");
                sb.AppendLine("<padding1 type=\"byte\">" + this._padding1.ToString(CultureInfo.InvariantCulture) + "</padding1>");
                sb.AppendLine("<articulationParameters type=\"byte\">" + this._articulationParameters.Count.ToString(CultureInfo.InvariantCulture) + "</articulationParameters>");
                sb.AppendLine("<entityLinearVelocity>");
                this._entityLinearVelocity.Reflection(sb);
                sb.AppendLine("</entityLinearVelocity>");
                sb.AppendLine("<entityLocation>");
                this._entityLocation.Reflection(sb);
                sb.AppendLine("</entityLocation>");
                sb.AppendLine("<entityOrientation>");
                this._entityOrientation.Reflection(sb);
                sb.AppendLine("</entityOrientation>");
                sb.AppendLine("<entityAppearance type=\"int\">" + this._entityAppearance.ToString(CultureInfo.InvariantCulture) + "</entityAppearance>");
                for (int idx = 0; idx < this._articulationParameters.Count; idx++)
                {
                    sb.AppendLine("<articulationParameters" + idx.ToString(CultureInfo.InvariantCulture) + " type=\"ArticulationParameter\">");
                    ArticulationParameter aArticulationParameter = (ArticulationParameter)this._articulationParameters[idx];
                    aArticulationParameter.Reflection(sb);
                    sb.AppendLine("</articulationParameters" + idx.ToString(CultureInfo.InvariantCulture) + ">");
                }

                sb.AppendLine("</EntityStateUpdatePdu>");
            }
            catch (Exception e)
            {
                if (PduBase.TraceExceptions)
                {
                    Trace.WriteLine(e);
                    Trace.Flush();
                }

                this.RaiseExceptionOccured(e);

                if (PduBase.ThrowExceptions)
                {
                    throw e;
                }
            }
        }
        public override void Unmarshal(DataInputStream dis)
        {
            base.Unmarshal(dis);

            if (dis != null)
            {
                try
                {
                    this._entityID.Unmarshal(dis);
                    this._forceId = dis.ReadUnsignedByte();
                    this._numberOfArticulationParameters = dis.ReadByte();
                    this._entityType.Unmarshal(dis);
                    this._alternativeEntityType.Unmarshal(dis);
                    this._entityLinearVelocity.Unmarshal(dis);
                    this._entityLocation.Unmarshal(dis);
                    this._entityOrientation.Unmarshal(dis);
                    this._entityAppearance = dis.ReadInt();
                    this._deadReckoningParameters.Unmarshal(dis);
                    this._marking.Unmarshal(dis);
                    this._capabilities = dis.ReadInt();

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

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
        public override void Marshal(DataOutputStream dos)
        {
            base.Marshal(dos);
            if (dos != null)
            {
                try
                {
                    this._entityID.Marshal(dos);
                    dos.WriteUnsignedByte((byte)this._forceId);
                    dos.WriteByte((byte)this._articulationParameters.Count);
                    this._entityType.Marshal(dos);
                    this._alternativeEntityType.Marshal(dos);
                    this._entityLinearVelocity.Marshal(dos);
                    this._entityLocation.Marshal(dos);
                    this._entityOrientation.Marshal(dos);
                    dos.WriteInt((int)this._entityAppearance);
                    this._deadReckoningParameters.Marshal(dos);
                    this._marking.Marshal(dos);
                    dos.WriteInt((int)this._capabilities);

                    for (int idx = 0; idx < this._articulationParameters.Count; idx++)
                    {
                        ArticulationParameter aArticulationParameter = (ArticulationParameter)this._articulationParameters[idx];
                        aArticulationParameter.Marshal(dos);
                    }
                }
                catch (Exception e)
                {
                    if (PduBase.TraceExceptions)
                    {
                        Trace.WriteLine(e);
                        Trace.Flush();
                    }

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
Exemple #4
0
        public override void Unmarshal(DataInputStream dis)
        {
            base.Unmarshal(dis);

            if (dis != null)
            {
                try
                {
                    this._munitionID.Unmarshal(dis);
                    this._eventID.Unmarshal(dis);
                    this._velocity.Unmarshal(dis);
                    this._locationInWorldCoordinates.Unmarshal(dis);
                    this._burstDescriptor.Unmarshal(dis);
                    this._locationInEntityCoordinates.Unmarshal(dis);
                    this._detonationResult = dis.ReadUnsignedByte();
                    this._numberOfArticulationParameters = dis.ReadUnsignedByte();
                    this._pad = dis.ReadShort();

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

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
Exemple #5
0
        public override int GetMarshalledSize()
        {
            int marshalSize = 0;

            marshalSize  = base.GetMarshalledSize();
            marshalSize += this._entityID.GetMarshalledSize();             // this._entityID
            marshalSize += 1;                                              // this._padding1
            marshalSize += 1;                                              // this._numberOfArticulationParameters
            marshalSize += this._entityLinearVelocity.GetMarshalledSize(); // this._entityLinearVelocity
            marshalSize += this._entityLocation.GetMarshalledSize();       // this._entityLocation
            marshalSize += this._entityOrientation.GetMarshalledSize();    // this._entityOrientation
            marshalSize += 4;                                              // this._entityAppearance
            for (int idx = 0; idx < this._articulationParameters.Count; idx++)
            {
                ArticulationParameter listElement = (ArticulationParameter)this._articulationParameters[idx];
                marshalSize += listElement.GetMarshalledSize();
            }

            return(marshalSize);
        }
Exemple #6
0
        public override void Marshal(DataOutputStream dos)
        {
            base.Marshal(dos);
            if (dos != null)
            {
                try
                {
                    this._munitionID.Marshal(dos);
                    this._eventID.Marshal(dos);
                    this._velocity.Marshal(dos);
                    this._locationInWorldCoordinates.Marshal(dos);
                    this._burstDescriptor.Marshal(dos);
                    this._locationInEntityCoordinates.Marshal(dos);
                    dos.WriteUnsignedByte((byte)this._detonationResult);
                    dos.WriteUnsignedByte((byte)this._articulationParameters.Count);
                    dos.WriteShort((short)this._pad);

                    for (int idx = 0; idx < this._articulationParameters.Count; idx++)
                    {
                        ArticulationParameter aArticulationParameter = (ArticulationParameter)this._articulationParameters[idx];
                        aArticulationParameter.Marshal(dos);
                    }
                }
                catch (Exception e)
                {
                    if (PduBase.TraceExceptions)
                    {
                        Trace.WriteLine(e);
                        Trace.Flush();
                    }

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
Exemple #7
0
        public override int GetMarshalledSize()
        {
            int marshalSize = 0;

            marshalSize  = base.GetMarshalledSize();
            marshalSize += this._munitionID.GetMarshalledSize();                  // this._munitionID
            marshalSize += this._eventID.GetMarshalledSize();                     // this._eventID
            marshalSize += this._velocity.GetMarshalledSize();                    // this._velocity
            marshalSize += this._locationInWorldCoordinates.GetMarshalledSize();  // this._locationInWorldCoordinates
            marshalSize += this._burstDescriptor.GetMarshalledSize();             // this._burstDescriptor
            marshalSize += this._locationInEntityCoordinates.GetMarshalledSize(); // this._locationInEntityCoordinates
            marshalSize += 1;                                                     // this._detonationResult
            marshalSize += 1;                                                     // this._numberOfArticulationParameters
            marshalSize += 2;                                                     // this._pad
            for (int idx = 0; idx < this._articulationParameters.Count; idx++)
            {
                ArticulationParameter listElement = (ArticulationParameter)this._articulationParameters[idx];
                marshalSize += listElement.GetMarshalledSize();
            }

            return(marshalSize);
        }
        /// <summary>
        /// Compares for reference AND value equality.
        /// </summary>
        /// <param name="obj">The object to compare with this instance.</param>
        /// <returns>
        ///     <c>true</c> if both operands are equal; otherwise, <c>false</c>.
        /// </returns>
        public bool Equals(ArticulationParameter obj)
        {
            bool ivarsEqual = true;

            if (obj.GetType() != this.GetType())
            {
                return(false);
            }

            if (this._parameterTypeDesignator != obj._parameterTypeDesignator)
            {
                ivarsEqual = false;
            }

            if (this._changeIndicator != obj._changeIndicator)
            {
                ivarsEqual = false;
            }

            if (this._partAttachedTo != obj._partAttachedTo)
            {
                ivarsEqual = false;
            }

            if (this._parameterType != obj._parameterType)
            {
                ivarsEqual = false;
            }

            if (this._parameterValue != obj._parameterValue)
            {
                ivarsEqual = false;
            }

            return(ivarsEqual);
        }