Esempio n. 1
0
 public string this[NotificationAttributeID key]
 {
     get
     {
         return(_dictionary[key]);
     }
 }
Esempio n. 2
0
        public NotificationAttributeCollection(IBuffer value)
        {
            _dictionary = new Dictionary <NotificationAttributeID, string>();

            var stream = value.AsStream();
            var br     = new BinaryReader(stream);

            // Read and validate the command ID.
            CommandID commandID = (CommandID)br.ReadByte();

            if (commandID != CommandID.GetNotificationAttributes)
            {
                throw new Exception("Invalid command.");
            }

            // Read the notification UID
            NotificationUID = br.ReadUInt32();

            // Read Attributes
            while (stream.Position < stream.Length)
            {
                NotificationAttributeID attributeID = (NotificationAttributeID)br.ReadByte();
                UInt16 attributeLength = br.ReadUInt16();
                String attributeValue  = Encoding.UTF8.GetString(br.ReadBytes(attributeLength));

                _dictionary.Add(attributeID, attributeValue);
            }
        }
Esempio n. 3
0
 public bool TryGetValue(NotificationAttributeID key, out string value)
 {
     return(_dictionary.TryGetValue(key, out value));
 }
Esempio n. 4
0
 public bool ContainsKey(NotificationAttributeID key)
 {
     return(_dictionary.ContainsKey(key));
 }