예제 #1
0
        public override int GetMarshalledSize()
        {
            int marshalSize = 0;

            marshalSize  = base.GetMarshalledSize();
            marshalSize += this._minefieldID.GetMarshalledSize();          // this._minefieldID
            marshalSize += 2;                                              // this._minefieldSequence
            marshalSize += 1;                                              // this._forceID
            marshalSize += 1;                                              // this._numberOfPerimeterPoints
            marshalSize += this._minefieldType.GetMarshalledSize();        // this._minefieldType
            marshalSize += 2;                                              // this._numberOfMineTypes
            marshalSize += this._minefieldLocation.GetMarshalledSize();    // this._minefieldLocation
            marshalSize += this._minefieldOrientation.GetMarshalledSize(); // this._minefieldOrientation
            marshalSize += 2;                                              // this._appearance
            marshalSize += 2;                                              // this._protocolMode
            for (int idx = 0; idx < this._perimeterPoints.Count; idx++)
            {
                Vector2Float listElement = (Vector2Float)this._perimeterPoints[idx];
                marshalSize += listElement.GetMarshalledSize();
            }

            for (int idx = 0; idx < this._mineType.Count; idx++)
            {
                EntityType listElement = (EntityType)this._mineType[idx];
                marshalSize += listElement.GetMarshalledSize();
            }

            return(marshalSize);
        }
예제 #2
0
        public override void Reflection(StringBuilder sb)
        {
            sb.AppendLine("<MinefieldStatePdu>");
            base.Reflection(sb);
            try
            {
                sb.AppendLine("<minefieldID>");
                this._minefieldID.Reflection(sb);
                sb.AppendLine("</minefieldID>");
                sb.AppendLine("<minefieldSequence type=\"ushort\">" + this._minefieldSequence.ToString(CultureInfo.InvariantCulture) + "</minefieldSequence>");
                sb.AppendLine("<forceID type=\"byte\">" + this._forceID.ToString(CultureInfo.InvariantCulture) + "</forceID>");
                sb.AppendLine("<perimeterPoints type=\"byte\">" + this._perimeterPoints.Count.ToString(CultureInfo.InvariantCulture) + "</perimeterPoints>");
                sb.AppendLine("<minefieldType>");
                this._minefieldType.Reflection(sb);
                sb.AppendLine("</minefieldType>");
                sb.AppendLine("<mineType type=\"ushort\">" + this._mineType.Count.ToString(CultureInfo.InvariantCulture) + "</mineType>");
                sb.AppendLine("<minefieldLocation>");
                this._minefieldLocation.Reflection(sb);
                sb.AppendLine("</minefieldLocation>");
                sb.AppendLine("<minefieldOrientation>");
                this._minefieldOrientation.Reflection(sb);
                sb.AppendLine("</minefieldOrientation>");
                sb.AppendLine("<appearance type=\"ushort\">" + this._appearance.ToString(CultureInfo.InvariantCulture) + "</appearance>");
                sb.AppendLine("<protocolMode type=\"ushort\">" + this._protocolMode.ToString(CultureInfo.InvariantCulture) + "</protocolMode>");
                for (int idx = 0; idx < this._perimeterPoints.Count; idx++)
                {
                    sb.AppendLine("<perimeterPoints" + idx.ToString(CultureInfo.InvariantCulture) + " type=\"Vector2Float\">");
                    Vector2Float aVector2Float = (Vector2Float)this._perimeterPoints[idx];
                    aVector2Float.Reflection(sb);
                    sb.AppendLine("</perimeterPoints" + idx.ToString(CultureInfo.InvariantCulture) + ">");
                }

                for (int idx = 0; idx < this._mineType.Count; idx++)
                {
                    sb.AppendLine("<mineType" + idx.ToString(CultureInfo.InvariantCulture) + " type=\"EntityType\">");
                    EntityType aEntityType = (EntityType)this._mineType[idx];
                    aEntityType.Reflection(sb);
                    sb.AppendLine("</mineType" + idx.ToString(CultureInfo.InvariantCulture) + ">");
                }

                sb.AppendLine("</MinefieldStatePdu>");
            }
            catch (Exception e)
            {
#if DEBUG
                Trace.WriteLine(e);
                Trace.Flush();
#endif
                this.OnException(e);
            }
        }
예제 #3
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++)
                    {
                        Vector2Float anX = new Vector2Float();
                        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 DEBUG
                    Trace.WriteLine(e);
                    Trace.Flush();
#endif
                    this.OnException(e);
                }
            }
        }
예제 #4
0
        /// <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(Vector2Float obj)
        {
            bool ivarsEqual = true;

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

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

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

            return(ivarsEqual);
        }
예제 #5
0
        public override void Marshal(DataOutputStream dos)
        {
            base.Marshal(dos);
            if (dos != null)
            {
                try
                {
                    this._minefieldID.Marshal(dos);
                    dos.WriteUnsignedShort((ushort)this._minefieldSequence);
                    dos.WriteUnsignedByte((byte)this._forceID);
                    dos.WriteUnsignedByte((byte)this._perimeterPoints.Count);
                    this._minefieldType.Marshal(dos);
                    dos.WriteUnsignedShort((ushort)this._mineType.Count);
                    this._minefieldLocation.Marshal(dos);
                    this._minefieldOrientation.Marshal(dos);
                    dos.WriteUnsignedShort((ushort)this._appearance);
                    dos.WriteUnsignedShort((ushort)this._protocolMode);

                    for (int idx = 0; idx < this._perimeterPoints.Count; idx++)
                    {
                        Vector2Float aVector2Float = (Vector2Float)this._perimeterPoints[idx];
                        aVector2Float.Marshal(dos);
                    }

                    for (int idx = 0; idx < this._mineType.Count; idx++)
                    {
                        EntityType aEntityType = (EntityType)this._mineType[idx];
                        aEntityType.Marshal(dos);
                    }
                }
                catch (Exception e)
                {
#if DEBUG
                    Trace.WriteLine(e);
                    Trace.Flush();
#endif
                    this.OnException(e);
                }
            }
        }
예제 #6
0
        /// <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(Vector2Float obj)
        {
            bool ivarsEqual = true;

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

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

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

            return ivarsEqual;
        }