コード例 #1
0
        public int Decode(byte[] buffer, int offset, uint count)
        {
            var len = 0;

            byte tagNumber;

            len += ASN1.decode_tag_number(buffer, offset + len, out tagNumber);

            switch (tagNumber)
            {
            case 0:
                var bdt = new BacnetDate();
                len  += bdt.Decode(buffer, offset + len, count);
                Entry = bdt;
                break;

            case 1:
                var bdr = new BacnetDateRange();
                len  += bdr.Decode(buffer, offset + len, count);
                Entry = bdr;
                len++;     // closing tag
                break;

            case 2:
                var bwd = new BacnetweekNDay();
                len  += bwd.Decode(buffer, offset + len, count);
                Entry = bwd;
                break;
            }

            return(len);
        }
コード例 #2
0
        public int Decode(byte[] buffer, int offset, uint count)
        {
            var len = 0;

            Entries = new List <object>();

            while (true)
            {
                byte tagNumber;
                len += ASN1.decode_tag_number(buffer, offset + len, out tagNumber);

                switch (tagNumber)
                {
                case 0:
                    var bdt = new BacnetDate();
                    len += bdt.Decode(buffer, offset + len, count);
                    Entries.Add(bdt);
                    break;

                case 1:
                    var bdr = new BacnetDateRange();
                    len += bdr.Decode(buffer, offset + len, count);
                    Entries.Add(bdr);
                    len++;     // closing tag
                    break;

                case 2:
                    var bwd = new BacnetweekNDay();
                    len += bwd.Decode(buffer, offset + len, count);
                    Entries.Add(bwd);
                    break;

                default:
                    return(len - 1);  // closing Tag
                }
            }
        }