Exemplo n.º 1
0
        public override int GetMarshalledSize()
        {
            int marshalSize = 0;

            marshalSize  = base.GetMarshalledSize();
            marshalSize += this._requestingEntityID.GetMarshalledSize(); // this._requestingEntityID
            marshalSize += this._servicingEntityID.GetMarshalledSize();  // this._servicingEntityID
            marshalSize += 1;                                            // this._serviceTypeRequested
            marshalSize += 1;                                            // this._numberOfSupplyTypes
            marshalSize += 2;                                            // this._serviceRequestPadding
            for (int idx = 0; idx < this._supplies.Count; idx++)
            {
                SupplyQuantity listElement = (SupplyQuantity)this._supplies[idx];
                marshalSize += listElement.GetMarshalledSize();
            }

            return(marshalSize);
        }
Exemplo n.º 2
0
        public override void Reflection(StringBuilder sb)
        {
            sb.AppendLine("<ServiceRequestPdu>");
            base.Reflection(sb);
            try
            {
                sb.AppendLine("<requestingEntityID>");
                this._requestingEntityID.Reflection(sb);
                sb.AppendLine("</requestingEntityID>");
                sb.AppendLine("<servicingEntityID>");
                this._servicingEntityID.Reflection(sb);
                sb.AppendLine("</servicingEntityID>");
                sb.AppendLine("<serviceTypeRequested type=\"byte\">" + this._serviceTypeRequested.ToString(CultureInfo.InvariantCulture) + "</serviceTypeRequested>");
                sb.AppendLine("<supplies type=\"byte\">" + this._supplies.Count.ToString(CultureInfo.InvariantCulture) + "</supplies>");
                sb.AppendLine("<serviceRequestPadding type=\"short\">" + this._serviceRequestPadding.ToString(CultureInfo.InvariantCulture) + "</serviceRequestPadding>");
                for (int idx = 0; idx < this._supplies.Count; idx++)
                {
                    sb.AppendLine("<supplies" + idx.ToString(CultureInfo.InvariantCulture) + " type=\"SupplyQuantity\">");
                    SupplyQuantity aSupplyQuantity = (SupplyQuantity)this._supplies[idx];
                    aSupplyQuantity.Reflection(sb);
                    sb.AppendLine("</supplies" + idx.ToString(CultureInfo.InvariantCulture) + ">");
                }

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

                this.RaiseExceptionOccured(e);

                if (PduBase.ThrowExceptions)
                {
                    throw e;
                }
            }
        }
Exemplo n.º 3
0
        public override void Reflection(StringBuilder sb)
        {
            sb.AppendLine("<ResupplyOfferPdu>");
            base.Reflection(sb);
            try
            {
                sb.AppendLine("<receivingEntityID>");
                this._receivingEntityID.Reflection(sb);
                sb.AppendLine("</receivingEntityID>");
                sb.AppendLine("<supplyingEntityID>");
                this._supplyingEntityID.Reflection(sb);
                sb.AppendLine("</supplyingEntityID>");
                sb.AppendLine("<supplies type=\"byte\">" + this._supplies.Count.ToString(CultureInfo.InvariantCulture) + "</supplies>");
                sb.AppendLine("<padding1 type=\"short\">" + this._padding1.ToString(CultureInfo.InvariantCulture) + "</padding1>");
                sb.AppendLine("<padding2 type=\"byte\">" + this._padding2.ToString(CultureInfo.InvariantCulture) + "</padding2>");
                for (int idx = 0; idx < this._supplies.Count; idx++)
                {
                    sb.AppendLine("<supplies" + idx.ToString(CultureInfo.InvariantCulture) + " type=\"SupplyQuantity\">");
                    SupplyQuantity aSupplyQuantity = (SupplyQuantity)this._supplies[idx];
                    aSupplyQuantity.Reflection(sb);
                    sb.AppendLine("</supplies" + idx.ToString(CultureInfo.InvariantCulture) + ">");
                }

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

                this.RaiseExceptionOccured(e);

                if (PduBase.ThrowExceptions)
                {
                    throw e;
                }
            }
        }
Exemplo n.º 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(SupplyQuantity obj)
        {
            bool ivarsEqual = true;

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

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

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

            return(ivarsEqual);
        }
Exemplo n.º 5
0
        public override void Unmarshal(DataInputStream dis)
        {
            base.Unmarshal(dis);

            if (dis != null)
            {
                try
                {
                    this._requestingEntityID.Unmarshal(dis);
                    this._servicingEntityID.Unmarshal(dis);
                    this._serviceTypeRequested  = dis.ReadUnsignedByte();
                    this._numberOfSupplyTypes   = dis.ReadUnsignedByte();
                    this._serviceRequestPadding = dis.ReadShort();

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

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
Exemplo n.º 6
0
        public override void Marshal(DataOutputStream dos)
        {
            base.Marshal(dos);
            if (dos != null)
            {
                try
                {
                    this._requestingEntityID.Marshal(dos);
                    this._servicingEntityID.Marshal(dos);
                    dos.WriteUnsignedByte((byte)this._serviceTypeRequested);
                    dos.WriteUnsignedByte((byte)this._supplies.Count);
                    dos.WriteShort((short)this._serviceRequestPadding);

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

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
Exemplo n.º 7
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(SupplyQuantity obj)
        {
            bool ivarsEqual = true;

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

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

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

            return ivarsEqual;
        }