internal static DiffDiskSettings DeserializeDiffDiskSettings(JsonElement element) { string option = default; DiffDiskPlacement?placement = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("option")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } option = property.Value.GetString(); continue; } if (property.NameEquals("placement")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } placement = new DiffDiskPlacement(property.Value.GetString()); continue; } } return(new DiffDiskSettings(option, placement)); }
internal static DiffDiskSettings DeserializeDiffDiskSettings(JsonElement element) { Optional <DiffDiskOptions> option = default; Optional <DiffDiskPlacement> placement = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("option")) { option = new DiffDiskOptions(property.Value.GetString()); continue; } if (property.NameEquals("placement")) { placement = new DiffDiskPlacement(property.Value.GetString()); continue; } } return(new DiffDiskSettings(Optional.ToNullable(option), Optional.ToNullable(placement))); }