Beispiel #1
0
        internal RenderingSession(string sessionId, RenderingServerSize size, RenderingSessionStatus status)
        {
            if (sessionId == null)
            {
                throw new ArgumentNullException(nameof(sessionId));
            }

            SessionId = sessionId;
            Size      = size;
            Status    = status;
        }
Beispiel #2
0
 internal RenderingSession(string sessionId, int?arrInspectorPort, int?handshakePort, int?elapsedTimeMinutes, string host, int?maxLeaseTimeMinutes, RenderingServerSize size, RenderingSessionStatus status, float?teraflops, RemoteRenderingServiceError error, DateTimeOffset?createdOn)
 {
     SessionId          = sessionId;
     ArrInspectorPort   = arrInspectorPort;
     HandshakePort      = handshakePort;
     ElapsedTimeMinutes = elapsedTimeMinutes;
     Host = host;
     MaxLeaseTimeMinutes = maxLeaseTimeMinutes;
     Size      = size;
     Status    = status;
     Teraflops = teraflops;
     Error     = error;
     CreatedOn = createdOn;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="RenderingSession"/> class for mocking purposes.
 /// </summary>
 public static RenderingSession RenderingSession(string sessionId, int?arrInspectorPort, int?handshakePort, int?elapsedTimeMinutes, string host, int?maxLeaseTimeMinutes, RenderingServerSize size, RenderingSessionStatus status, float?teraflops, RemoteRenderingServiceError error, DateTimeOffset?createdOn)
 => new RenderingSession(sessionId, arrInspectorPort, handshakePort, elapsedTimeMinutes, host, maxLeaseTimeMinutes, size, status, teraflops, error, createdOn);
 /// <summary> Initializes a new instance of RenderingSessionOptions. </summary>
 /// <param name="maxLeaseTimeMinutes"> The time in minutes the session will run after reaching the &apos;Ready&apos; state. </param>
 /// <param name="size"> Size of the server used for the rendering session. Remote Rendering with Standard size server has a maximum scene size of 20 million polygons. Remote Rendering with Premium size does not enforce a hard maximum, but performance may be degraded if your content exceeds the rendering capabilities of the service. </param>
 internal RenderingSessionOptions(int maxLeaseTimeMinutes, RenderingServerSize size)
 {
     MaxLeaseTimeMinutes = maxLeaseTimeMinutes;
     Size = size;
 }
 /// <summary> Initializes a new instance of RenderingSessionOptions. </summary>
 /// <param name="maxLeaseTime"> The time the session will run after reaching the &apos;Ready&apos; state. The provided values will be rounded to the nearest minute. </param>
 /// <param name="size"> Size of the server used for the rendering session. Remote Rendering with Standard size server has a maximum scene size of 20 million polygons. Remote Rendering with Premium size does not enforce a hard maximum, but performance may be degraded if your content exceeds the rendering capabilities of the service. </param>
 public RenderingSessionOptions(TimeSpan maxLeaseTime, RenderingServerSize size)
 {
     MaxLeaseTimeMinutes = (int)Math.Round(maxLeaseTime.TotalMinutes);
     Size = size;
 }
        internal static RenderingSession DeserializeRenderingSession(JsonElement element)
        {
            string                 id = default;
            Optional <int>         arrInspectorPort    = default;
            Optional <int>         handshakePort       = default;
            Optional <int>         elapsedTimeMinutes  = default;
            Optional <string>      hostname            = default;
            Optional <int>         maxLeaseTimeMinutes = default;
            RenderingServerSize    size                  = default;
            RenderingSessionStatus status                = default;
            Optional <float>       teraflops             = default;
            Optional <RemoteRenderingServiceError> error = default;
            Optional <DateTimeOffset> creationTime       = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("arrInspectorPort"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    arrInspectorPort = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("handshakePort"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    handshakePort = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("elapsedTimeMinutes"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    elapsedTimeMinutes = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("hostname"))
                {
                    hostname = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("maxLeaseTimeMinutes"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    maxLeaseTimeMinutes = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("size"))
                {
                    size = new RenderingServerSize(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("status"))
                {
                    status = new RenderingSessionStatus(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("teraflops"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    teraflops = property.Value.GetSingle();
                    continue;
                }
                if (property.NameEquals("error"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        error = null;
                        continue;
                    }
                    error = RemoteRenderingServiceError.DeserializeRemoteRenderingServiceError(property.Value);
                    continue;
                }
                if (property.NameEquals("creationTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    creationTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
            }
            return(new RenderingSession(id, Optional.ToNullable(arrInspectorPort), Optional.ToNullable(handshakePort), Optional.ToNullable(elapsedTimeMinutes), hostname.Value, Optional.ToNullable(maxLeaseTimeMinutes), size, status, Optional.ToNullable(teraflops), error.Value, Optional.ToNullable(creationTime)));
        }