Пример #1
0
        public virtual byte[] Serialize()
        {
            if ((TimeZoneCode ?? "").Trim().ToUpper() == "TEST")
            {
                return(Encoding.ASCII.GetBytes("tEsT"));
            }
            var rv = new List <byte>();

            rv.Add(Version);
            rv.Add(0);
            var payload = Encoding.ASCII.GetBytes(TimeZoneCode.ToString());

            rv.AddRange(payload);;
            rv[1] = Convert.ToByte(payload.Length); // Total length of payload only
            byte cs = ChecksumSeed;

            foreach (byte b in rv)
            {
                cs ^= b;
            }
            rv.Add(cs);
            return(rv.ToArray());
        }