Пример #1
0
        public Message(byte[] package)
        {
            string temp = new ASCIIEncoding().GetString(package);

            totalmessage = temp;
            temp         = temp.Trim();
            if (temp.StartsWith("<") && temp.EndsWith(">"))
            {
                temp = temp.Substring(1, temp.Length - 2);
                string[] strmsg = temp.Split(',');
                this.stationId = strmsg[0];
                this.MsgId     = Convert.ToInt32(strmsg[1]);
                this.MsgType   = (MsgType)strmsg[2][0];
                this.Info      = strmsg[3];
                if (strmsg.Length > 4)
                {
                    this.DutID = strmsg[4];
                }
                string[] strmsg2 = this.Info.Split(':');
                if (strmsg2[0] == "E")
                {
                    this.Info      = "E";
                    this.ErrorInfo = strmsg2[1];
                }
            }
        }