public void SetupTerminal() { //just so that the terminal can access our save SaveSystem.CurrentSave = MySave; Applications.Terminal.MakeWidget(txtterm); TerminalBackend.InStory = false; TerminalBackend.PrefixEnabled = true; Console.WriteLine("{TERMINAL_TUTORIAL_1}"); SaveSystem.TransferCodepointsFrom("oobe", 50); Shiftorium.Installed += () => { if (SaveSystem.CurrentSave.StoryPosition < 5) { if (Shiftorium.UpgradeInstalled("mud_fundamentals")) { Console.WriteLine("{TERMINAL_TUTORIAL_2}"); txtterm.Height -= pgsystemstatus.Height - 4; pgsystemstatus.Show(); StartInstall(); } } }; }
protected override Size MeasureOverride(Size constraint) { int topHeight = 0; int bottomHeight = 0; int leftHeight = 0; int rightHeight = 0; if (Shiftorium.UpgradeInstalled("wm_titlebar")) { topHeight = LoadedSkin.TitlebarHeight; } if (Shiftorium.UpgradeInstalled("wm_free_placement")) { bottomHeight = LoadedSkin.BottomBorderWidth; leftHeight = LoadedSkin.LeftBorderWidth; rightHeight = LoadedSkin.RightBorderWidth; } if (_isWPF) { return(new Size( leftHeight + _parent.Width + rightHeight, topHeight + _parent.Height + bottomHeight)); } else { return(new Size( leftHeight + _wParent.Width + rightHeight, topHeight + _wParent.Height + bottomHeight)); } }
private void Populate() { cats = Shiftorium.GetCategories(); upgrades = new Dictionary <string, ShiftoriumUpgrade> [cats.Length]; int numComplete = 0; avail = backend.GetAvailable(); foreach (var it in cats.Select((catName, catId) => new { catName, catId })) { var upl = new Dictionary <string, ShiftoriumUpgrade>(); upgrades[it.catId] = upl; var t = new Thread((tupobj) => { foreach (var upg in avail.Where(x => x.Category == it.catName)) { upl.Add(Localization.Parse(upg.Name) + " - " + upg.Cost.ToString() + "CP", upg); } numComplete++; }); t.Start(); } while (numComplete < cats.Length) { } // wait for all threads to finish their job }
private void lvitems_SelectedIndexChanged(object sender, EventArgs e) { try { if (currentdir != "__system") { var itm = lvitems.SelectedItems[0]; if (itm.Tag.ToString() != "__..") { if (DirectoryExists(currentdir + "/" + itm.Tag.ToString())) { deleteToolStripMenuItem.Visible = Shiftorium.UpgradeInstalled("fs_recursive_delete"); moveToolStripMenuItem.Visible = Shiftorium.UpgradeInstalled("fs_move_folder"); copyToolStripMenuItem.Visible = Shiftorium.UpgradeInstalled("fs_copy_folder"); } else if (FileExists(currentdir + "/" + itm.Tag.ToString())) { deleteToolStripMenuItem.Visible = Shiftorium.UpgradeInstalled("fs_delete"); moveToolStripMenuItem.Visible = Shiftorium.UpgradeInstalled("fs_move"); copyToolStripMenuItem.Visible = Shiftorium.UpgradeInstalled("fs_copy"); } } } } catch { moveToolStripMenuItem.Visible = false; copyToolStripMenuItem.Visible = false; } }
public void PopulateAppLauncher(LauncherItem[] items) { apps.DropDownItems.Clear(); foreach (var kv in items) { var item = new ToolStripMenuItem(); item.Text = kv.DisplayData.Name; item.Click += (o, a) => { Engine.AppearanceManager.SetupWindow(Activator.CreateInstance(kv.LaunchType) as IShiftOSWindow); }; apps.DropDownItems.Add(item); } if (Shiftorium.UpgradeInstalled("al_shutdown")) { apps.DropDownItems.Add(new ToolStripSeparator()); var item = new ToolStripMenuItem(); item.Text = Localization.Parse("{SHUTDOWN}"); item.Click += (o, a) => { TerminalBackend.InvokeCommand("sos.shutdown"); }; apps.DropDownItems.Add(item); } }
public void OpenFile(string path) { bool opened = true; string ext = path.Split('.')[path.Split('.').Length - 1]; switch (ext) { case "txt": if (Shiftorium.UpgradeInstalled("textpad_open")) { var txt = new TextPad(); txt.LoadFile(path); AppearanceManager.SetupWindow(txt); } else { opened = false; } break; case "pic": case "png": case "jpg": case "bmp": break; case "wav": case "mp3": break; case "lua": break; case "py": break; case "skn": break; case "mfs": Utils.MountPersistent(path); string mount = (Utils.Mounts.Count - 1).ToString() + ":"; OpenDirectory(mount); break; default: opened = false; break; } if (opened == false) { Infobox.Show("File Skimmer - Can't open file", "File Skimmer can't find an application to open this file!"); } }
protected override void Run() { this.SetStatus("Downloading..."); SetProgress(0); int i = 0; while (i <= Size) { double progress = ((i / Size) * 100); SetProgress((int)progress); i += Applications.DownloadManager.GetDownloadSpeed(); Thread.Sleep(1000); } SetProgress(0); SetStatus("Installing..."); i = 0; while (i <= Size) { double progress = ((i / Size) * 100); SetProgress((int)progress); i += 1024; Thread.Sleep(1000); } Desktop.InvokeOnWorkerThread(() => { Shiftorium.Buy(ShiftoriumId, 0); Infobox.Show("Install complete!", "The installation of " + Name + " has completed."); SaveSystem.SaveGame(); }); }
private void pnlright_MouseDown(object sender, MouseEventArgs e) { if (Shiftorium.UpgradeInstalled("resizable_windows")) { resizing = true; } }
public void OnUpgrade() { lbupgrades.SelectionMode = (UpgradeInstalled("shiftorium_gui_bulk_buy") == true) ? SelectionMode.MultiExtended : SelectionMode.One; lbcodepoints.Visible = Shiftorium.UpgradeInstalled("shiftorium_gui_codepoints_display"); Populate(); SetList(); }
private void Populate() { cats = Shiftorium.GetCategories(); upgrades = new Dictionary <string, ShiftoriumUpgrade> [cats.Length]; int numComplete = 0; avail = backend.GetAvailable(); foreach (var it in cats.Select((catName, catId) => new { catName, catId })) { var upl = new Dictionary <string, ShiftoriumUpgrade>(); upgrades[it.catId] = upl; var t = new Thread((tupobj) => { foreach (var upg in avail.Where(x => x.Category == it.catName)) { upl.Add(Localization.Parse(upg.Name) + " - " + upg.Cost.ToString() + "CP", upg); } if (it.catId == CategoryId) { this.Invoke(new Action(() => { SetList(); })); } numComplete++; }); t.Start(); } }
private void wbmain_NewWindow(object sender, CancelEventArgs e) { e.Cancel = true; if (Shiftorium.UpgradeInstalled("web_browser_new_window")) { AppearanceManager.SetupWindow(new WebBrowser()); } }
/// <summary> /// Pnltitles the mouse move. /// </summary> /// <returns>The mouse move.</returns> /// <param name="sender">Sender.</param> /// <param name="e">E.</param> private void pnltitle_MouseMove(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left && Shiftorium.UpgradeInstalled("draggable_windows")) { ReleaseCapture(); SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0); } }
public void Setup() { lbupgrades.Items.Clear(); foreach (var itm in Shiftorium.GetAvailable()) { lbupgrades.Items.Add(itm.Name); } }
public void PopulateAppLauncher() { appsmenu.Children.Clear(); double biggestWidth = 0; appsmenu.Background = LoadedSkin.Menu_ToolStripDropDownBackground.CreateBrush(); foreach (var kv in AppLauncherDaemon.Available()) { var item = new Button(); if (kv.LaunchType.BaseType == typeof(System.Windows.Forms.UserControl)) { item.Content = kv.DisplayData.Name + " (Legacy)"; } else { item.Content = kv.DisplayData.Name; } item.Margin = new Thickness(2); double measure = item.Content.ToString().Measure(LoadedSkin.MainFont); if (measure > biggestWidth) { biggestWidth = measure; } item.Click += (o, a) => { AppearanceManager.SetupWindow(Activator.CreateInstance(kv.LaunchType) as IShiftOSWindow); appsmenu.Visibility = Visibility.Hidden; }; item.HorizontalAlignment = HorizontalAlignment.Stretch; appsmenu.Children.Add(item); } if (Shiftorium.UpgradeInstalled("al_shutdown")) { var item = new Button(); item.Content = ShiftOS.Engine.Localization.Parse("{SHUTDOWN}"); item.Margin = new Thickness(2); double measure = item.Content.ToString().Measure(LoadedSkin.MainFont); if (measure > biggestWidth) { biggestWidth = measure; } item.Click += (o, a) => { TerminalBackend.InvokeCommand("sos.shutdown"); }; appsmenu.Children.Add(item); } appsmenu.Width = biggestWidth + 50; SkinAppLauncher(); }
public void SetLastText() { if (SaveSystem.CurrentSave != null) { if (!Shiftorium.UpgradeInstalled("window_manager")) { AppearanceManager.LastTerminalText = UnderlyingControl.Text; } } }
public ShiftoriumUpgrade GetUpgradeFromName(string upg) { foreach (var upgrade in Shiftorium.GetDefaults()) { if (upgrade.Name == upg) { return(upgrade); } } return(null); }
private static Visibility getVisibility(string upg) { if (Shiftorium.UpgradeInstalled(upg)) { return(Visibility.Visible); } else { return(Visibility.Collapsed); } }
public static void SentiencesLikeGods() { Story.Context.AutoComplete = false; Applications.Chat chat = null; Desktop.InvokeOnWorkerThread(() => { chat = OpenChat(); }); while (chat == null) { Thread.Sleep(10); } CurrentChat = chat; chat.ChatID = "devx@system"; chat.ShowChat(); SendChatMessage("maureen_fenn", "Hey, you remember when I told you to come see me if you wanted to become a real hacker?"); SendChatMessage("maureen_fenn", "Well, it's now time you learn about port scanners, firewalls, and malware injection."); SendChatMessage("maureen_fenn", "You know, not everything involves password cracking and stealing from wide-open FTP servers."); SendChatMessage("maureen_fenn", "That's baby talk."); SendChatMessage("maureen_fenn", "Have you ever felt the rush of breaching the root account of a Codepoint bank and going on a 60-second long withdrawl-spree to see how much Codepoints you can get from as many users as possible?"); SendChatMessage("maureen_fenn", "Or maybe you felt like droppin' a little script on your buddy's Shiftnet website that makes it so everytime someone buys something, half the cash goes to you?"); SendChatMessage("maureen_fenn", "Or maybe you want to spy on someone, see what they're doing, without them knowing?"); SendChatMessage("maureen_fenn", "Whatever the case may be, brute is not going to help with that."); SendChatMessage("maureen_fenn", "What you need is my much more advanced and sophisticated toolset, consisting of a port scanner, network monitor, IP spoofer, and yes, an unreasonably convoluted user-interface."); SendChatMessage("maureen_fenn", "Also, you may want to get yourself a better window manager if you're still on the tiling WM. The WM Free Placement upgrade should do the trick."); SendChatMessage("maureen_fenn", "If you want to download my toolset, head to this underground Shiftnet URL: downunder/maureen_fenn/hacker_suite"); SendChatMessage("maureen_fenn", "Actually, you'll need it for our DevX exposition quest, so go get it now."); Action onGotWMFreePlacement = () => { Story.PushObjective("Sentiences Like Gods: Go down under.", "Head to the Shiftnet URL that Maureen sent you to get the advanced hacker's tool suite.", () => { return(Shiftorium.UpgradeInstalled("mf_hackertools")); }, () => { SendChatMessage("maureen_fenn", "Alright. When you're ready for a crash course, let me know."); Story.Context.MarkComplete(); }); }; if (Shiftorium.UpgradeInstalled("wm_free_placement")) { onGotWMFreePlacement.Invoke(); } else { SendChatMessage("maureen_fenn", "First, let's get you a better window manager."); Story.PushObjective("Sentiences Like Gods: A new window manager", "An application is only as good as its user interface allows it to be. That's the same for an operating system. Eventually, you'll need to be able to run more than just 4 programs at once, and you'll need a window manager that can place program windows of any size anywhere on screen. There are Shiftorium Upgrades for that. Let's get some.", () => { return(Shiftorium.UpgradeInstalled("wm_free_placement") && Shiftorium.UpgradeInstalled("wm_unlimited_windows")); }, onGotWMFreePlacement); } }
public override void SetupDialog(IShiftOSWindow form) { if (!Shiftorium.UpgradeAttributesUnlocked(form.GetType())) { Console.WriteLine("{APP_NOT_FOUND}"); return; } var wb = new WindowBorder(form as UserControl); wb.IsDialog = true; Desktop.ShowWindow(wb); }
private void btnopen_Click(object sender, RoutedEventArgs e) { string filters = ".txt"; if (Shiftorium.UpgradeInstalled("textpad_lua_support")) { filters += ";.lua"; } if (Shiftorium.UpgradeInstalled("textpad_python_support")) { filters += ";.py"; } FileSkimmerBackend.GetFile(filters.Split(';'), FileOpenerStyle.Open, new Action <string>((file) => LoadFile(file))); }
private void btnbuy_Click_1(object sender, RoutedEventArgs e) { var upg = this.DataContext as ShiftoriumUpgrade; Shiftorium.Silent = true; if (Shiftorium.Buy(upg.ID, upg.Cost) == true) { btnbuy.Visibility = Visibility.Collapsed; Setup(); } else { Infobox.Show("Shiftorium", $"You do not have enough Codepoints to buy this upgrade. You need {upg.Cost - SaveSystem.CurrentSave.Codepoints} more."); } }
public bool DependenciesInstalled(ShiftoriumUpgrade upg) { string[] split = upg.Dependencies.Split(';'); foreach (var u in split) { if (!u.StartsWith("appscape_handled")) { if (!Shiftorium.UpgradeInstalled(u)) { return(false); } } } return(true); }
private void apps_Click(object sender, EventArgs e) { if (Shiftorium.UpgradeInstalled("advanced_app_launcher")) { lbalstatus.Text = $@"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName} {SaveSystem.CurrentSave.Codepoints} Codepoints {Shiftorium.GetAvailable().Length} available, {SaveSystem.CurrentSave.CountUpgrades()} installed."; flapps.Controls.Clear(); apps.DropDown.Hide(); pnladvancedal.Location = new Point(0, (LoadedSkin.DesktopPanelPosition == 0) ? desktoppanel.Height : this.Height - pnladvancedal.Height - desktoppanel.Height); pnladvancedal.Visible = !pnladvancedal.Visible; pnladvancedal.BringToFront(); } }
private void buybtn_Click(object sender, EventArgs e) { if (Shiftorium.UpgradeInstalled("mindblow")) { Infobox.Show("Already Purchased", "You have already bought MindBlow."); } else if (SaveSystem.CurrentSave.Codepoints < 50000) { Infobox.Show("Not Enough Codepoints", "You do not have enough Codepoints to buy MindBlow."); } else { Shiftorium.Buy("mindblow", 50000); Infobox.Show("Installation Complete", "MindBlow has been successfully installed."); } }
public static void Universal_KeyDown(object o, KeyEventArgs a) { if (a.Control && a.KeyCode == Keys.T) { a.SuppressKeyPress = true; if (SaveSystem.CurrentSave != null) { if (Shiftorium.UpgradeInstalled("window_manager")) { Engine.AppearanceManager.SetupWindow(new Applications.Terminal()); } } } }
public static void PushObjectives() { Story.PushObjective("Buy the Skinning upgrade", "The Skinning upgrade will allow you to set pictures in place of solid colors for most UI elements. If you want richer customization and more Codepoints, this upgrade is a necessity.", () => { return(Shiftorium.UpgradeInstalled("skinning")); }, () => { Story.PushObjective("Buy the Skin Loader.", "The Skin Loader is an application that allows you to save and load .skn files containing Shifter skin data. These files can be loaded in to the Skin Loader and applied to the system to give ShiftOS a completely different feel. It's Shiftorium upgrade ID is \"skin_loader\".", () => { return(Shiftorium.UpgradeInstalled("skin_loader")); }, () => { Story.Context.MarkComplete(); }); }); }
public void OnUpgrade() { grade = 1; if (Shiftorium.UpgradeInstalled("virus_scanner_grade_2")) { grade++; } if (Shiftorium.UpgradeInstalled("virus_scanner_grade_3")) { grade++; } if (Shiftorium.UpgradeInstalled("virus_scanner_grade_4")) { grade++; } SetupStatus(); }
public ShiftoriumUpgrade[] GetAllInCategory() { var upgrades = Shiftorium.GetDefaults().Where(x => (x.Dependencies == null) ? false : x.Dependencies.Contains("appscape_")); if (upgrades.Count() == 0) { return(new ShiftoriumUpgrade[0]); } if (Category == "All") { return(upgrades.ToArray()); } else { return(upgrades.Where(x => Localization.Parse(x.Category) == Localization.Parse(Category)).ToArray()); } }
private void titlebar_MouseDown(object sender, MouseEventArgs e) { if (Shiftorium.UpgradeInstalled("draggable_windows") && isInDrag == true) { var element = sender as FrameworkElement; currentPoint = e.GetPosition(null); transform.X += (currentPoint.X - anchorPoint.X); transform.Y += (currentPoint.Y - anchorPoint.Y); this.RenderTransform = transform; anchorPoint = currentPoint; if (_isWPF == false) { _wParent.Refresh(); (pgcontents.Content as WindowsFormsHost).InvalidateVisual(); } } }
public void WindowBorder_Load(object sender, EventArgs e) { this.DoubleBuffered = true; this._parentWindow.TextChanged += (o, a) => { Setup(); Desktop.ResetPanelButtons(); }; this.Left = (Screen.PrimaryScreen.Bounds.Width - this.Width) / 2; this.Top = (Screen.PrimaryScreen.Bounds.Height - this.Height) / 2; if (!this.IsDialog) { Engine.AppearanceManager.OpenForms.Add(this); } SaveSystem.GameReady += () => { if (Shiftorium.UpgradeInstalled("wm_free_placement")) { AppearanceManager.Invoke(new Action(() => { this.Left = (Screen.PrimaryScreen.Bounds.Width - this.Width) / 2; this.Top = (Screen.PrimaryScreen.Bounds.Height - this.Height) / 2; })); } AppearanceManager.Invoke(new Action(() => { Setup(); })); }; ControlManager.SetupControls(this); Setup(); var sWin = (IShiftOSWindow)ParentWindow; sWin.OnLoad(); }