diff --git a/Flexstudio for OBS/FormDashboard.cs b/Flexstudio for OBS/FormDashboard.cs index 37634ee..3c8f15a 100644 --- a/Flexstudio for OBS/FormDashboard.cs +++ b/Flexstudio for OBS/FormDashboard.cs @@ -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(); @@ -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"); - } }