Beispiel #1
0
        internal static MediaGraphUnsecuredEndpoint DeserializeMediaGraphUnsecuredEndpoint(JsonElement element)
        {
            string type = default;
            Optional <MediaGraphCredentials> credentials = default;
            string url = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("@type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("credentials"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    credentials = MediaGraphCredentials.DeserializeMediaGraphCredentials(property.Value);
                    continue;
                }
                if (property.NameEquals("url"))
                {
                    url = property.Value.GetString();
                    continue;
                }
            }
            return(new MediaGraphUnsecuredEndpoint(type, credentials.Value, url));
        }
        internal static MediaGraphTlsEndpoint DeserializeMediaGraphTlsEndpoint(JsonElement element)
        {
            Optional <MediaGraphCertificateSource>    trustedCertificates = default;
            Optional <MediaGraphTlsValidationOptions> validationOptions   = default;
            string type = default;
            Optional <MediaGraphCredentials> credentials = default;
            string url = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("trustedCertificates"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    trustedCertificates = MediaGraphCertificateSource.DeserializeMediaGraphCertificateSource(property.Value);
                    continue;
                }
                if (property.NameEquals("validationOptions"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    validationOptions = MediaGraphTlsValidationOptions.DeserializeMediaGraphTlsValidationOptions(property.Value);
                    continue;
                }
                if (property.NameEquals("@type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("credentials"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    credentials = MediaGraphCredentials.DeserializeMediaGraphCredentials(property.Value);
                    continue;
                }
                if (property.NameEquals("url"))
                {
                    url = property.Value.GetString();
                    continue;
                }
            }
            return(new MediaGraphTlsEndpoint(type, credentials.Value, url, trustedCertificates.Value, validationOptions.Value));
        }
Beispiel #3
0
        internal static MediaGraphEndpoint DeserializeMediaGraphEndpoint(JsonElement element)
        {
            if (element.TryGetProperty("@type", out JsonElement discriminator))
            {
                switch (discriminator.GetString())
                {
                case "#Microsoft.Media.MediaGraphTlsEndpoint": return(MediaGraphTlsEndpoint.DeserializeMediaGraphTlsEndpoint(element));

                case "#Microsoft.Media.MediaGraphUnsecuredEndpoint": return(MediaGraphUnsecuredEndpoint.DeserializeMediaGraphUnsecuredEndpoint(element));
                }
            }
            string type = default;
            Optional <MediaGraphCredentials> credentials = default;
            string url = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("@type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("credentials"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    credentials = MediaGraphCredentials.DeserializeMediaGraphCredentials(property.Value);
                    continue;
                }
                if (property.NameEquals("url"))
                {
                    url = property.Value.GetString();
                    continue;
                }
            }
            return(new MediaGraphEndpoint(type, credentials.Value, url));
        }
Beispiel #4
0
 internal MediaGraphEndpoint(string type, MediaGraphCredentials credentials, string url)
 {
     Type        = type;
     Credentials = credentials;
     Url         = url;
 }
 internal MediaGraphUnsecuredEndpoint(string type, MediaGraphCredentials credentials, string url) : base(type, credentials, url)
 {
     Type = type ?? "#Microsoft.Media.MediaGraphUnsecuredEndpoint";
 }
Beispiel #6
0
 internal MediaGraphTlsEndpoint(string type, MediaGraphCredentials credentials, string url, MediaGraphCertificateSource trustedCertificates, MediaGraphTlsValidationOptions validationOptions) : base(type, credentials, url)
 {
     TrustedCertificates = trustedCertificates;
     ValidationOptions   = validationOptions;
     Type = type ?? "#Microsoft.Media.MediaGraphTlsEndpoint";
 }