示例#1
0
        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!");
            }
        }
示例#2
0
        public void OpenFile(string path)
        {
            var stpInstall = new StpInstallation(path);

            AppearanceManager.SetupWindow(this);
            InitiateInstall(stpInstall);
        }
示例#3
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            SaveSystem.GameReady  += () => Dispatcher.Invoke(() => PopulateAppLauncher());
            Shiftorium.Installed  += () => Dispatcher.Invoke(() => PopulateAppLauncher());
            SkinEngine.SkinLoaded += () => Dispatcher.Invoke(() => PopulateAppLauncher());


            onWindowShow += (brdr) =>
            {
                brdr.Measure(windowlayer.DesiredSize);
                brdr.SetValue(System.Windows.Controls.Canvas.LeftProperty, (windowlayer.ActualWidth - brdr.Width) / 2);
                brdr.SetValue(System.Windows.Controls.Canvas.TopProperty, (windowlayer.ActualHeight - brdr.ActualActualHeight) / 2);
                windowlayer.Children.Add(brdr);
                brdr.PreviewMouseDown += (o, a) =>
                {
                    brdr.BringToFront(windowlayer);
                };
            };
            onWindowClose += (brdr) =>
            {
                if (windowlayer.Children.Contains(brdr))
                {
                    windowlayer.Children.Remove(brdr);
                    brdr.ParentWindow.OnUnload();
                    brdr = null;
                }
            };
            AppearanceManager.SetupWindow(new Terminal());
        }
示例#4
0
        public void OpenDirectory(string path)
        {
            var fs = new Applications.FileSkimmer();

            AppearanceManager.SetupWindow(fs);
            fs.ChangeDirectory(path);
        }
示例#5
0
 private void wbmain_NewWindow(object sender, CancelEventArgs e)
 {
     e.Cancel = true;
     if (Shiftorium.UpgradeInstalled("web_browser_new_window"))
     {
         AppearanceManager.SetupWindow(new WebBrowser());
     }
 }
示例#6
0
        public dynamic createWindow(string name, dynamic size)
        {
            var win = new Window();

            win.Size = size;
            AppearanceManager.SetupWindow(win);
            return(win);
        }
示例#7
0
        public void OpenFile(string file)
        {
            var contents = Objects.ShiftFS.Utils.ReadAllText(file);
            var dict     = JsonConvert.DeserializeObject <Dictionary <string, byte[]> >(contents);

            AppearanceManager.SetupWindow(this);
            Icons = dict;
            SetupUI();
        }
示例#8
0
        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();
        }
示例#9
0
 public void StartShowing(Save save)
 {
     MySave = save;
     AppearanceManager.SetupWindow(this);
     SetupLanguages();
     SaveSystem.GameReady += () =>
     {
         Dispatcher.Invoke(() =>
         {
             AppearanceManager.Close(this);
         });
     };
 }
示例#10
0
        public static Applications.Chat OpenChat()
        {
            var chatbrd = AppearanceManager.OpenForms.FirstOrDefault(x => x.ParentWindow is Applications.Chat);

            Applications.Chat chat = null;
            if (chatbrd == null)
            {
                chat = new Applications.Chat();
                AppearanceManager.SetupWindow(chat);
            }
            else
            {
                chat = chatbrd.ParentWindow as Applications.Chat;
            }
            return(chat);
        }
示例#11
0
        public void SetupAdvancedCategory(string cat)
        {
            flapps.Controls.Clear();

            foreach (var app in LauncherItemList[cat])
            {
                var catbtn = new Button();
                catbtn.Font      = LoadedSkin.AdvALItemFont;
                catbtn.FlatStyle = FlatStyle.Flat;
                catbtn.FlatAppearance.BorderSize         = 0;
                catbtn.FlatAppearance.MouseOverBackColor = LoadedSkin.Menu_MenuItemSelected;
                catbtn.FlatAppearance.MouseDownBackColor = LoadedSkin.Menu_MenuItemPressedGradientBegin;
                catbtn.BackColor   = LoadedSkin.Menu_ToolStripDropDownBackground;
                catbtn.ForeColor   = LoadedSkin.Menu_TextColor;
                catbtn.MouseEnter += (o, a) =>
                {
                    catbtn.ForeColor = LoadedSkin.Menu_SelectedTextColor;
                };
                catbtn.MouseLeave += (o, a) =>
                {
                    catbtn.ForeColor = LoadedSkin.Menu_TextColor;
                };
                catbtn.TextAlign  = ContentAlignment.MiddleLeft;
                catbtn.Text       = (app is LuaLauncherItem) ? app.DisplayData.Name : NameChangerBackend.GetNameRaw(app.LaunchType);
                catbtn.Width      = flapps.Width;
                catbtn.ImageAlign = ContentAlignment.MiddleRight;
                catbtn.Height     = 24;
                catbtn.Image      = (app.LaunchType == null) ? null : SkinEngine.GetIcon(app.LaunchType.Name);

                flapps.Controls.Add(catbtn);
                catbtn.Show();
                catbtn.Click += (o, a) =>
                {
                    pnladvancedal.Hide();
                    if (app is LuaLauncherItem)
                    {
                        var interp = new LuaInterpreter();
                        interp.ExecuteFile((app as LuaLauncherItem).LaunchPath);
                    }
                    else
                    {
                        IShiftOSWindow win = Activator.CreateInstance(app.LaunchType) as IShiftOSWindow;
                        AppearanceManager.SetupWindow(win);
                    }
                };
            }
        }
示例#12
0
        public static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            //if ANYONE puts code before those two winforms config lines they will be declared a drunky. - Michael
            SkinEngine.SetPostProcessor(new DitheringSkinPostProcessor());
            LoginManager.Init(new GUILoginFrontend());
            CrashHandler.SetGameMetadata(Assembly.GetExecutingAssembly());
            SkinEngine.SetIconProber(new ShiftOSIconProvider());
            TerminalBackend.TerminalRequested += () =>
            {
                AppearanceManager.SetupWindow(new Applications.Terminal());
            };
            Localization.RegisterProvider(new WFLanguageProvider());
            Infobox.Init(new Dialog());
            LoginManager.Init(new WinForms.GUILoginFrontend());
            FileSkimmerBackend.Init(new WinformsFSFrontend());
            var desk = new WinformsDesktop();

            Desktop.Init(desk);
            OutOfBoxExperience.Init(new Oobe());
            AppearanceManager.Initiate(new WinformsWindowManager());
#if OLD
            SaveSystem.PreDigitalSocietyConnection += () =>
            {
                Action completed = null;
                completed = () =>
                {
                    SaveSystem.Ready.Set();
                    Engine.AudioManager.PlayCompleted -= completed;
                    AudioManager.StartAmbientLoop();
                };
                Engine.AudioManager.PlayCompleted += completed;
                Engine.AudioManager.PlayStream(Properties.Resources.dial_up_modem_02);
            };

            Application.Run(desk);
#else
            Application.Run(new MainMenu.MainMenu(desk));
#endif
        }
示例#13
0
        private static void StartCoherence(Process prc)
        {
            RECT rct = new RECT();


            while (!GetWindowRect(prc.MainWindowHandle, ref rct))
            {
            }



            AppearanceManager.Invoke(new Action(() =>
            {
                IShiftOSWindow coherenceWindow = new Applications.CoherenceOverlay(prc.MainWindowHandle, rct);

                AppearanceManager.SetupWindow(coherenceWindow);
                SetWindowPos(prc.MainWindowHandle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);

                //MakeExternalWindowBorderless(prc.MainWindowHandle);
            }));
        }
示例#14
0
        public static void BreakingTheBondsIntro()
        {
            CharacterName = "hacker101";
            SysName       = "pebcak";

            if (!terminalOpen())
            {
                var term = new Applications.Terminal();
                AppearanceManager.SetupWindow(term);
            }

            WriteLine("hacker101@pebcak - user connecting to your system.", false);
            Thread.Sleep(2000);
            WriteLine("Greetings, user.");
            WriteLine("My name is hacker101. I have a few things to show you.");
            WriteLine("Before I can do that, however, I need you to do a few things.");
            WriteLine("I'll assign what I need you to do as an objective. When you're done, I'll tell you what you need to know.");

            TerminalBackend.PrefixEnabled = true;

            Story.PushObjective("Breaking the Bonds: Errand Boy", @"hacker101 has something he needs to show you, however before he can, you need to do the following:

 - Buy ""TriWrite"" from Appscape
 - Buy ""Address Book"" from Appscape
 - Buy ""SimpleSRC"" from Appscape", () =>
            {
                bool flag1 = Shiftorium.UpgradeInstalled("address_book");
                bool flag2 = Shiftorium.UpgradeInstalled("triwrite");
                bool flag3 = Shiftorium.UpgradeInstalled("simplesrc_client");
                return(flag1 && flag2 && flag3);
            }, () =>
            {
                Story.Context.MarkComplete();
                SaveSystem.SaveGame();
                Story.Start("hacker101_breakingbonds_2");
            });
            Story.Context.AutoComplete = false;
        }
示例#15
0
        public void OpenFile(string file)
        {
            int    lastline     = 0;
            string lastlinetext = "";

            try
            {
                var lines = new List <string>(ShiftOS.Objects.ShiftFS.Utils.ReadAllText(file).Split(new[] { Environment.NewLine.ToString() }, StringSplitOptions.RemoveEmptyEntries));
                AppearanceManager.SetupWindow(this);
                var parser = CommandParser.GenerateSample();
                foreach (var line in lines)
                {
                    lastline     = lines.IndexOf(line) + 1;
                    lastlinetext = line;
                    var command = parser.ParseCommand(line);
                    TerminalBackend.InvokeCommand(command.Key, command.Value);
                }
            }
            catch (Exception ex)
            {
                ConsoleEx.ForegroundColor = ConsoleColor.Red;
                ConsoleEx.Bold            = true;
                Console.WriteLine("Script exception");
                ConsoleEx.ForegroundColor = ConsoleColor.Yellow;
                ConsoleEx.Bold            = false;
                ConsoleEx.Italic          = true;
#if DEBUG
                Console.WriteLine(ex.Message);
#endif
                Console.WriteLine(ex.StackTrace);
                if (lastline > 0)
                {
                    Console.WriteLine(" at " + lastlinetext + " (line " + lastline + ") in " + file);
                }
            }
            TerminalBackend.PrintPrompt();
        }
示例#16
0
        static void Main()
        {
            Localization.RegisterProvider(new WFLanguageProvider());
            Shiftorium.RegisterProvider(new WinformsShiftoriumProvider());
            AppearanceManager.OnExit += () =>
            {
                Environment.Exit(0);
            };

            TerminalBackend.TerminalRequested += () =>
            {
                AppearanceManager.SetupWindow(new Applications.Terminal());
            };
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            AppearanceManager.Initiate(new WinformsWindowManager());
            OutOfBoxExperience.Init(new Oobe());
            Infobox.Init(new WinformsInfobox());
            FileSkimmerBackend.Init(new WinformsFSFrontend());
            var desk = new WinformsDesktop();

            Desktop.Init(desk);
            Application.Run(desk);
        }
示例#17
0
        public void Start()
        {
            Shiftorium.Silent = false;
            foreach (var frm in AppearanceManager.OpenForms)
            {
                (frm as Form).Invoke(new Action(() => {
                    frm.Close();
                }));
            }

            TerminalBackend.CommandProcessed += (cmd, args) =>
            {
                if (cmd == "sos.help")
                {
                    if (TutorialProgress == 0)
                    {
                        TutorialProgress = 1;
                    }
                }
                else if (cmd == "sos.status")
                {
                    if (TutorialProgress == 1)
                    {
                        TutorialProgress = 2;
                    }
                }
                else if (cmd == "shiftorium.list")
                {
                    if (TutorialProgress == 2)
                    {
                        TutorialProgress = 3;
                        SaveSystem.TransferCodepointsFrom("sys", 50);
                    }
                }
                else if (cmd == "shiftorium.info" && args == "{\"upgrade\":\"mud_fundamentals\"}")
                {
                    if (TutorialProgress == 3)
                    {
                        TutorialProgress = 4;
                    }
                }
                else if (cmd == "win.open")
                {
                    if (TutorialProgress == 4)
                    {
                        TutorialProgress = 5;
                    }
                }
            };
            if (this.Visible == false)
            {
                this.Show();
            }
            var t = new Thread(() =>
            {
                textgeninput = lblHijack;
                Clear();
                textgeninput = lblhackwords;
                Clear();

                this.Invoke(new Action(() =>
                {
                    textgeninput.Font = SkinEngine.LoadedSkin.TerminalFont;
                }));
                TextType("ShiftOS has been installed successfully.");
                Thread.Sleep(500);
                TextType("Before you can continue to the operating system, here's a little tutorial on how to use it.");
                Thread.Sleep(500);
                TextType("Starting a Terminal...");
                Applications.Terminal term = null;
                this.Invoke(new Action(() =>
                {
                    term = new Applications.Terminal();
                    this.Controls.Add(term);
                    term.Location = new Point(
                        (this.Width - term.Width) / 2,
                        (this.Height - term.Height) / 2
                        );
                    term.Show();
                    term.OnLoad();
                    term.OnSkinLoad();
                    term.OnUpgrade();
                }));
                TextType("This little text box is called a Terminal.");
                Thread.Sleep(500);
                TextType("Normally, it would appear in full-screen, but this window is hosting it as a control so you can see this text as well.");
                Thread.Sleep(500);
                TextType("In ShiftOS, the Terminal is your main control centre for the operating system. You can see system status, check Codepoints, open other programs, buy upgrades, and more.");
                Thread.Sleep(500);
                TextType("Go ahead and type 'sos.help' to see a list of commands.");
                while (TutorialProgress == 0)
                {
                    //JESUS CHRIST PAST MICHAEL.

                    //We should PROBABLY block the thread... You know... not everyone has a 10-core processor.
                    Thread.Sleep(100);
                }
                TextType("As you can see, sos.help gives you a list of all commands in the system.");
                Thread.Sleep(500);
                TextType("You can run any command, by typing in their Namespace, followed by a period (.), followed by their Command Name.");
                Thread.Sleep(500);
                TextType("Go ahead and run the 'status' command within the 'sos' namespace to see what the command does.");
                while (TutorialProgress == 1)
                {
                    //JESUS CHRIST PAST MICHAEL.

                    //We should PROBABLY block the thread... You know... not everyone has a 10-core processor.
                    Thread.Sleep(100);
                }
                TextType("Brilliant. The sos.status command will tell you how many Codepoints you have, as well as how many upgrades you have installed and how many are available.");
                Thread.Sleep(500);
                TextType("Codepoints, as you know, are a special currency within ShiftOS. They are used to buy things within the multi-user domain, such as upgrades, scripts, and applications.");
                Thread.Sleep(500);
                TextType("You can earn Codepoints by doing things in ShiftOS - such as completing jobs for other users, making things like skins, scripts, documents, etc, and playing games like Pong.");
                Thread.Sleep(500);
                TextType("At times, you'll be given Codepoints to help complete a task. You will receive Codepoints from 'sys' - the multi-user domain itself.");
                //SaveSystem.TransferCodepointsFrom("sys", 50);
                TextType("Right now, you don't have any upgrades. Upgrades can give ShiftOS additional features and capabilities - like new core applications, supported file types, and new Terminal commands.");
                Thread.Sleep(500);
                TextType("You can easily get upgrades using the Shiftorium - a repository of approved ShiftOS upgrades.");
                Thread.Sleep(500);
                TextType("To start using the Shiftorium, simply type 'shiftorium.list' to see available upgrades.");
                while (TutorialProgress == 2)
                {
                    //JESUS CHRIST PAST MICHAEL.

                    //We should PROBABLY block the thread... You know... not everyone has a 10-core processor.
                    Thread.Sleep(100);
                }
                Clear();
                TextType("Right now, you have enough Codepoints to buy the 'mud_fundamentals' upgrade. You can use shiftorium.info to see information about this upgrade.");
                Thread.Sleep(500);
                TextType("Some commands, like shiftorium.info, require you to pass information to them in the form of arguments.");
                Thread.Sleep(500);
                TextType("Argument pairs sit at the end of the command, and are enclosed in curly braces.");
                Thread.Sleep(500);
                TextType("Inside these curly braces, you can input an argument key, followed by a colon, followed by the value. Then, if you need multiple arguments, you can put a comma after the value, and then insert another argument pair.");
                Thread.Sleep(500);
                TextType("There are different value types - numeric values, which can be any positive or negative 32-bit integer");
                Thread.Sleep(500);
                TextType("Then there are boolean values which can be either 'true' or 'false'");
                Thread.Sleep(500);
                TextType("Then there are string values, which are enclosed in double-quotes.");
                Thread.Sleep(500);
                TextType(" If for some reason you need to use a double-quote inside a string, you must escape it using a single backslash followed by the quote, like this: key:\"My \\\"awesome\\\" value.\"");
                Thread.Sleep(500);
                TextType("If you want to escape a backslash inside a string, simply type two backslashes instead of one - for example key:\"Back\\\\slash.\"");
                Thread.Sleep(500);
                TextType("shiftorium.info requires an upgrade argument, which is a string type. Go ahead and give shiftorium.info's upgrade argument the 'mud_fundamentals' upgrade's ID.");
                while (TutorialProgress == 3)
                {
                    //JESUS CHRIST PAST MICHAEL.

                    //We should PROBABLY block the thread... You know... not everyone has a 10-core processor.
                    Thread.Sleep(100);
                }
                TextType("As you can see, mud_fundamentals is very useful. In fact, a lot of useful upgrades depend on it. You should buy it!");
                Thread.Sleep(500);
                TextType("shiftorium.info already gave you a command that will let you buy the upgrade - go ahead and run that command!");
                while (!Shiftorium.UpgradeInstalled("mud_fundamentals"))
                {                //JESUS CHRIST PAST MICHAEL.
                    //We should PROBABLY block the thread... You know... not everyone has a 10-core processor.
                    Thread.Sleep(100);
                }
                TextType("Hooray! You now have the MUD Fundamentals upgrade.");
                Thread.Sleep(500);
                TextType("You can also earn more Codepoints by playing Pong. To open Pong, you can use the win.open command.");
                Thread.Sleep(500);
                TextType("If you run win.open without arguments, you can see a list of applications that you can open.");
                Thread.Sleep(500);
                TextType("Just run win.open without arguments, and this tutorial will be completed!");
                while (TutorialProgress == 4)
                {
                    //JESUS CHRIST PAST MICHAEL.

                    //We should PROBABLY block the thread... You know... not everyone has a 10-core processor.
                    Thread.Sleep(100);
                }
                TextType("This concludes the ShiftOS beginners' guide brought to you by the multi-user domain. Stay safe in a connected world.");
                Thread.Sleep(2000);
                Desktop.InvokeOnWorkerThread(() =>
                {
                    OnComplete?.Invoke(this, EventArgs.Empty);
                    SaveSystem.CurrentSave.StoryPosition = 2;
                    this.Close();
                    SaveSystem.SaveGame();
                    AppearanceManager.SetupWindow(new Applications.Terminal());
                });
            });

            t.IsBackground = true;
            t.Start();
        }
示例#18
0
        public void ViewMoreInfo(ShiftoriumUpgrade upg)
        {
            lbtitle.Text = upg.Name;
            pnlappslist.Controls.Clear();

            var cp_display = new Panel();

            cp_display.Height = 30;
            cp_display.Dock   = DockStyle.Bottom;
            pnlappslist.Controls.Add(cp_display);
            cp_display.Show();

            var cp_value = new Label();

            if (Shiftorium.UpgradeInstalled(upg.ID))
            {
                cp_value.Text = "Already Purchased.";
            }
            else
            {
                cp_value.Text = $"{upg.Cost} CP";
            }
            cp_value.AutoSize = true;
            cp_value.Top      = (cp_display.Height - cp_value.Height) / 2;
            cp_value.Left     = 5;
            cp_display.Controls.Add(cp_value);
            cp_value.Show();


            if (cp_value.Text != "Already Purchased.")
            {
                var more_info = new Button();
                more_info.Text   = "Buy";
                more_info.Click += (o, a) =>
                {
                    //Detect if dependencies are installed.
                    if (DependenciesInstalled(upg))
                    {
                        //Detect sufficient codepoints
                        if (SaveSystem.CurrentSave.Codepoints >= upg.Cost)
                        {
                            Infobox.PromptYesNo("Confirm Purchase", "Do you want to purchase " + upg.Name + " from Appscape for " + upg.Cost.ToString() + " Codepoints?", (result) =>
                            {
                                if (result == true)
                                {
                                    SaveSystem.CurrentSave.Codepoints -= upg.Cost;
                                    foreach (var type in ReflectMan.Types)
                                    {
                                        var attrib = type.GetCustomAttributes(false).FirstOrDefault(x => x is AppscapeEntryAttribute) as AppscapeEntryAttribute;
                                        if (attrib != null)
                                        {
                                            if (attrib.Name == upg.Name)
                                            {
                                                var installer    = new Applications.Installer();
                                                var installation = new AppscapeInstallation(upg.Name, attrib.DownloadSize, upg.ID);
                                                AppearanceManager.SetupWindow(installer);
                                                installer.InitiateInstall(installation);
                                                return;
                                            }
                                        }
                                    }
                                }
                            });
                        }
                        else
                        {
                            Infobox.Show("Not enough Codepoints", "You do not have enough Codepoints to buy this package.");
                        }
                    }
                    else
                    {
                        Infobox.Show("Missing dependencies", "You are missing some Shiftorium upgrades that this package requires. Please upgrade your system and try again!");
                    }
                };
                more_info.AutoSize     = false;
                more_info.AutoSizeMode = AutoSizeMode.GrowAndShrink;
                more_info.Top          = (cp_display.Height - more_info.Height) / 2;
                more_info.Left         = cp_display.Width - more_info.Width - 5;
                cp_display.Controls.Add(more_info);
                more_info.Show();
                ControlManager.SetupControls(pnlappslist);
            }

            var desc = new Label();

            desc.Text     = upg.Description;
            desc.AutoSize = false;
            desc.Dock     = DockStyle.Fill;
            pnlappslist.Controls.Add(desc);
            desc.Show();
            desc.BringToFront();

            desc.Text += Environment.NewLine + Environment.NewLine + "Dependencies:" + Environment.NewLine;
            string[] deplist = upg.Dependencies.Split(';');
            if (deplist.Length > 1)
            {
                for (int i = 1; i < deplist.Length; i++)
                {
                    ShiftoriumUpgrade dep = Shiftorium.GetDefaults().FirstOrDefault(x => x.ID == deplist[i]);
                    if (dep != null)
                    {
                        desc.Text += $" - {dep.Name}{Environment.NewLine}";
                    }
                }
            }
            else
            {
                desc.Text += " - No dependencies.";
            }
        }
示例#19
0
 public void OpenFile(string file)
 {
     AppearanceManager.SetupWindow(this);
     LoadedSkin = JsonConvert.DeserializeObject <Skin>(Objects.ShiftFS.Utils.ReadAllText(file));
     SetupUI();
 }
示例#20
0
        public static void FirstSteps()
        {
            TerminalBackend.PrefixEnabled = false;
            TerminalBackend.InStory       = true;
            Console.WriteLine("Hey there, and welcome to ShiftOS.");
            Thread.Sleep(2000);
            Console.WriteLine("My name is DevX. I am the developer of this operating system.");
            Thread.Sleep(2000);
            Console.WriteLine("Right now, I am using the Terminal application as a means of talking to you.");
            Thread.Sleep(2000);
            Console.WriteLine("ShiftOS is a very early operating system, but I have big plans for it.");
            Thread.Sleep(2000);
            Console.WriteLine("I can't reveal all my plans to you at this moment, but you play a big role.");
            Thread.Sleep(2000);
            Console.WriteLine("Your role in all of this is to help me develop ShiftOS more.");
            Thread.Sleep(2000);
            Console.WriteLine("You may not know how to program, but that's perfectly fine. You don't need to.");
            Thread.Sleep(2000);
            Console.WriteLine("What you do need to do, is simply use the operating system - like you would a regular computer.");
            Thread.Sleep(2000);
            Console.WriteLine("As you use ShiftOS, you will earn a special currency called Codepoints.");
            Thread.Sleep(2000);
            Console.WriteLine("The more things you do, the more Codepoints you get! Simple, right?");
            Thread.Sleep(2000);
            Console.WriteLine("Once you rack up enough Codepoints, you can use them inside the Shiftorium to buy new features for ShiftOS.");
            Thread.Sleep(2000);
            Console.WriteLine("These features include new programs, system enhancements, Terminal commands, and so much more!");
            Thread.Sleep(2000);
            Console.WriteLine("Ahh, that reminds me. I suppose you don't know how to use the Terminal yet, do you...");
            Thread.Sleep(2000);
            Console.WriteLine("Well, you know what you say, things are best learned by doing them!");
            Thread.Sleep(2000);
            Console.WriteLine("Give it a try! Type \"help\" in the following prompt to view a list of all ShiftOS commands.");
            Thread.Sleep(2000);
            TerminalBackend.InStory       = false;
            TerminalBackend.PrefixEnabled = true;
            TerminalBackend.PrintPrompt();
            bool help_entered = false;

            TerminalBackend.CommandProcessed += (text, args) =>
            {
                if (text.EndsWith("help") && help_entered == false)
                {
                    help_entered = true;
                }
            };
            while (help_entered == false)
            {
                Thread.Sleep(10);
            }
            TerminalBackend.InStory       = true;
            TerminalBackend.PrefixEnabled = false;
            Thread.Sleep(2000);
            Console.WriteLine("Good job! Next, we will look at how to pass data to a command, such as buy.");
            Thread.Sleep(2000);
            Console.WriteLine("In ShiftOS, passing data to a command is quite simple! All you have to do is put --, and then the name of the argument! For example, you could do \"buy --upgrade \"name_of_upgrade\"\"!");
            Thread.Sleep(2000);
            Console.WriteLine("However, you can't just spam a bunch of 1s and 0s and call it a day, nonono! You have to give it a value!");
            Thread.Sleep(2000);
            Console.WriteLine("There are three main types of values. Booleans, which can be either \"true\" or \"false\", Numbers, which can be any integer number, positive or negative, and Strings - any piece of text as long as it is surrounded by double-quotes.");
            Thread.Sleep(10000);
            Console.WriteLine("Now that you've got the gist of using ShiftOS, I have a goal for you.");
            Thread.Sleep(2000);
            Console.WriteLine("As you know, ShiftOS doesn't have very many features.");
            Thread.Sleep(2000);
            Console.WriteLine("Using the applications you have, I need you to earn as many Codepoints as you can.");
            Thread.Sleep(2000);
            Console.WriteLine("You can use the Codepoints you earn to buy new applications and features in the Shiftorium, to help earn even more Codepoints.");
            Thread.Sleep(2000);
            Console.WriteLine("Once you earn 1,000 Codepoints, I will check back with you and see how well you've done.");
            Thread.Sleep(2000);
            Console.WriteLine("I'll leave you to it, you've got the hang of it! One last thing, if ever you find yourself in another program, and want to exit, simply press CTRL+T to return to the Terminal.");
            Thread.Sleep(2000);
            TerminalBackend.PrefixEnabled = true;
            TerminalBackend.InStory       = false;
            SaveSystem.SaveGame();
            Thread.Sleep(1000);

            Story.Context.AutoComplete = false;

            Console.WriteLine(@"Welcome to the ShiftOS Newbie's Guide.

This tutorial will guide you through the more intermediate features of ShiftOS,
such as earning Codepoints, buying Shiftoorium Upgrades, and using the objectives system.

Every now and then, you'll get a notification in your terminal of a ""NEW OBJECTIVE"".
This means that someone has instructed you to do something inside ShiftOS. At any moment
you may type ""status"" in your Terminal to see your current objectives.

This command is very useful as not only does it allow you to see your current objectives
but you can also see the amount of Codepoints you have as well as the upgrades you've
installed and how many upgrades are available.

Now, onto your first objective! All you need to do is earn 200 Codepoints using any
program on your system.");

            Story.PushObjective("First Steps: Your First Codepoints", "Play a few rounds of Pong, or use another program to earn 200 Codepoints.", () =>
            {
                return(SaveSystem.CurrentSave.Codepoints >= 200);
            }, () =>
            {
                Desktop.InvokeOnWorkerThread(() =>
                {
                    AppearanceManager.SetupWindow(new Terminal());
                });
                Console.WriteLine("Good job! You've earned " + SaveSystem.CurrentSave.Codepoints + @" Codepoints! You can use these inside the
Shiftorium to buy new upgrades inside ShiftOS.

These upgrades can give ShiftOS more features, fixes and programs,
which can make the operating system easier to use and navigate around
and also make it easier for you to earn more Codepoints and thus upgrade
the system further.

Be cautious though! Only certain upgrades offer the ability to earn more
Codepoints. These upgrades are typically in the form of new programs.

So, try to get as many new programs as possible for your computer, and save
the system feature upgrades for later unless you absolutely need them.

The worst thing that could happen is you end up stuck with very little Codepoints
and only a few small programs to use to earn very little amounts of Codepoints.

Now, let's get you your first Shiftorium upgrade!");

                Story.PushObjective("First Steps: The Shiftorium", "Buy your first Shiftorium upgrade with your new Codepoints using the upgrades, upgradeinfo and buy commands.",
                                    () =>
                {
                    return(SaveSystem.CurrentSave.CountUpgrades() > 0);
                }, () =>
                {
                    Console.WriteLine("This concludes the ShiftOS Newbie's Guide! Now, go, and shift it your way!");
                    Console.WriteLine(@"
Your goal: Earn 1,000 Codepoints.");
                    Story.Context.MarkComplete();
                    Story.Start("first_steps_transition");
                });
                TerminalBackend.PrintPrompt();
            });

            TerminalBackend.PrintPrompt();
        }
示例#21
0
        public void OpenFile(string path)
        {
            try
            {
                switch (FileSkimmerBackend.GetFileType(path))
                {
                case FileType.TextFile:
                    if (!Shiftorium.UpgradeInstalled("textpad"))
                    {
                        throw new Exception();
                    }

                    var txt = new TextPad();
                    AppearanceManager.SetupWindow(txt);
                    txt.LoadFile(path);
                    break;

                case FileType.Executable:
                    //NYI
                    throw new Exception();

                case FileType.Lua:
                    try
                    {
                        var runner = new Engine.Scripting.LuaInterpreter();
                        runner.ExecuteFile(path);
                    }
                    catch (Exception ex)
                    {
                        Infobox.Show("{LUA_ERROR}", ex.Message);
                    }
                    break;

                case FileType.JSON:
                    //NYI
                    throw new Exception();

                case FileType.Filesystem:
                    MountPersistent(path);
                    //If this doesn't fail...
                    FileSkimmerBackend.OpenDirectory((Mounts.Count - 1).ToString() + ":");
                    break;

                case FileType.Skin:
                    if (!Shiftorium.UpgradeInstalled("skinning"))
                    {
                        throw new Exception();
                    }

                    var sl = new Skin_Loader();
                    AppearanceManager.SetupWindow(sl);
                    sl.LoadedSkin = JsonConvert.DeserializeObject <Skin>(ReadAllText(path));
                    sl.SetupUI();
                    break;

                case FileType.Image:
                    if (!Shiftorium.UpgradeInstalled("artpad_open"))
                    {
                        throw new Exception();
                    }

                    var ap = new Artpad();
                    AppearanceManager.SetupWindow(ap);
                    ap.LoadPicture(path);
                    break;

                default:
                    throw new Exception();
                }
            }
            catch
            {
                Infobox.Show("{NO_APP_TO_OPEN}", "{NO_APP_TO_OPEN_EXP}");
            }
        }
示例#22
0
        public static void ShiftnetStoryFeaturingTheBlueSmileyFaceHolyFuckThisFunctionNameIsLong()
        {
            CharacterName = "aiden";
            SysName       = "appscape_main";
            bool waiting   = false;
            var  installer = new Applications.Installer();

            installer.InstallCompleted += () =>
            {
                Desktop.InvokeOnWorkerThread(() =>
                {
                    AppearanceManager.Close(installer);
                });
                waiting = false;
            };

            if (!terminalOpen())
            {
                var term = new Applications.Terminal();
                AppearanceManager.SetupWindow(term);
            }

            WriteLine("aiden@appscape_main - user connecting to your system.", false);
            Thread.Sleep(2000);
            WriteLine("Hello there! My name's Aiden Nirh.");
            WriteLine("I run a small Shiftnet website known simply as \"Appscape\".");
            WriteLine("Oh - wait... you don't know what the Shiftnet is...");
            WriteLine("Well, the Shiftnet is like... a private Internet, only accessible through ShiftOS.");
            WriteLine("It has many sites and companies on it - banks, software centres, service providers, you name it.");
            WriteLine("Appscape is one of them. I host many applications on Appscape, from games to utilities to productivity programs, and anything in between. If it exists as a ShiftOS program, it's either on the Shiftorium or Appscape.");
            WriteLine("I'm going to assume you're interested... and I'll install the Shiftnet just in case.");
            WriteLine("Beginning installation of Shiftnet...");
            //Set up an Installer.
            waiting = true;
            Desktop.InvokeOnWorkerThread(() =>
            {
                SaveSystem.CurrentSave.StoriesExperienced.Add("installer");
                SaveSystem.CurrentSave.StoriesExperienced.Add("downloader");

                while (!Shiftorium.UpgradeInstalled("installer"))
                {
                    Thread.Sleep(20);
                }
                AppearanceManager.SetupWindow(installer);
                installer.InitiateInstall(new ShiftnetInstallation());
            });
            while (waiting == true)
            {
                Thread.Sleep(25);
            }

            WriteLine("All good to go! Once I disconnect, type win.open to see a list of your new apps.");
            WriteLine("I've installed everything you need, for free.");
            WriteLine("You've got the Downloader, a simple application to help you track Shiftnet file downloads...");
            WriteLine("...the Installer which will help you unpack programs from .stp files and install them to your system...");
            WriteLine("...and lastly, the Shiftnet browser itself. This program lets you browse the Shiftnet, much like you would the real Internet.");
            WriteLine("I'd stay on the shiftnet/ cluster though, because although there are many services on the Shiftnet, some of them may try to scam you into losing loads of Codepoints, or worse, wrecking your system with viruses.");
            WriteLine("If you want a nice list of safe Shiftnet services, head to ShiftSoft's \"Ping\" site, at shiftnet/shiftsoft/ping.");
            WriteLine("Oh, also, the Shiftnet, much like the real internet, is not free.");
            WriteLine("It requires a service provider. Service providers cost a fair amount of Codepoints, but if you want to get faster speeds and more reliable connections on the Shiftnet, finding a good service provider is a necessity.");
            WriteLine("Right now, you are on ShiftSoft's free trial plan, Freebie Solutions, which gives you access to the Shiftnet however you are locked at 256 bytes per second file downloads and can't leave the shiftnet/ cluster.");
            WriteLine("It's enough to get you started - you'll want to find a faster provider though..");
            WriteLine("Anyways, that's all I'll say for now. Have fun on the Shiftnet. I have to go work on something.");
            WriteLine("One of my friends'll contact you once you've gotten a new service provider.");



            Story.Context.MarkComplete();
            Story.Start("aiden_shiftnet2");
        }
示例#23
0
 public void OpenFile(string file)
 {
     AppearanceManager.SetupWindow(this);
     LoadFile(file);
 }
示例#24
0
        public static void BreakingTheBonds_Outro()
        {
            Story.Context.AutoComplete = false;
            CharacterName = "hacker101";
            SysName       = "pebcak";

            if (!terminalOpen())
            {
                var term = new Applications.Terminal();
                AppearanceManager.SetupWindow(term);
            }

            WriteLine("Now let's teach you how to hack others' systems.");
            WriteLine("I'll start up a safe virtual environment for you to mess with.");
            VirtualEnvironments.Create("pebcak_devel", new List <Objects.ClientSave>
            {
                new Objects.ClientSave
                {
                    Username    = "******",
                    Password    = GenRandomPassword(),
                    Permissions = Objects.UserPermissions.Root
                },
                new Objects.ClientSave
                {
                    Username    = "******",
                    Password    = "",
                    Permissions = Objects.UserPermissions.Admin,
                }
            }, 6500l, JsonConvert.DeserializeObject <ShiftOS.Objects.ShiftFS.Directory>(Properties.Resources.PebcakDevelFS));
            Thread.Sleep(2000);
            WriteLine("It's all set up now. The system name for this environment is \"pebcak_devel\".");
            WriteLine("This server allows FTP connections through your File Skimmer.");
            WriteLine("Other systems can allow RTS connections (which allows you to control their terminals remotely), SMTP (mail transfer), etc. It depends on the system's role.");

            bool isFsCopyInstalled = Shiftorium.UpgradeInstalled("fs_copy");

            if (isFsCopyInstalled == false)
            {
                WriteLine("Before we can begin, one last thing. You need the FS Copy Shiftorium upgrade.");
                Story.PushObjective("Breaking The Bonds: Preparations", "You need to buy the FS Copy upgrade from the Shiftorium.", () => { return(Shiftorium.UpgradeInstalled("fs_copy")); }, () =>
                {
                    isFsCopyInstalled = true;
                });
            }
            while (isFsCopyInstalled == false)
            {
                Thread.Sleep(10);
            }

            WriteLine("Alright, open your File Skimmer, click \"Start Remote Session\", and connect to the system name \"pebcak_devel\" with user name \"user\" and no password.");

            Story.PushObjective("Breaking The Bonds: A little practice...", "hacker101 has set up a virtual environment for you to connect to. Its system name is \"pebcak_local\", and has an unsecured user account with the name \"user\". Log into that user using your File Skimmer.",
                                () => { return(Applications.FileSkimmer.OpenConnection.SystemName == "pebcak_devel"); },
                                () =>
            {
                WriteLine("Good work. You're in. This user only has Admin privileges, and doesn't have anything useful on it. This is where hacking comes in.");
                WriteLine("See that \"super private personal stuff\" folder? It can only be accessed as a root user. You'll need the root password for pebcak_devel to get in there.");
                WriteLine("I'll send you a password cracking utility that can use open ShiftOS connections to sniff out all the users on the system and allow you to brute-force into an account.");
                Console.WriteLine("New program unlocked: brute");
                SaveSystem.CurrentSave.StoriesExperienced.Add("brute");
                WriteLine("Go ahead and open it! Use it to breach the root user on pebcak_devel.");
                WriteLine("Once you've got the root password, click the Reauthenticate button in File Skimmer and it will ask you to log in as a new user.");
                WriteLine("Use the new credentials to log in.");
                Story.PushObjective("Breaking The Bonds: The Brute", "Use your new \"brute\" application to breach the root account on pebcak_local so you can access the super secret folder and download its contents.", () =>
                {
                    return(Applications.FileSkimmer.CurrentRemoteUser == Applications.FileSkimmer.OpenConnection.Users.FirstOrDefault(x => x.Username == "root"));
                },
                                    () =>
                {
                    WriteLine("Now, open the folder and you can copy files and folders from it to your system.");
                    WriteLine("You've got 60 seconds before ShiftOS's internet daemon terminates this connection.");
                    int counter = 60;
                    while (counter > 0 && Applications.FileSkimmer.OpenConnection.SystemName == "pebcak_devel")
                    {
                        Thread.Sleep(1000);
                        Console.WriteLine("Connection termination in " + counter + " seconds...");
                        if (counter == 30 || counter == 15)
                        {
                            Engine.AudioManager.PlayStream(Properties.Resources._3beepvirus);
                        }
                        if (counter <= 10)
                        {
                            Engine.AudioManager.PlayStream(Properties.Resources.writesound);
                        }
                        counter--;
                    }
                    VirtualEnvironments.Clear();
                    Applications.FileSkimmer.DisconnectRemote();
                    WriteLine("Connections terminated I see.. Alright. Have fun with those dummy documents - you can keep them if you'd like. There's nothing important in them.");
                    WriteLine("That's one thing you can do with brute and other hacking utilities. I'd recommend buying some of brute's Shiftorium upgrades to make it faster and more efficient.");
                    WriteLine("Also, along the way, you're going to find a lot of new tricks. Some of them will require more than just brute to get into.");
                    WriteLine("So be on the lookout on the Shiftnet for other hacking-related tools. You won't find any on Appscape, however...");
                    WriteLine("That darn Aiden Nirh guy can't stand hackers.");
                    WriteLine("Looking at your logs, I see he's contacted you before... Seriously... don't let him find out about brute. He'll report it directly to DevX.");
                    WriteLine("Oh yeah, one more thing... that virus scanner... you may want to scan any files that you transfer from other systems with it.");
                    WriteLine("You never know what sorts of digital filth is hidden within such innocent-looking files.");
                    WriteLine("ALWAYS scan before opening - because if you open a file containing malicious code, it'll get run. It's just how ShiftOS's kernel works.");
                    WriteLine("Oh yeah, one last thing. Things are going to start getting pretty open in the Digital Society..");
                    WriteLine("Multiple people are going to want you to help them out with multiple things.");
                    WriteLine("I've written a little command-line utility that'll help you keep track of these missions and see how far you've gotten.");
                    WriteLine("Use the missions command to list out all the available missions, then use the startmission command to start one.");
                    WriteLine("When you complete a mission, you'll earn Codepoints depending on the mission.");
                    WriteLine("Allow me to demonstrate...");
                    Console.WriteLine("User has disconnected.");



                    Story.Context.MarkComplete();
                    TerminalBackend.PrefixEnabled = true;
                    SaveSystem.SaveGame();
                    TerminalBackend.PrintPrompt();
                });
            });
        }
示例#25
0
        public static void DoStory()
        {
            Applications.Terminal term = null;
            TerminalBackend.PrefixEnabled = false;
            Desktop.InvokeOnWorkerThread(() =>
            {
                term = new Applications.Terminal();
                AppearanceManager.SetupWindow(term);
                ConsoleEx.Bold            = true;
                ConsoleEx.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Welcome to ShiftOS.");
                Console.WriteLine();
                ConsoleEx.Bold            = false;
                ConsoleEx.ForegroundColor = ConsoleColor.White;
                Console.WriteLine("Before we can bring you to your new system, we must perform some system tasks.");
                Console.WriteLine();
                Console.WriteLine("Here's the installation outline.");
                Console.WriteLine();
                Console.Write(" - ");
                ConsoleEx.Bold = true;
                Console.Write("Storage preparation");
                ConsoleEx.Bold = false;
                Console.Write(" First, we have to prepare your computer's storage device for ShiftOS. This \r\nincludes formatting your drive with the ShiftFS file \r\nsystem, creating system directories, and generating system files.");
                Console.WriteLine();
                Console.Write(" - ");
                ConsoleEx.Bold = true;
                Console.Write("User configuration");
                ConsoleEx.Bold = false;
                Console.Write(" Next it's up to you to set up a system hostname, create a user account, and personalize it.");
                Console.WriteLine();
                Console.Write(" - ");
                ConsoleEx.Bold = true;
                Console.Write("System tutorial");
                ConsoleEx.Bold = false;
                Console.WriteLine("Finally, we'll teach you how to use ShiftOS.");

                Console.WriteLine();

                ConsoleEx.Bold            = true;
                ConsoleEx.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("Let's get started!");
            });
            int position = 0;

            Thread.Sleep(5000);

            ConsoleEx.Bold = true;
            Console.WriteLine("System preparation");


            Console.WriteLine();
            ConsoleEx.Bold            = false;
            ConsoleEx.ForegroundColor = ConsoleColor.White;
            Console.WriteLine(@"We'll now begin formatting your drive. Please be patient.");
            Console.WriteLine();
            double  bytesFree, totalBytes;
            string  type, name;
            dynamic dinf;

            try
            {
                if (Lunix.InWine)
                {
                    dinf = new Lunix.DFDriveInfo("/");
                }
                else
                {
                    dinf = new DriveInfo("C:\\");
                }
                bytesFree      = dinf.AvailableFreeSpace / 1073741824.0;
                totalBytes     = dinf.TotalSize / 1073741824.0;
                type           = dinf.DriveFormat.ToString();
                name           = dinf.Name;
                ConsoleEx.Bold = true;
                Console.Write("Drive name: ");
                ConsoleEx.Bold = false;
                Console.WriteLine(name);
                ConsoleEx.Bold = true;
                Console.Write("Drive type: ");
                ConsoleEx.Bold = false;
                Console.WriteLine(type);
                ConsoleEx.Bold = true;
                Console.Write("Total space: ");
                ConsoleEx.Bold = false;
                Console.WriteLine(String.Format("{0:F1}", totalBytes) + " GB");
                ConsoleEx.Bold = true;
                Console.Write("Free space: ");
                Console.WriteLine(String.Format("{0:F1}", bytesFree) + " GB");
                Console.WriteLine();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }

            ConsoleEx.Bold            = false;
            ConsoleEx.BackgroundColor = ConsoleColor.Black;
            Console.Write("Formatting: [");
            ConsoleEx.OnFlush?.Invoke();
            int formatProgress = 3;

            while (formatProgress <= 100)
            {
                if (formatProgress % 3 == 0)
                {
                    ConsoleEx.BackgroundColor = ConsoleColor.White;
                    Console.Write(" ");
                    ConsoleEx.OnFlush?.Invoke();
                    ConsoleEx.BackgroundColor = ConsoleColor.Black;
                }
                Desktop.InvokeOnWorkerThread(() => Engine.AudioManager.PlayStream(Properties.Resources.typesound));
                formatProgress++;
                Thread.Sleep(175);
            }
            Console.WriteLine("] ..done.");
            Thread.Sleep(1000);
            ConsoleEx.Bold = true;
            Console.WriteLine("Creating directories...");
            ConsoleEx.Bold = false;
            foreach (var dir in Paths.GetAllWithoutKey())
            {
                if (!dir.Contains(".") && dir.StartsWith("0:/"))
                {
                    Console.WriteLine("Creating: " + dir);
                    Thread.Sleep(125);
                    Desktop.InvokeOnWorkerThread(() => Engine.AudioManager.PlayStream(Properties.Resources.writesound));
                }
            }
            Console.WriteLine();
            Console.WriteLine("Next, let's get user information.");
            Console.WriteLine();
            Desktop.InvokeOnWorkerThread(() =>
            {
                var uSignUpDialog = new UniteSignupDialog((result) =>
                {
                    var sve                = new Save();
                    sve.SystemName         = result.SystemName;
                    sve.Codepoints         = 0;
                    sve.Upgrades           = new Dictionary <string, bool>();
                    sve.ID                 = Guid.NewGuid();
                    sve.StoriesExperienced = new List <string>();
                    sve.StoriesExperienced.Add("mud_fundamentals");
                    sve.Users = new List <ClientSave>
                    {
                        new ClientSave
                        {
                            Username    = "******",
                            Password    = result.RootPassword,
                            Permissions = 0
                        }
                    };

                    sve.StoryPosition      = 8675309;
                    SaveSystem.CurrentSave = sve;
                    Shiftorium.Silent      = true;
                    SaveSystem.SaveGame();
                    Shiftorium.Silent = false;
                });
                AppearanceManager.SetupDialog(uSignUpDialog);
            });
        }
示例#26
0
        public static void BreakingTheBonds_Patchwork()
        {
            CharacterName = "hacker101";
            SysName       = "pebcak";

            if (!terminalOpen())
            {
                var term = new Applications.Terminal();
                AppearanceManager.SetupWindow(term);
            }

            WriteLine("hacker101@pebcak - user connecting to your system.", false);
            Thread.Sleep(2000);
            WriteLine("Alright, you've gotten the applications you need.");
            WriteLine("Now, I know you're wondering, why do you need these three applications on your system?");
            WriteLine("Well, you're going to be doing some shady things and we need secure ways of storing the things you learn.");
            WriteLine("TriWrite is also needed so you can view rich-formatted text documents without them being garbled in TextPad.");
            WriteLine("Address Book is a secure way of storing information about the people you meet and learn about in the Digital Society.");
            WriteLine("And SimpleSRC is a chat system, much more advanced and secure than this remote terminal stuff you may have seen people doing to you.");
            WriteLine("ALL further operations with me will be done on SimpleSRC. But, for now, let's get you set up with your task.");
            WriteLine("You're going to be learning how to hack and crack systems in the Digital Society.");
            WriteLine("And this ain't no hippy DDoS stuff. Pfft, that crap is boring as hell.");
            WriteLine("I'm talking the ability to steal people's files remotely, read them on your system, and also, gain desktop-level and even root-level access to their ShiftOS installations, without them even knowing.");
            WriteLine("You'll be able to steal documents, programs, Codepoints and even more.");
            WriteLine("Of course, there's going to be defenses in place on other people's systems, such as secure passwords, advanced firewalls, network monitors, virus scanners, etc. You should get those kinds of things going on your system before we continue.");
            Story.Context.AutoComplete = false;
            WriteLine("I'll push out a sequence of objectives for you to follow to get your system secure.");
            Story.PushObjective("Breaking The Bonds: Patchwork - Get a virus scanner.", "Viruses are programs with the intent to harm users. They spread across the Digital Society infecting whoever they can find. A virus scanner can help you fight them off. There's a minimal one in the Shiftorium. Go get it!",

                                () => { return(Shiftorium.UpgradeInstalled("virus_scanner")); },
                                () =>
            {
                WriteLine("Alright, you've got a virus scanning program.");
                WriteLine("Now, let's take care of your system's biggest vulnerability, your root account.");
                bool isRootVulnerable = false;
                if (string.IsNullOrWhiteSpace(SaveSystem.Users.FirstOrDefault(x => x.Username == "root").Password))
                {
                    isRootVulnerable = true;
                    WriteLine("I was able to authenticate as root on your system without a password. Use the passwd command when logged in as root to change that.");
                    Story.PushObjective("Breaking The Bonds: Patchwork - Set a root password.", "If you aren't already, login as root using the su command. Then, Jesus Christ, set a root password!",
                                        () => { return(string.IsNullOrWhiteSpace(SaveSystem.Users.FirstOrDefault(x => x.Username == "root").Password)); },
                                        () => {
                        WriteLine("Man, oh man. My connection got terminated. That means you did it.");
                        WriteLine("Be lucky that was me and not someone who wanted to harm you.");
                        WriteLine("In ShiftOS, as well as most other Unix-likes, the root account has full permissions to everything on your system, no matter what.");
                        WriteLine("If someone gains access to your root system remotely, you must change its password immediately or you can call that system toast.");

                        isRootVulnerable = false;
                    });
                }
                while (isRootVulnerable)
                {
                    Thread.Sleep(10);
                }

                WriteLine("Alright, now let's make you another user account.");
                WriteLine("This user account will have administrative permissions, but in order for you to use them, you'll need to type your root password to confirm any administrative task.");
                WriteLine("Use the adduser command to add a new user. Give it a name, log into it, set a password if you'd like, then log back into root using su...");
                WriteLine("Then, in root, run \"setuserpermissions --user \"yourusername\" --val 2\". This will give the specified user \"admin\" permissions.");
                Story.PushObjective("Breaking The Bonds: Patchwork - Create an admin user", "Your root account looks nice and safe, but it's good practice on any Unix-like operating system, including ShiftOS, to have a user with slightly lower permissions called an Admin user. This user can do all the things that root can, but it requires you to enter your root password to verify administrative tasks.",

                                    () =>
                {
                    bool success = false;
                    if (SaveSystem.Users.Count() > 1)
                    {
                        success = SaveSystem.Users.FirstOrDefault(x => x.Username != "root" && x.Permissions == Objects.UserPermissions.Admin) != null;
                    }
                    return(success);
                },
                                    () =>
                {
                    WriteLine("It's as secure as you need now. There are a few other things you'll want to do, like setting up a firewall and a network monitor, but we'll save that for later.");
                    Story.Context.MarkComplete();
                    Story.Start("hacker101_breakingbonds_3");
                });
            });
        }
示例#27
0
 public void OpenFile(string file)
 {
     AppearanceManager.SetupWindow(this);
     names = JsonConvert.DeserializeObject <Dictionary <string, string> >(ShiftOS.Objects.ShiftFS.Utils.ReadAllText(file));
     SetupUI();
 }
示例#28
0
        public static void DevX1000CPStory()
        {
            Desktop.InvokeOnWorkerThread(() =>
            {
                var t = new Applications.Terminal();
                AppearanceManager.SetupWindow(t);
            });
            TerminalBackend.InStory       = true;
            TerminalBackend.PrefixEnabled = false;
            Thread.Sleep(3000);
            Engine.AudioManager.PlayStream(Properties.Resources._3beepvirus);
            Console.WriteLine("devx@anon_127420: Connection established.");
            Thread.Sleep(1500);
            Console.WriteLine("DevX: Hello, " + SaveSystem.CurrentUser.Username + "@" + SaveSystem.CurrentSave.SystemName + "! I see you've gotten a decent amount of Codepoints.");
            Thread.Sleep(2000);
            Console.WriteLine("DevX: Have you gotten a chance to install my \"Shifter\" application yet?");
            Thread.Sleep(1500);
            if (!Shiftorium.UpgradeInstalled("shifter"))
            {
                Console.WriteLine("You: Not yet. What's it for?");
                Thread.Sleep(2000);
                Console.WriteLine("DevX: The Shifter is a very effective way to make ShiftOS look however you want it to.");
                Thread.Sleep(2000);
                Console.WriteLine("DevX: It can even be adapted to support other applications, features and upgrades.");
                Thread.Sleep(2000);
            }
            else
            {
                Console.WriteLine("You: Yeah. Just seems kinda lackluster to me. What is it supposed to do?");
                Thread.Sleep(2000);
                Console.WriteLine("DevX: The Shifter is a very effective way to make ShiftOS look however you want it to.");
                Thread.Sleep(2000);
                Console.WriteLine("DevX: It can even be adapted to support other applications, features and upgrades.");
                Thread.Sleep(2000);
                Console.WriteLine("DevX: I haven't finished it just yet. Keep upgrading it and you'll notice it gets a lot better.");
                Thread.Sleep(2000);
            }
            Console.WriteLine("DevX: I'd also recommend going for the Skin Loader, that way you can save your creations to the disk. Also, go for the Skinning upgrade - which will allow more rich customization of certain elements.");
            Thread.Sleep(2000);
            Console.WriteLine("You: This still ain't gonna help me get back to my old system and out of this stupid Digital Society, is it?");
            Thread.Sleep(2000);
            Console.WriteLine("DevX: How the...How do you know about the Digital Societ....Who the hell talked!?");
            Thread.Sleep(2000);
            Console.WriteLine("You: Whoa! Just... calm down, will ya? I heard about it in the news, shortly before I got infected by this damn virus of an operating system.");
            Thread.Sleep(2000);
            Console.WriteLine("DevX: Whatever. That doesn't matter yet. Just focus on upgrading ShiftOS and earning Codepoints. I'll let you know when we're done. I've gotta go...work on something else.");
            Thread.Sleep(1500);
            Console.WriteLine("User disconnected.");
            Thread.Sleep(2000);
            Console.WriteLine("You: Something doesn't seem right about DevX. I wonder what he's really up to.");

            if (Shiftorium.UpgradeInstalled("shifter"))
            {
                PushObjectives();
            }
            else
            {
                Story.PushObjective("Buy the Shifter.", "The Shifter is a super-effective way to earn more Codepoints. It is an essential buy if you haven't already bought it. Save up for the Shifter, and buy it using shiftorium.buy{upgrade:\"shifter\"}.", () =>
                {
                    return(Shiftorium.UpgradeInstalled("shifter"));
                }, () =>
                {
                    PushObjectives();
                });
            }
            Story.Context.AutoComplete    = false;
            TerminalBackend.InStory       = false;
            TerminalBackend.PrefixEnabled = false;
            TerminalBackend.PrintPrompt();
        }