diff options
| author | Michael <[email protected]> | 2017-02-19 10:11:50 -0500 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-02-19 10:11:50 -0500 |
| commit | 1a0d863263eed70268ae110d0f6b546a8e09325a (patch) | |
| tree | 7cdc126118d98e18c962d947d22768285218e5e6 /ShiftOS_TheReturn/Commands.cs | |
| parent | 12b520e981d6ec498b819c4d6340eb8b75c5f9ea (diff) | |
| download | shiftos_thereturn-1a0d863263eed70268ae110d0f6b546a8e09325a.tar.gz shiftos_thereturn-1a0d863263eed70268ae110d0f6b546a8e09325a.tar.bz2 shiftos_thereturn-1a0d863263eed70268ae110d0f6b546a8e09325a.zip | |
fix bug with win.open type prober
Diffstat (limited to 'ShiftOS_TheReturn/Commands.cs')
| -rw-r--r-- | ShiftOS_TheReturn/Commands.cs | 60 |
1 files changed, 34 insertions, 26 deletions
diff --git a/ShiftOS_TheReturn/Commands.cs b/ShiftOS_TheReturn/Commands.cs index 401d1f3..f58ceff 100644 --- a/ShiftOS_TheReturn/Commands.cs +++ b/ShiftOS_TheReturn/Commands.cs @@ -615,41 +615,45 @@ shiftorium.buy{{upgrade:""{upg.ID}""}}"); if (asmExec.EndsWith(".exe") || asmExec.EndsWith(".dll")) { var asm = Assembly.LoadFile(asmExec); - - foreach (var type in asm.GetTypes()) + try { - if (type.BaseType == typeof(UserControl)) + foreach (var type in asm.GetTypes()) { - foreach (var attr in type.GetCustomAttributes(false)) + if (type.BaseType == typeof(UserControl)) { - if (attr is WinOpenAttribute) + foreach (var attr in type.GetCustomAttributes(false)) { - if (app == (attr as WinOpenAttribute).ID) + if (attr is WinOpenAttribute) { - if (SaveSystem.CurrentSave.Upgrades.ContainsKey(app)) + if (app == (attr as WinOpenAttribute).ID) { - if (Shiftorium.UpgradeInstalled(app)) + if (SaveSystem.CurrentSave.Upgrades.ContainsKey(app)) { - IShiftOSWindow frm = Activator.CreateInstance(type) as IShiftOSWindow; - AppearanceManager.SetupWindow(frm); - return true; + if (Shiftorium.UpgradeInstalled(app)) + { + IShiftOSWindow frm = Activator.CreateInstance(type) as IShiftOSWindow; + AppearanceManager.SetupWindow(frm); + return true; + } + else + { + throw new Exception($"{app} was not found on your system! Try looking in the shiftorium..."); + } } else { - throw new Exception($"{app} was not found on your system! Try looking in the shiftorium..."); + IShiftOSWindow frm = Activator.CreateInstance(type) as IShiftOSWindow; + AppearanceManager.SetupWindow(frm); + return true; } } - else - { - IShiftOSWindow frm = Activator.CreateInstance(type) as IShiftOSWindow; - AppearanceManager.SetupWindow(frm); - return true; - } } } } } } + catch { } + } } @@ -660,24 +664,28 @@ shiftorium.buy{{upgrade:""{upg.ID}""}}"); { if (asmExec.EndsWith(".exe") || asmExec.EndsWith(".dll")) { - var asm = Assembly.LoadFile(asmExec); - - foreach (var type in asm.GetTypes()) + try { - if (type.GetInterfaces().Contains(typeof(IShiftOSWindow))) + var asm = Assembly.LoadFile(asmExec); + + foreach (var type in asm.GetTypes()) { - foreach (var attr in type.GetCustomAttributes(false)) + if (type.GetInterfaces().Contains(typeof(IShiftOSWindow))) { - if (attr is WinOpenAttribute) + foreach (var attr in type.GetCustomAttributes(false)) { - if (Shiftorium.UpgradeAttributesUnlocked(type)) + if (attr is WinOpenAttribute) { - Console.WriteLine("win.open{app:\"" + (attr as WinOpenAttribute).ID + "\"}"); + if (Shiftorium.UpgradeAttributesUnlocked(type)) + { + Console.WriteLine("win.open{app:\"" + (attr as WinOpenAttribute).ID + "\"}"); + } } } } } } + catch { } } } |
