예제 #1
0
        /// <summary>
        /// This method retrieves the C-Octet string from the byte stream
        /// </summary>
        /// <param name="reader">Byte stream</param>
        public void GetFromStream(SmppReader reader)
        {
            int len = (int)reader.ReadByte();

            if (len > 0)
            {
                data_ = reader.ReadString(len);
            }
            ValidateData();
        }
예제 #2
0
        /// <summary>
        /// This method implements the ISupportSmppByteStream.GetFromStream
        /// method so that the PDU can serialize itself from the data stream.
        /// </summary>
        /// <param name="reader">StreamReader</param>
        public override void GetFromStream(SmppReader reader)
        {
            distList_ = new List <string>();
            int count = (int)reader.ReadByte();

            for (int i = 0; i < count; i++)
            {
                distList_.Add(reader.ReadString());
            }
        }
예제 #3
0
파일: mod_dl.cs 프로젝트: xtoblizi/smpp.net
 /// <summary>
 /// This method implements the ISupportSmppByteStream.GetFromStream
 /// method so that the PDU can serialize itself from the data stream.
 /// </summary>
 /// <param name="reader">StreamReader</param>
 public override void GetFromStream(SmppReader reader)
 {
     reader.ReadObject(sourceAddr_);
     reader.ReadObject(dlname_);
     type_ = (DistributionListModifyType)reader.ReadByte();
     if (type_ == DistributionListModifyType.AddMember)
     {
         reader.ReadObject(memberDetails_);
     }
     else
     {
         memberDetails_.Address     = new address();
         memberDetails_.Description = reader.ReadString();
     }
 }
예제 #4
0
 /// <summary>
 /// This method implements the ISupportSmppByteStream.GetFromStream
 /// method so that the PDU can serialize itself from the data stream.
 /// </summary>
 /// <param name="reader">StreamReader</param>
 public override void GetFromStream(SmppReader reader)
 {
     id_ = reader.ReadString();
 }
예제 #5
0
 /// <summary>
 /// This method retrieves the C-Octet string from the byte stream
 /// </summary>
 /// <param name="reader">Byte stream</param>
 public void GetFromStream(SmppReader reader)
 {
     data_ = reader.ReadString();
     ValidateData();
 }
예제 #6
0
        /// <summary>
        /// This method retrieves the value from the byte stream
        /// </summary>
        /// <param name="reader">Byte stream</param>
        public void GetFromStream(SmppReader reader)
        {
            string s = reader.ReadString();

            if (s.Length >= MIN_SHORT_SIZE)
            {
                int MM, DD, YY, mm, hh, ss;

                YY = Convert.ToInt32(s.Substring(0, 2));
                MM = Convert.ToInt32(s.Substring(2, 2));
                DD = Convert.ToInt32(s.Substring(4, 2));
                hh = Convert.ToInt32(s.Substring(6, 2));
                mm = Convert.ToInt32(s.Substring(8, 2));
                ss = 0;
                if (s.Length >= MIN_REQUIRED_SIZE)
                {
                    ss = Convert.ToInt32(s.Substring(10, 2));
                }

                if (s.Length >= MAX_REQUIRED_SIZE)
                {
                    int    t, nn;
                    string type;

                    t    = Convert.ToInt32(s.Substring(12, 1));
                    nn   = Convert.ToInt32(s.Substring(13, 2));
                    type = s.Substring(15, 1);

                    // If it is a relative time, then use a timespan.
                    if (type == "R")
                    {
                        isRelative_ = true;
                        includeUTC_ = true;
                        //TODO: we are generalizing here; 365 days per year, 30 days per month
                        data2_ = new TimeSpan((YY * 365) + (MM * 30) + DD, hh, mm, ss, t * 100);
                    }
                    else
                    {
                        includeUTC_ = true;
                        isRelative_ = false;

                        // Calculate the date and then convert it to UTC.
                        DateTime dt = new DateTime(YY + 2000, MM, DD, hh, mm, ss, t * 100);
                        if (type == "+")
                        {
                            dt += new TimeSpan(0, 0, nn * 15, 0, 0);
                        }
                        else if (type == "-")
                        {
                            dt -= new TimeSpan(0, 0, nn * 15, 0, 0);
                        }

                        // Now convert it to our local time.
                        TimeZone localZone = TimeZone.CurrentTimeZone;
                        data_ = localZone.ToLocalTime(dt);
                    }
                }
                else
                {
                    data_       = new DateTime(YY, MM, DD, hh, mm, ss);
                    includeUTC_ = false;
                    isRelative_ = false;
                }
            }

            ValidateData();
        }