Ejemplo n.º 1
0
            public override uint Parse(byte[] msg)
            {
                int  pos       = (int)base.Parse(msg);
                uint cmdLength = SupportOperations.FromBigEndianUInt(msg);
                int  newpos    = 0;

                byte[]        localArray;
                ASCIIEncoding ascii = new ASCIIEncoding();

                ServiceType = SupportOperations.getStringValue(msg, pos, out newpos);
                localArray  = new byte[msg.Length - newpos];
                Array.Copy(msg, newpos, localArray, 0, msg.Length - newpos);
                pos        = newpos + (int)Source.Parse(localArray);
                localArray = new byte[msg.Length - pos];
                Array.Copy(msg, pos, localArray, 0, msg.Length - pos);
                pos               += (int)Destination.Parse(localArray);
                EsmClass           = msg[pos++];
                RegisteredDelivery = msg[pos++];
                DataCoding         = (dataCodingEnum)Enum.Parse(typeof(dataCodingEnum), msg[pos++].ToString());
                // parse optional params
                localArray = new byte[2];
                while (pos < cmdLength)
                {
                    OptionalParameter op = new OptionalParameter();
                    Array.Copy(msg, pos, localArray, 0, 2);
                    op.Param = (OptionalParameter.tagEnum)Enum.Parse(typeof(OptionalParameter.tagEnum), SupportOperations.FromBigEndianUShort(localArray).ToString());
                    pos     += 2;
                    Array.Copy(msg, pos, localArray, 0, 2);
                    op.Length = SupportOperations.FromBigEndianUShort(localArray);
                    pos      += 2;
                    op.Value  = new byte[op.Length];
                    Array.Copy(msg, pos, op.Value, 0, op.Length);
                    pos += op.Length;
                    OptionalParamList.Add(op);
                }
                return((uint)pos);
            }
Ejemplo n.º 2
0
            public override uint Parse(byte[] msg)
            {
                int pos = (int)base.Parse(msg);
                int newpos;

                if (pos == 0)
                {
                    return(0);
                }

                byte[] localArray = new byte[8];

                Array.Copy(msg, pos, localArray, 0, 8);
                RequestId = SupportOperations.FromBigEndianULong(localArray);
                pos      += 8;


                DestinationAddr = SupportOperations.getStringValue(msg, pos, out newpos);
                pos             = newpos;


                ServiceState = (serviceStateEnum)msg[pos];
                pos++;


                Array.Copy(msg, pos, localArray, 0, 8);
                ServiceTypeId = SupportOperations.FromBigEndianULong(localArray);
                pos          += 8;


                ServiceClass = SupportOperations.get1251StringValue(msg, pos, out newpos);
                pos          = newpos;


                ServiceDescr = SupportOperations.get1251StringValue(msg, pos, out newpos);
                pos          = newpos;


                Array.Copy(msg, pos, localArray, 0, 4);
                ServiceCost = SupportOperations.FromBigEndianUInt(localArray);
                pos        += 4;


                ServicePeriod = (servicePeriodEnum)msg[pos];
                pos++;


                ActivationType = (activationTypeEnum)msg[pos];
                pos++;


                ActivationAddr = SupportOperations.getStringValue(msg, pos, out newpos);
                pos            = newpos;


                ActivationMessage = SupportOperations.get1251StringValue(msg, pos, out newpos);
                pos = newpos;


                Array.Copy(msg, pos, localArray, 0, 8);
                ServiceId = SupportOperations.FromBigEndianULong(localArray);
                pos      += 8;

                return((uint)pos);
            }