Skip to content

Commit

Permalink
* Now checking for running OBS versions -before- starting it automati…
Browse files Browse the repository at this point in the history
…cally
  • Loading branch information
tryallthethings committed May 15, 2023
1 parent 6950e9d commit 9073b1d
Showing 1 changed file with 33 additions and 31 deletions.
64 changes: 33 additions & 31 deletions Flexstudio for OBS/FormDashboard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,39 @@ public FormDashboard()
if (sett.ing.HasKeyWithValue("defaultDrive"))
sett.ing.DriveIsMapped = HelperFunctions.CheckSubstDrive(char.Parse(sett.ing["defaultDrive"]));

if (sett.ing.HasKeyWithValue("DefaultOBSversion"))
{
if (Directory.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, sett.ing["DefaultOBSversion"])))
{
lblDefaultOBS.Text = sett.ing["DefaultOBSversion"];

// Default OBS version set. Let's check, if it's already running
var obsVersion = HelperFunctions.FindObsVersionInPath(sett.ing["DefaultOBSpath"]);
Process proc = HelperFunctions.OBSrunningForFolder(obsVersion);
if (proc != null)
{
lock (GlobalState.ObsProcessesLock)
{
if (!GlobalState.ObsProcesses.ContainsKey(obsVersion.FolderName))
{
proc.Exited += (senderObj, eArgs) => MainFormReference.Process_Exited(senderObj, null, obsVersion.FolderName);
GlobalState.ObsProcesses[obsVersion.FolderName] = proc;
}
}
}
}
else
{
UsrMsg.Show("defaultOBSversionRemoved", MessageType.Error);
sett.ing["DefaultOBSversion"] = "";
lblDefaultOBS.Text = trans.Me("dashboardOBSdefaultVersionNotSetHint");
}
}
else
{
lblDefaultOBS.Text = trans.Me("dashboardOBSdefaultVersionNotSetHint");
}

if (!sett.ing.DriveIsMapped)
{
CanMapDrive();
Expand Down Expand Up @@ -72,38 +105,7 @@ public FormDashboard()
btnStartOBS.Enabled = true;
}

if (sett.ing.HasKeyWithValue("DefaultOBSversion"))
{
if (Directory.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, sett.ing["DefaultOBSversion"])))
{
lblDefaultOBS.Text = sett.ing["DefaultOBSversion"];

// Default OBS version set. Let's check, if it's already running
var obsVersion = HelperFunctions.FindObsVersionInPath(sett.ing["DefaultOBSpath"]);
Process proc = HelperFunctions.OBSrunningForFolder(obsVersion);
if (proc != null)
{
lock (GlobalState.ObsProcessesLock)
{
if (!GlobalState.ObsProcesses.ContainsKey(obsVersion.FolderName))
{
proc.Exited += (senderObj, eArgs) => MainFormReference.Process_Exited(senderObj, null, obsVersion.FolderName);
GlobalState.ObsProcesses[obsVersion.FolderName] = proc;
}
}
}
}
else
{
UsrMsg.Show("defaultOBSversionRemoved", MessageType.Error);
sett.ing["DefaultOBSversion"] = "";
lblDefaultOBS.Text = trans.Me("dashboardOBSdefaultVersionNotSetHint");
}
}
else
{
lblDefaultOBS.Text = trans.Me("dashboardOBSdefaultVersionNotSetHint");
}

}

Expand Down

0 comments on commit 9073b1d

Please sign in to comment.