Exemplo n.º 1
0
        public static BooleanResources Deserialise(TlvReader reader)
        {
            BooleanResources result = null;

            if (reader.TlvRecord == null)
            {
                reader.Read();
            }
            if (reader.TlvRecord != null)
            {
                if (reader.TlvRecord.TypeIdentifier == TTlvTypeIdentifier.MultipleResources)
                {
                    result = new BooleanResources(reader.TlvRecord.Identifier.ToString());
                    if (reader.TlvRecord.Value != null)
                    {
                        using (TlvReader childReader = new TlvReader(reader.TlvRecord.Value))
                        {
                            while (childReader.Read())
                            {
                                if (childReader.TlvRecord.TypeIdentifier == TTlvTypeIdentifier.ResourceInstance)
                                {
                                    BooleanResource childResource = new BooleanResource(childReader.TlvRecord.Identifier.ToString());
                                    childResource.Value = childReader.TlvRecord.ValueAsBoolean();
                                    result.Add(childResource);
                                }
                            }
                        }
                    }
                }
            }
            return(result);
        }
Exemplo n.º 2
0
 public static BooleanResources Deserialise(TlvReader reader)
 {
     BooleanResources result = null;
     if (reader.TlvRecord == null)
         reader.Read();
     if (reader.TlvRecord != null)
     {
         if (reader.TlvRecord.TypeIdentifier == TTlvTypeIdentifier.MultipleResources)
         {
             result = new BooleanResources(reader.TlvRecord.Identifier.ToString());
             if (reader.TlvRecord.Value != null)
             {
                 using (TlvReader childReader = new TlvReader(reader.TlvRecord.Value))
                 {
                     while (childReader.Read())
                     {
                         if (childReader.TlvRecord.TypeIdentifier == TTlvTypeIdentifier.ResourceInstance)
                         {
                             BooleanResource childResource = new BooleanResource(childReader.TlvRecord.Identifier.ToString());
                             childResource.Value = childReader.TlvRecord.ValueAsBoolean();
                             result.Add(childResource);
                         }
                     }
                 }
             }
         }
     }
     return result;
 }
Exemplo n.º 3
0
        public static BooleanResources Deserialise(Request request)
        {
            BooleanResources result = null;
            string           name   = request.UriPaths.Last();

            if (!string.IsNullOrEmpty(name) && (request.ContentType == TlvConstant.CONTENT_TYPE_TLV))
            {
                using (TlvReader reader = new TlvReader(request.Payload))
                {
                    result = Deserialise(reader);
                }
            }
            return(result);
        }