Exemple #1
0
        internal static ManagementLockObject DeserializeManagementLockObject(JsonElement element)
        {
            Optional <string> id    = default;
            Optional <string> type  = default;
            Optional <string> name  = default;
            LockLevel         level = default;
            Optional <string> notes = default;
            Optional <IList <ManagementLockOwner> > owners = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("level"))
                        {
                            level = new LockLevel(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("notes"))
                        {
                            notes = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("owners"))
                        {
                            List <ManagementLockOwner> array = new List <ManagementLockOwner>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(ManagementLockOwner.DeserializeManagementLockOwner(item));
                            }
                            owners = array;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new ManagementLockObject(id.Value, type.Value, name.Value, level, notes.Value, Optional.ToList(owners)));
        }
Exemple #2
0
        internal static ManagementLockObject DeserializeManagementLockObject(JsonElement element)
        {
            string    id    = default;
            string    type  = default;
            string    name  = default;
            LockLevel level = default;
            string    notes = default;
            IList <ManagementLockOwner> owners = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("level"))
                        {
                            level = new LockLevel(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("notes"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            notes = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("owners"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            List <ManagementLockOwner> array = new List <ManagementLockOwner>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                if (item.ValueKind == JsonValueKind.Null)
                                {
                                    array.Add(null);
                                }
                                else
                                {
                                    array.Add(ManagementLockOwner.DeserializeManagementLockOwner(item));
                                }
                            }
                            owners = array;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new ManagementLockObject(id, type, name, level, notes, owners));
        }