internal OnvifDevice(OnvifHostName hostname, OnvifSystemDateTime systemDateTime, OnvifDns dns, IList <MediaProfile> mediaProfiles) { Hostname = hostname; SystemDateTime = systemDateTime; Dns = dns; MediaProfiles = mediaProfiles; }
internal static OnvifDevice DeserializeOnvifDevice(JsonElement element) { Optional <OnvifHostName> hostname = default; Optional <OnvifSystemDateTime> systemDateTime = default; Optional <OnvifDns> dns = default; Optional <IList <MediaProfile> > mediaProfiles = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("hostname")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } hostname = OnvifHostName.DeserializeOnvifHostName(property.Value); continue; } if (property.NameEquals("systemDateTime")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } systemDateTime = OnvifSystemDateTime.DeserializeOnvifSystemDateTime(property.Value); continue; } if (property.NameEquals("dns")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } dns = OnvifDns.DeserializeOnvifDns(property.Value); continue; } if (property.NameEquals("mediaProfiles")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <MediaProfile> array = new List <MediaProfile>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(MediaProfile.DeserializeMediaProfile(item)); } mediaProfiles = array; continue; } } return(new OnvifDevice(hostname.Value, systemDateTime.Value, dns.Value, Optional.ToList(mediaProfiles))); }