Skip to content

Commit

Permalink
fix SceneSourceSelector (OBS5), lost credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
PhoenixWyllow committed Jan 5, 2023
1 parent 84967a4 commit 96757a8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions GUI/PluginConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public PluginConfig()
{
credentials = credentialsList[0];
}
if (credentials != null)
if (credentials != null && credentials.ContainsKey("host") && credentials.ContainsKey("password"))
{
this.host.Text = credentials["host"];
this.password.Text = credentials["password"];
Expand All @@ -50,7 +50,7 @@ public PluginConfig()
this.host.Text = "ws://127.0.0.1:4455";
}

var versionTypeFound = Enum.TryParse<OBSWebSocketVersionType>(PluginConfiguration.GetValue(PluginInstance.Main, "versionType"), out OBSWebSocketVersionType versionType);
var versionTypeFound = Enum.TryParse(PluginConfiguration.GetValue(PluginInstance.Main, "versionType"), out OBSWebSocketVersionType versionType);
SetVersionTypeSelected(versionTypeFound ? versionType : OBSWebSocketVersionType.OBS_WEBSOCKET_AUTO);

var timeoutFound = int.TryParse(PluginConfiguration.GetValue(PluginInstance.Main, "timeout"), out int timeout);
Expand Down
5 changes: 3 additions & 2 deletions GUI/SceneSourceSelector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,16 @@ private void LoadSources()
else
{
var self = this;
var sceneName = scenesBox.Text;
_ = Task.Run(async () =>
{
var response = await PluginInstance.Main.OBS5.SceneItemsRequests.GetSceneItemListAsync(scenesBox.Text);
var response = await PluginInstance.Main.OBS5.SceneItemsRequests.GetSceneItemListAsync(sceneName);
if (response != null)
{
foreach (JObject sceneItem in response.SceneItems)
{
var name = sceneItem["sourceName"]?.ToString();
if (!String.IsNullOrEmpty(name))
if (!string.IsNullOrEmpty(name))
{
sourcesBox.Invoke((MethodInvoker)delegate { sourcesBox.Items.Add(name); });
}
Expand Down

0 comments on commit 96757a8

Please sign in to comment.