Пример #1
0
        internal static EncryptionSettingsCollection DeserializeEncryptionSettingsCollection(JsonElement element)
        {
            bool enabled = default;
            Optional <IList <EncryptionSettingsElement> > encryptionSettings = default;
            Optional <string> encryptionSettingsVersion = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("enabled"))
                {
                    enabled = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("encryptionSettings"))
                {
                    List <EncryptionSettingsElement> array = new List <EncryptionSettingsElement>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(EncryptionSettingsElement.DeserializeEncryptionSettingsElement(item));
                    }
                    encryptionSettings = array;
                    continue;
                }
                if (property.NameEquals("encryptionSettingsVersion"))
                {
                    encryptionSettingsVersion = property.Value.GetString();
                    continue;
                }
            }
            return(new EncryptionSettingsCollection(enabled, Optional.ToList(encryptionSettings), encryptionSettingsVersion.Value));
        }
        internal static EncryptionSettingsCollection DeserializeEncryptionSettingsCollection(JsonElement element)
        {
            bool enabled = default;
            IList <EncryptionSettingsElement> encryptionSettings = default;
            string encryptionSettingsVersion = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("enabled"))
                {
                    enabled = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("encryptionSettings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <EncryptionSettingsElement> array = new List <EncryptionSettingsElement>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(EncryptionSettingsElement.DeserializeEncryptionSettingsElement(item));
                        }
                    }
                    encryptionSettings = array;
                    continue;
                }
                if (property.NameEquals("encryptionSettingsVersion"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    encryptionSettingsVersion = property.Value.GetString();
                    continue;
                }
            }
            return(new EncryptionSettingsCollection(enabled, encryptionSettings, encryptionSettingsVersion));
        }