diff --git a/obs-websocket-dotnet/Types/MediaInputStatus.cs b/obs-websocket-dotnet/Types/MediaInputStatus.cs index 4df0fab..93bb677 100644 --- a/obs-websocket-dotnet/Types/MediaInputStatus.cs +++ b/obs-websocket-dotnet/Types/MediaInputStatus.cs @@ -1,5 +1,4 @@ -using System; -using Newtonsoft.Json; +using Newtonsoft.Json; using Newtonsoft.Json.Linq; namespace OBSWebsocketDotNet.Types @@ -13,34 +12,19 @@ public class MediaInputStatus /// State of the media input /// [JsonProperty(PropertyName = "mediaState")] - public string StateString { get; set; } - - /// - /// State of the media input - /// - public MediaState? State - { - get - { - if (!Enum.TryParse(StateString, out MediaState state)) - { - return null; - } - return state; - } - } + public string State { get; set; } /// /// Total duration of the playing media in milliseconds. `null` if not playing /// [JsonProperty(PropertyName = "mediaDuration")] - public long? Duration { get; set; } + public int? Duration { get; set; } /// /// Position of the cursor in milliseconds. `null` if not playing /// [JsonProperty(PropertyName = "mediaCursor")] - public long? Cursor { get; set; } + public int? Cursor { get; set; } /// /// Instantiate from JObject @@ -56,50 +40,4 @@ public MediaInputStatus(JObject body) /// public MediaInputStatus() { } } - - /// - /// Enum representing the state of a media input - /// - public enum MediaState - { - /// - /// No media is loaded - /// - OBS_MEDIA_STATE_NONE, - - /// - /// Media is playing - /// - OBS_MEDIA_STATE_PLAYING, - - /// - /// Media is opening - /// - OBS_MEDIA_STATE_OPENING, - - /// - /// Media is buffering - /// - OBS_MEDIA_STATE_BUFFERING, - - /// - /// Media is playing but is paused - /// - OBS_MEDIA_STATE_PAUSED, - - /// - /// Media is stopped - /// - OBS_MEDIA_STATE_STOPPED, - - /// - /// Media is ended - /// - OBS_MEDIA_STATE_ENDED, - - /// - /// Media has errored - /// - OBS_MEDIA_STATE_ERROR - } } diff --git a/obs-websocket-dotnet/Types/OBSVideoSettings.cs b/obs-websocket-dotnet/Types/OBSVideoSettings.cs index 77bbf25..87eedfe 100644 --- a/obs-websocket-dotnet/Types/OBSVideoSettings.cs +++ b/obs-websocket-dotnet/Types/OBSVideoSettings.cs @@ -11,36 +11,36 @@ public class ObsVideoSettings /// Numerator of the fractional FPS value /// [JsonProperty(PropertyName = "fpsNumerator")] - public double FpsNumerator { set; get; } + public double FpsNumerator { internal set; get; } /// /// Denominator of the fractional FPS value /// [JsonProperty(PropertyName = "fpsDenominator")] - public double FpsDenominator { set; get; } + public double FpsDenominator { internal set; get; } /// /// Base (canvas) width /// [JsonProperty(PropertyName = "baseWidth")] - public int BaseWidth { set; get; } + public int BaseWidth { internal set; get; } /// /// Base (canvas) height /// [JsonProperty(PropertyName = "baseHeight")] - public int BaseHeight { set; get; } + public int BaseHeight { internal set; get; } /// /// Width of the output resolution in pixels /// [JsonProperty(PropertyName = "outputWidth")] - public int OutputWidth { set; get; } + public int OutputWidth { internal set; get; } /// /// Height of the output resolution in pixels /// [JsonProperty(PropertyName = "outputHeight")] - public int OutputHeight { set; get; } + public int OutputHeight { internal set; get; } } } \ No newline at end of file diff --git a/obs-websocket-dotnet/Types/OutputStateChanged.cs b/obs-websocket-dotnet/Types/OutputStateChanged.cs index f3fa88b..7df9d85 100644 --- a/obs-websocket-dotnet/Types/OutputStateChanged.cs +++ b/obs-websocket-dotnet/Types/OutputStateChanged.cs @@ -35,11 +35,29 @@ public OutputState State { return state.Value; } - if (!Enum.TryParse(StateStr, ignoreCase: true, out OutputState stateTmp)) + switch (StateStr) { - throw new ArgumentOutOfRangeException($"Couldn't parse '{StateStr}' as {nameof(OutputState)}"); + case "OBS_WEBSOCKET_OUTPUT_STARTING": + state = OutputState.OBS_WEBSOCKET_OUTPUT_STARTING; + break; + case "OBS_WEBSOCKET_OUTPUT_STARTED": + state = OutputState.OBS_WEBSOCKET_OUTPUT_STARTED; + break; + case "OBS_WEBSOCKET_OUTPUT_STOPPING": + state = OutputState.OBS_WEBSOCKET_OUTPUT_STOPPING; + break; + case "OBS_WEBSOCKET_OUTPUT_STOPPED": + state = OutputState.OBS_WEBSOCKET_OUTPUT_STOPPED; + break; + case "OBS_WEBSOCKET_OUTPUT_PAUSED": + state = OutputState.OBS_WEBSOCKET_OUTPUT_PAUSED; + break; + case "OBS_WEBSOCKET_OUTPUT_RESUMED": + state = OutputState.OBS_WEBSOCKET_OUTPUT_RESUMED; + break; + default: + throw new ArgumentOutOfRangeException(); } - state = stateTmp; return state.Value; } diff --git a/obs-websocket-dotnet/Types/StreamingServiceSettings.cs b/obs-websocket-dotnet/Types/StreamingServiceSettings.cs index 58aa1f1..fae5236 100644 --- a/obs-websocket-dotnet/Types/StreamingServiceSettings.cs +++ b/obs-websocket-dotnet/Types/StreamingServiceSettings.cs @@ -1,6 +1,4 @@ -using System.Collections.Generic; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; +using Newtonsoft.Json; namespace OBSWebsocketDotNet.Types { @@ -38,23 +36,5 @@ public class StreamingServiceSettings /// [JsonProperty(PropertyName = "password")] public string Password { set; get; } - - /// - /// The service being used to stream - /// - [JsonProperty(PropertyName = "service")] - public string Service { get; set; } - - /// - /// The protocol to use for the stream - /// - [JsonProperty(PropertyName = "protocol")] - public string Protocol { get; set; } - - /// - /// Other values not covered by the class - /// - [JsonExtensionData] - public Dictionary OtherValues { get; set; } } } \ No newline at end of file