public static bool CloseWindow(Dictionary <string, object> args) { int winNum = -1; if (args.ContainsKey("win")) { winNum = Convert.ToInt32(args["win"].ToString()); } string err = null; if (winNum < 0 || winNum >= AppearanceManager.OpenForms.Count) { err = Localization.Parse("{ERR_BADWINID}", new Dictionary <string, string> { ["%max"] = (AppearanceManager.OpenForms.Count - 1).ToString() }); } if (string.IsNullOrEmpty(err)) { Console.WriteLine("{RES_WINDOWCLOSED}"); AppearanceManager.Close(AppearanceManager.OpenForms[winNum].ParentWindow); } else { Console.WriteLine(err); } return(true); }
public static bool Shutdown() { SaveSystem.ShuttingDown = true; TerminalBackend.InvokeCommand("sos.save"); AppearanceManager.Exit(); return(true); }
/// <summary> /// Creates a new save, starting the Out Of Box Experience (OOBE). /// </summary> public static void NewSave() { AppearanceManager.Invoke(new Action(() => { CurrentSave = new Save(); CurrentSave.Codepoints = 0; CurrentSave.Upgrades = new Dictionary <string, bool>(); Shiftorium.Init(); oobe.Start(CurrentSave); })); }
public static bool Shutdown() { SaveSystem.SaveGame(); AppearanceManager.Exit(); return(true); }
public static bool Open(Dictionary <string, object> args) { try { if (args.ContainsKey("app")) { var app = args["app"] as string; //ANNND now we start reflecting... foreach (var asmExec in System.IO.Directory.GetFiles(Environment.CurrentDirectory)) { if (asmExec.EndsWith(".exe") || asmExec.EndsWith(".dll")) { var asm = Assembly.LoadFile(asmExec); foreach (var type in asm.GetTypes()) { if (type.BaseType == typeof(UserControl)) { foreach (var attr in type.GetCustomAttributes(false)) { if (attr is WinOpenAttribute) { if (app == (attr as WinOpenAttribute).ID) { if (SaveSystem.CurrentSave.Upgrades.ContainsKey(app)) { 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 { IShiftOSWindow frm = Activator.CreateInstance(type) as IShiftOSWindow; AppearanceManager.SetupWindow(frm); return(true); } } } } } } } } } else { Console.WriteLine("Please specify a valid 'app' param."); return(true); } Console.WriteLine("Couldn't find the specified app on your system."); return(true); } catch (Exception ex) { Console.WriteLine("Error running script:" + ex); return(false); } }
public override void Invoke(Dictionary <string, object> args) { AppearanceManager.SetupWindow((IShiftOSWindow)Activator.CreateInstance(ShiftOSWindow, null)); }