Beispiel #1
0
 internal MediaCompositionLayout(LayoutResolution resolution, GridLayoutOptions grid, AutoGridLayoutOptions autoGrid, PresenterLayoutOptions presenter, PresentationLayoutOptions presentation, CustomLayoutOptions custom, string placeholderImageUri, LayoutType?kind)
 {
     Resolution          = resolution;
     Grid                = grid;
     AutoGrid            = autoGrid;
     Presenter           = presenter;
     Presentation        = presentation;
     Custom              = custom;
     PlaceholderImageUri = placeholderImageUri;
     Kind                = kind;
 }
Beispiel #2
0
        internal static MediaCompositionLayout DeserializeMediaCompositionLayout(JsonElement element)
        {
            Optional <LayoutResolution>          resolution   = default;
            Optional <GridLayoutOptions>         grid         = default;
            Optional <AutoGridLayoutOptions>     autoGrid     = default;
            Optional <PresenterLayoutOptions>    presenter    = default;
            Optional <PresentationLayoutOptions> presentation = default;
            Optional <CustomLayoutOptions>       custom       = default;
            Optional <string>     placeholderImageUri         = default;
            Optional <LayoutType> kind = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("resolution"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    resolution = LayoutResolution.DeserializeLayoutResolution(property.Value);
                    continue;
                }
                if (property.NameEquals("grid"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    grid = GridLayoutOptions.DeserializeGridLayoutOptions(property.Value);
                    continue;
                }
                if (property.NameEquals("autoGrid"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    autoGrid = AutoGridLayoutOptions.DeserializeAutoGridLayoutOptions(property.Value);
                    continue;
                }
                if (property.NameEquals("presenter"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    presenter = PresenterLayoutOptions.DeserializePresenterLayoutOptions(property.Value);
                    continue;
                }
                if (property.NameEquals("presentation"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    presentation = PresentationLayoutOptions.DeserializePresentationLayoutOptions(property.Value);
                    continue;
                }
                if (property.NameEquals("custom"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    custom = CustomLayoutOptions.DeserializeCustomLayoutOptions(property.Value);
                    continue;
                }
                if (property.NameEquals("placeholderImageUri"))
                {
                    placeholderImageUri = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("kind"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    kind = new LayoutType(property.Value.GetString());
                    continue;
                }
            }
            return(new MediaCompositionLayout(resolution.Value, grid.Value, autoGrid.Value, presenter.Value, presentation.Value, custom.Value, placeholderImageUri.Value, Optional.ToNullable(kind)));
        }