Ejemplo n.º 1
0
        internal static CognitiveServicesVisionProcessor DeserializeCognitiveServicesVisionProcessor(JsonElement element)
        {
            EndpointBase endpoint = default;
            Optional <ImageProperties>   image           = default;
            Optional <SamplingOptions>   samplingOptions = default;
            SpatialAnalysisOperationBase operation       = default;
            string            type   = default;
            string            name   = default;
            IList <NodeInput> inputs = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("endpoint"))
                {
                    endpoint = EndpointBase.DeserializeEndpointBase(property.Value);
                    continue;
                }
                if (property.NameEquals("image"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    image = ImageProperties.DeserializeImageProperties(property.Value);
                    continue;
                }
                if (property.NameEquals("samplingOptions"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    samplingOptions = SamplingOptions.DeserializeSamplingOptions(property.Value);
                    continue;
                }
                if (property.NameEquals("operation"))
                {
                    operation = SpatialAnalysisOperationBase.DeserializeSpatialAnalysisOperationBase(property.Value);
                    continue;
                }
                if (property.NameEquals("@type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("inputs"))
                {
                    List <NodeInput> array = new List <NodeInput>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(NodeInput.DeserializeNodeInput(item));
                    }
                    inputs = array;
                    continue;
                }
            }
            return(new CognitiveServicesVisionProcessor(type, name, inputs, endpoint, image.Value, samplingOptions.Value, operation));
        }
Ejemplo n.º 2
0
        internal static GrpcExtension DeserializeGrpcExtension(JsonElement element)
        {
            GrpcExtensionDataTransfer dataTransfer           = default;
            Optional <string>         extensionConfiguration = default;
            EndpointBase               endpoint        = default;
            ImageProperties            image           = default;
            Optional <SamplingOptions> samplingOptions = default;
            string            type   = default;
            string            name   = default;
            IList <NodeInput> inputs = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("dataTransfer"))
                {
                    dataTransfer = GrpcExtensionDataTransfer.DeserializeGrpcExtensionDataTransfer(property.Value);
                    continue;
                }
                if (property.NameEquals("extensionConfiguration"))
                {
                    extensionConfiguration = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("endpoint"))
                {
                    endpoint = EndpointBase.DeserializeEndpointBase(property.Value);
                    continue;
                }
                if (property.NameEquals("image"))
                {
                    image = ImageProperties.DeserializeImageProperties(property.Value);
                    continue;
                }
                if (property.NameEquals("samplingOptions"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    samplingOptions = SamplingOptions.DeserializeSamplingOptions(property.Value);
                    continue;
                }
                if (property.NameEquals("@type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("inputs"))
                {
                    List <NodeInput> array = new List <NodeInput>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(NodeInput.DeserializeNodeInput(item));
                    }
                    inputs = array;
                    continue;
                }
            }
            return(new GrpcExtension(type, name, inputs, endpoint, image, samplingOptions.Value, dataTransfer, extensionConfiguration.Value));
        }
Ejemplo n.º 3
0
        internal static VideoSink DeserializeVideoSink(JsonElement element)
        {
            string videoName = default;
            Optional <VideoCreationProperties> videoCreationProperties = default;
            Optional <VideoPublishingOptions>  videoPublishingOptions  = default;
            string            localMediaCachePath           = default;
            string            localMediaCacheMaximumSizeMiB = default;
            string            type   = default;
            string            name   = default;
            IList <NodeInput> inputs = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("videoName"))
                {
                    videoName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("videoCreationProperties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    videoCreationProperties = VideoCreationProperties.DeserializeVideoCreationProperties(property.Value);
                    continue;
                }
                if (property.NameEquals("videoPublishingOptions"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    videoPublishingOptions = VideoPublishingOptions.DeserializeVideoPublishingOptions(property.Value);
                    continue;
                }
                if (property.NameEquals("localMediaCachePath"))
                {
                    localMediaCachePath = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("localMediaCacheMaximumSizeMiB"))
                {
                    localMediaCacheMaximumSizeMiB = 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("inputs"))
                {
                    List <NodeInput> array = new List <NodeInput>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(NodeInput.DeserializeNodeInput(item));
                    }
                    inputs = array;
                    continue;
                }
            }
            return(new VideoSink(type, name, inputs, videoName, videoCreationProperties.Value, videoPublishingOptions.Value, localMediaCachePath, localMediaCacheMaximumSizeMiB));
        }