From e85832a5a4caefe854f3f27b7e60663e2bf26624 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 28 May 2017 16:05:51 -0400 Subject: [PATCH 01/71] fix double login issue and oobe bugs --- ShiftOS.WinForms/OobeStory.cs | 2 ++ ShiftOS_TheReturn/SaveSystem.cs | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ShiftOS.WinForms/OobeStory.cs b/ShiftOS.WinForms/OobeStory.cs index a35e1d8..8d86b9e 100644 --- a/ShiftOS.WinForms/OobeStory.cs +++ b/ShiftOS.WinForms/OobeStory.cs @@ -111,6 +111,7 @@ namespace ShiftOS.WinForms ConsoleEx.Bold = false; ConsoleEx.BackgroundColor = ConsoleColor.Black; Console.Write("Formatting: ["); + ConsoleEx.OnFlush?.Invoke(); int formatProgress = 3; while (formatProgress <= 100) { @@ -118,6 +119,7 @@ namespace ShiftOS.WinForms { ConsoleEx.BackgroundColor = ConsoleColor.White; Console.Write(" "); + ConsoleEx.OnFlush?.Invoke(); ConsoleEx.BackgroundColor = ConsoleColor.Black; } Desktop.InvokeOnWorkerThread(() => Engine.AudioManager.PlayStream(Properties.Resources.typesound)); diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs index 55f5cd5..c8996d4 100644 --- a/ShiftOS_TheReturn/SaveSystem.cs +++ b/ShiftOS_TheReturn/SaveSystem.cs @@ -21,6 +21,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ +// #define NOSAVE //#define ONLINEMODE @@ -213,15 +214,14 @@ namespace ShiftOS.Engine savehandshake = (msg) => { + ServerManager.MessageReceived -= savehandshake; if (msg.Name == "mud_savefile") { CurrentSave = JsonConvert.DeserializeObject(msg.Contents); - ServerManager.MessageReceived -= savehandshake; } else if (msg.Name == "mud_login_denied") { oobe.PromptForLogin(); - ServerManager.MessageReceived -= savehandshake; } }; ServerManager.MessageReceived += savehandshake; @@ -554,6 +554,7 @@ namespace ShiftOS.Engine /// public static void SaveGame() { +#if !NOSAVE if(!Shiftorium.Silent) Console.WriteLine(""); if(!Shiftorium.Silent) @@ -566,6 +567,7 @@ namespace ShiftOS.Engine if (!Shiftorium.Silent) Console.WriteLine(" ...{DONE}."); System.IO.File.WriteAllText(Paths.SaveFile, Utils.ExportMount(0)); +#endif } /// From f5a8a0a8c79f12eddb9ea862f1733d0d2706fa50 Mon Sep 17 00:00:00 2001 From: Rylan/wowmom98 Date: Sun, 28 May 2017 16:29:51 -0400 Subject: [PATCH 02/71] actually fix my dumb mistake --- ShiftOS.Server/Core.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ShiftOS.Server/Core.cs b/ShiftOS.Server/Core.cs index a53a5bc..7bb5b1d 100644 --- a/ShiftOS.Server/Core.cs +++ b/ShiftOS.Server/Core.cs @@ -32,7 +32,6 @@ using NetSockets; using Newtonsoft.Json; using System.IO; using static ShiftOS.Server.Program; -using ShiftOS.Engine namespace ShiftOS.Server @@ -181,7 +180,7 @@ namespace ShiftOS.Server if (sve.EndsWith(".save")) { var save = JsonConvert.DeserializeObject(File.ReadAllText(sve)); - accs.Add($"{ShiftOS.Engine.SaveSytem.CurrentUser.Username}@{save.SystemName}"); + accs.Add($"{save.Username}@{save.SystemName}"); } } From 58c9152351b02b37e63fc193060474478f1e9a65 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 29 May 2017 11:38:11 -0400 Subject: [PATCH 03/71] various things from last night --- .../Applications/Chat.Designer.cs | 178 +++++++++--------- ShiftOS.WinForms/Applications/Terminal.cs | 2 +- ShiftOS.WinForms/Oobe.cs | 2 +- ShiftOS.WinForms/ShiftOS.WinForms.csproj | 9 + .../ShiftnetSites/ShiftSoft_Ping.Designer.cs | 89 +++++++++ .../ShiftnetSites/ShiftSoft_Ping.cs | 92 +++++++++ .../ShiftnetSites/ShiftSoft_Ping.resx | 120 ++++++++++++ ShiftOS.WinForms/Stories/LegionStory.cs | 6 + 8 files changed, 407 insertions(+), 91 deletions(-) create mode 100644 ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.Designer.cs create mode 100644 ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.cs create mode 100644 ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.resx diff --git a/ShiftOS.WinForms/Applications/Chat.Designer.cs b/ShiftOS.WinForms/Applications/Chat.Designer.cs index d51b732..7bfa4dd 100644 --- a/ShiftOS.WinForms/Applications/Chat.Designer.cs +++ b/ShiftOS.WinForms/Applications/Chat.Designer.cs @@ -54,6 +54,13 @@ namespace ShiftOS.WinForms.Applications { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Chat)); this.panel1 = new System.Windows.Forms.Panel(); + this.pnlstart = new System.Windows.Forms.Panel(); + this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.txtchatid = new System.Windows.Forms.TextBox(); + this.btnjoin = new System.Windows.Forms.Button(); + this.label3 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); this.rtbchat = new System.Windows.Forms.RichTextBox(); this.toolStrip1 = new System.Windows.Forms.ToolStrip(); this.tschatid = new System.Windows.Forms.ToolStripLabel(); @@ -61,18 +68,11 @@ namespace ShiftOS.WinForms.Applications this.tsbottombar = new System.Windows.Forms.ToolStrip(); this.txtuserinput = new System.Windows.Forms.ToolStripTextBox(); this.btnsend = new System.Windows.Forms.ToolStripButton(); - this.pnlstart = new System.Windows.Forms.Panel(); - this.label1 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); - this.txtchatid = new System.Windows.Forms.TextBox(); - this.btnjoin = new System.Windows.Forms.Button(); this.panel1.SuspendLayout(); - this.toolStrip1.SuspendLayout(); - this.tsbottombar.SuspendLayout(); this.pnlstart.SuspendLayout(); this.flowLayoutPanel1.SuspendLayout(); + this.toolStrip1.SuspendLayout(); + this.tsbottombar.SuspendLayout(); this.SuspendLayout(); // // panel1 @@ -87,6 +87,82 @@ namespace ShiftOS.WinForms.Applications this.panel1.Size = new System.Drawing.Size(633, 318); this.panel1.TabIndex = 0; // + // pnlstart + // + this.pnlstart.Controls.Add(this.flowLayoutPanel1); + this.pnlstart.Controls.Add(this.label3); + this.pnlstart.Controls.Add(this.label2); + this.pnlstart.Controls.Add(this.label1); + this.pnlstart.Dock = System.Windows.Forms.DockStyle.Fill; + this.pnlstart.Location = new System.Drawing.Point(0, 25); + this.pnlstart.Name = "pnlstart"; + this.pnlstart.Size = new System.Drawing.Size(633, 268); + this.pnlstart.TabIndex = 4; + // + // flowLayoutPanel1 + // + this.flowLayoutPanel1.AutoSize = true; + this.flowLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.flowLayoutPanel1.Controls.Add(this.txtchatid); + this.flowLayoutPanel1.Controls.Add(this.btnjoin); + this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Top; + this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 118); + this.flowLayoutPanel1.Name = "flowLayoutPanel1"; + this.flowLayoutPanel1.Size = new System.Drawing.Size(633, 29); + this.flowLayoutPanel1.TabIndex = 3; + // + // txtchatid + // + this.txtchatid.Location = new System.Drawing.Point(3, 3); + this.txtchatid.Name = "txtchatid"; + this.txtchatid.Size = new System.Drawing.Size(192, 20); + this.txtchatid.TabIndex = 0; + // + // btnjoin + // + this.btnjoin.Location = new System.Drawing.Point(201, 3); + this.btnjoin.Name = "btnjoin"; + this.btnjoin.Size = new System.Drawing.Size(75, 23); + this.btnjoin.TabIndex = 1; + this.btnjoin.Text = "Join"; + this.btnjoin.UseVisualStyleBackColor = true; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Dock = System.Windows.Forms.DockStyle.Top; + this.label3.Location = new System.Drawing.Point(0, 85); + this.label3.Name = "label3"; + this.label3.Padding = new System.Windows.Forms.Padding(10); + this.label3.Size = new System.Drawing.Size(79, 33); + this.label3.TabIndex = 2; + this.label3.Tag = "header3"; + this.label3.Text = "Join a chat"; + // + // label2 + // + this.label2.Dock = System.Windows.Forms.DockStyle.Top; + this.label2.Location = new System.Drawing.Point(0, 33); + this.label2.Name = "label2"; + this.label2.Padding = new System.Windows.Forms.Padding(10); + this.label2.Size = new System.Drawing.Size(633, 52); + this.label2.TabIndex = 1; + this.label2.Text = "SimpleSRC is a simple chat program that utilises the ShiftOS Relay Chat protocol." + + " All you have to do is enter a chat code or system name, and SimpleSRC will try " + + "to initiate a chat for you."; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Dock = System.Windows.Forms.DockStyle.Top; + this.label1.Location = new System.Drawing.Point(0, 0); + this.label1.Name = "label1"; + this.label1.Padding = new System.Windows.Forms.Padding(10); + this.label1.Size = new System.Drawing.Size(143, 33); + this.label1.TabIndex = 0; + this.label1.Tag = "header1"; + this.label1.Text = "Welcome to SimpleSRC!"; + // // rtbchat // this.rtbchat.Dock = System.Windows.Forms.DockStyle.Fill; @@ -151,82 +227,6 @@ namespace ShiftOS.WinForms.Applications this.btnsend.Text = "Send"; this.btnsend.Click += new System.EventHandler(this.btnsend_Click); // - // pnlstart - // - this.pnlstart.Controls.Add(this.flowLayoutPanel1); - this.pnlstart.Controls.Add(this.label3); - this.pnlstart.Controls.Add(this.label2); - this.pnlstart.Controls.Add(this.label1); - this.pnlstart.Dock = System.Windows.Forms.DockStyle.Fill; - this.pnlstart.Location = new System.Drawing.Point(0, 25); - this.pnlstart.Name = "pnlstart"; - this.pnlstart.Size = new System.Drawing.Size(633, 268); - this.pnlstart.TabIndex = 4; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Dock = System.Windows.Forms.DockStyle.Top; - this.label1.Location = new System.Drawing.Point(0, 0); - this.label1.Name = "label1"; - this.label1.Padding = new System.Windows.Forms.Padding(10); - this.label1.Size = new System.Drawing.Size(143, 33); - this.label1.TabIndex = 0; - this.label1.Tag = "header1"; - this.label1.Text = "Welcome to SimpleSRC!"; - // - // label2 - // - this.label2.Dock = System.Windows.Forms.DockStyle.Top; - this.label2.Location = new System.Drawing.Point(0, 33); - this.label2.Name = "label2"; - this.label2.Padding = new System.Windows.Forms.Padding(10); - this.label2.Size = new System.Drawing.Size(633, 52); - this.label2.TabIndex = 1; - this.label2.Text = "SimpleSRC is a simple chat program that utilises the ShiftOS Relay Chat protocol." + - " All you have to do is enter a chat code or system name, and SimpleSRC will try " + - "to initiate a chat for you."; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Dock = System.Windows.Forms.DockStyle.Top; - this.label3.Location = new System.Drawing.Point(0, 85); - this.label3.Name = "label3"; - this.label3.Padding = new System.Windows.Forms.Padding(10); - this.label3.Size = new System.Drawing.Size(79, 33); - this.label3.TabIndex = 2; - this.label3.Tag = "header3"; - this.label3.Text = "Join a chat"; - // - // flowLayoutPanel1 - // - this.flowLayoutPanel1.AutoSize = true; - this.flowLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.flowLayoutPanel1.Controls.Add(this.txtchatid); - this.flowLayoutPanel1.Controls.Add(this.btnjoin); - this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Top; - this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 118); - this.flowLayoutPanel1.Name = "flowLayoutPanel1"; - this.flowLayoutPanel1.Size = new System.Drawing.Size(633, 29); - this.flowLayoutPanel1.TabIndex = 3; - // - // txtchatid - // - this.txtchatid.Location = new System.Drawing.Point(3, 3); - this.txtchatid.Name = "txtchatid"; - this.txtchatid.Size = new System.Drawing.Size(192, 20); - this.txtchatid.TabIndex = 0; - // - // btnjoin - // - this.btnjoin.Location = new System.Drawing.Point(201, 3); - this.btnjoin.Name = "btnjoin"; - this.btnjoin.Size = new System.Drawing.Size(75, 23); - this.btnjoin.TabIndex = 1; - this.btnjoin.Text = "Join"; - this.btnjoin.UseVisualStyleBackColor = true; - // // Chat // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -236,14 +236,14 @@ namespace ShiftOS.WinForms.Applications this.Size = new System.Drawing.Size(633, 318); this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); - this.toolStrip1.ResumeLayout(false); - this.toolStrip1.PerformLayout(); - this.tsbottombar.ResumeLayout(false); - this.tsbottombar.PerformLayout(); this.pnlstart.ResumeLayout(false); this.pnlstart.PerformLayout(); this.flowLayoutPanel1.ResumeLayout(false); this.flowLayoutPanel1.PerformLayout(); + this.toolStrip1.ResumeLayout(false); + this.toolStrip1.PerformLayout(); + this.tsbottombar.ResumeLayout(false); + this.tsbottombar.PerformLayout(); this.ResumeLayout(false); } diff --git a/ShiftOS.WinForms/Applications/Terminal.cs b/ShiftOS.WinForms/Applications/Terminal.cs index de4888b..2d2b4c5 100644 --- a/ShiftOS.WinForms/Applications/Terminal.cs +++ b/ShiftOS.WinForms/Applications/Terminal.cs @@ -232,7 +232,7 @@ namespace ShiftOS.WinForms.Applications var text = txt.Lines.ToArray(); var text2 = text[text.Length - 1]; var text3 = ""; - Console.WriteLine(); + txt.AppendText(Environment.NewLine); var text4 = Regex.Replace(text2, @"\t|\n|\r", ""); if (IsInRemoteSystem == true) diff --git a/ShiftOS.WinForms/Oobe.cs b/ShiftOS.WinForms/Oobe.cs index 90395a7..9182b4b 100644 --- a/ShiftOS.WinForms/Oobe.cs +++ b/ShiftOS.WinForms/Oobe.cs @@ -302,7 +302,7 @@ namespace ShiftOS.WinForms var client = new UniteClient("http://getshiftos.ml", token); var sve = new Save(); - SaveSystem.CurrentUser.Username = client.GetEmail(); + sve.Username = client.GetEmail(); sve.Password = Guid.NewGuid().ToString(); sve.SystemName = client.GetSysName(); sve.UniteAuthToken = token; diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index 9844657..22bd1d2 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -388,6 +388,12 @@ ShiftGames.cs + + UserControl + + + ShiftSoft_Ping.cs + @@ -583,6 +589,9 @@ ShiftGames.cs + + ShiftSoft_Ping.cs + UniteLoginDialog.cs diff --git a/ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.Designer.cs b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.Designer.cs new file mode 100644 index 0000000..244f6d4 --- /dev/null +++ b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.Designer.cs @@ -0,0 +1,89 @@ +namespace ShiftOS.WinForms.ShiftnetSites +{ + partial class ShiftSoft_Ping + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.fllist = new System.Windows.Forms.FlowLayoutPanel(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Dock = System.Windows.Forms.DockStyle.Top; + this.label1.Location = new System.Drawing.Point(0, 0); + this.label1.Name = "label1"; + this.label1.Padding = new System.Windows.Forms.Padding(10); + this.label1.Size = new System.Drawing.Size(48, 33); + this.label1.TabIndex = 0; + this.label1.Tag = "header2"; + this.label1.Text = "Ping"; + // + // label2 + // + this.label2.Dock = System.Windows.Forms.DockStyle.Top; + this.label2.Location = new System.Drawing.Point(0, 33); + this.label2.Name = "label2"; + this.label2.Padding = new System.Windows.Forms.Padding(10); + this.label2.Size = new System.Drawing.Size(734, 56); + this.label2.TabIndex = 1; + this.label2.Text = "Ping is a simple service that lets you see all the sites on the shiftnet/ cluster" + + ". These sites are safe for you to use and do not contain malware or other threat" + + "s."; + // + // fllist + // + this.fllist.Dock = System.Windows.Forms.DockStyle.Fill; + this.fllist.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; + this.fllist.Location = new System.Drawing.Point(0, 89); + this.fllist.Name = "fllist"; + this.fllist.Size = new System.Drawing.Size(734, 389); + this.fllist.TabIndex = 2; + // + // ShiftSoft_Ping + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.fllist); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Name = "ShiftSoft_Ping"; + this.Size = new System.Drawing.Size(734, 478); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.FlowLayoutPanel fllist; + } +} diff --git a/ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.cs b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.cs new file mode 100644 index 0000000..1c64390 --- /dev/null +++ b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.cs @@ -0,0 +1,92 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using System.Reflection; +using System.IO; +using ShiftOS.Engine; +using ShiftOS.WinForms.Tools; + +namespace ShiftOS.WinForms.ShiftnetSites +{ + [ShiftnetSite("shiftnet/shiftsoft/ping", "Ping", "A site listing hosted by ShiftSoft.")] + public partial class ShiftSoft_Ping : UserControl, IShiftnetSite + { + public ShiftSoft_Ping() + { + InitializeComponent(); + } + + public event Action GoBack; + public event Action GoToUrl; + + public void OnLoad() + { + SetupListing(); + } + + public void OnSkinLoad() + { + ControlManager.SetupControls(this); + SetupListing(); + } + + public void SetupListing() + { + foreach(var exec in Directory.GetFiles(Environment.CurrentDirectory)) + { + if(exec.ToLower().EndsWith(".exe") || exec.ToLower().EndsWith(".dll")) + { + try + { + var asm = Assembly.LoadFile(exec); + var types = asm.GetTypes(); + foreach (var type in types) + { + if (type.GetInterfaces().Contains(typeof(IShiftnetSite))) + { + var attr = type.GetCustomAttributes(false).Where(x => x is ShiftnetSiteAttribute) as ShiftnetSiteAttribute; + if (attr != null) + { + var lnk = new LinkLabel(); + lnk.LinkColor = SkinEngine.LoadedSkin.ControlTextColor; + lnk.Tag = "header3"; + lnk.Text = attr.Name; + var desc = new Label(); + desc.AutoSize = true; + lnk.AutoSize = true; + desc.MaximumSize = new Size(this.Width / 3, 0); + desc.Text = attr.Description; + lnk.Click += (o, a) => + { + GoToUrl?.Invoke(attr.Url); + }; + fllist.Controls.Add(lnk); + fllist.Controls.Add(desc); + ControlManager.SetupControls(lnk); + lnk.Show(); + desc.Show(); + } + } + } + } + catch { } + } + } + } + + public void OnUpgrade() + { + } + + public void Setup() + { + SetupListing(); + } + } +} diff --git a/ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.resx b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ShiftOS.WinForms/Stories/LegionStory.cs b/ShiftOS.WinForms/Stories/LegionStory.cs index 433ad2d..a0fc9bf 100644 --- a/ShiftOS.WinForms/Stories/LegionStory.cs +++ b/ShiftOS.WinForms/Stories/LegionStory.cs @@ -51,6 +51,8 @@ namespace ShiftOS.WinForms.Stories Desktop.InvokeOnWorkerThread(() => { Story.Start("installer"); + while (!Shiftorium.UpgradeInstalled("installer")) + Thread.Sleep(20); AppearanceManager.SetupWindow(installer); installer.InitiateInstall(new ShiftnetInstallation()); }); @@ -64,6 +66,10 @@ namespace ShiftOS.WinForms.Stories WriteLine("There are also lots of companies offering many services."); WriteLine("I'd stay on the shiftnet/ cluster though, others may be dangerous."); WriteLine("I'd also stick to the sites listed on shiftnet/shiftsoft/ping - that site is regularly updated with the most safe Shiftnet sites."); + WriteLine("Oh, that reminds me. I have set you up with ShiftSoft's service provider, Freebie Solutions."); + WriteLine("It's a free provider, but it offers only 256 bytes per second download and upload speeds."); + WriteLine("You may want to go look for another provider when you can afford it."); + WriteLine("Trust me - with this provider, things get slow."); WriteLine("Anyways, it was nice meeting you, hopefully someday you'll give theShell a try."); TerminalBackend.PrefixEnabled = true; From 505073b6938fc8be8b91807a69bd67e45ed4382f Mon Sep 17 00:00:00 2001 From: Michael VanOverbeek Date: Mon, 29 May 2017 16:41:49 +0000 Subject: [PATCH 04/71] Fix server-side crash when kiading revoked api keys --- ShiftOS.Objects/Save.cs | 23 +++++++++++++---------- ShiftOS.Server/Program.cs | 13 +++++++++---- ShiftOS.Server/SaveManager.cs | 26 +++++++++++++++++++++++++- 3 files changed, 47 insertions(+), 15 deletions(-) diff --git a/ShiftOS.Objects/Save.cs b/ShiftOS.Objects/Save.cs index f4e1e09..8675a35 100644 --- a/ShiftOS.Objects/Save.cs +++ b/ShiftOS.Objects/Save.cs @@ -47,24 +47,27 @@ namespace ShiftOS.Objects { get { - if (!string.IsNullOrWhiteSpace(UniteAuthToken)) + try { var uc = new ShiftOS.Unite.UniteClient("", UniteAuthToken); return uc.GetCodepoints(); } - else + catch + { return _cp; + } } set { - if (!string.IsNullOrWhiteSpace(UniteAuthToken)) - { - var uc = new ShiftOS.Unite.UniteClient("", UniteAuthToken); - uc.SetCodepoints(value); - } - else - _cp = value; - + try + { + var uc = new ShiftOS.Unite.UniteClient("", UniteAuthToken); + uc.SetCodepoints(value); + } + catch + { + _cp = value; + } } } diff --git a/ShiftOS.Server/Program.cs b/ShiftOS.Server/Program.cs index c880321..e1dcdf2 100644 --- a/ShiftOS.Server/Program.cs +++ b/ShiftOS.Server/Program.cs @@ -98,11 +98,16 @@ namespace ShiftOS.Server { if (server.IsOnline) { - server.DispatchAll(new NetObject("heartbeat", new ServerMessage + + try { - Name = "heartbeat", - GUID = "server" - })); + server.DispatchAll(new NetObject("heartbeat", new ServerMessage + { + Name = "heartbeat", + GUID = "server" + })); + } + catch { } } }; if (!Directory.Exists("saves")) diff --git a/ShiftOS.Server/SaveManager.cs b/ShiftOS.Server/SaveManager.cs index d81a1a7..bb71c71 100644 --- a/ShiftOS.Server/SaveManager.cs +++ b/ShiftOS.Server/SaveManager.cs @@ -207,7 +207,6 @@ namespace ShiftOS.Server { var save = JsonConvert.DeserializeObject(ReadEncFile(savefile)); - if (save.UniteAuthToken==token) { if (save.ID == new Guid()) @@ -216,6 +215,31 @@ namespace ShiftOS.Server WriteEncFile(savefile, JsonConvert.SerializeObject(save)); } + var wr = HttpWebRequest.Create(UserConfig.Get().UniteUrl + "/API/GetCodepoints"); + wr.Headers.Add("Authentication: Token " + save.UniteAuthToken); + try + { + using(var resp = wr.GetResponse()) + { + using(var str = resp.GetResponseStream()) + { + using(var reader = new StreamReader(str)) + { + Console.WriteLine("This user has " + reader.ReadToEnd() + " Codepoint(s)."); + } + } + } + } + catch (Exception ex) + { + Console.WriteLine(ex); + Program.server.DispatchTo(new Guid(guid), new NetObject("auth_failed", new ServerMessage + { + Name = "mud_login_denied", + GUID = "server" + })); + return; + } Program.server.DispatchTo(new Guid(guid), new NetObject("mud_savefile", new ServerMessage { From ff47625d2547deed441a853569f9fe84197e23b6 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 29 May 2017 16:08:59 -0400 Subject: [PATCH 05/71] fix some clientside save softlocks --- ShiftOS.WinForms/Applications/Terminal.cs | 31 +++++++++++++---------- ShiftOS.WinForms/Oobe.cs | 3 ++- ShiftOS_TheReturn/SaveSystem.cs | 15 ++++++++--- 3 files changed, 31 insertions(+), 18 deletions(-) diff --git a/ShiftOS.WinForms/Applications/Terminal.cs b/ShiftOS.WinForms/Applications/Terminal.cs index 2d2b4c5..080e8bb 100644 --- a/ShiftOS.WinForms/Applications/Terminal.cs +++ b/ShiftOS.WinForms/Applications/Terminal.cs @@ -313,21 +313,24 @@ namespace ShiftOS.WinForms.Applications } else if (a.KeyCode == Keys.Left) { - var getstring = txt.Lines[txt.Lines.Length - 1]; - var stringlen = getstring.Length + 1; - var header = $"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "; - var headerlen = header.Length + 1; - var selstart = txt.SelectionStart; - var remstrlen = txt.TextLength - stringlen; - var finalnum = selstart - remstrlen; + if (SaveSystem.CurrentSave != null) + { + var getstring = txt.Lines[txt.Lines.Length - 1]; + var stringlen = getstring.Length + 1; + var header = $"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "; + var headerlen = header.Length + 1; + var selstart = txt.SelectionStart; + var remstrlen = txt.TextLength - stringlen; + var finalnum = selstart - remstrlen; - if (finalnum != headerlen) - { - AppearanceManager.CurrentPosition--; - } - else - { - a.SuppressKeyPress = true; + if (finalnum != headerlen) + { + AppearanceManager.CurrentPosition--; + } + else + { + a.SuppressKeyPress = true; + } } } else if (a.KeyCode == Keys.Up) diff --git a/ShiftOS.WinForms/Oobe.cs b/ShiftOS.WinForms/Oobe.cs index 9182b4b..96c2bf5 100644 --- a/ShiftOS.WinForms/Oobe.cs +++ b/ShiftOS.WinForms/Oobe.cs @@ -207,14 +207,15 @@ namespace ShiftOS.WinForms ServerMessageReceived smr = null; smr = (msg) => { - ServerManager.MessageReceived -= smr; if (msg.Name == "mud_savefile") { + ServerManager.MessageReceived -= smr; SaveSystem.CurrentSave = JsonConvert.DeserializeObject(msg.Contents); SaveSystem.SaveGame(); } else if(msg.Name=="mud_login_denied") { + ServerManager.MessageReceived -= smr; LinkSaveFile(token); } }; diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs index c8996d4..d1b92fd 100644 --- a/ShiftOS_TheReturn/SaveSystem.cs +++ b/ShiftOS_TheReturn/SaveSystem.cs @@ -214,13 +214,22 @@ namespace ShiftOS.Engine savehandshake = (msg) => { - ServerManager.MessageReceived -= savehandshake; if (msg.Name == "mud_savefile") { - CurrentSave = JsonConvert.DeserializeObject(msg.Contents); - } + ServerManager.MessageReceived -= savehandshake; + try + { + CurrentSave = JsonConvert.DeserializeObject(msg.Contents); + } + catch + { + Console.WriteLine("[system] [SEVERE] Cannot parse configuration file."); + oobe.PromptForLogin(); + } + } else if (msg.Name == "mud_login_denied") { + ServerManager.MessageReceived -= savehandshake; oobe.PromptForLogin(); } }; From 37ac4c684ce3904c5ec614362ed99bb9867ca0f3 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 29 May 2017 20:08:30 -0400 Subject: [PATCH 06/71] It's amazing what talking to Rylan can do to an integer datatype. --- ShiftOS.Objects/EngineShiftnetSubscription.cs | 2 +- ShiftOS.Objects/Save.cs | 4 ++-- ShiftOS.Objects/Shop.cs | 2 +- ShiftOS.Objects/UniteClient.cs | 12 +++++------ ShiftOS.WinForms/Applications/Pong.cs | 20 +++++++++---------- ShiftOS.WinForms/Applications/ShiftLetters.cs | 2 +- ShiftOS.WinForms/Applications/ShiftLotto.cs | 4 ++-- ShiftOS.WinForms/Applications/ShiftSweeper.cs | 8 ++++---- ShiftOS.WinForms/Applications/Shifter.cs | 2 +- .../Applications/ShiftoriumFrontend.cs | 4 ++-- .../Applications/ShopItemCreator.cs | 4 ++-- ShiftOS.WinForms/HackerCommands.cs | 2 +- ShiftOS.WinForms/JobTasks.cs | 4 ++-- .../ShiftnetSites/AppscapeMain.cs | 4 ++-- ShiftOS.WinForms/WinformsDesktop.cs | 2 +- ShiftOS_TheReturn/Commands.cs | 4 ++-- ShiftOS_TheReturn/SaveSystem.cs | 4 ++-- ShiftOS_TheReturn/Scripting.cs | 4 ++-- ShiftOS_TheReturn/ServerManager.cs | 2 +- ShiftOS_TheReturn/Shiftorium.cs | 10 +++++----- 20 files changed, 50 insertions(+), 50 deletions(-) diff --git a/ShiftOS.Objects/EngineShiftnetSubscription.cs b/ShiftOS.Objects/EngineShiftnetSubscription.cs index 1296a98..c319f18 100644 --- a/ShiftOS.Objects/EngineShiftnetSubscription.cs +++ b/ShiftOS.Objects/EngineShiftnetSubscription.cs @@ -10,7 +10,7 @@ namespace ShiftOS.Objects { public string Name { get; set; } public string Description { get; set; } - public int CostPerMonth { get; set; } + public uint CostPerMonth { get; set; } public int DownloadSpeed { get; set; } public string Company { get; set; } } diff --git a/ShiftOS.Objects/Save.cs b/ShiftOS.Objects/Save.cs index 8675a35..0fef7b3 100644 --- a/ShiftOS.Objects/Save.cs +++ b/ShiftOS.Objects/Save.cs @@ -41,9 +41,9 @@ namespace ShiftOS.Objects [Obsolete("This save variable is no longer used in Beta 2.4 and above of ShiftOS. Please use ShiftOS.Engine.SaveSystem.CurrentUser.Username to access the current user's username.")] public string Username { get; set; } - private long _cp = 0; + private ulong _cp = 0; - public long Codepoints + public ulong Codepoints { get { diff --git a/ShiftOS.Objects/Shop.cs b/ShiftOS.Objects/Shop.cs index 65f5746..c603523 100644 --- a/ShiftOS.Objects/Shop.cs +++ b/ShiftOS.Objects/Shop.cs @@ -42,7 +42,7 @@ namespace ShiftOS.Objects { public string Name { get; set; } public string Description { get; set; } - public int Cost { get; set; } + public ulong Cost { get; set; } public int FileType { get; set; } public byte[] MUDFile { get; set; } } diff --git a/ShiftOS.Objects/UniteClient.cs b/ShiftOS.Objects/UniteClient.cs index d8e34b7..ccd721b 100644 --- a/ShiftOS.Objects/UniteClient.cs +++ b/ShiftOS.Objects/UniteClient.cs @@ -83,9 +83,9 @@ namespace ShiftOS.Unite /// Get the Pong codepoint highscore for the current user. /// /// The amount of Codepoints returned by the server - public int GetPongCP() + public ulong GetPongCP() { - return Convert.ToInt32(MakeCall("/API/GetPongCP")); + return Convert.ToUInt64(MakeCall("/API/GetPongCP")); } /// @@ -110,7 +110,7 @@ namespace ShiftOS.Unite /// Set the pong Codepoints record for the user /// /// The amount of Codepoints to set the record to - public void SetPongCP(int value) + public void SetPongCP(ulong value) { MakeCall("/API/SetPongCP/" + value.ToString()); } @@ -182,16 +182,16 @@ namespace ShiftOS.Unite /// Get the user's codepoints. /// /// The amount of codepoints stored on the server for this user. - public long GetCodepoints() + public ulong GetCodepoints() { - return Convert.ToInt64(MakeCall("/API/GetCodepoints")); + return Convert.ToUInt64(MakeCall("/API/GetCodepoints")); } /// /// Set the user's codepoints. /// /// The amount of codepoints to set the user's codepoints value to. - public void SetCodepoints(long value) + public void SetCodepoints(ulong value) { MakeCall("/API/SetCodepoints/" + value.ToString()); } diff --git a/ShiftOS.WinForms/Applications/Pong.cs b/ShiftOS.WinForms/Applications/Pong.cs index 84177b7..6d81c64 100644 --- a/ShiftOS.WinForms/Applications/Pong.cs +++ b/ShiftOS.WinForms/Applications/Pong.cs @@ -58,10 +58,10 @@ namespace ShiftOS.WinForms.Applications double incrementy = 0.2; int levelxspeed = 3; int levelyspeed = 3; - int beatairewardtotal; - int beataireward = 1; - int[] levelrewards = new int[50]; - int totalreward; + ulong beatairewardtotal; + ulong beataireward = 1; + ulong[] levelrewards = new ulong[50]; + ulong totalreward; int countdown = 3; bool aiShouldIsbeEnabled = true; @@ -297,11 +297,11 @@ namespace ShiftOS.WinForms.Applications lblmissedout.Text = Localization.Parse("{YOU_MISSED_OUT_ON}:") + Environment.NewLine + lblstatscodepoints.Text.Replace(Localization.Parse("{CODEPOINTS}: "), "") + Localization.Parse(" {CODEPOINTS}"); if (ShiftoriumFrontend.UpgradeInstalled("pong_upgrade_2")) { - totalreward = levelrewards[level - 1] + beatairewardtotal; + totalreward = (ulong)(levelrewards[level - 1] + beatairewardtotal); double onePercent = (totalreward / 100); lblbutyougained.Show(); lblbutyougained.Text = Localization.Parse("{BUT_YOU_GAINED}:") + Environment.NewLine + onePercent.ToString("") + (Localization.Parse(" {CODEPOINTS}")); - SaveSystem.TransferCodepointsFrom("pong", (totalreward / 100)); + SaveSystem.TransferCodepointsFrom("pong", (ulong)(totalreward / 100)); } else { @@ -715,10 +715,10 @@ namespace ShiftOS.WinForms.Applications { if (ShiftoriumFrontend.UpgradeInstalled("pong_upgrade")) { - beataireward = level * 10; + beataireward = (ulong)(level * 10); } else { - beataireward = level * 5; + beataireward = (ulong)(level * 5); } } else @@ -726,11 +726,11 @@ namespace ShiftOS.WinForms.Applications if (ShiftoriumFrontend.UpgradeInstalled("pong_upgrade")) { double br = levelrewards[level - 1] / 10; - beataireward = (int)Math.Round(br) * 10; + beataireward = (ulong)Math.Round(br) * 10; } else { double br = levelrewards[level - 1] / 10; - beataireward = (int)Math.Round(br) * 5; + beataireward = (ulong)Math.Round(br) * 5; } } diff --git a/ShiftOS.WinForms/Applications/ShiftLetters.cs b/ShiftOS.WinForms/Applications/ShiftLetters.cs index 42e19f8..0e9f74a 100644 --- a/ShiftOS.WinForms/Applications/ShiftLetters.cs +++ b/ShiftOS.WinForms/Applications/ShiftLetters.cs @@ -217,7 +217,7 @@ namespace ShiftOS.WinForms.Applications if (!lblword.Text.Contains("_")) { int oldlives = lives; - int cp = (word.Length * oldlives) * 2; //drunky michael made this 5x... + ulong cp = (ulong)(word.Length * oldlives) * 2; //drunky michael made this 5x... SaveSystem.TransferCodepointsFrom("shiftletters", cp); StartGame(); } diff --git a/ShiftOS.WinForms/Applications/ShiftLotto.cs b/ShiftOS.WinForms/Applications/ShiftLotto.cs index 5ab8154..3f940c7 100644 --- a/ShiftOS.WinForms/Applications/ShiftLotto.cs +++ b/ShiftOS.WinForms/Applications/ShiftLotto.cs @@ -88,7 +88,7 @@ namespace ShiftOS.WinForms.Applications } else { - if (SaveSystem.CurrentSave.Codepoints - (codePoints * difficulty) <= 0) + if (SaveSystem.CurrentSave.Codepoints - (ulong)(codePoints * difficulty) <= 0) { Infobox.Show("Not enough Codepoints", "You do not have enough Codepoints to gamble this amount!"); } @@ -102,7 +102,7 @@ namespace ShiftOS.WinForms.Applications int winningNumber = rnd.Next(0, difficulty); // Multiply CodePoints * Difficulty - int jackpot = codePoints * difficulty; + ulong jackpot = (ulong)(codePoints * difficulty); // Test the random ints if (guessedNumber == winningNumber) diff --git a/ShiftOS.WinForms/Applications/ShiftSweeper.cs b/ShiftOS.WinForms/Applications/ShiftSweeper.cs index f23ed73..772ec26 100644 --- a/ShiftOS.WinForms/Applications/ShiftSweeper.cs +++ b/ShiftOS.WinForms/Applications/ShiftSweeper.cs @@ -300,12 +300,12 @@ namespace ShiftOS.WinForms.Applications { } public void winGame() { - int cp = 0; - int origminecount = gameBombCount * 10; + ulong cp = 0; + ulong origminecount = (ulong)(gameBombCount * 10); if (minetimer < 31) cp = (origminecount * 3); - else if (minetimer < 61) cp = (Int32)(origminecount * 2.5); + else if (minetimer < 61) cp = (ulong)(origminecount * 2.5); else if (minetimer < 91) cp = (origminecount * 2); - else if (minetimer < 121) cp = (Int32)(origminecount * 1.5); + else if (minetimer < 121) cp = (ulong)(origminecount * 1.5); else if (minetimer > 120) cp = (origminecount * 1); SaveSystem.TransferCodepointsFrom("shiftsweeper", cp); panelGameStatus.Image = Properties.Resources.SweeperWinFace; diff --git a/ShiftOS.WinForms/Applications/Shifter.cs b/ShiftOS.WinForms/Applications/Shifter.cs index 1a59c80..3b3a4f1 100644 --- a/ShiftOS.WinForms/Applications/Shifter.cs +++ b/ShiftOS.WinForms/Applications/Shifter.cs @@ -391,7 +391,7 @@ namespace ShiftOS.WinForms.Applications } - public int CodepointValue = 0; + public uint CodepointValue = 0; public List settings = new List(); public Skin LoadedSkin = null; diff --git a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs index 08e6c8f..d6b014d 100644 --- a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs +++ b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs @@ -213,9 +213,9 @@ namespace ShiftOS.WinForms.Applications private void btnbuy_Click(object sender, EventArgs e) { - long cpCost = 0; + ulong cpCost = 0; backend.Silent = true; - Dictionary UpgradesToBuy = new Dictionary(); + Dictionary UpgradesToBuy = new Dictionary(); foreach (var itm in lbupgrades.SelectedItems) { cpCost += upgrades[itm.ToString()].Cost; diff --git a/ShiftOS.WinForms/Applications/ShopItemCreator.cs b/ShiftOS.WinForms/Applications/ShopItemCreator.cs index 61e7491..d2836ee 100644 --- a/ShiftOS.WinForms/Applications/ShopItemCreator.cs +++ b/ShiftOS.WinForms/Applications/ShopItemCreator.cs @@ -73,7 +73,7 @@ namespace ShiftOS.WinForms.Applications Infobox.Show("No file chosen.", "Please select a file to sell."); return; } - Item.Cost = Convert.ToInt32(txtcost.Text); + Item.Cost = Convert.ToUInt64(txtcost.Text); Item.Description = txtdescription.Text; Item.Name = txtitemname.Text; Callback?.Invoke(Item); @@ -101,7 +101,7 @@ namespace ShiftOS.WinForms.Applications { try { - Item.Cost = Convert.ToInt32(txtcost.Text); + Item.Cost = Convert.ToUInt64(txtcost.Text); } catch { diff --git a/ShiftOS.WinForms/HackerCommands.cs b/ShiftOS.WinForms/HackerCommands.cs index 47b486d..f467eb2 100644 --- a/ShiftOS.WinForms/HackerCommands.cs +++ b/ShiftOS.WinForms/HackerCommands.cs @@ -504,7 +504,7 @@ namespace ShiftOS.WinForms string usr = args["user"].ToString(); string sys = args["sys"].ToString(); string pass = args["pass"].ToString(); - long amount = (long)args["amount"]; + ulong amount = (ulong)args["amount"]; if(amount < 0) { Console.WriteLine("--invalid codepoint amount - halting..."); diff --git a/ShiftOS.WinForms/JobTasks.cs b/ShiftOS.WinForms/JobTasks.cs index 622e287..d862961 100644 --- a/ShiftOS.WinForms/JobTasks.cs +++ b/ShiftOS.WinForms/JobTasks.cs @@ -35,12 +35,12 @@ namespace ShiftOS.WinForms { public class AcquireCodepointsJobTask : JobTask { - public AcquireCodepointsJobTask(int amount) + public AcquireCodepointsJobTask(uint amount) { CodepointsRequired = SaveSystem.CurrentSave.Codepoints + amount; } - public long CodepointsRequired { get; private set; } + public ulong CodepointsRequired { get; private set; } public override bool IsComplete { diff --git a/ShiftOS.WinForms/ShiftnetSites/AppscapeMain.cs b/ShiftOS.WinForms/ShiftnetSites/AppscapeMain.cs index fa575f4..c7830d0 100644 --- a/ShiftOS.WinForms/ShiftnetSites/AppscapeMain.cs +++ b/ShiftOS.WinForms/ShiftnetSites/AppscapeMain.cs @@ -372,7 +372,7 @@ namespace ShiftOS.WinForms /// public class AppscapeEntryAttribute : RequiresUpgradeAttribute { - public AppscapeEntryAttribute(string name, string description, int downloadSize, long cost, string dependencies = "", string category = "Misc") : base(name.ToLower().Replace(' ', '_')) + public AppscapeEntryAttribute(string name, string description, int downloadSize, ulong cost, string dependencies = "", string category = "Misc") : base(name.ToLower().Replace(' ', '_')) { Name = name; Description = description; @@ -385,7 +385,7 @@ namespace ShiftOS.WinForms public string Name { get; private set; } public string Description { get; private set; } public string Category { get; private set; } - public long Cost { get; private set; } + public ulong Cost { get; private set; } public string DependencyString { get; private set; } public int DownloadSize { get; private set; } } diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index 85eab55..95e7c1a 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -192,7 +192,7 @@ namespace ShiftOS.WinForms SetupDesktop(); }; - long lastcp = 0; + ulong lastcp = 0; var storythread = new Thread(() => { diff --git a/ShiftOS_TheReturn/Commands.cs b/ShiftOS_TheReturn/Commands.cs index b97cd1d..ec89539 100644 --- a/ShiftOS_TheReturn/Commands.cs +++ b/ShiftOS_TheReturn/Commands.cs @@ -311,7 +311,7 @@ namespace ShiftOS.Engine if (args.ContainsKey("amount")) try { - long codepointsToAdd = Convert.ToInt64(args["amount"].ToString()); + ulong codepointsToAdd = Convert.ToUInt64(args["amount"].ToString()); SaveSystem.CurrentSave.Codepoints += codepointsToAdd; return true; } @@ -639,7 +639,7 @@ shiftorium.buy{{upgrade:""{upg.ID}""}}"); cat = args["cat"].ToString(); } - Dictionary upgrades = new Dictionary(); + Dictionary upgrades = new Dictionary(); int maxLength = 5; IEnumerable upglist = Shiftorium.GetAvailable(); diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs index d1b92fd..395db85 100644 --- a/ShiftOS_TheReturn/SaveSystem.cs +++ b/ShiftOS_TheReturn/SaveSystem.cs @@ -480,7 +480,7 @@ namespace ShiftOS.Engine /// Deducts a set amount of Codepoints from the save file... and sends them to a place where they'll never be seen again. /// /// The amount of Codepoints to deduct. - public static void TransferCodepointsToVoid(long amount) + public static void TransferCodepointsToVoid(ulong amount) { if (amount < 0) throw new ArgumentOutOfRangeException("We see what you did there. Trying to pull Codepoints from the void? That won't work."); @@ -584,7 +584,7 @@ namespace ShiftOS.Engine /// /// The character name /// The amount of Codepoints. - public static void TransferCodepointsFrom(string who, long amount) + public static void TransferCodepointsFrom(string who, ulong amount) { if (amount < 0) throw new ArgumentOutOfRangeException("We see what you did there... You can't just give a fake character Codepoints like that. It's better if you transfer them to the void."); diff --git a/ShiftOS_TheReturn/Scripting.cs b/ShiftOS_TheReturn/Scripting.cs index 61c6676..5021f50 100644 --- a/ShiftOS_TheReturn/Scripting.cs +++ b/ShiftOS_TheReturn/Scripting.cs @@ -444,7 +444,7 @@ end"); /// Retrieves the user's Codepoints from the save file. /// /// The user's Codepoints. - public long getCodepoints() { return SaveSystem.CurrentSave.Codepoints; } + public ulong getCodepoints() { return SaveSystem.CurrentSave.Codepoints; } /// /// Run a command in the Terminal. @@ -462,7 +462,7 @@ end"); /// Adds the specified amount of Codepoints to the save flie. /// /// The codepoints to add. - public void addCodepoints(int cp) + public void addCodepoints(uint cp) { if (cp > 100 || cp <= 0) { diff --git a/ShiftOS_TheReturn/ServerManager.cs b/ShiftOS_TheReturn/ServerManager.cs index abb674d..1439c0d 100644 --- a/ShiftOS_TheReturn/ServerManager.cs +++ b/ShiftOS_TheReturn/ServerManager.cs @@ -246,7 +246,7 @@ Ping: {ServerManager.DigitalSocietyPing} ms var args = JsonConvert.DeserializeObject>(msg.Contents); if(args["username"] as string == SaveSystem.CurrentUser.Username) { - SaveSystem.CurrentSave.Codepoints += (long)args["amount"]; + SaveSystem.CurrentSave.Codepoints += (ulong)args["amount"]; Desktop.InvokeOnWorkerThread(new Action(() => { Infobox.Show($"MUD Control Centre", $"Someone bought an item in your shop, and they have paid {args["amount"]}, and as such, you have been granted these Codepoints."); diff --git a/ShiftOS_TheReturn/Shiftorium.cs b/ShiftOS_TheReturn/Shiftorium.cs index bd7105f..975939f 100644 --- a/ShiftOS_TheReturn/Shiftorium.cs +++ b/ShiftOS_TheReturn/Shiftorium.cs @@ -112,7 +112,7 @@ namespace ShiftOS.Engine /// The upgrade ID to buy /// The amount of Codepoints to deduct /// True if the upgrade was installed successfully, false if the user didn't have enough Codepoints or the upgrade wasn' found. - public static bool Buy(string id, long cost) + public static bool Buy(string id, ulong cost) { if (SaveSystem.CurrentSave.Codepoints >= cost) { @@ -365,7 +365,7 @@ namespace ShiftOS.Engine /// /// The upgrade ID to search /// The codepoint value. - public static long GetCPValue(string id) + public static ulong GetCPValue(string id) { foreach (var upg in GetDefaults()) { @@ -520,7 +520,7 @@ namespace ShiftOS.Engine { public string Name { get; set; } public string Description { get; set; } - public long Cost { get; set; } + public ulong Cost { get; set; } public string ID { get { return (this.Id != null ? this.Id : (Name.ToLower().Replace(" ", "_"))); } } public string Id { get; set; } public string Category { get; set; } @@ -536,7 +536,7 @@ namespace ShiftOS.Engine public class ShiftoriumUpgradeAttribute : RequiresUpgradeAttribute { - public ShiftoriumUpgradeAttribute(string name, long cost, string desc, string dependencies, string category) : base(name.ToLower().Replace(" ", "_")) + public ShiftoriumUpgradeAttribute(string name, ulong cost, string desc, string dependencies, string category) : base(name.ToLower().Replace(" ", "_")) { Name = name; Description = desc; @@ -547,7 +547,7 @@ namespace ShiftOS.Engine public string Name { get; private set; } public string Description { get; private set; } - public long Cost { get; private set; } + public ulong Cost { get; private set; } public string Dependencies { get; private set; } public string Category { get; private set; } } From b35e50e7ef0b34baa1151aa397311ae1f7865dd2 Mon Sep 17 00:00:00 2001 From: Michael VanOverbeek Date: Tue, 30 May 2017 00:14:55 +0000 Subject: [PATCH 07/71] You scratch my back and I detach your back. --- ShiftOS.Server/SaveManager.cs | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/ShiftOS.Server/SaveManager.cs b/ShiftOS.Server/SaveManager.cs index bb71c71..2a94fb1 100644 --- a/ShiftOS.Server/SaveManager.cs +++ b/ShiftOS.Server/SaveManager.cs @@ -207,7 +207,7 @@ namespace ShiftOS.Server { var save = JsonConvert.DeserializeObject(ReadEncFile(savefile)); - if (save.UniteAuthToken==token) + if (save.UniteAuthToken == token) { if (save.ID == new Guid()) { @@ -219,11 +219,11 @@ namespace ShiftOS.Server wr.Headers.Add("Authentication: Token " + save.UniteAuthToken); try { - using(var resp = wr.GetResponse()) + using (var resp = wr.GetResponse()) { - using(var str = resp.GetResponseStream()) + using (var str = resp.GetResponseStream()) { - using(var reader = new StreamReader(str)) + using (var reader = new StreamReader(str)) { Console.WriteLine("This user has " + reader.ReadToEnd() + " Codepoint(s)."); } @@ -252,15 +252,11 @@ namespace ShiftOS.Server } catch { } } - try + Program.server.DispatchTo(new Guid(guid), new NetObject("auth_failed", new ServerMessage { - Program.server.DispatchTo(new Guid(guid), new NetObject("auth_failed", new ServerMessage - { - Name = "mud_login_denied", - GUID = "server" - })); - } - catch { } + Name = "mud_login_denied", + GUID = "server" + })); } [MudRequest("delete_save", typeof(ClientSave))] From c6e3d0e905d9c87483f4b8887be6c4d68dcb6f9f Mon Sep 17 00:00:00 2001 From: Michael VanOverbeek Date: Tue, 30 May 2017 00:20:19 +0000 Subject: [PATCH 08/71] Really you long-ass nerd, Michael... --- ShiftOS.Server/RandomUserGenerator.cs | 2 +- ShiftOS.Server/SaveManager.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ShiftOS.Server/RandomUserGenerator.cs b/ShiftOS.Server/RandomUserGenerator.cs index 3a62f9c..6da891d 100644 --- a/ShiftOS.Server/RandomUserGenerator.cs +++ b/ShiftOS.Server/RandomUserGenerator.cs @@ -111,7 +111,7 @@ namespace ShiftOS.Server break; } - sve.Codepoints = rnd.Next(startCP, maxAmt); + sve.Codepoints = (ulong)rnd.Next(startCP, maxAmt); //FS treasure generation. /* diff --git a/ShiftOS.Server/SaveManager.cs b/ShiftOS.Server/SaveManager.cs index 2a94fb1..cb2e1ba 100644 --- a/ShiftOS.Server/SaveManager.cs +++ b/ShiftOS.Server/SaveManager.cs @@ -288,7 +288,7 @@ namespace ShiftOS.Server { args["username"] = args["username"].ToString().ToLower(); string userName = args["username"] as string; - long cpAmount = (long)args["amount"]; + ulong cpAmount = (ulong)args["amount"]; if (Directory.Exists("saves")) { @@ -322,7 +322,7 @@ namespace ShiftOS.Server args["username"] = args["username"].ToString().ToLower(); string userName = args["username"] as string; string passw = args["password"] as string; - int cpAmount = (int)args["amount"]; + ulong cpAmount = (ulong)args["amount"]; if (Directory.Exists("saves")) { @@ -335,7 +335,7 @@ namespace ShiftOS.Server WriteEncFile(saveFile, JsonConvert.SerializeObject(saveFileContents, Formatting.Indented)); Program.ClientDispatcher.Broadcast("update_your_cp", new { username = userName, - amount = -cpAmount + amount = -(long)cpAmount }); Program.ClientDispatcher.DispatchTo("update_your_cp", guid, new { From 0ca2fffe7a214fb5cc4c6482ca6fb8d1e4d2c4ea Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 30 May 2017 13:18:08 -0400 Subject: [PATCH 09/71] storydev.list command --- ShiftOS.WinForms/HackerCommands.cs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/ShiftOS.WinForms/HackerCommands.cs b/ShiftOS.WinForms/HackerCommands.cs index f467eb2..316b7fc 100644 --- a/ShiftOS.WinForms/HackerCommands.cs +++ b/ShiftOS.WinForms/HackerCommands.cs @@ -2,12 +2,14 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using System.Reflection; using System.Text; using System.Threading; using System.Threading.Tasks; using Newtonsoft.Json; using ShiftOS.Engine; using ShiftOS.Objects; +using ShiftOS.Objects.ShiftFS; using ShiftOS.WinForms.Applications; using static ShiftOS.Objects.ShiftFS.Utils; @@ -674,6 +676,34 @@ namespace ShiftOS.WinForms return true; } + [Command("list", description ="Lists all story IDs.")] + public static bool ListIds() + { + foreach(var exec in System.IO.Directory.GetFiles(Environment.CurrentDirectory)) + { + if(exec.ToLower().EndsWith(".exe") || exec.ToLower().EndsWith(".dll")) + { + try + { + var asm = Assembly.LoadFile(exec); + { + foreach(var type in asm.GetTypes()) + { + foreach(var method in type.GetMethods(BindingFlags.Public | BindingFlags.Static)) + { + var attr = method.GetCustomAttributes(false).FirstOrDefault(x => x is StoryAttribute); + if (attr != null) + Console.WriteLine(" - " + (attr as StoryAttribute).StoryID); + } + } + } + } + catch { } + } + } + return true; + } + [Command("unexperience", description = "Marks a story plot as not-experienced yet.", usage ="id:string")] [RemoteLock] [RequiresArgument("id")] From 0451b5d15703987b6be1160917ea31d36f6ee125 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 30 May 2017 16:34:31 -0400 Subject: [PATCH 10/71] Slight Shiftnet mods, new default skin. --- ShiftOS.WinForms/Applications/Chat.resx | 6 + ShiftOS.WinForms/Applications/Shiftnet.cs | 3 + ShiftOS.WinForms/ShiftOS.WinForms.csproj | 9 ++ .../ShiftnetSites/ShiftSoft.Designer.cs | 61 +++++++++ ShiftOS.WinForms/ShiftnetSites/ShiftSoft.cs | 38 ++++++ ShiftOS.WinForms/ShiftnetSites/ShiftSoft.resx | 120 ++++++++++++++++++ .../ShiftnetSites/ShiftSoft_Ping.cs | 51 ++++---- ShiftOS_TheReturn/Skinning.cs | 12 +- 8 files changed, 271 insertions(+), 29 deletions(-) create mode 100644 ShiftOS.WinForms/ShiftnetSites/ShiftSoft.Designer.cs create mode 100644 ShiftOS.WinForms/ShiftnetSites/ShiftSoft.cs create mode 100644 ShiftOS.WinForms/ShiftnetSites/ShiftSoft.resx diff --git a/ShiftOS.WinForms/Applications/Chat.resx b/ShiftOS.WinForms/Applications/Chat.resx index a7b2b93..e4a35ad 100644 --- a/ShiftOS.WinForms/Applications/Chat.resx +++ b/ShiftOS.WinForms/Applications/Chat.resx @@ -123,6 +123,12 @@ 122, 17 + + 17, 17 + + + 122, 17 + diff --git a/ShiftOS.WinForms/Applications/Shiftnet.cs b/ShiftOS.WinForms/Applications/Shiftnet.cs index 7f5d3c1..22b53a0 100644 --- a/ShiftOS.WinForms/Applications/Shiftnet.cs +++ b/ShiftOS.WinForms/Applications/Shiftnet.cs @@ -80,6 +80,7 @@ namespace ShiftOS.WinForms.Applications txturl.Location = new Point(btnforward.Left + btnforward.Width + 2, 2); txturl.Width = flcontrols.Width - btnback.Width - 2 - btnforward.Width - 2 - (btngo.Width*2) - 2; btngo.Location = new Point(flcontrols.Width - btngo.Width - 2, 2); + flcontrols.BackColor = SkinEngine.LoadedSkin.TitleBackgroundColor; } public bool OnUnload() @@ -147,6 +148,7 @@ namespace ShiftOS.WinForms.Applications public void NavigateToUrl(string url) { + txturl.Text = url; foreach(var exe in Directory.GetFiles(Environment.CurrentDirectory)) { @@ -188,6 +190,7 @@ namespace ShiftOS.WinForms.Applications obj.OnUpgrade(); obj.OnSkinLoad(); obj.Setup(); + AppearanceManager.SetWindowTitle(this, attribute.Name + " - Shiftnet"); return; } } diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index 22bd1d2..65a512e 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -388,6 +388,12 @@ ShiftGames.cs + + UserControl + + + ShiftSoft.cs + UserControl @@ -589,6 +595,9 @@ ShiftGames.cs + + ShiftSoft.cs + ShiftSoft_Ping.cs diff --git a/ShiftOS.WinForms/ShiftnetSites/ShiftSoft.Designer.cs b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft.Designer.cs new file mode 100644 index 0000000..a62b5a8 --- /dev/null +++ b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft.Designer.cs @@ -0,0 +1,61 @@ +namespace ShiftOS.WinForms.ShiftnetSites +{ + partial class ShiftSoft + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Franklin Gothic Heavy", 24.75F, System.Drawing.FontStyle.Italic); + this.label1.Location = new System.Drawing.Point(13, 17); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(152, 38); + this.label1.TabIndex = 0; + this.label1.Tag = "keepfont"; + this.label1.Text = "Shiftsoft"; + // + // ShiftSoft + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.label1); + this.Name = "ShiftSoft"; + this.Size = new System.Drawing.Size(523, 384); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + } +} diff --git a/ShiftOS.WinForms/ShiftnetSites/ShiftSoft.cs b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft.cs new file mode 100644 index 0000000..18968cd --- /dev/null +++ b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using ShiftOS.Engine; + +namespace ShiftOS.WinForms.ShiftnetSites +{ + [ShiftnetSite("shiftnet/shiftsoft", "ShiftSoft", "What do you want to shift today?")] + [ShiftnetFundamental] + public partial class ShiftSoft : UserControl, IShiftnetSite + { + public ShiftSoft() + { + InitializeComponent(); + } + + public event Action GoBack; + public event Action GoToUrl; + + public void OnSkinLoad() + { + } + + public void OnUpgrade() + { + } + + public void Setup() + { + } + } +} diff --git a/ShiftOS.WinForms/ShiftnetSites/ShiftSoft.resx b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.cs b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.cs index 1c64390..1593117 100644 --- a/ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.cs +++ b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.cs @@ -25,11 +25,6 @@ namespace ShiftOS.WinForms.ShiftnetSites public event Action GoBack; public event Action GoToUrl; - public void OnLoad() - { - SetupListing(); - } - public void OnSkinLoad() { ControlManager.SetupControls(this); @@ -38,6 +33,7 @@ namespace ShiftOS.WinForms.ShiftnetSites public void SetupListing() { + fllist.Controls.Clear(); foreach(var exec in Directory.GetFiles(Environment.CurrentDirectory)) { if(exec.ToLower().EndsWith(".exe") || exec.ToLower().EndsWith(".dll")) @@ -50,27 +46,36 @@ namespace ShiftOS.WinForms.ShiftnetSites { if (type.GetInterfaces().Contains(typeof(IShiftnetSite))) { - var attr = type.GetCustomAttributes(false).Where(x => x is ShiftnetSiteAttribute) as ShiftnetSiteAttribute; + var attr = type.GetCustomAttributes(false).FirstOrDefault(x => x is ShiftnetSiteAttribute) as ShiftnetSiteAttribute; if (attr != null) { - var lnk = new LinkLabel(); - lnk.LinkColor = SkinEngine.LoadedSkin.ControlTextColor; - lnk.Tag = "header3"; - lnk.Text = attr.Name; - var desc = new Label(); - desc.AutoSize = true; - lnk.AutoSize = true; - desc.MaximumSize = new Size(this.Width / 3, 0); - desc.Text = attr.Description; - lnk.Click += (o, a) => + if (attr.Url.StartsWith("shiftnet/")) { - GoToUrl?.Invoke(attr.Url); - }; - fllist.Controls.Add(lnk); - fllist.Controls.Add(desc); - ControlManager.SetupControls(lnk); - lnk.Show(); - desc.Show(); + var lnk = new LinkLabel(); + lnk.LinkColor = SkinEngine.LoadedSkin.ControlTextColor; + lnk.Text = attr.Name; + var desc = new Label(); + desc.AutoSize = true; + lnk.AutoSize = true; + desc.MaximumSize = new Size(this.Width / 3, 0); + desc.Text = attr.Description; + desc.Padding = new Padding + { + Bottom = 25, + Top = 0, + Left = 10, + Right = 10 + }; + lnk.Click += (o, a) => + { + GoToUrl?.Invoke(attr.Url); + }; + fllist.Controls.Add(lnk); + fllist.Controls.Add(desc); + ControlManager.SetupControls(lnk); + lnk.Show(); + desc.Show(); + } } } } diff --git a/ShiftOS_TheReturn/Skinning.cs b/ShiftOS_TheReturn/Skinning.cs index f5dd211..5bd4ab1 100644 --- a/ShiftOS_TheReturn/Skinning.cs +++ b/ShiftOS_TheReturn/Skinning.cs @@ -332,18 +332,18 @@ namespace ShiftOS.Engine public class Skin { //borrowing from the discourse theme for the default skin - private static readonly Color DefaultBackground = Color.FromArgb(0, 0x44, 0x00); + private static readonly Color DefaultBackground = Color.FromArgb(0x11, 0x11, 0x11); private static readonly Color DefaultForeground = Color.FromArgb(0xDD, 0xDD, 0xDD); private static readonly Color Accent1 = Color.FromArgb(0x66, 0x66, 0x66); private static readonly Color Accent2 = Color.FromArgb(0x80, 0, 0); - private static readonly Color DesktopBG = Color.FromArgb(0x22, 0x22, 0x22); + private static readonly Color DesktopBG = Color.FromArgb(0x00, 0x00, 0x00); private static readonly Font SysFont = new Font("Tahoma", 9F); private static readonly Font SysFont2 = new Font("Tahoma", 10F, FontStyle.Bold); - private static readonly Font Header1 = new Font("Helvetica", 20F, FontStyle.Bold); - private static readonly Font Header2 = new Font("Helvetica", 17.5F, FontStyle.Bold); - private static readonly Font Header3 = new Font("Tahoma", 15F, FontStyle.Bold); + private static readonly Font Header1 = new Font("Courier New", 20F, FontStyle.Bold); + private static readonly Font Header2 = new Font("Courier New", 17.5F, FontStyle.Bold); + private static readonly Font Header3 = new Font("Courier New", 15F, FontStyle.Bold); - private static readonly Color TitleBG = Color.FromArgb(0x11, 0x11, 0x11); + private static readonly Color TitleBG = Color.FromArgb(0x55, 0x11, 0x11); private static readonly Color TitleFG = Color.FromArgb(0xaa, 0xaa, 0xaa); //Todo: When making Shifter GUI we need to label all these with proper Shifter attributes to get 'em displaying in the right places. From ecf5297dbb9fd551005963dc1d430ed348848390 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 30 May 2017 21:50:19 -0400 Subject: [PATCH 11/71] slightly fix balloon notes --- ShiftOS.WinForms/WinformsDesktop.cs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index 95e7c1a..76c5050 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -47,8 +47,24 @@ namespace ShiftOS.WinForms /// /// Winforms desktop. /// + [Namespace("desktop")] public partial class WinformsDesktop : Form, IDesktop { + [Command("pushnote")] + [RequiresArgument("target")] + [RequiresArgument("title")] + [RequiresArgument("body")] + public static bool PushNote(Dictionary args) + { + string ta = args["target"].ToString(); + string ti = args["title"].ToString(); + string bo = args["body"].ToString(); + + Desktop.PushNotification(ta, ti, bo); + + return true; + } + public List Widgets = new List(); @@ -64,7 +80,7 @@ namespace ShiftOS.WinForms pnlnotificationbox.Left = desktoppanel.Width - pnlnotificationbox.Width; else { - int left = ctl.PointToScreen(ctl.Location).X; + int left = ctl.Parent.PointToScreen(ctl.Location).X; int realleft = left - pnlnotificationbox.Width; realleft += ctl.Width; pnlnotificationbox.Left = realleft; @@ -75,6 +91,7 @@ namespace ShiftOS.WinForms pnlnotificationbox.Top = desktoppanel.Height; else pnlnotificationbox.Top = this.Height - desktoppanel.Height - pnlnotificationbox.Height; + ControlManager.SetupControls(pnlnotificationbox); var notekiller = new System.Windows.Forms.Timer(); notekiller.Interval = 10000; notekiller.Tick += (o, a) => @@ -83,6 +100,7 @@ namespace ShiftOS.WinForms }; Engine.AudioManager.PlayStream(Properties.Resources.infobox); pnlnotificationbox.Show(); + pnlnotificationbox.BringToFront(); notekiller.Start(); } From 3dd402277bba874f24fab11865d257133c6f782c Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 31 May 2017 08:40:29 -0400 Subject: [PATCH 12/71] Fix sizing issue with notifications, and UP key in terminal --- ShiftOS.WinForms/Applications/Terminal.cs | 1 + ShiftOS.WinForms/WinformsDesktop.cs | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/ShiftOS.WinForms/Applications/Terminal.cs b/ShiftOS.WinForms/Applications/Terminal.cs index 080e8bb..a4b77ae 100644 --- a/ShiftOS.WinForms/Applications/Terminal.cs +++ b/ShiftOS.WinForms/Applications/Terminal.cs @@ -338,6 +338,7 @@ namespace ShiftOS.WinForms.Applications var tostring3 = txt.Lines[txt.Lines.Length - 1]; if (tostring3 == $"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ") Console.Write(TerminalBackend.LastCommand); + ConsoleEx.OnFlush?.Invoke(); a.SuppressKeyPress = true; } diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index 76c5050..643c02a 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -74,6 +74,10 @@ namespace ShiftOS.WinForms { lbnotemsg.Text = msg; lbnotetitle.Text = title; + int height = pnlnotificationbox.Height; + pnlnotificationbox.AutoSize = false; + pnlnotificationbox.Height = height; + pnlnotificationbox.Width = lbnotetitle.Width; var ctl = flnotifications.Controls.ToList().FirstOrDefault(x => x.Tag.ToString() == app); if (ctl == null) @@ -97,8 +101,11 @@ namespace ShiftOS.WinForms notekiller.Tick += (o, a) => { pnlnotificationbox.Hide(); + pnlnotificationbox.AutoSize = true; }; Engine.AudioManager.PlayStream(Properties.Resources.infobox); + + pnlnotificationbox.Show(); pnlnotificationbox.BringToFront(); notekiller.Start(); From c63117276194d18890f14c75b8864749fbd33a0e Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 31 May 2017 09:03:19 -0400 Subject: [PATCH 13/71] modular notifications --- ShiftOS.WinForms/WinformsDesktop.cs | 44 +++++++++++++++++++++++++ ShiftOS_TheReturn/IStatusIcon.cs | 14 ++++++++ ShiftOS_TheReturn/NotificationDaemon.cs | 30 +++++++++++++++++ ShiftOS_TheReturn/ShiftOS.Engine.csproj | 1 + 4 files changed, 89 insertions(+) create mode 100644 ShiftOS_TheReturn/IStatusIcon.cs diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index 643c02a..0cfd667 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -70,6 +70,46 @@ namespace ShiftOS.WinForms private int millisecondsUntilScreensaver = 300000; + public void LoadIcons() + { + //That shot me back to 0.0.x with that name. Whatever. + flnotifications.Controls.Clear(); //Clear the status tray + + foreach(var itype in NotificationDaemon.GetAllStatusIcons()) + { + //We have the types. No need for shiftorium calls or anything. + //First create the icon control... + + var ic = new PictureBox(); + //We can use the type name, in lowercase, for the icon tag. + ic.Tag = itype.Name.ToLower(); + //Next get the icon data if any. + + var iconattrib = itype.GetCustomAttributes(false).FirstOrDefault(x => x is DefaultIconAttribute) as DefaultIconAttribute; + if(iconattrib != null) + { + //We can use this attribute's ID in the skin engine to get an icon. + var img = GetIcon(iconattrib.ID); + //Make it transparent. + (img as Bitmap).MakeTransparent(LoadedSkin.SystemKey); + //Assign it to the control + ic.Image = img; + //Set the sizing mode + ic.SizeMode = PictureBoxSizeMode.StretchImage; + } + else + { + ic.BackColor = Color.White; //TODO: Make it skinnable. + } + ic.Size = new Size(20, 20); //TODO: make it skinnable + //add to the notification tray + flnotifications.Controls.Add(ic); + ic.Show(); + + //TODO: Settings pane on click. + } + } + public void PushNotification(string app, string title, string msg) { lbnotemsg.Text = msg; @@ -134,6 +174,8 @@ namespace ShiftOS.WinForms widget.OnUpgrade(); } + LoadIcons(); + //Only if the DevX Legions story hasn't been experienced yet. if (!Shiftorium.UpgradeInstalled("devx_legions")) { @@ -180,6 +222,7 @@ namespace ShiftOS.WinForms SaveSystem.GameReady += () => { + this.Invoke(new Action(LoadIcons)); if (this.Visible == true) this.Invoke(new Action(() => SetupDesktop())); }; @@ -208,6 +251,7 @@ namespace ShiftOS.WinForms }; SkinEngine.SkinLoaded += () => { + LoadIcons(); foreach (var widget in Widgets) { widget.OnSkinLoad(); diff --git a/ShiftOS_TheReturn/IStatusIcon.cs b/ShiftOS_TheReturn/IStatusIcon.cs new file mode 100644 index 0000000..f32d1c1 --- /dev/null +++ b/ShiftOS_TheReturn/IStatusIcon.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ShiftOS.Engine +{ + public interface IStatusIcon + { + void Setup(); + + } +} diff --git a/ShiftOS_TheReturn/NotificationDaemon.cs b/ShiftOS_TheReturn/NotificationDaemon.cs index a90510a..0725782 100644 --- a/ShiftOS_TheReturn/NotificationDaemon.cs +++ b/ShiftOS_TheReturn/NotificationDaemon.cs @@ -25,6 +25,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Reflection; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; @@ -34,6 +35,35 @@ namespace ShiftOS.Engine { public static class NotificationDaemon { + /// + /// Gets a list of all objects that meet their Shiftorium dependencies. + /// + /// An array of s containing the found objects. + public static Type[] GetAllStatusIcons() + { + List lst = new List(); + foreach(var exec in System.IO.Directory.GetFiles(Environment.CurrentDirectory)) + { + if(exec.ToLower().EndsWith(".exe") || exec.ToLower().EndsWith(".dll")) + { + try + { + var asm = Assembly.LoadFile(exec); + foreach(var type in asm.GetTypes().Where(x => x.GetInterfaces().Contains(typeof(IStatusIcon)))) + { + if (Shiftorium.UpgradeAttributesUnlocked(type)) + { + lst.Add(type); + } + } + } + catch { } + } + } + return lst.ToArray(); + } + + //if the notifications file already exists then get them public static Notification[] GetAllFromFile() { diff --git a/ShiftOS_TheReturn/ShiftOS.Engine.csproj b/ShiftOS_TheReturn/ShiftOS.Engine.csproj index 4cbce72..f70c41e 100644 --- a/ShiftOS_TheReturn/ShiftOS.Engine.csproj +++ b/ShiftOS_TheReturn/ShiftOS.Engine.csproj @@ -109,6 +109,7 @@ + From b0da30bbde2bb198850ea45dc0006762b23f99a3 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 31 May 2017 09:14:27 -0400 Subject: [PATCH 14/71] COMPLETELY WORKING notification system! --- ShiftOS.WinForms/WinformsDesktop.cs | 31 ++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index 0cfd667..b9c4f37 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -106,7 +106,32 @@ namespace ShiftOS.WinForms flnotifications.Controls.Add(ic); ic.Show(); - //TODO: Settings pane on click. + ic.Click += (o, a) => + { + HideAppLauncher(); + + if(itype.BaseType == typeof(UserControl)) + { + UserControl ctrl = (UserControl)Activator.CreateInstance(itype); + (ctrl as IStatusIcon).Setup(); + currentSettingsPane = ctrl; + if(LoadedSkin.DesktopPanelPosition == 0) + { + ctrl.Top = desktoppanel.Height; + } + else + { + ctrl.Top = this.Height - desktoppanel.Height - ctrl.Height; + } + int noteleft = flnotifications.PointToScreen(ic.Location).X; + int realleft = (this.Width - (noteleft + ic.Width)) - ctrl.Width; + ctrl.Left = realleft; + ControlManager.SetupControls(ctrl); + ctrl.Show(); + } + + + }; } } @@ -151,6 +176,8 @@ namespace ShiftOS.WinForms notekiller.Start(); } + private UserControl currentSettingsPane = null; + /// /// Initializes a new instance of the class. /// @@ -1101,6 +1128,8 @@ namespace ShiftOS.WinForms { this.Invoke(new Action(() => { + currentSettingsPane?.Hide(); + currentSettingsPane = null; pnladvancedal.Hide(); })); } From 324104eb0b8650969b2205404e3ad83401fb100e Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 31 May 2017 19:23:40 -0400 Subject: [PATCH 15/71] volume control slider and other goodies --- .../Controls/ShiftedProgressBar.cs | 90 +++++++------ .../Properties/Resources.Designer.cs | 16 ++- ShiftOS.WinForms/Properties/Resources.resx | 3 + ShiftOS.WinForms/Resources/iconSpeaker.bmp | Bin 0 -> 3382 bytes ShiftOS.WinForms/ShiftOS.WinForms.csproj | 19 +++ .../StatusIcons/ShiftnetStatus.Designer.cs | 90 +++++++++++++ .../StatusIcons/ShiftnetStatus.cs | 33 +++++ .../StatusIcons/ShiftnetStatus.resx | 120 ++++++++++++++++++ .../StatusIcons/Volume.Designer.cs | 59 +++++++++ ShiftOS.WinForms/StatusIcons/Volume.cs | 67 ++++++++++ ShiftOS.WinForms/StatusIcons/Volume.resx | 120 ++++++++++++++++++ ShiftOS.WinForms/Tools/ControlManager.cs | 15 ++- ShiftOS.WinForms/WinformsDesktop.Designer.cs | 29 +++-- ShiftOS.WinForms/WinformsDesktop.cs | 32 ++--- ShiftOS.WinForms/WinformsDesktop.resx | 3 - 15 files changed, 618 insertions(+), 78 deletions(-) create mode 100644 ShiftOS.WinForms/Resources/iconSpeaker.bmp create mode 100644 ShiftOS.WinForms/StatusIcons/ShiftnetStatus.Designer.cs create mode 100644 ShiftOS.WinForms/StatusIcons/ShiftnetStatus.cs create mode 100644 ShiftOS.WinForms/StatusIcons/ShiftnetStatus.resx create mode 100644 ShiftOS.WinForms/StatusIcons/Volume.Designer.cs create mode 100644 ShiftOS.WinForms/StatusIcons/Volume.cs create mode 100644 ShiftOS.WinForms/StatusIcons/Volume.resx diff --git a/ShiftOS.WinForms/Controls/ShiftedProgressBar.cs b/ShiftOS.WinForms/Controls/ShiftedProgressBar.cs index ceaff02..c5a6d05 100644 --- a/ShiftOS.WinForms/Controls/ShiftedProgressBar.cs +++ b/ShiftOS.WinForms/Controls/ShiftedProgressBar.cs @@ -140,51 +140,65 @@ namespace ShiftOS.WinForms.Controls protected override void OnPaint(PaintEventArgs pe) { - pe.Graphics.Clear(this.RealBackColor); - if(RealBackgroundImage != null) + try { - pe.Graphics.FillRectangle(new TextureBrush(RealBackgroundImage), new Rectangle(0, 0, this.Width, this.Height)); - } - switch (Style) - { - case ProgressBarStyle.Continuous: - double width = linear(this.Value, 0, this.Maximum, 0, this.Width); - if (ProgressImage != null) - { - pe.Graphics.FillRectangle(new TextureBrush(ProgressImage), new RectangleF(0, 0, (float)width, this.Height)); - } - else - { - pe.Graphics.FillRectangle(new SolidBrush(ProgressColor), new RectangleF(0, 0, (float)width, this.Height)); - } - break; - case ProgressBarStyle.Blocks: - int block_count = this.Width / (this.BlockSize + 2); - int blocks = (int)linear(this.Value, 0, this.Maximum, 0, block_count); - for(int i = 0; i < blocks - 1; i++) - { - int position = i * (BlockSize + 2); + pe.Graphics.Clear(this.RealBackColor); + if (RealBackgroundImage != null) + { + pe.Graphics.FillRectangle(new TextureBrush(RealBackgroundImage), new Rectangle(0, 0, this.Width, this.Height)); + } + switch (Style) + { + case ProgressBarStyle.Continuous: + double width = linear(this.Value, 0, this.Maximum, 0, this.Width); if (ProgressImage != null) { - pe.Graphics.FillRectangle(new TextureBrush(ProgressImage), new Rectangle(position, 0, BlockSize, this.Height)); - + pe.Graphics.FillRectangle(new TextureBrush(ProgressImage), new RectangleF(0, 0, (float)width, this.Height)); } else { - pe.Graphics.FillRectangle(new SolidBrush(ProgressColor), new Rectangle(position, 0, BlockSize, this.Height)); + pe.Graphics.FillRectangle(new SolidBrush(ProgressColor), new RectangleF(0, 0, (float)width, this.Height)); } - } - break; - case ProgressBarStyle.Marquee: - if (ProgressImage != null) - { - pe.Graphics.FillRectangle(new TextureBrush(ProgressImage), new Rectangle(_marqueePos, 0, this.Width / 4, this.Height)); - } - else - { - pe.Graphics.FillRectangle(new SolidBrush(ProgressColor), new Rectangle(_marqueePos, 0, this.Width / 4, this.Height)); - } - break; + break; + case ProgressBarStyle.Blocks: + int block_count = this.Width / (this.BlockSize + 2); + int blocks = (int)linear(this.Value, 0, this.Maximum, 0, block_count); + for (int i = 0; i < blocks - 1; i++) + { + int position = i * (BlockSize + 2); + if (ProgressImage != null) + { + pe.Graphics.FillRectangle(new TextureBrush(ProgressImage), new Rectangle(position, 0, BlockSize, this.Height)); + + } + else + { + pe.Graphics.FillRectangle(new SolidBrush(ProgressColor), new Rectangle(position, 0, BlockSize, this.Height)); + } + } + break; + case ProgressBarStyle.Marquee: + if (ProgressImage != null) + { + pe.Graphics.FillRectangle(new TextureBrush(ProgressImage), new Rectangle(_marqueePos, 0, this.Width / 4, this.Height)); + } + else + { + pe.Graphics.FillRectangle(new SolidBrush(ProgressColor), new Rectangle(_marqueePos, 0, this.Width / 4, this.Height)); + } + break; + } + } + catch + { + pe.Graphics.Clear(Color.Black); + string text = "Preview mode. This control can't be drawn without an initiated ShiftOS engine."; + SizeF sz = pe.Graphics.MeasureString(text, this.Font); + PointF loc = new PointF( + (this.Width - sz.Width) / 2, + (this.Height - sz.Height) / 2 + ); + pe.Graphics.DrawString(text, Font, new SolidBrush(Color.White), loc); } } diff --git a/ShiftOS.WinForms/Properties/Resources.Designer.cs b/ShiftOS.WinForms/Properties/Resources.Designer.cs index 3e83c3f..0386237 100644 --- a/ShiftOS.WinForms/Properties/Resources.Designer.cs +++ b/ShiftOS.WinForms/Properties/Resources.Designer.cs @@ -947,6 +947,16 @@ namespace ShiftOS.WinForms.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap iconSpeaker { + get { + object obj = ResourceManager.GetObject("iconSpeaker", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -1103,9 +1113,9 @@ namespace ShiftOS.WinForms.Properties { /// Category: "Enhancements", /// }, /// { - /// Name: "GUI Based Login Screen", - /// Cost: 500, - /// Description: "Tired of using the text-based login screen in ShiftOS? Well, we have a functioning window manager, and a functioning desktop, w [rest of string was truncated]";. + /// Name: "Shift Progress Bar", + /// Cost: 150, + /// Description: "Want to customize the look of all ShiftOS Progress Bars? Buy this upgrade today and you'll get the ability to set the foreground an [rest of string was truncated]";. /// internal static string Shiftorium { get { diff --git a/ShiftOS.WinForms/Properties/Resources.resx b/ShiftOS.WinForms/Properties/Resources.resx index 1db7a46..d1a3544 100644 --- a/ShiftOS.WinForms/Properties/Resources.resx +++ b/ShiftOS.WinForms/Properties/Resources.resx @@ -34603,4 +34603,7 @@ ..\Resources\notestate_connection_full.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\iconSpeaker.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/ShiftOS.WinForms/Resources/iconSpeaker.bmp b/ShiftOS.WinForms/Resources/iconSpeaker.bmp new file mode 100644 index 0000000000000000000000000000000000000000..ec2defb7e1758c3d59d36289e5486b0bdc4ff19e GIT binary patch literal 3382 zcmeIyG0qb~42Izk2_!1S5nOVDzqaV%3_gmF0i6p93J&3dLr}U!qM)ZR?{5AmfCLvH z6Fr&vW+$^7?nz3LQe<>X{B5xedZ=P$w}_+egE;( ze);-sWsU%AtEry;spUX43?NBakRGX43_OBakRGW-|nX zBakRG=6udFjouMR6dJQxg253;6dJSHg253;6dJQRg253;6dJQFo^u%-fkdG(+a?$s zfkdG(+b$R!fkdG(+aVYnfkdG(+bI|vfkdG(+a(wrfkdG({6+5{$uyuTb=ck zc6Gj%!5NML{@srMhFg<9e7NN!-SQ<}^EI8BP0ppq^5gTzF6a1f`H%Hnz-@!;`L8qA ld|h+PmziJlG4p%AeYgAQUV(cB?iILK;9h}y1^%ZB`~ + + UserControl + + + ShiftnetStatus.cs + + + UserControl + + + Volume.cs + @@ -601,6 +613,12 @@ ShiftSoft_Ping.cs + + ShiftnetStatus.cs + + + Volume.cs + UniteLoginDialog.cs @@ -827,6 +845,7 @@ + diff --git a/ShiftOS.WinForms/StatusIcons/ShiftnetStatus.Designer.cs b/ShiftOS.WinForms/StatusIcons/ShiftnetStatus.Designer.cs new file mode 100644 index 0000000..65aed28 --- /dev/null +++ b/ShiftOS.WinForms/StatusIcons/ShiftnetStatus.Designer.cs @@ -0,0 +1,90 @@ +namespace ShiftOS.WinForms.StatusIcons +{ + partial class ShiftnetStatus + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.lbserviceprovider = new System.Windows.Forms.Label(); + this.lbstatus = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Dock = System.Windows.Forms.DockStyle.Top; + this.label1.Location = new System.Drawing.Point(0, 0); + this.label1.Name = "label1"; + this.label1.Padding = new System.Windows.Forms.Padding(5); + this.label1.Size = new System.Drawing.Size(53, 23); + this.label1.TabIndex = 0; + this.label1.Tag = "header2"; + this.label1.Text = "Shiftnet"; + // + // lbserviceprovider + // + this.lbserviceprovider.AutoSize = true; + this.lbserviceprovider.Dock = System.Windows.Forms.DockStyle.Top; + this.lbserviceprovider.Location = new System.Drawing.Point(0, 23); + this.lbserviceprovider.Name = "lbserviceprovider"; + this.lbserviceprovider.Padding = new System.Windows.Forms.Padding(5); + this.lbserviceprovider.Size = new System.Drawing.Size(98, 23); + this.lbserviceprovider.TabIndex = 1; + this.lbserviceprovider.Tag = "header3"; + this.lbserviceprovider.Text = "Freebie Solutions"; + // + // lbstatus + // + this.lbstatus.Dock = System.Windows.Forms.DockStyle.Fill; + this.lbstatus.Location = new System.Drawing.Point(0, 46); + this.lbstatus.Name = "lbstatus"; + this.lbstatus.Padding = new System.Windows.Forms.Padding(5); + this.lbstatus.Size = new System.Drawing.Size(331, 144); + this.lbstatus.TabIndex = 2; + this.lbstatus.Text = "This will show the Shiftnet status."; + // + // ShiftnetStatus + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.lbstatus); + this.Controls.Add(this.lbserviceprovider); + this.Controls.Add(this.label1); + this.Name = "ShiftnetStatus"; + this.Size = new System.Drawing.Size(331, 190); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label lbserviceprovider; + private System.Windows.Forms.Label lbstatus; + } +} diff --git a/ShiftOS.WinForms/StatusIcons/ShiftnetStatus.cs b/ShiftOS.WinForms/StatusIcons/ShiftnetStatus.cs new file mode 100644 index 0000000..f1d31af --- /dev/null +++ b/ShiftOS.WinForms/StatusIcons/ShiftnetStatus.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using ShiftOS.Engine; + +namespace ShiftOS.WinForms.StatusIcons +{ + [DefaultIcon("iconShiftnet")] + [RequiresUpgrade("victortran_shiftnet")] + public partial class ShiftnetStatus : UserControl, IStatusIcon + { + public ShiftnetStatus() + { + InitializeComponent(); + } + + public void Setup() + { + var subscription = Applications.DownloadManager.GetAllSubscriptions()[SaveSystem.CurrentSave.ShiftnetSubscription]; + float kilobytes = (float)subscription.DownloadSpeed / 1024F; + lbserviceprovider.Text = subscription.Name; + lbstatus.Text = $@"Company: {subscription.Company} +Download speed (KB/s): {kilobytes}"; + + } + } +} diff --git a/ShiftOS.WinForms/StatusIcons/ShiftnetStatus.resx b/ShiftOS.WinForms/StatusIcons/ShiftnetStatus.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS.WinForms/StatusIcons/ShiftnetStatus.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ShiftOS.WinForms/StatusIcons/Volume.Designer.cs b/ShiftOS.WinForms/StatusIcons/Volume.Designer.cs new file mode 100644 index 0000000..aa8aa7a --- /dev/null +++ b/ShiftOS.WinForms/StatusIcons/Volume.Designer.cs @@ -0,0 +1,59 @@ +namespace ShiftOS.WinForms.StatusIcons +{ + partial class Volume + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.lbvolume = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // lbvolume + // + this.lbvolume.AutoSize = true; + this.lbvolume.Location = new System.Drawing.Point(4, 4); + this.lbvolume.Name = "lbvolume"; + this.lbvolume.Size = new System.Drawing.Size(81, 13); + this.lbvolume.TabIndex = 0; + this.lbvolume.Text = "System volume:"; + // + // Volume + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.lbvolume); + this.Name = "Volume"; + this.Size = new System.Drawing.Size(444, 44); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label lbvolume; + } +} diff --git a/ShiftOS.WinForms/StatusIcons/Volume.cs b/ShiftOS.WinForms/StatusIcons/Volume.cs new file mode 100644 index 0000000..329faf0 --- /dev/null +++ b/ShiftOS.WinForms/StatusIcons/Volume.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using ShiftOS.Engine; +using ShiftOS.WinForms.Controls; + +namespace ShiftOS.WinForms.StatusIcons +{ + [DefaultIcon("iconSpeaker")] + public partial class Volume : UserControl, IStatusIcon + { + public Volume() + { + InitializeComponent(); + } + + public void Setup() + { + lbvolume.Top = (this.Height - lbvolume.Height) / 2; + bool moving = false; + var prg = new ShiftedProgressBar(); + prg.Tag = "ignoreal"; //Don't close AL or current widget when this control is clicked. + this.Controls.Add(prg); + prg.Height = this.Height / 3; + prg.Maximum = 100; + prg.Value = SaveSystem.CurrentSave.MusicVolume; + prg.Width = this.Width - lbvolume.Width - 50; + prg.Left = lbvolume.Left + lbvolume.Width + 15; + prg.Top = (this.Height - prg.Height) / 2; + prg.MouseDown += (o, a) => + { + moving = true; + }; + + prg.MouseMove += (o, a) => + { + if (moving) + { + int val = (int)linear(a.X, 0, prg.Width, 0, 100); + SaveSystem.CurrentSave.MusicVolume = val; + prg.Value = val; + } + }; + + prg.MouseUp += (o, a) => + { + moving = false; + }; + prg.Show(); + } + + static public double linear(double x, double x0, double x1, double y0, double y1) + { + if ((x1 - x0) == 0) + { + return (y0 + y1) / 2; + } + return y0 + (x - x0) * (y1 - y0) / (x1 - x0); + } + } +} diff --git a/ShiftOS.WinForms/StatusIcons/Volume.resx b/ShiftOS.WinForms/StatusIcons/Volume.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS.WinForms/StatusIcons/Volume.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ShiftOS.WinForms/Tools/ControlManager.cs b/ShiftOS.WinForms/Tools/ControlManager.cs index 92482fa..548a62a 100644 --- a/ShiftOS.WinForms/Tools/ControlManager.cs +++ b/ShiftOS.WinForms/Tools/ControlManager.cs @@ -158,6 +158,15 @@ namespace ShiftOS.WinForms.Tools } catch { } + if (!tag.Contains("ignoreal")) + { + ctrl.Click += (o, a) => + { + Desktop.HideAppLauncher(); + }; + + } + if (!tag.Contains("keepbg")) { if (ctrl.BackColor != Control.DefaultBackColor) @@ -279,6 +288,8 @@ namespace ShiftOS.WinForms.Tools { (ctrl as WindowBorder).Setup(); } + + MakeDoubleBuffered(ctrl); ControlSetup?.Invoke(ctrl); }); @@ -305,10 +316,6 @@ namespace ShiftOS.WinForms.Tools public static void SetupControls(Control frm, bool runInThread = true) { - frm.Click += (o, a) => - { - Desktop.HideAppLauncher(); - }; var ctrls = frm.Controls.ToList(); for (int i = 0; i < ctrls.Count(); i++) { diff --git a/ShiftOS.WinForms/WinformsDesktop.Designer.cs b/ShiftOS.WinForms/WinformsDesktop.Designer.cs index 968a31c..d82bc0c 100644 --- a/ShiftOS.WinForms/WinformsDesktop.Designer.cs +++ b/ShiftOS.WinForms/WinformsDesktop.Designer.cs @@ -55,6 +55,7 @@ namespace ShiftOS.WinForms this.desktoppanel = new System.Windows.Forms.Panel(); this.pnlnotifications = new System.Windows.Forms.Panel(); this.flnotifications = new System.Windows.Forms.FlowLayoutPanel(); + this.ntconnectionstatus = new System.Windows.Forms.PictureBox(); this.lbtime = new System.Windows.Forms.Label(); this.panelbuttonholder = new System.Windows.Forms.FlowLayoutPanel(); this.sysmenuholder = new System.Windows.Forms.Panel(); @@ -63,7 +64,6 @@ namespace ShiftOS.WinForms this.pnlscreensaver = new System.Windows.Forms.Panel(); this.pnlssicon = new System.Windows.Forms.Panel(); this.pnlwidgetlayer = new System.Windows.Forms.Panel(); - this.ntconnectionstatus = new System.Windows.Forms.PictureBox(); this.pnlnotificationbox = new System.Windows.Forms.Panel(); this.lbnotemsg = new System.Windows.Forms.Label(); this.lbnotetitle = new System.Windows.Forms.Label(); @@ -77,10 +77,10 @@ namespace ShiftOS.WinForms this.desktoppanel.SuspendLayout(); this.pnlnotifications.SuspendLayout(); this.flnotifications.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.ntconnectionstatus)).BeginInit(); this.sysmenuholder.SuspendLayout(); this.menuStrip1.SuspendLayout(); this.pnlscreensaver.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.ntconnectionstatus)).BeginInit(); this.pnlnotificationbox.SuspendLayout(); this.pnladvancedal.SuspendLayout(); this.pnlalsystemactions.SuspendLayout(); @@ -121,6 +121,18 @@ namespace ShiftOS.WinForms this.flnotifications.Name = "flnotifications"; this.flnotifications.Size = new System.Drawing.Size(22, 24); this.flnotifications.TabIndex = 1; + this.flnotifications.WrapContents = false; + // + // ntconnectionstatus + // + this.ntconnectionstatus.Image = global::ShiftOS.WinForms.Properties.Resources.notestate_connection_full; + this.ntconnectionstatus.Location = new System.Drawing.Point(3, 3); + this.ntconnectionstatus.Name = "ntconnectionstatus"; + this.ntconnectionstatus.Size = new System.Drawing.Size(16, 16); + this.ntconnectionstatus.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; + this.ntconnectionstatus.TabIndex = 0; + this.ntconnectionstatus.TabStop = false; + this.ntconnectionstatus.Tag = "digitalsociety"; // // lbtime // @@ -200,17 +212,6 @@ namespace ShiftOS.WinForms this.pnlwidgetlayer.Size = new System.Drawing.Size(1296, 714); this.pnlwidgetlayer.TabIndex = 1; // - // ntconnectionstatus - // - this.ntconnectionstatus.Image = global::ShiftOS.WinForms.Properties.Resources.notestate_connection_full; - this.ntconnectionstatus.Location = new System.Drawing.Point(3, 3); - this.ntconnectionstatus.Name = "ntconnectionstatus"; - this.ntconnectionstatus.Size = new System.Drawing.Size(16, 16); - this.ntconnectionstatus.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; - this.ntconnectionstatus.TabIndex = 0; - this.ntconnectionstatus.TabStop = false; - this.ntconnectionstatus.Tag = "digitalsociety"; - // // pnlnotificationbox // this.pnlnotificationbox.AutoSize = true; @@ -341,12 +342,12 @@ namespace ShiftOS.WinForms this.pnlnotifications.PerformLayout(); this.flnotifications.ResumeLayout(false); this.flnotifications.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.ntconnectionstatus)).EndInit(); this.sysmenuholder.ResumeLayout(false); this.sysmenuholder.PerformLayout(); this.menuStrip1.ResumeLayout(false); this.menuStrip1.PerformLayout(); this.pnlscreensaver.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.ntconnectionstatus)).EndInit(); this.pnlnotificationbox.ResumeLayout(false); this.pnlnotificationbox.PerformLayout(); this.pnladvancedal.ResumeLayout(false); diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index b9c4f37..f1dbe48 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -85,27 +85,24 @@ namespace ShiftOS.WinForms ic.Tag = itype.Name.ToLower(); //Next get the icon data if any. - var iconattrib = itype.GetCustomAttributes(false).FirstOrDefault(x => x is DefaultIconAttribute) as DefaultIconAttribute; - if(iconattrib != null) - { //We can use this attribute's ID in the skin engine to get an icon. - var img = GetIcon(iconattrib.ID); + var img = GetIcon(itype.Name); //Make it transparent. - (img as Bitmap).MakeTransparent(LoadedSkin.SystemKey); + (img as Bitmap).MakeTransparent(Color.White); //Assign it to the control ic.Image = img; //Set the sizing mode ic.SizeMode = PictureBoxSizeMode.StretchImage; - } - else - { - ic.BackColor = Color.White; //TODO: Make it skinnable. - } - ic.Size = new Size(20, 20); //TODO: make it skinnable + ic.Size = new Size(16, 16); //TODO: make it skinnable //add to the notification tray flnotifications.Controls.Add(ic); ic.Show(); + ic.BringToFront(); + + flnotifications.Show(); + + ic.Click += (o, a) => { HideAppLauncher(); @@ -115,7 +112,14 @@ namespace ShiftOS.WinForms UserControl ctrl = (UserControl)Activator.CreateInstance(itype); (ctrl as IStatusIcon).Setup(); currentSettingsPane = ctrl; - if(LoadedSkin.DesktopPanelPosition == 0) + ControlManager.SetupControls(ctrl); + this.Controls.Add(ctrl); + ctrl.BringToFront(); + int left = ic.Parent.PointToScreen(ic.Location).X; + int realleft = left - ctrl.Width; + realleft += ic.Width; + ctrl.Left = realleft; + if (LoadedSkin.DesktopPanelPosition == 0) { ctrl.Top = desktoppanel.Height; } @@ -123,10 +127,6 @@ namespace ShiftOS.WinForms { ctrl.Top = this.Height - desktoppanel.Height - ctrl.Height; } - int noteleft = flnotifications.PointToScreen(ic.Location).X; - int realleft = (this.Width - (noteleft + ic.Width)) - ctrl.Width; - ctrl.Left = realleft; - ControlManager.SetupControls(ctrl); ctrl.Show(); } diff --git a/ShiftOS.WinForms/WinformsDesktop.resx b/ShiftOS.WinForms/WinformsDesktop.resx index b77504b..d5494e3 100644 --- a/ShiftOS.WinForms/WinformsDesktop.resx +++ b/ShiftOS.WinForms/WinformsDesktop.resx @@ -120,7 +120,4 @@ 17, 17 - - 17, 17 - \ No newline at end of file From 03cf891c53cc648bb1ed4ea3d78755c1a440a713 Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 1 Jun 2017 17:09:22 -0400 Subject: [PATCH 16/71] Icon Manager and various icon bugfixes. --- .../Applications/IconManager.Designer.cs | 163 ++++++++++++ ShiftOS.WinForms/Applications/IconManager.cs | 244 ++++++++++++++++++ .../Applications/IconManager.resx | 120 +++++++++ ShiftOS.WinForms/Resources/Shiftorium.txt | 14 + ShiftOS.WinForms/ShiftOS.WinForms.csproj | 18 ++ .../StatusIcons/TestStatus.Designer.cs | 60 +++++ ShiftOS.WinForms/StatusIcons/TestStatus.cs | 26 ++ ShiftOS.WinForms/StatusIcons/TestStatus.resx | 120 +++++++++ ShiftOS_TheReturn/Skinning.cs | 10 +- 9 files changed, 774 insertions(+), 1 deletion(-) create mode 100644 ShiftOS.WinForms/Applications/IconManager.Designer.cs create mode 100644 ShiftOS.WinForms/Applications/IconManager.cs create mode 100644 ShiftOS.WinForms/Applications/IconManager.resx create mode 100644 ShiftOS.WinForms/StatusIcons/TestStatus.Designer.cs create mode 100644 ShiftOS.WinForms/StatusIcons/TestStatus.cs create mode 100644 ShiftOS.WinForms/StatusIcons/TestStatus.resx diff --git a/ShiftOS.WinForms/Applications/IconManager.Designer.cs b/ShiftOS.WinForms/Applications/IconManager.Designer.cs new file mode 100644 index 0000000..25bcee4 --- /dev/null +++ b/ShiftOS.WinForms/Applications/IconManager.Designer.cs @@ -0,0 +1,163 @@ +namespace ShiftOS.WinForms.Applications +{ + partial class IconManager + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.btnclose = new System.Windows.Forms.Button(); + this.btnreset = new System.Windows.Forms.Button(); + this.btnapply = new System.Windows.Forms.Button(); + this.flbody = new System.Windows.Forms.FlowLayoutPanel(); + this.lbcurrentpage = new System.Windows.Forms.Label(); + this.btnprev = new System.Windows.Forms.Button(); + this.btnnext = new System.Windows.Forms.Button(); + this.flowLayoutPanel1.SuspendLayout(); + this.SuspendLayout(); + // + // flowLayoutPanel1 + // + this.flowLayoutPanel1.AutoSize = true; + this.flowLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.flowLayoutPanel1.Controls.Add(this.btnclose); + this.flowLayoutPanel1.Controls.Add(this.btnreset); + this.flowLayoutPanel1.Controls.Add(this.btnapply); + this.flowLayoutPanel1.Controls.Add(this.lbcurrentpage); + this.flowLayoutPanel1.Controls.Add(this.btnprev); + this.flowLayoutPanel1.Controls.Add(this.btnnext); + this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Bottom; + this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 416); + this.flowLayoutPanel1.Name = "flowLayoutPanel1"; + this.flowLayoutPanel1.Size = new System.Drawing.Size(393, 29); + this.flowLayoutPanel1.TabIndex = 0; + // + // btnclose + // + this.btnclose.AutoSize = true; + this.btnclose.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnclose.Location = new System.Drawing.Point(3, 3); + this.btnclose.Name = "btnclose"; + this.btnclose.Size = new System.Drawing.Size(43, 23); + this.btnclose.TabIndex = 0; + this.btnclose.Text = "Close"; + this.btnclose.UseVisualStyleBackColor = true; + this.btnclose.Click += new System.EventHandler(this.btnclose_Click); + // + // btnreset + // + this.btnreset.AutoSize = true; + this.btnreset.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnreset.Location = new System.Drawing.Point(52, 3); + this.btnreset.Name = "btnreset"; + this.btnreset.Size = new System.Drawing.Size(45, 23); + this.btnreset.TabIndex = 1; + this.btnreset.Text = "Reset"; + this.btnreset.UseVisualStyleBackColor = true; + this.btnreset.Click += new System.EventHandler(this.btnreset_Click); + // + // btnapply + // + this.btnapply.AutoSize = true; + this.btnapply.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnapply.Location = new System.Drawing.Point(103, 3); + this.btnapply.Name = "btnapply"; + this.btnapply.Size = new System.Drawing.Size(43, 23); + this.btnapply.TabIndex = 2; + this.btnapply.Text = "Apply"; + this.btnapply.UseVisualStyleBackColor = true; + this.btnapply.Click += new System.EventHandler(this.btnapply_Click); + // + // flbody + // + this.flbody.Dock = System.Windows.Forms.DockStyle.Fill; + this.flbody.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; + this.flbody.Location = new System.Drawing.Point(0, 0); + this.flbody.Name = "flbody"; + this.flbody.Size = new System.Drawing.Size(393, 416); + this.flbody.TabIndex = 1; + this.flbody.WrapContents = false; + // + // lbcurrentpage + // + this.lbcurrentpage.AutoSize = true; + this.lbcurrentpage.Location = new System.Drawing.Point(152, 0); + this.lbcurrentpage.Name = "lbcurrentpage"; + this.lbcurrentpage.Size = new System.Drawing.Size(71, 13); + this.lbcurrentpage.TabIndex = 3; + this.lbcurrentpage.Text = "Current page:"; + // + // btnprev + // + this.btnprev.AutoSize = true; + this.btnprev.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnprev.Location = new System.Drawing.Point(229, 3); + this.btnprev.Name = "btnprev"; + this.btnprev.Size = new System.Drawing.Size(51, 23); + this.btnprev.TabIndex = 4; + this.btnprev.Text = " < Prev"; + this.btnprev.UseVisualStyleBackColor = true; + this.btnprev.Click += new System.EventHandler(this.btnprev_Click); + // + // btnnext + // + this.btnnext.AutoSize = true; + this.btnnext.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnnext.Location = new System.Drawing.Point(286, 3); + this.btnnext.Name = "btnnext"; + this.btnnext.Size = new System.Drawing.Size(48, 23); + this.btnnext.TabIndex = 5; + this.btnnext.Text = "Next >"; + this.btnnext.UseVisualStyleBackColor = true; + this.btnnext.Click += new System.EventHandler(this.btnnext_Click); + // + // IconManager + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.flbody); + this.Controls.Add(this.flowLayoutPanel1); + this.Name = "IconManager"; + this.Size = new System.Drawing.Size(393, 445); + this.flowLayoutPanel1.ResumeLayout(false); + this.flowLayoutPanel1.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; + private System.Windows.Forms.Button btnclose; + private System.Windows.Forms.Button btnreset; + private System.Windows.Forms.Button btnapply; + private System.Windows.Forms.FlowLayoutPanel flbody; + private System.Windows.Forms.Label lbcurrentpage; + private System.Windows.Forms.Button btnprev; + private System.Windows.Forms.Button btnnext; + } +} diff --git a/ShiftOS.WinForms/Applications/IconManager.cs b/ShiftOS.WinForms/Applications/IconManager.cs new file mode 100644 index 0000000..0c6e119 --- /dev/null +++ b/ShiftOS.WinForms/Applications/IconManager.cs @@ -0,0 +1,244 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using ShiftOS.Engine; +using System.Reflection; +using ShiftOS.WinForms.Tools; +using Newtonsoft.Json; + +namespace ShiftOS.WinForms.Applications +{ + [RequiresUpgrade("icon_manager")] + [Launcher("Icon Manager", true, "al_icon_manager", "Customization")] + [DefaultTitle("Icon Manager")] + [DefaultIcon("iconIconManager")] + public partial class IconManager : UserControl, IShiftOSWindow + { + public IconManager() + { + InitializeComponent(); + } + + public void OnLoad() + { + LoadIconsFromEngine(); + SetupUI(); + } + + public void OnSkinLoad() + { + LoadIconsFromEngine(); + SetupUI(); + } + + public bool OnUnload() + { + Icons = null; + return true; + } + + private Dictionary Icons = null; + + private const int pageSize = 10; + private int currentPage = 0; + private int pageCount = 0; + + public Image GetIcon(string id) + { + if (!Icons.ContainsKey(id)) + Icons.Add(id, null); + + if (Icons[id] == null) + { + var img = SkinEngine.GetDefaultIcon(id); + using (var mstr = new System.IO.MemoryStream()) + { + img.Save(mstr, System.Drawing.Imaging.ImageFormat.Png); + Icons[id] = mstr.ToArray(); + } + return img; + } + else + { + using (var sr = new System.IO.MemoryStream(Icons[id])) + { + return Image.FromStream(sr); + } + } + } + + public void SetIcon(string key, byte[] raw) + { + if (!Icons.ContainsKey(key)) + Icons.Add(key, raw); + Icons[key] = raw; + } + + public void LoadIconsFromEngine() + { + //We have to serialize the engine icon list to JSON to break references with the data. + string json = JsonConvert.SerializeObject(SkinEngine.LoadedSkin.AppIcons); + //And deserialize to the local instance...essentially making a clone. + Icons = JsonConvert.DeserializeObject>(json); + } + + public void SetupUI() + { + flbody.Controls.Clear(); //Clear the icon list. + + List types = new List(); + + foreach(var exe in System.IO.Directory.GetFiles(Environment.CurrentDirectory)) + { + if(exe.ToLower().EndsWith(".exe") || exe.ToLower().EndsWith(".dll")) + { + try + { + var asm = Assembly.LoadFile(exe); + + var typeList = asm.GetTypes().Where(x => x.GetCustomAttributes(false).FirstOrDefault(y => y is DefaultIconAttribute) != null); + types.AddRange(typeList); + + } + catch { } + } + } + + pageCount = types.ToArray().GetPageCount(pageSize); + + foreach (var type in types.ToArray().GetItemsOnPage(currentPage, pageSize)) + { + if (Shiftorium.UpgradeAttributesUnlocked(type)) + { + var pnl = new Panel(); + pnl.Height = 30; + pnl.Width = flbody.Width - 15; + flbody.Controls.Add(pnl); + pnl.Show(); + var pic = new PictureBox(); + pic.SizeMode = PictureBoxSizeMode.StretchImage; + pic.Size = new Size(24, 24); + pic.Image = GetIcon(type.Name); + pnl.Controls.Add(pic); + pic.Left = 5; + pic.Top = (pnl.Height - pic.Height) / 2; + pic.Show(); + var lbl = new Label(); + lbl.Tag = "header3"; + lbl.AutoSize = true; + lbl.Text = NameChangerBackend.GetNameRaw(type); + ControlManager.SetupControl(lbl); + pnl.Controls.Add(lbl); + lbl.CenterParent(); + lbl.Show(); + var btn = new Button(); + btn.Text = "Change..."; + btn.AutoSize = true; + btn.AutoSizeMode = AutoSizeMode.GrowAndShrink; + pnl.Controls.Add(btn); + btn.Left = (pnl.Width - btn.Width) - 5; + btn.Top = (pnl.Height - btn.Height) / 2; + btn.Click += (o, a) => + { + var gfp = new GraphicPicker(pic.Image, lbl.Text + " icon", ImageLayout.Stretch, (raw, img, layout) => + { + pic.Image = img; + SetIcon(type.Name, raw); + }); + AppearanceManager.SetupDialog(gfp); + }; + btn.Show(); + ControlManager.SetupControls(pnl); + } + } + + btnnext.Visible = (currentPage < pageCount - 1); + btnprev.Visible = (currentPage > 0); + + lbcurrentpage.Text = "Page " + (currentPage + 1).ToString() + " of " + pageCount.ToString(); + } + + public void OnUpgrade() + { + LoadIconsFromEngine(); + SetupUI(); + } + + private void btnprev_Click(object sender, EventArgs e) + { + currentPage--; + SetupUI(); + } + + public void ResetToDefaults() + { + currentPage = 0; + foreach (var key in Icons.Keys) + { + var img = SkinEngine.GetDefaultIcon(key); + using(var ms = new System.IO.MemoryStream()) + { + img.Save(ms, System.Drawing.Imaging.ImageFormat.Png); + Icons[key] = ms.ToArray(); + } + } + SetupUI(); + } + + private void btnnext_Click(object sender, EventArgs e) + { + currentPage++; + SetupUI(); + } + + private void btnclose_Click(object sender, EventArgs e) + { + AppearanceManager.Close(this); + } + + private void btnreset_Click(object sender, EventArgs e) + { + ResetToDefaults(); + } + + private void btnapply_Click(object sender, EventArgs e) + { + SkinEngine.LoadedSkin.AppIcons = Icons; + SkinEngine.SaveSkin(); + SkinEngine.LoadSkin(); + Infobox.Show("Icons applied!", "The new icons have been applied to ShiftOS successfully!"); + } + } + + public static class PaginationExtensions + { + public static int GetPageCount(this IEnumerable collection, int pageSize) + { + return (collection.Count() + pageSize - 1) / pageSize; + } + + public static T[] GetItemsOnPage(this T[] collection, int page, int pageSize) + { + List obj = new List(); + + for (int i = pageSize * page; i <= pageSize + (pageSize * page) && i < collection.Count(); i++) + { + try + { + obj.Add(collection[i]); + } + catch + { + } + } + return obj.ToArray(); + } + } + +} diff --git a/ShiftOS.WinForms/Applications/IconManager.resx b/ShiftOS.WinForms/Applications/IconManager.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS.WinForms/Applications/IconManager.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ShiftOS.WinForms/Resources/Shiftorium.txt b/ShiftOS.WinForms/Resources/Shiftorium.txt index 0eac58e..1a6d8c2 100644 --- a/ShiftOS.WinForms/Resources/Shiftorium.txt +++ b/ShiftOS.WinForms/Resources/Shiftorium.txt @@ -7,6 +7,20 @@ Dependencies: "desktop", Category: "Enhancements", }, + { + Name: "Icon Manager", + Cost: 450, + Description: "This tool allows you to add and edit application icons within ShiftOS for the small prive of 450 Codepoints!", + Dependencies: "skinning", + Category: "Application" + }, + { + Name: "AL Icon Manager", + Costs: 150, + Description: "Add an App Launcher entry for the Icon Manager.", + Dependencies: "icon_manager;app_launcher", + Category: "Customization" + }, { Name: "Shift Progress Bar", Cost: 150, diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index fd875e9..0a59c00 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -70,6 +70,12 @@ About.cs + + UserControl + + + IconManager.cs + UserControl @@ -409,6 +415,12 @@ ShiftnetStatus.cs + + UserControl + + + TestStatus.cs + UserControl @@ -461,6 +473,9 @@ About.cs + + IconManager.cs + TriPresent.cs @@ -616,6 +631,9 @@ ShiftnetStatus.cs + + TestStatus.cs + Volume.cs diff --git a/ShiftOS.WinForms/StatusIcons/TestStatus.Designer.cs b/ShiftOS.WinForms/StatusIcons/TestStatus.Designer.cs new file mode 100644 index 0000000..3643d2d --- /dev/null +++ b/ShiftOS.WinForms/StatusIcons/TestStatus.Designer.cs @@ -0,0 +1,60 @@ +namespace ShiftOS.WinForms.StatusIcons +{ + partial class TestStatus + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // label1 + // + this.label1.Dock = System.Windows.Forms.DockStyle.Fill; + this.label1.Location = new System.Drawing.Point(0, 0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(264, 52); + this.label1.TabIndex = 0; + this.label1.Tag = "header1"; + this.label1.Text = "This is a test."; + this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // TestStatus + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.label1); + this.Name = "TestStatus"; + this.Size = new System.Drawing.Size(264, 52); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Label label1; + } +} diff --git a/ShiftOS.WinForms/StatusIcons/TestStatus.cs b/ShiftOS.WinForms/StatusIcons/TestStatus.cs new file mode 100644 index 0000000..90baafc --- /dev/null +++ b/ShiftOS.WinForms/StatusIcons/TestStatus.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using ShiftOS.Engine; + +namespace ShiftOS.WinForms.StatusIcons +{ + [DefaultIcon("iconShiftorium")] + public partial class TestStatus : UserControl, IStatusIcon + { + public TestStatus() + { + InitializeComponent(); + } + + public void Setup() + { + } + } +} diff --git a/ShiftOS.WinForms/StatusIcons/TestStatus.resx b/ShiftOS.WinForms/StatusIcons/TestStatus.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS.WinForms/StatusIcons/TestStatus.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ShiftOS_TheReturn/Skinning.cs b/ShiftOS_TheReturn/Skinning.cs index 5bd4ab1..4a073f4 100644 --- a/ShiftOS_TheReturn/Skinning.cs +++ b/ShiftOS_TheReturn/Skinning.cs @@ -287,7 +287,15 @@ namespace ShiftOS.Engine LoadedSkin.AppIcons.Add(id, null); if (LoadedSkin.AppIcons[id] == null) - return GetDefaultIcon(id); + { + var img = GetDefaultIcon(id); + using (var mstr = new MemoryStream()) + { + img.Save(mstr, System.Drawing.Imaging.ImageFormat.Png); + LoadedSkin.AppIcons[id] = mstr.ToArray(); + } + return img; + } else { using (var sr = new MemoryStream(LoadedSkin.AppIcons[id])) From d001b613fba71bcee04163492940f17a0027daa7 Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 1 Jun 2017 17:45:59 -0400 Subject: [PATCH 17/71] Fix Graphic Picker UI. --- .../Applications/GraphicPicker.Designer.cs | 45 ++++++++++++------- .../Applications/GraphicPicker.cs | 9 ++++ 2 files changed, 37 insertions(+), 17 deletions(-) diff --git a/ShiftOS.WinForms/Applications/GraphicPicker.Designer.cs b/ShiftOS.WinForms/Applications/GraphicPicker.Designer.cs index 988acbd..889c8aa 100644 --- a/ShiftOS.WinForms/Applications/GraphicPicker.Designer.cs +++ b/ShiftOS.WinForms/Applications/GraphicPicker.Designer.cs @@ -86,12 +86,12 @@ namespace ShiftOS.WinForms.Applications this.pgcontents.Dock = System.Windows.Forms.DockStyle.Fill; this.pgcontents.Location = new System.Drawing.Point(0, 0); this.pgcontents.Name = "pgcontents"; - this.pgcontents.Size = new System.Drawing.Size(390, 383); + this.pgcontents.Size = new System.Drawing.Size(487, 383); this.pgcontents.TabIndex = 20; // // btncancel // - this.btncancel.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.btncancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.btncancel.Location = new System.Drawing.Point(21, 335); this.btncancel.Name = "btncancel"; this.btncancel.Size = new System.Drawing.Size(109, 32); @@ -102,10 +102,11 @@ namespace ShiftOS.WinForms.Applications // // btnreset // - this.btnreset.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.btnreset.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.btnreset.Location = new System.Drawing.Point(136, 335); this.btnreset.Name = "btnreset"; - this.btnreset.Size = new System.Drawing.Size(109, 32); + this.btnreset.Size = new System.Drawing.Size(206, 32); this.btnreset.TabIndex = 22; this.btnreset.Text = "Reset"; this.btnreset.UseVisualStyleBackColor = true; @@ -113,8 +114,8 @@ namespace ShiftOS.WinForms.Applications // // btnapply // - this.btnapply.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.btnapply.Location = new System.Drawing.Point(251, 335); + this.btnapply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.btnapply.Location = new System.Drawing.Point(348, 335); this.btnapply.Name = "btnapply"; this.btnapply.Size = new System.Drawing.Size(118, 32); this.btnapply.TabIndex = 21; @@ -124,19 +125,21 @@ namespace ShiftOS.WinForms.Applications // // Label2 // - this.Label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.Label2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.Label2.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Label2.Location = new System.Drawing.Point(125, 260); this.Label2.Name = "Label2"; - this.Label2.Size = new System.Drawing.Size(163, 28); + this.Label2.Size = new System.Drawing.Size(260, 28); this.Label2.TabIndex = 12; + this.Label2.Tag = "header3"; this.Label2.Text = "Idle"; this.Label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // btnidlebrowse // - this.btnidlebrowse.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.btnidlebrowse.Location = new System.Drawing.Point(295, 260); + this.btnidlebrowse.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.btnidlebrowse.Location = new System.Drawing.Point(392, 260); this.btnidlebrowse.Name = "btnidlebrowse"; this.btnidlebrowse.Size = new System.Drawing.Size(73, 60); this.btnidlebrowse.TabIndex = 10; @@ -146,14 +149,15 @@ namespace ShiftOS.WinForms.Applications // // txtidlefile // - this.txtidlefile.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.txtidlefile.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.txtidlefile.BackColor = System.Drawing.Color.White; this.txtidlefile.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.txtidlefile.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.txtidlefile.Location = new System.Drawing.Point(125, 291); this.txtidlefile.Multiline = true; this.txtidlefile.Name = "txtidlefile"; - this.txtidlefile.Size = new System.Drawing.Size(163, 29); + this.txtidlefile.Size = new System.Drawing.Size(260, 29); this.txtidlefile.TabIndex = 9; this.txtidlefile.Text = "None"; this.txtidlefile.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; @@ -172,9 +176,10 @@ namespace ShiftOS.WinForms.Applications // // btnzoom // + this.btnzoom.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.btnzoom.FlatAppearance.BorderColor = System.Drawing.Color.Black; this.btnzoom.FlatAppearance.BorderSize = 0; - this.btnzoom.Location = new System.Drawing.Point(286, 144); + this.btnzoom.Location = new System.Drawing.Point(383, 144); this.btnzoom.Name = "btnzoom"; this.btnzoom.Size = new System.Drawing.Size(82, 65); this.btnzoom.TabIndex = 7; @@ -184,9 +189,10 @@ namespace ShiftOS.WinForms.Applications // // btnstretch // + this.btnstretch.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.btnstretch.FlatAppearance.BorderColor = System.Drawing.Color.Black; this.btnstretch.FlatAppearance.BorderSize = 0; - this.btnstretch.Location = new System.Drawing.Point(197, 144); + this.btnstretch.Location = new System.Drawing.Point(294, 144); this.btnstretch.Name = "btnstretch"; this.btnstretch.Size = new System.Drawing.Size(82, 65); this.btnstretch.TabIndex = 6; @@ -228,6 +234,9 @@ namespace ShiftOS.WinForms.Applications // // picgraphic // + this.picgraphic.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.picgraphic.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; this.picgraphic.Location = new System.Drawing.Point(0, 0); this.picgraphic.Name = "picgraphic"; @@ -237,11 +246,14 @@ namespace ShiftOS.WinForms.Applications // // lblobjecttoskin // + this.lblobjecttoskin.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.lblobjecttoskin.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lblobjecttoskin.Location = new System.Drawing.Point(19, 9); this.lblobjecttoskin.Name = "lblobjecttoskin"; - this.lblobjecttoskin.Size = new System.Drawing.Size(350, 23); + this.lblobjecttoskin.Size = new System.Drawing.Size(447, 23); this.lblobjecttoskin.TabIndex = 2; + this.lblobjecttoskin.Tag = "header1"; this.lblobjecttoskin.Text = "Close Button"; this.lblobjecttoskin.TextAlign = System.Drawing.ContentAlignment.TopCenter; // @@ -249,10 +261,9 @@ namespace ShiftOS.WinForms.Applications // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(390, 383); this.Controls.Add(this.pgcontents); this.Name = "GraphicPicker"; - this.Text = "{GRAPHIC_PICKER_NAME}"; + this.Size = new System.Drawing.Size(487, 383); this.Load += new System.EventHandler(this.Graphic_Picker_Load); this.pgcontents.ResumeLayout(false); this.pgcontents.PerformLayout(); diff --git a/ShiftOS.WinForms/Applications/GraphicPicker.cs b/ShiftOS.WinForms/Applications/GraphicPicker.cs index 85f95bd..f299f0d 100644 --- a/ShiftOS.WinForms/Applications/GraphicPicker.cs +++ b/ShiftOS.WinForms/Applications/GraphicPicker.cs @@ -45,6 +45,12 @@ namespace ShiftOS.WinForms.Applications { InitializeComponent(); SelectedLayout = layout; + Image = old; + using(var ms = new System.IO.MemoryStream()) + { + Image.Save(ms, System.Drawing.Imaging.ImageFormat.Png); + ImageAsBinary = ms.ToArray(); + } Callback = cb; lblobjecttoskin.Text = name; @@ -123,10 +129,12 @@ namespace ShiftOS.WinForms.Applications public void OnLoad() { + Setup(); } public void OnSkinLoad() { + Setup(); } public bool OnUnload() @@ -136,6 +144,7 @@ namespace ShiftOS.WinForms.Applications public void OnUpgrade() { + Setup(); } } } From 0b9ac754acd76348cd1a61fde14f0821e32a31c8 Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 1 Jun 2017 18:27:22 -0400 Subject: [PATCH 18/71] Another new default skin. --- ShiftOS_TheReturn/Skinning.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ShiftOS_TheReturn/Skinning.cs b/ShiftOS_TheReturn/Skinning.cs index 4a073f4..d5114c5 100644 --- a/ShiftOS_TheReturn/Skinning.cs +++ b/ShiftOS_TheReturn/Skinning.cs @@ -343,7 +343,7 @@ namespace ShiftOS.Engine private static readonly Color DefaultBackground = Color.FromArgb(0x11, 0x11, 0x11); private static readonly Color DefaultForeground = Color.FromArgb(0xDD, 0xDD, 0xDD); private static readonly Color Accent1 = Color.FromArgb(0x66, 0x66, 0x66); - private static readonly Color Accent2 = Color.FromArgb(0x80, 0, 0); + private static readonly Color Accent2 = Color.FromArgb(0x0, 0x80, 0); private static readonly Color DesktopBG = Color.FromArgb(0x00, 0x00, 0x00); private static readonly Font SysFont = new Font("Tahoma", 9F); private static readonly Font SysFont2 = new Font("Tahoma", 10F, FontStyle.Bold); @@ -351,7 +351,7 @@ namespace ShiftOS.Engine private static readonly Font Header2 = new Font("Courier New", 17.5F, FontStyle.Bold); private static readonly Font Header3 = new Font("Courier New", 15F, FontStyle.Bold); - private static readonly Color TitleBG = Color.FromArgb(0x55, 0x11, 0x11); + private static readonly Color TitleBG = Color.FromArgb(0x11, 0x55, 0x11); private static readonly Color TitleFG = Color.FromArgb(0xaa, 0xaa, 0xaa); //Todo: When making Shifter GUI we need to label all these with proper Shifter attributes to get 'em displaying in the right places. @@ -650,7 +650,7 @@ namespace ShiftOS.Engine [ShifterName("Close Button Color")] [RequiresUpgrade("shift_title_buttons")] [ShifterDescription("The close button color")] - public Color CloseButtonColor = Accent2; + public Color CloseButtonColor = Color.FromArgb(0x80,0,0); [ShifterMeta("Windows")] [ShifterCategory("Title Buttons")] From 5246798b0ad07ac1a2dd9a1369da4ecad2383488 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 2 Jun 2017 08:05:53 -0400 Subject: [PATCH 19/71] Make stories not happen until user is logged in. --- ShiftOS.WinForms/WinformsDesktop.cs | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index f1dbe48..4614842 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -196,38 +196,14 @@ namespace ShiftOS.WinForms SetupControl(desktoppanel); Shiftorium.Installed += () => { - foreach(var widget in Widgets) + foreach (var widget in Widgets) { widget.OnUpgrade(); } LoadIcons(); - //Only if the DevX Legions story hasn't been experienced yet. - if (!Shiftorium.UpgradeInstalled("devx_legions")) - { - //Check for shiftnet story experience - if (Shiftorium.UpgradeInstalled("shiftnet")) - { - //Check for saturation of the "GUI" upgrade set - if (Shiftorium.IsCategoryEmptied("GUI")) - { - //Start the MUD Control Centre story. - Story.Start("devx_legions"); - } - } - } - if (!Shiftorium.UpgradeInstalled("victortran_shiftnet")) - { - if (SaveSystem.CurrentSave.Codepoints >= 50000) - { - if (Shiftorium.IsCategoryEmptied("Applications")) - { - Story.Start("victortran_shiftnet"); - } - } - } }; this.TopMost = false; @@ -294,6 +270,9 @@ namespace ShiftOS.WinForms { do { + while (SaveSystem.CurrentUser == null) + Thread.Sleep(10); + if (SaveSystem.CurrentSave != null) { if (SaveSystem.CurrentSave.Codepoints != lastcp) From ce5469464ad90e801f828dfc80ee630257e2dc96 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 2 Jun 2017 08:15:51 -0400 Subject: [PATCH 20/71] Fix bug where terminal hangs on bad command --- ShiftOS_TheReturn/TerminalBackend.cs | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/ShiftOS_TheReturn/TerminalBackend.cs b/ShiftOS_TheReturn/TerminalBackend.cs index 6104927..09ef3d6 100644 --- a/ShiftOS_TheReturn/TerminalBackend.cs +++ b/ShiftOS_TheReturn/TerminalBackend.cs @@ -108,13 +108,7 @@ namespace ShiftOS.Engine if (!commandWasClient && !string.IsNullOrWhiteSpace(ns)) { - PrefixEnabled = false; - - ServerManager.SendMessage("script", $@"{{ - user: ""{ns}"", - script: ""{command}"", - args: ""{GetSentArgs(arguments)}"" -}}"); + Console.WriteLine("Error: Command not found."); } CommandProcessed?.Invoke(ns + "." + command, JsonConvert.SerializeObject(arguments)); @@ -369,27 +363,14 @@ namespace ShiftOS.Engine { var args = GetArgs(ref text); - Stopwatch debugger = new Stopwatch(); - debugger.Start(); bool commandWasClient = RunClient(text, args, isRemote); if (!commandWasClient) { - Console.WriteLine("Command not found."); - debugger.Stop(); - return; + Console.WriteLine("Error: Command not found."); + } CommandProcessed?.Invoke(text, GetSentArgs(args)); - debugger.Stop(); - ConsoleEx.ForegroundColor = ConsoleColor.White; - Console.Write("<"); - ConsoleEx.Bold = true; - ConsoleEx.ForegroundColor = ConsoleColor.Blue; - Console.Write("debugger"); - ConsoleEx.ForegroundColor = ConsoleColor.White; - ConsoleEx.Bold = false; - Console.Write("> "); - Console.WriteLine("Command " + text + " took " + debugger.Elapsed.ToString() + " to execute."); } catch (Exception ex) { From 17f3f6f68567b0151474af86d6ba265b35029b8e Mon Sep 17 00:00:00 2001 From: RogueAI42 Date: Sat, 3 Jun 2017 00:43:20 +1000 Subject: [PATCH 21/71] Fixed Pong? there are some sound crashes but Michael told me to just make the PR and let him fix the audio backend so that's what I'm doing. --- .../Applications/Pong.Designer.cs | 3 - ShiftOS.WinForms/Applications/Pong.cs | 406 ++++++------------ ShiftOS.WinForms/Applications/Pong.resx | 3 + 3 files changed, 140 insertions(+), 272 deletions(-) diff --git a/ShiftOS.WinForms/Applications/Pong.Designer.cs b/ShiftOS.WinForms/Applications/Pong.Designer.cs index 0254e94..c5ea375 100644 --- a/ShiftOS.WinForms/Applications/Pong.Designer.cs +++ b/ShiftOS.WinForms/Applications/Pong.Designer.cs @@ -182,7 +182,6 @@ namespace ShiftOS.WinForms.Applications this.pgcontents.Name = "pgcontents"; this.pgcontents.Size = new System.Drawing.Size(912, 504); this.pgcontents.TabIndex = 20; - this.pgcontents.Paint += new System.Windows.Forms.PaintEventHandler(this.pgcontents_Paint); this.pgcontents.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pongMain_MouseMove); // // pnlmultiplayerhandshake @@ -250,7 +249,6 @@ namespace ShiftOS.WinForms.Applications this.Label6.TabIndex = 15; this.Label6.Text = "{PONG_DESC}"; this.Label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - this.Label6.Click += new System.EventHandler(this.Label6_Click); // // btnstartgame // @@ -273,7 +271,6 @@ namespace ShiftOS.WinForms.Applications this.Label8.Size = new System.Drawing.Size(280, 31); this.Label8.TabIndex = 14; this.Label8.Text = "{PONG_WELCOME}"; - this.Label8.Click += new System.EventHandler(this.Label8_Click); // // pnlhighscore // diff --git a/ShiftOS.WinForms/Applications/Pong.cs b/ShiftOS.WinForms/Applications/Pong.cs index 6d81c64..87f0306 100644 --- a/ShiftOS.WinForms/Applications/Pong.cs +++ b/ShiftOS.WinForms/Applications/Pong.cs @@ -60,11 +60,60 @@ namespace ShiftOS.WinForms.Applications int levelyspeed = 3; ulong beatairewardtotal; ulong beataireward = 1; - ulong[] levelrewards = new ulong[50]; + readonly uint[] levelrewards = { + 0, + 20, + 60, + 140, + 290, + 400, + 600, + 900, + 1200, + 1600, + 2000, + 2500, + 3000, + 4000, + 5000, + 6000, + 8000, + 10000, + 13000, + 16000, + 20000, + 25000, + 32000, + 40000, + 50000, + 60000, + 75000, + 90000, + 110000, + 140000, + 180000, + 220000, + 270000, + 320000, + 400000, + 500000, + 640000, + 800000, + 1000000, + 1500000, + 2000000}; ulong totalreward; int countdown = 3; + int rwdmultiplier; + Thread soundThread; - bool aiShouldIsbeEnabled = true; + bool aiShouldIsbeEnabled = true; // who named this variable? and were they having a stroke? + + private void playsound(System.IO.Stream stream) + { + soundThread = new Thread((a) => ShiftOS.Engine.AudioManager.PlayStream((System.IO.Stream)a)); + soundThread.Start(stream); + } public Pong() { @@ -73,11 +122,9 @@ namespace ShiftOS.WinForms.Applications private void Pong_Load(object sender, EventArgs e) { - setuplevelrewards(); + rwdmultiplier = ShiftoriumFrontend.UpgradeInstalled("pong_upgrade") ? 2 : 1; } - - // Move the paddle according to the mouse position. private void pongMain_MouseMove(object sender, MouseEventArgs e) { @@ -133,9 +180,7 @@ namespace ShiftOS.WinForms.Applications { if (this.Left < Screen.PrimaryScreen.Bounds.Width) { - ball.BackColor = SkinEngine.LoadedSkin.ControlTextColor; - paddleComputer.BackColor = SkinEngine.LoadedSkin.ControlTextColor; - paddleHuman.BackColor = SkinEngine.LoadedSkin.ControlTextColor; + ball.BackColor = paddleComputer.BackColor = paddleHuman.BackColor = SkinEngine.LoadedSkin.ControlTextColor; //Check if paddle upgrade has been bought and change paddles accordingly //if (ShiftoriumFrontend.UpgradeInstalled("pong_increased_paddle_size")) @@ -146,7 +191,7 @@ namespace ShiftOS.WinForms.Applications //I don't know the point of this but I'm fucking 86ing it. - Michael //Set the computer player to move according to the ball's position. - if (IsMultiplayerSession == true) + if (IsMultiplayerSession) { //If we're multiplayer, then we want to set the computer Y to the opponent's Y. //If we're the leader, we set the AI paddle, else we set the player paddle. @@ -160,83 +205,63 @@ namespace ShiftOS.WinForms.Applications if (aiShouldIsbeEnabled) if (ball.Location.X > (this.Width - (this.Width / 3)) - xVel * 10 && xVel > 0) { - if (ball.Location.Y > paddleComputer.Location.Y + 50) - { - paddleComputer.Location = new Point(paddleComputer.Location.X, paddleComputer.Location.Y + computerspeed); - } - if (ball.Location.Y < paddleComputer.Location.Y + 50) - { - paddleComputer.Location = new Point(paddleComputer.Location.X, paddleComputer.Location.Y - computerspeed); - } + if (ball.Top > paddleComputer.Top + 50) + paddleComputer.Top += computerspeed; + else + paddleComputer.Top -= computerspeed; casualposition = rand.Next(-150, 201); } else { //used to be me.location.y - except it's fucking C# and this comment is misleading as fuck. OH WAIT! I didn't write it! And none of the current devs did either! - Michael - if (paddleComputer.Location.Y > this.Size.Height / 2 - paddleComputer.Height + casualposition) - { - paddleComputer.Location = new Point(paddleComputer.Location.X, paddleComputer.Location.Y - computerspeed); - } - //Rylan is hot. Used to be //used to be me.location.y - if (paddleComputer.Location.Y < this.Size.Height / 2 - paddleComputer.Height + casualposition) - { - paddleComputer.Location = new Point(paddleComputer.Location.X, paddleComputer.Location.Y + computerspeed); - } + if (paddleComputer.Top > this.Height / 2 - paddleComputer.Height + casualposition) + paddleComputer.Top -= computerspeed; + else + paddleComputer.Top += computerspeed; } } //Set Xvel and Yvel speeds from decimal if (xVel > 0) xVel = (int)Math.Round(xveldec); - if (xVel < 0) + else xVel = (int)-Math.Round(xveldec); if (yVel > 0) yVel = (int)Math.Round(yveldec); - if (yVel < 0) + else yVel = (int)-Math.Round(yveldec); - bool BallPhysics = true; - - if (IsMultiplayerSession) + if (IsMultiplayerSession && !IsLeader) { - //Logic for moving the ball in Multiplayer. - if (IsLeader) - { - ball.Location = new Point(ball.Location.X + xVel, ball.Location.Y + yVel); - } - else - { - //Move it to the leader's ball position. - ball.Location = new Point(LeaderX, LeaderY); - BallPhysics = false; - } + // Move it to the leader's ball position. + ball.Location = new Point(LeaderX, LeaderY); } else - {// Move the game ball. - ball.Location = new Point(ball.Location.X + xVel, ball.Location.Y + yVel); - } - if (BallPhysics) { + var newRect = new Rectangle(ball.Location, ball.Size); // copy ball's Bounds + newRect.X += xVel; + newRect.Y += yVel; + // Check for top wall. - if (ball.Location.Y < 0) + if (newRect.Y < 0) { - ball.Location = new Point(ball.Location.X, 0); + newRect.Y = 0; yVel = -yVel; - ShiftOS.Engine.AudioManager.PlayStream(Properties.Resources.typesound); + playsound(Properties.Resources.typesound); } // Check for bottom wall. - if (ball.Location.Y > pgcontents.Height - ball.Height) + if (newRect.Y > pgcontents.Height - ball.Height) { - ball.Location = new Point(ball.Location.X, pgcontents.Height - ball.Size.Height); + newRect.Y = pgcontents.Height - ball.Height; yVel = -yVel; - ShiftOS.Engine.AudioManager.PlayStream(Properties.Resources.typesound); + playsound(Properties.Resources.typesound); } // Check for player paddle. - if (ball.Bounds.IntersectsWith(paddleHuman.Bounds)) + if (newRect.IntersectsWith(paddleHuman.Bounds)) { - ball.Location = new Point(paddleHuman.Location.X + ball.Size.Width + 1, ball.Location.Y); + newRect.X = paddleHuman.Left + ball.Width + 1; //randomly increase x or y speed of ball switch (rand.Next(1, 3)) { @@ -246,23 +271,24 @@ namespace ShiftOS.WinForms.Applications case 2: if (yveldec > 0) yveldec = yveldec + incrementy; - if (yveldec < 0) + else yveldec = yveldec - incrementy; break; } xVel = -xVel; - ShiftOS.Engine.AudioManager.PlayStream(Properties.Resources.writesound); + playsound(Properties.Resources.writesound); } // Check for computer paddle. - if (ball.Bounds.IntersectsWith(paddleComputer.Bounds)) + if (newRect.IntersectsWith(paddleComputer.Bounds)) { - ball.Location = new Point(paddleComputer.Location.X - paddleComputer.Size.Width - 1, ball.Location.Y); + newRect.X = paddleComputer.Left - paddleComputer.Width - 1; xveldec = xveldec + incrementx; xVel = -xVel; - ShiftOS.Engine.AudioManager.PlayStream(Properties.Resources.writesound); + playsound(Properties.Resources.writesound); } + ball.Location = newRect.Location; } @@ -297,11 +323,11 @@ namespace ShiftOS.WinForms.Applications lblmissedout.Text = Localization.Parse("{YOU_MISSED_OUT_ON}:") + Environment.NewLine + lblstatscodepoints.Text.Replace(Localization.Parse("{CODEPOINTS}: "), "") + Localization.Parse(" {CODEPOINTS}"); if (ShiftoriumFrontend.UpgradeInstalled("pong_upgrade_2")) { - totalreward = (ulong)(levelrewards[level - 1] + beatairewardtotal); + totalreward = (levelrewards[level - 1] * (ulong) rwdmultiplier + beatairewardtotal); double onePercent = (totalreward / 100); lblbutyougained.Show(); lblbutyougained.Text = Localization.Parse("{BUT_YOU_GAINED}:") + Environment.NewLine + onePercent.ToString("") + (Localization.Parse(" {CODEPOINTS}")); - SaveSystem.TransferCodepointsFrom("pong", (ulong)(totalreward / 100)); + SaveSystem.TransferCodepointsFrom("pong", (ulong)(onePercent)); } else { @@ -345,7 +371,7 @@ namespace ShiftOS.WinForms.Applications //lblstats.Text = "Xspeed: " & Math.Abs(xVel) & " Yspeed: " & Math.Abs(yVel) & " Human Location: " & paddleHuman.Location.ToString & " Computer Location: " & paddleComputer.Location.ToString & Environment.NewLine & " Ball Location: " & ball.Location.ToString & " Xdec: " & xveldec & " Ydec: " & yveldec & " Xinc: " & incrementx & " Yinc: " & incrementy lblstatsX.Text = "X vel: " + xveldec; lblstatsY.Text = "Y vel: " + yveldec; - lblstatscodepoints.Text = "Codepoints: " + (levelrewards[level - 1] + beatairewardtotal).ToString(); + lblstatscodepoints.Text = "Codepoints: " + (levelrewards[level - 1] * (ulong) rwdmultiplier + beatairewardtotal).ToString(); lbllevelandtime.Text = "Level: " + level + " - " + secondsleft + " seconds left"; if (xVel > 20 || xVel < -20) @@ -355,8 +381,7 @@ namespace ShiftOS.WinForms.Applications } else { - paddleHuman.Width = 20; - paddleComputer.Width = 20; + paddleHuman.Width = paddleComputer.Width = 20; } } if (!IsMultiplayerSession) @@ -415,7 +440,7 @@ namespace ShiftOS.WinForms.Applications StartLevel(); })); } - else if(msg.Name == "pong_mp_levelcompleted") + else if (msg.Name == "pong_mp_levelcompleted") { level = Convert.ToInt32(msg.Contents) + 1; this.Invoke(new Action(CompleteLevel)); @@ -434,7 +459,7 @@ namespace ShiftOS.WinForms.Applications pnlmultiplayerhandshake.Hide(); })); } - else if(msg.Name == "pong_mp_cashedout") + else if (msg.Name == "pong_mp_cashedout") { this.Invoke(new Action(() => { @@ -442,19 +467,19 @@ namespace ShiftOS.WinForms.Applications })); Infobox.Show("Cashed out.", "The other player has cashed out their Codepoints. Therefore, we have automatically cashed yours out."); } - else if(msg.Name == "pong_mp_startlevel") + else if (msg.Name == "pong_mp_startlevel") { OpponentAgrees = true; - if(YouAgree == false) + if (YouAgree == false) { - Infobox.PromptYesNo("Play another level?", "The opponent wants to play another level. Would you like to as well?", (answer)=> + Infobox.PromptYesNo("Play another level?", "The opponent wants to play another level. Would you like to as well?", (answer) => { YouAgree = answer; ServerManager.Forward(OpponentGUID, "pong_mp_level_callback", YouAgree.ToString()); }); } } - else if(msg.Name == "pong_mp_level_callback") + else if (msg.Name == "pong_mp_level_callback") { bool agreed = bool.Parse(msg.Contents); OpponentAgrees = agreed; @@ -472,7 +497,7 @@ namespace ShiftOS.WinForms.Applications this.PossibleMatchmakes.Remove(msg.Contents); this.Invoke(new Action(ListMatchmakes)); } - else if(msg.Name == "pong_mp_clockupdate") + else if (msg.Name == "pong_mp_clockupdate") { secondsleft = Convert.ToInt32(msg.Contents); } @@ -566,7 +591,7 @@ namespace ShiftOS.WinForms.Applications public void LoseMP() { ball.Location = new Point(this.Size.Width / 2 + 200, this.Size.Height / 2); - if(IsLeader) + if (IsLeader) if (xVel > 0) xVel = -xVel; lblbeatai.Show(); @@ -634,7 +659,7 @@ namespace ShiftOS.WinForms.Applications CompleteLevel(); } - lblstatscodepoints.Text = "Codepoints: " + (levelrewards[level - 1] + beatairewardtotal).ToString(); + lblstatscodepoints.Text = "Codepoints: " + (levelrewards[level - 1] * (ulong) rwdmultiplier + beatairewardtotal).ToString(); } } SetupStats(); @@ -670,200 +695,56 @@ namespace ShiftOS.WinForms.Applications lblpreviousstats.Text = Localization.Parse("{INITIAL_H_VEL}: " + levelxspeed + Environment.NewLine + "{INITIAL_V_VEL}: " + levelyspeed + Environment.NewLine + "{INC_H_VEL}: " + incrementx + Environment.NewLine + "{INC_V_VEL}: " + incrementy); - switch (rand.Next(1, 3)) - { - case 1: - levelxspeed = levelxspeed + 1; - break; - case 2: - levelxspeed = levelxspeed + 2; - break; - } + levelxspeed += rand.Next(1, 3); - switch (rand.Next(1, 3)) - { - case 1: - levelyspeed = levelyspeed + 1; - break; - case 2: - levelyspeed = levelyspeed + 2; - break; - } + levelyspeed += rand.Next(1, 3); - switch (rand.Next(1, 6)) - { - case 1: - incrementx = incrementx + 0.1; - break; - case 2: - incrementx = incrementx + 0.2; - break; - case 3: - incrementy = incrementy + 0.1; - break; - case 4: - incrementy = incrementy + 0.2; - break; - case 5: - incrementy = incrementy + 0.3; - break; - } + int rndinc = rand.Next(1, 6); + if (rndinc == 5) + incrementy += 0.3; + else + incrementy += (((rndinc - 1) % 2) + 1) / 10; lblnextstats.Text = Localization.Parse("{INITIAL_H_VEL}: " + levelxspeed + Environment.NewLine + "{INITIAL_V_VEL}: " + levelyspeed + Environment.NewLine + "{INC_H_VEL}: " + incrementx + Environment.NewLine + "{INC_V_VEL}: " + incrementy); if (level < 15) { + beataireward = (ulong)(level * 5); if (ShiftoriumFrontend.UpgradeInstalled("pong_upgrade")) - { - beataireward = (ulong)(level * 10); - } else - { - beataireward = (ulong)(level * 5); - } + beataireward *= 2; } else - { if (ShiftoriumFrontend.UpgradeInstalled("pong_upgrade")) - { - double br = levelrewards[level - 1] / 10; - beataireward = (ulong)Math.Round(br) * 10; - } else - { - double br = levelrewards[level - 1] / 10; - beataireward = (ulong)Math.Round(br) * 5; - } - } + beataireward = levelrewards[level - 1]; + else + beataireward = (ulong)Math.Round((double) levelrewards[level - 1] / 2); - totalreward = levelrewards[level - 1] + beatairewardtotal; + totalreward = levelrewards[level - 1] * (ulong) rwdmultiplier + beatairewardtotal; btncashout.Text = Localization.Parse("{CASH_OUT_WITH_CODEPOINTS}"); btnplayon.Text = Localization.Parse("{PONG_PLAY_ON_FOR_MORE}"); } - private void setuplevelrewards() - { - if (ShiftoriumFrontend.UpgradeInstalled("pong_upgrade")) - { - levelrewards[0] = 0; - levelrewards[1] = 40; - levelrewards[2] = 120; - levelrewards[3] = 280; - levelrewards[4] = 580; - levelrewards[5] = 800; - levelrewards[6] = 1200; - levelrewards[7] = 1800; - levelrewards[8] = 2400; - levelrewards[9] = 3200; - levelrewards[10] = 4000; - levelrewards[11] = 5000; - levelrewards[12] = 6000; - levelrewards[13] = 8000; - levelrewards[14] = 10000; - levelrewards[15] = 12000; - levelrewards[16] = 16000; - levelrewards[17] = 20000; - levelrewards[18] = 26000; - levelrewards[19] = 32000; - levelrewards[20] = 40000; - levelrewards[21] = 50000; - levelrewards[22] = 64000; - levelrewards[23] = 80000; - levelrewards[24] = 100000; - levelrewards[25] = 120000; - levelrewards[26] = 150000; - levelrewards[27] = 180000; - levelrewards[28] = 220000; - levelrewards[29] = 280000; - levelrewards[30] = 360000; - levelrewards[31] = 440000; - levelrewards[32] = 540000; - levelrewards[33] = 640000; - levelrewards[34] = 800000; - levelrewards[35] = 1000000; - levelrewards[36] = 1280000; - levelrewards[37] = 1600000; - levelrewards[38] = 2000000; - levelrewards[39] = 3000000; - levelrewards[40] = 4000000; - } else - { - levelrewards[0] = 0; - levelrewards[1] = 20; - levelrewards[2] = 60; - levelrewards[3] = 140; - levelrewards[4] = 290; - levelrewards[5] = 400; - levelrewards[6] = 600; - levelrewards[7] = 900; - levelrewards[8] = 1200; - levelrewards[9] = 1600; - levelrewards[10] = 2000; - levelrewards[11] = 2500; - levelrewards[12] = 3000; - levelrewards[13] = 4000; - levelrewards[14] = 5000; - levelrewards[15] = 6000; - levelrewards[16] = 8000; - levelrewards[17] = 10000; - levelrewards[18] = 13000; - levelrewards[19] = 16000; - levelrewards[20] = 20000; - levelrewards[21] = 25000; - levelrewards[22] = 32000; - levelrewards[23] = 40000; - levelrewards[24] = 50000; - levelrewards[25] = 60000; - levelrewards[26] = 75000; - levelrewards[27] = 90000; - levelrewards[28] = 110000; - levelrewards[29] = 140000; - levelrewards[30] = 180000; - levelrewards[31] = 220000; - levelrewards[32] = 270000; - levelrewards[33] = 320000; - levelrewards[34] = 400000; - levelrewards[35] = 500000; - levelrewards[36] = 640000; - levelrewards[37] = 800000; - levelrewards[38] = 1000000; - levelrewards[39] = 1500000; - levelrewards[40] = 2000000; - } - } - // ERROR: Handles clauses are not supported in C# private void countdown_Tick(object sender, EventArgs e) { if (this.Left < Screen.PrimaryScreen.Bounds.Width) { - switch (countdown) + if (countdown == 0) { - case 0: - countdown = 3; - lblcountdown.Hide(); - lblbeatai.Hide(); - gameTimer.Start(); - counter.Start(); - tmrcountdown.Stop(); - break; - case 1: - lblcountdown.Text = "1"; - countdown = countdown - 1; - ShiftOS.Engine.AudioManager.PlayStream(Properties.Resources.typesound); - break; - case 2: - lblcountdown.Text = "2"; - countdown = countdown - 1; - ShiftOS.Engine.AudioManager.PlayStream(Properties.Resources.typesound); - break; - case 3: - lblcountdown.Text = "3"; - countdown = countdown - 1; - lblcountdown.Show(); - ShiftOS.Engine.AudioManager.PlayStream(Properties.Resources.typesound); - break; + countdown = 3; + lblcountdown.Hide(); + lblbeatai.Hide(); + gameTimer.Start(); + counter.Start(); + tmrcountdown.Stop(); + return; } - + if (!lblcountdown.Visible) + lblcountdown.Show(); + lblcountdown.Text = countdown.ToString(); + countdown -= 1; + playsound(Properties.Resources.typesound); } } @@ -874,7 +755,7 @@ namespace ShiftOS.WinForms.Applications pnlfinalstats.Show(); lblfinalcodepointswithtext.Text = Localization.Parse("{YOU_WON} " + totalreward + " {CODEPOINTS}!"); lblfinallevelreached.Text = Localization.Parse("{CODEPOINTS_FOR_BEATING_LEVEL}: ") + (level - 1).ToString(); - lblfinallevelreward.Text = levelrewards[level - 1].ToString(); + lblfinallevelreward.Text = (levelrewards[level - 1] * rwdmultiplier).ToString(); lblfinalcomputerreward.Text = beatairewardtotal.ToString(); lblfinalcodepoints.Text = totalreward + Localization.Parse(" {CODEPOINTS_SHORT}"); SaveSystem.TransferCodepointsFrom("pong", totalreward); @@ -912,7 +793,8 @@ namespace ShiftOS.WinForms.Applications if (ShiftoriumFrontend.UpgradeInstalled("pong_upgrade")) { beataireward = 10; - } else + } + else { beataireward = 5; } @@ -981,7 +863,7 @@ namespace ShiftOS.WinForms.Applications var hs = unite.GetPongHighscores(); foreach (var score in hs.Highscores) { - if(this.ParentForm.Visible == false) + if (this.ParentForm.Visible == false) { Thread.CurrentThread.Abort(); } @@ -1000,7 +882,7 @@ namespace ShiftOS.WinForms.Applications { try { - if (this.ParentForm.Visible == true) + if (this.ParentForm.Visible) { Infobox.Show("Service unavailable.", "The Pong Highscore service is unavailable at this time."); this.Invoke(new Action(pnlgamestats.BringToFront)); @@ -1030,7 +912,7 @@ namespace ShiftOS.WinForms.Applications { newgame(); } - + // ERROR: Handles clauses are not supported in C# private void btnstartgame_Click(object sender, EventArgs e) { @@ -1045,9 +927,7 @@ namespace ShiftOS.WinForms.Applications int i = rand.Next(0, 100); if (i >= 25 && i <= 50) - { tmrstoryline.Stop(); - } } @@ -1057,25 +937,13 @@ namespace ShiftOS.WinForms.Applications tmrstoryline.Stop(); } - private void Label6_Click(object sender, EventArgs e) + private void ball_MouseEnter(object sender, EventArgs e) { - - } - - private void Label8_Click(object sender, EventArgs e) - { - - } - - private void pgcontents_Paint(object sender, PaintEventArgs e) { - - } - - private void ball_MouseEnter(object sender, EventArgs e) { aiShouldIsbeEnabled = false; } - private void ball_MouseLeave(object sender, EventArgs e) { + private void ball_MouseLeave(object sender, EventArgs e) + { aiShouldIsbeEnabled = true; } @@ -1102,9 +970,9 @@ namespace ShiftOS.WinForms.Applications public bool OnUnload() { - if(IsMultiplayerSession == true) + if (IsMultiplayerSession) { - if(!string.IsNullOrWhiteSpace(OpponentGUID)) + if (!string.IsNullOrWhiteSpace(OpponentGUID)) ServerManager.Forward(OpponentGUID, "pong_mp_left", null); LeaveMatchmake(); } @@ -1134,10 +1002,10 @@ namespace ShiftOS.WinForms.Applications private void lvotherplayers_DoubleClick(object sender, EventArgs e) { - if(lvotherplayers.SelectedItems.Count > 0) + if (lvotherplayers.SelectedItems.Count > 0) { SendLeaderGUID(lvotherplayers.SelectedItems[0].Text); } } } -} +} \ No newline at end of file diff --git a/ShiftOS.WinForms/Applications/Pong.resx b/ShiftOS.WinForms/Applications/Pong.resx index 3b5619d..cc96099 100644 --- a/ShiftOS.WinForms/Applications/Pong.resx +++ b/ShiftOS.WinForms/Applications/Pong.resx @@ -129,4 +129,7 @@ 17, 17 + + 472, 17 + \ No newline at end of file From 11e80a6a6134e2cbee1041d6ddc95781a265bead Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 2 Jun 2017 11:38:38 -0400 Subject: [PATCH 22/71] fix the audio system --- ShiftOS.Objects/Save.cs | 6 +-- ShiftOS.WinForms/AudioManager.cs | 51 +++++++++++++++++++------- ShiftOS_TheReturn/AudioManager.cs | 61 ++++++++++++++++++++----------- ShiftOS_TheReturn/Commands.cs | 40 +++++++++++++++----- 4 files changed, 111 insertions(+), 47 deletions(-) diff --git a/ShiftOS.Objects/Save.cs b/ShiftOS.Objects/Save.cs index 0fef7b3..cbd77e2 100644 --- a/ShiftOS.Objects/Save.cs +++ b/ShiftOS.Objects/Save.cs @@ -34,9 +34,9 @@ namespace ShiftOS.Objects //Better to store this stuff server-side so we can do some neat stuff with hacking... public class Save { - - public int MusicVolume { get; set; } - public int SfxVolume { get; set; } + public bool MusicEnabled = true; + public bool SoundEnabled = true; + public int MusicVolume = 100; [Obsolete("This save variable is no longer used in Beta 2.4 and above of ShiftOS. Please use ShiftOS.Engine.SaveSystem.CurrentUser.Username to access the current user's username.")] public string Username { get; set; } diff --git a/ShiftOS.WinForms/AudioManager.cs b/ShiftOS.WinForms/AudioManager.cs index ec12614..afa0d78 100644 --- a/ShiftOS.WinForms/AudioManager.cs +++ b/ShiftOS.WinForms/AudioManager.cs @@ -88,23 +88,46 @@ namespace ShiftOS.WinForms }; while (shuttingDown == false) { - str = new MemoryStream(GetRandomSong()); - mp3 = new NAudio.Wave.Mp3FileReader(str); - o = new NAudio.Wave.WaveOut(); - o.Init(mp3); - bool c = false; - o.Play(); - o.PlaybackStopped += (s, a) => + if (Engine.SaveSystem.CurrentSave != null) { - c = true; - }; - while (!c) - { - try + if (Engine.SaveSystem.CurrentSave.MusicEnabled) { - o.Volume = (float)Engine.SaveSystem.CurrentSave.MusicVolume / 100; + str = new MemoryStream(GetRandomSong()); + mp3 = new NAudio.Wave.Mp3FileReader(str); + o = new NAudio.Wave.WaveOut(); + o.Init(mp3); + bool c = false; + o.Play(); + o.PlaybackStopped += (s, a) => + { + c = true; + }; + + while (!c) + { + if (Engine.SaveSystem.CurrentSave.MusicEnabled) + { + try + { + o.Volume = (float)Engine.SaveSystem.CurrentSave.MusicVolume / 100; + } + catch { } + } + else + { + o.Stop(); + c = true; + } + Thread.Sleep(10); + } } - catch { } + else + { + Thread.Sleep(10); + } + } + else + { Thread.Sleep(10); } } diff --git a/ShiftOS_TheReturn/AudioManager.cs b/ShiftOS_TheReturn/AudioManager.cs index 553a1d9..0a1a210 100644 --- a/ShiftOS_TheReturn/AudioManager.cs +++ b/ShiftOS_TheReturn/AudioManager.cs @@ -83,21 +83,28 @@ namespace ShiftOS.Engine /// The file to play. public static void Play(string file) { - try + bool play = true; + float volume = 1f; + if (SaveSystem.CurrentSave != null) { - _reader = new AudioFileReader(file); - _out = new WaveOut(); - _out.Init(_reader); - _out.Play(); - if (SaveSystem.CurrentSave == null) - _out.Volume = 1.0f; - else - _out.Volume = (float)SaveSystem.CurrentSave.MusicVolume / 100; - _out.PlaybackStopped += (o, a) => { PlayCompleted?.Invoke(); }; + play = (SaveSystem.CurrentSave.SoundEnabled); + volume = (float)SaveSystem.CurrentSave.MusicVolume / 100f; } - catch(Exception ex) + if (play) { - Console.WriteLine("Audio error: " + ex.Message); + try + { + _reader = new AudioFileReader(file); + _out = new WaveOut(); + _out.Init(_reader); + _out.Volume = volume; + _out.Play(); + _out.PlaybackStopped += (o, a) => { PlayCompleted?.Invoke(); }; + } + catch (Exception ex) + { + Console.WriteLine("Audio error: " + ex.Message); + } } } @@ -107,15 +114,27 @@ namespace ShiftOS.Engine /// The stream to read from. public static void PlayStream(Stream str) { - var bytes = new byte[str.Length]; - str.Read(bytes, 0, bytes.Length); - ShiftOS.Engine.AudioManager.Stop(); - if (File.Exists("snd.wav")) - File.Delete("snd.wav"); - File.WriteAllBytes("snd.wav", bytes); - - ShiftOS.Engine.AudioManager.Play("snd.wav"); - + try + { + bool play = true; + float volume = 1f; + if (SaveSystem.CurrentSave != null) + { + play = (SaveSystem.CurrentSave.SoundEnabled); + volume = (float)SaveSystem.CurrentSave.MusicVolume / 100f; + } + if (play) + { + ShiftOS.Engine.AudioManager.Stop(); + _out = new WaveOut(); + var mp3 = new WaveFileReader(str); + _out.Init(mp3); + _out.Volume = volume; + _out.Play(); + _out.PlaybackStopped += (o, a) => { PlayCompleted?.Invoke(); }; + } + } + catch { } } public static event Action PlayCompleted; diff --git a/ShiftOS_TheReturn/Commands.cs b/ShiftOS_TheReturn/Commands.cs index ec89539..e379a50 100644 --- a/ShiftOS_TheReturn/Commands.cs +++ b/ShiftOS_TheReturn/Commands.cs @@ -383,26 +383,48 @@ namespace ShiftOS.Engine [Namespace("sos")] public static class ShiftOSCommands { - [Command("setsfxvolume", description = "Set the volume of various sound effects to a value between 1 and 100.")] + + [Command("setsfxenabled", description = "Set whether or not sound effects are enabled in the system.")] [RequiresArgument("value")] - public static bool SetSfxVolume(Dictionary args) + public static bool SetSfxEnabled(Dictionary args) { - int value = int.Parse(args["value"].ToString()); - if (value >= 0 && value <= 100) + try { - SaveSystem.CurrentSave.SfxVolume = value; + bool value = Convert.ToBoolean(args["value"].ToString()); + SaveSystem.CurrentSave.SoundEnabled = value; SaveSystem.SaveGame(); } - else + catch { - Console.WriteLine("Volume must be between 0 and 100!"); + Console.WriteLine("Error: Value must be either true or false."); } return true; } - [Command("setmusicvolume", description ="Set the music volume to a value between 1 and 100.")] + + + [Command("setmusicenabled", description = "Set whether or not music is enabled in the system.")] [RequiresArgument("value")] - public static bool SetMusicVolume(Dictionary args) + public static bool SetMusicEnabled(Dictionary args) + { + try + { + bool value = Convert.ToBoolean(args["value"].ToString()); + SaveSystem.CurrentSave.MusicEnabled = value; + SaveSystem.SaveGame(); + } + catch + { + Console.WriteLine("Error: Value must be either true or false."); + } + return true; + } + + + + [Command("setsfxvolume", description ="Set the system sound volume to a value between 1 and 100.")] + [RequiresArgument("value")] + public static bool SetSfxVolume(Dictionary args) { int value = int.Parse(args["value"].ToString()); if(value >= 0 && value <= 100) From 719f2e4170e0a42ca372ff142e5b9613177db1be Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 2 Jun 2017 21:06:31 -0400 Subject: [PATCH 23/71] Rebalance shiftnet subscriptions --- ShiftOS.WinForms/Applications/Shiftnet.cs | 2 +- ShiftOS.WinForms/Resources/ShiftnetServices.txt | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/ShiftOS.WinForms/Applications/Shiftnet.cs b/ShiftOS.WinForms/Applications/Shiftnet.cs index 22b53a0..6ccdb19 100644 --- a/ShiftOS.WinForms/Applications/Shiftnet.cs +++ b/ShiftOS.WinForms/Applications/Shiftnet.cs @@ -173,7 +173,7 @@ namespace ShiftOS.WinForms.Applications var obj = (IShiftnetSite)Activator.CreateInstance(type, null); obj.GoToUrl += (u) => { - History.Push(u); + History.Push(CurrentUrl); NavigateToUrl(u); }; obj.GoBack += () => diff --git a/ShiftOS.WinForms/Resources/ShiftnetServices.txt b/ShiftOS.WinForms/Resources/ShiftnetServices.txt index d8582b6..fa3988b 100644 --- a/ShiftOS.WinForms/Resources/ShiftnetServices.txt +++ b/ShiftOS.WinForms/Resources/ShiftnetServices.txt @@ -11,21 +11,22 @@ With Freebie Solutions from ShiftSoft, you'll be able to traverse the Shiftnet w { Company: "Shiftcast", Name: "NetXtreme Hyper Edition", - CostPerMonth: 1500, + CostPerMonth: 150, DownloadSpeed: 524288, //512 kb/s Description: "It's time to supercharge your Shiftnet experience. With all the multimedia available, fast download speeds are a must on the Shiftnet. Start your subscription today for the low price of 1500 Codepoints and become a hyper-traveller today." }, { - Company: "Plumb Corp.", - Name: "youConnect", - CostPerMonth: 6000, + Company: "Bit Communications", + Name: "EncoderNet", + CostPerMonth: 600, DownloadSpeed: 1048576, //1 mb/s + Description: "The most reliable service provider on the Shiftnet." }, { - Company: "theCorp", - Name: "theNet", - CostPerMonth: 3000, + Company: "SOL Communications", + Name: "ShiftOS Online", + CostPerMonth: 300, DownloadSpeed: 786342, //768 kb/s - Description: "theNet is not *just* a Shiftnet service provider. It is theGateway to all of theShiftnet and your needs. It is also theValue service provider with theGreatest price and download speed." + Description: "SOL is the Shiftnet." }, ] \ No newline at end of file From cc55af0c8b4d14053bfb46ec14c3e1887d375f7d Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 3 Jun 2017 09:16:44 -0400 Subject: [PATCH 24/71] story objectives system --- ShiftOS.WinForms/ShiftOS.WinForms.csproj | 1 + ShiftOS.WinForms/Stories/DevXSkinningStory.cs | 99 +++++++++++++++++ ShiftOS_TheReturn/Commands.cs | 15 ++- ShiftOS_TheReturn/Story.cs | 104 +++++++++++++++++- 4 files changed, 215 insertions(+), 4 deletions(-) create mode 100644 ShiftOS.WinForms/Stories/DevXSkinningStory.cs diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index 0a59c00..e1afa84 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -427,6 +427,7 @@ Volume.cs + diff --git a/ShiftOS.WinForms/Stories/DevXSkinningStory.cs b/ShiftOS.WinForms/Stories/DevXSkinningStory.cs new file mode 100644 index 0000000..09dfd7f --- /dev/null +++ b/ShiftOS.WinForms/Stories/DevXSkinningStory.cs @@ -0,0 +1,99 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using ShiftOS.Engine; + +namespace ShiftOS.WinForms.Stories +{ + public class DevXSkinningStory + { + [Story("devx_1000_codepoints")] + 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(); + } + + 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(); + }); + }); + } + } +} diff --git a/ShiftOS_TheReturn/Commands.cs b/ShiftOS_TheReturn/Commands.cs index e379a50..72bccb1 100644 --- a/ShiftOS_TheReturn/Commands.cs +++ b/ShiftOS_TheReturn/Commands.cs @@ -533,11 +533,20 @@ namespace ShiftOS.Engine Codepoints: {SaveSystem.CurrentSave.Codepoints} Upgrades: {SaveSystem.CurrentSave.CountUpgrades()} installed, - {Shiftorium.GetAvailable().Length} available"; + {Shiftorium.GetAvailable().Length} available + +"; - if (Shiftorium.UpgradeInstalled("mud_control_centre")) - status += Environment.NewLine + $"Reputation: {SaveSystem.CurrentSave.RawReputation} ({SaveSystem.CurrentSave.Reputation})"; Console.WriteLine(status); + + if(Story.CurrentObjective != null) + { + Console.WriteLine("CURRENT OBJECTIVE: " + Story.CurrentObjective.Name); + Console.WriteLine("-------------------------------"); + Console.WriteLine(); + Console.WriteLine(Story.CurrentObjective.Description); + } + return true; } } diff --git a/ShiftOS_TheReturn/Story.cs b/ShiftOS_TheReturn/Story.cs index d62dae4..848c757 100644 --- a/ShiftOS_TheReturn/Story.cs +++ b/ShiftOS_TheReturn/Story.cs @@ -35,11 +35,100 @@ using Newtonsoft.Json; namespace ShiftOS.Engine { + public class StoryContext + { + public string Id { get; set; } + public MethodInfo Method { get; set; } + public bool AutoComplete = false; + + public StoryContext() + { + AutoComplete = true; + } + + public void MarkComplete() + { + SaveSystem.CurrentSave.StoriesExperienced.Add(Id); + OnComplete?.Invoke(); + } + + public event Action OnComplete; + } + + public class Objective + { + private Func _completeFunc = null; + + public string Name { get; set; } + public string Description { get; set; } + + public bool IsComplete + { + get + { + return (bool)_completeFunc?.Invoke(); + } + } + + public Objective(string name, string desc, Func completeFunc, Action onComplete) + { + _completeFunc = completeFunc; + Name = name; + Description = desc; + this.onComplete = onComplete; + } + + private Action onComplete = null; + + public void Complete() + { + onComplete?.Invoke(); + } + } + /// /// Storyline management class. /// public static class Story { + public static StoryContext Context { get; private set; } + public static event Action StoryComplete; + public static Objective CurrentObjective { get; private set; } + + public static void PushObjective(string name, string desc, Func completeFunc, Action onComplete) + { + if (CurrentObjective != null) + { + if (CurrentObjective.IsComplete == false) + { + throw new Exception("Cannot start objective - an objective is already running."); + } + else + { + CurrentObjective = null; + } + } + + CurrentObjective = new Objective(name, desc, completeFunc, onComplete); + + var t = new Thread(() => + { + var obj = CurrentObjective; + while (!obj.IsComplete) + { + Thread.Sleep(5000); + } + obj.Complete(); + CurrentObjective = null; + }); + t.IsBackground = true; + t.Start(); + + Console.WriteLine("NEW OBJECTIVE:"); + Console.WriteLine("A new objective has been added to your system. Run sos.status to find out what you need to do."); + } + + /// /// Starts the storyline with the specified Storyline ID. /// @@ -68,8 +157,21 @@ namespace ShiftOS.Engine { new Thread(() => { + Context = new Engine.StoryContext + { + Id = stid, + Method = mth, + AutoComplete = true, + }; + Context.OnComplete += () => + { + StoryComplete?.Invoke(stid); + }; mth.Invoke(null, null); - SaveSystem.CurrentSave.StoriesExperienced.Add(stid); + if (Context.AutoComplete) + { + Context.MarkComplete(); + } }).Start(); return; } From 7fe5d790dc9d73056e86af8116ba4db9674fd612 Mon Sep 17 00:00:00 2001 From: RogueAI42 Date: Sun, 4 Jun 2017 01:29:21 +1000 Subject: [PATCH 25/71] fixed shiftorium just in time for chrimbus --- ShiftOS.Objects/Save.cs | 75 +++++-- .../ShiftoriumFrontend.Designer.cs | 3 - .../Applications/ShiftoriumFrontend.cs | 186 +++++++----------- ShiftOS_TheReturn/SaveSystem.cs | 11 +- 4 files changed, 136 insertions(+), 139 deletions(-) diff --git a/ShiftOS.Objects/Save.cs b/ShiftOS.Objects/Save.cs index cbd77e2..e0282e8 100644 --- a/ShiftOS.Objects/Save.cs +++ b/ShiftOS.Objects/Save.cs @@ -26,8 +26,7 @@ using System; using System.Collections.Generic; using System.Dynamic; using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Threading; namespace ShiftOS.Objects { @@ -41,33 +40,77 @@ namespace ShiftOS.Objects [Obsolete("This save variable is no longer used in Beta 2.4 and above of ShiftOS. Please use ShiftOS.Engine.SaveSystem.CurrentUser.Username to access the current user's username.")] public string Username { get; set; } - private ulong _cp = 0; + private List _setCpCallbacks = new List(); // everything in this list is called by Codepoints.set() and syncCp(). + private ulong _cp = 0; // locally cached codepoints counter + private Object _cpLock = new Object(); // locked when modifying or reading the codepoints counter + private Object _webLock = new Object(); // locked when communicating with the server + private Timer _updTimer; // timer to start a new sync thread every 5 minutes + + // Sync local Codepoints count with the server. + public void syncCp() + { + new Thread(() => + { + lock (_cpLock) + { + lock (_webLock) + { + var uc = new ShiftOS.Unite.UniteClient("", UniteAuthToken); + _cp = uc.GetCodepoints(); + } + } + foreach (Action a in _setCpCallbacks) + a(); + }).Start(); + } + + // we have to write these wrapper functions so we can keep _setCpCallbacks private, + // so that it doesn't get serialised + public void addSetCpCallback(Action callback) + { + _setCpCallbacks.Add(callback); + } + + public void removeSetCpCallback(Action callback) + { + _setCpCallbacks.Remove(callback); + } public ulong Codepoints { get { - try - { - var uc = new ShiftOS.Unite.UniteClient("", UniteAuthToken); - return uc.GetCodepoints(); - } - catch + if (_updTimer == null) + _updTimer = new Timer((o) => syncCp(), null, 0, 300000); + lock (_cpLock) { return _cp; } } set { - try + lock (_cpLock) + { + _cp = value; + new Thread(() => { - var uc = new ShiftOS.Unite.UniteClient("", UniteAuthToken); - uc.SetCodepoints(value); - } - catch + lock (_webLock) + { + try + { + var uc = new ShiftOS.Unite.UniteClient("", UniteAuthToken); + uc.SetCodepoints(value); + } + catch + { } + } + }) { - _cp = value; - } + IsBackground = false + }.Start(); + } + foreach (Action a in _setCpCallbacks) + a(); } } diff --git a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.Designer.cs b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.Designer.cs index dc107c4..e4e493e 100644 --- a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.Designer.cs +++ b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.Designer.cs @@ -189,7 +189,6 @@ namespace ShiftOS.WinForms.Applications this.lblcategorytext.TabIndex = 2; this.lblcategorytext.Text = "No Upgrades"; this.lblcategorytext.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - this.lblcategorytext.Click += new System.EventHandler(this.lblcategorytext_Click); // // btncat_forward // @@ -226,7 +225,6 @@ namespace ShiftOS.WinForms.Applications this.lbcodepoints.Size = new System.Drawing.Size(135, 13); this.lbcodepoints.TabIndex = 3; this.lbcodepoints.Text = "You have: %cp Codepoints"; - this.lbcodepoints.Click += new System.EventHandler(this.lbcodepoints_Click); // // label1 // @@ -280,7 +278,6 @@ namespace ShiftOS.WinForms.Applications this.ForeColor = System.Drawing.Color.LightGreen; this.Name = "ShiftoriumFrontend"; this.Size = new System.Drawing.Size(782, 427); - this.Load += new System.EventHandler(this.Shiftorium_Load); this.panel1.ResumeLayout(false); this.panel2.ResumeLayout(false); this.pnlupgradeactions.ResumeLayout(false); diff --git a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs index d6b014d..0ae0803 100644 --- a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs +++ b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs @@ -47,19 +47,22 @@ namespace ShiftOS.WinForms.Applications public partial class ShiftoriumFrontend : UserControl, IShiftOSWindow { public int CategoryId = 0; - public static System.Timers.Timer timer100; + private string[] cats = backend.GetCategories(); + private ShiftoriumUpgrade[] avail; + public void updatecounter() + { + Desktop.InvokeOnWorkerThread(() => { lbcodepoints.Text = $"You have {SaveSystem.CurrentSave.Codepoints} Codepoints."; }); + } + public ShiftoriumFrontend() { - cp_update = new System.Windows.Forms.Timer(); - cp_update.Tick += (o, a) => - { - lbcodepoints.Text = $"You have {SaveSystem.CurrentSave.Codepoints} Codepoints."; - }; - cp_update.Interval = 100; InitializeComponent(); - PopulateShiftorium(); + SaveSystem.CurrentSave.addSetCpCallback(updatecounter); + updatecounter(); + Populate(); + SetList(); lbupgrades.SelectedIndexChanged += (o, a) => { try @@ -82,84 +85,57 @@ namespace ShiftOS.WinForms.Applications public void SelectUpgrade(string name) { btnbuy.Show(); - var upg = upgrades[name]; + var upg = upgrades[CategoryId][name]; lbupgradetitle.Text = Localization.Parse(upg.Name); lbupgradedesc.Text = Localization.Parse(upg.Description); } - Dictionary upgrades = new Dictionary(); - - public void PopulateShiftorium() + Dictionary[] upgrades; + + private void Populate() { - var t = new Thread(() => + upgrades = new Dictionary[cats.Length]; + int numComplete = 0; + avail = backend.GetAvailable(); + foreach (var it in cats.Select((catName, catId) => new { catName, catId })) { - try + var upl = new Dictionary(); + upgrades[it.catId] = upl; + var t = new Thread((tupobj) => { - Desktop.InvokeOnWorkerThread(() => - { - lbnoupgrades.Hide(); - lbupgrades.Items.Clear(); - upgrades.Clear(); - Timer(); - }); + 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 + } - foreach (var upg in backend.GetAvailable().Where(x => x.Category == backend.GetCategories()[CategoryId])) - { - string name = Localization.Parse(upg.Name) + " - " + upg.Cost.ToString() + "CP"; - upgrades.Add(name, upg); - Desktop.InvokeOnWorkerThread(() => - { - lbupgrades.Items.Add(name); - }); - } - - if (lbupgrades.Items.Count == 0) - { - Desktop.InvokeOnWorkerThread(() => - { - lbnoupgrades.Show(); - lbnoupgrades.Location = new Point( - (lbupgrades.Width - lbnoupgrades.Width) / 2, - lbupgrades.Top + (lbupgrades.Height - lbnoupgrades.Height) / 2 - ); - }); - } - else - { - Desktop.InvokeOnWorkerThread(() => - { - lbnoupgrades.Hide(); - }); - } - - Desktop.InvokeOnWorkerThread(() => - { - try - { - lblcategorytext.Text = Shiftorium.GetCategories()[CategoryId]; - btncat_back.Visible = (CategoryId > 0); - btncat_forward.Visible = (CategoryId < backend.GetCategories().Length - 1); - } - catch - { - - } - }); - } - catch - { - Desktop.InvokeOnWorkerThread(() => - { - lbnoupgrades.Show(); - lbnoupgrades.Location = new Point( - (lbupgrades.Width - lbnoupgrades.Width) / 2, - lbupgrades.Top + (lbupgrades.Height - lbnoupgrades.Height) / 2 - ); - }); - } - }); - t.IsBackground = true; - t.Start(); + private void SetList() + { + lbnoupgrades.Hide(); + lbupgrades.Items.Clear(); + try + { + lbupgrades.Items.AddRange(upgrades[CategoryId].Keys.ToArray()); + } + catch + { + Engine.Infobox.Show("Shiftorium Machine Broke", "Category ID " + CategoryId.ToString() + " is invalid, modulo is broken, and the world is doomed. Please tell Declan about this."); + return; + } + if (lbupgrades.Items.Count == 0) + { + lbnoupgrades.Show(); + lbnoupgrades.Location = new Point( + (lbupgrades.Width - lbnoupgrades.Width) / 2, + lbupgrades.Top + (lbupgrades.Height - lbnoupgrades.Height) / 2 + ); + } + else + lbnoupgrades.Hide(); + lblcategorytext.Text = cats[CategoryId]; } public static bool UpgradeInstalled(string upg) @@ -218,8 +194,9 @@ namespace ShiftOS.WinForms.Applications Dictionary UpgradesToBuy = new Dictionary(); foreach (var itm in lbupgrades.SelectedItems) { - cpCost += upgrades[itm.ToString()].Cost; - UpgradesToBuy.Add(upgrades[itm.ToString()].ID, upgrades[itm.ToString()].Cost); + var upg = upgrades[CategoryId][itm.ToString()]; + cpCost += upg.Cost; + UpgradesToBuy.Add(upg.ID, upg.Cost); } if (SaveSystem.CurrentSave.Codepoints < cpCost) { @@ -230,7 +207,6 @@ namespace ShiftOS.WinForms.Applications { foreach(var upg in UpgradesToBuy) { - SaveSystem.CurrentSave.Codepoints -= upg.Value; if (SaveSystem.CurrentSave.Upgrades.ContainsKey(upg.Key)) { SaveSystem.CurrentSave.Upgrades[upg.Key] = true; @@ -242,20 +218,15 @@ namespace ShiftOS.WinForms.Applications SaveSystem.SaveGame(); backend.InvokeUpgradeInstalled(); } + SaveSystem.CurrentSave.Codepoints -= cpCost; } backend.Silent = false; - PopulateShiftorium(); btnbuy.Hide(); } - private void Shiftorium_Load(object sender, EventArgs e) { - - } - public void OnLoad() { - cp_update.Start(); lbnoupgrades.Hide(); } @@ -264,12 +235,9 @@ namespace ShiftOS.WinForms.Applications } - System.Windows.Forms.Timer cp_update = new System.Windows.Forms.Timer(); - public bool OnUnload() { - cp_update.Stop(); - cp_update = null; + SaveSystem.CurrentSave.removeSetCpCallback(updatecounter); return true; } @@ -277,44 +245,26 @@ namespace ShiftOS.WinForms.Applications { lbupgrades.SelectionMode = (UpgradeInstalled("shiftorium_gui_bulk_buy") == true) ? SelectionMode.MultiExtended : SelectionMode.One; lbcodepoints.Visible = Shiftorium.UpgradeInstalled("shiftorium_gui_codepoints_display"); + Populate(); + SetList(); } - private void lbcodepoints_Click(object sender, EventArgs e) + private void moveCat(short direction) // direction is -1 to move backwards or 1 to move forwards { - - } - - void Timer() - { - timer100 = new System.Timers.Timer(); - timer100.Interval = 2000; - //CLARIFICATION: What is this supposed to do? - Michael - //timer100.Elapsed += ???; - timer100.AutoReset = true; - timer100.Enabled = true; + CategoryId += direction; + CategoryId %= cats.Length; + if (CategoryId < 0) CategoryId += cats.Length; // fix modulo on negatives + SetList(); } private void btncat_back_Click(object sender, EventArgs e) { - if(CategoryId > 0) - { - CategoryId--; - PopulateShiftorium(); - } + moveCat(-1); } private void btncat_forward_Click(object sender, EventArgs e) { - if(CategoryId < backend.GetCategories().Length - 1) - { - CategoryId++; - PopulateShiftorium(); - } - } - - private void lblcategorytext_Click(object sender, EventArgs e) - { - + moveCat(1); } } } diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs index 395db85..155f002 100644 --- a/ShiftOS_TheReturn/SaveSystem.cs +++ b/ShiftOS_TheReturn/SaveSystem.cs @@ -570,8 +570,15 @@ namespace ShiftOS.Engine Console.Write("{SE_SAVING}... "); if (SaveSystem.CurrentSave != null) { - Utils.WriteAllText(Paths.GetPath("user.dat"), CurrentSave.UniteAuthToken); - ServerManager.SendMessage("mud_save", JsonConvert.SerializeObject(CurrentSave, Formatting.Indented)); + Utils.WriteAllText(Paths.GetPath("user.dat"), CurrentSave.UniteAuthToken); + var serialisedSaveFile = JsonConvert.SerializeObject(CurrentSave, Formatting.Indented); + new Thread(() => + { + // please don't do networking on the main thread if you're just going to + // discard the response, it's extremely slow + ServerManager.SendMessage("mud_save", serialisedSaveFile); + }) + { IsBackground = false }.Start(); } if (!Shiftorium.Silent) Console.WriteLine(" ...{DONE}."); From 69aba3b373f9c9c70ec4ef2250e71465d3327299 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 4 Jun 2017 15:18:53 -0400 Subject: [PATCH 26/71] A fuckton of storyline features. --- ShiftOS.Objects/Save.cs | 5 + ShiftOS.WinForms/Applications/Terminal.cs | 82 +++++++++++- ShiftOS.WinForms/Commands.cs | 1 - ShiftOS.WinForms/Oobe.cs | 6 +- ShiftOS.WinForms/Stories/LegionStory.cs | 146 +++++++++++++++------- ShiftOS.WinForms/Tools/ControlManager.cs | 12 +- ShiftOS_TheReturn/Commands.cs | 27 ++-- ShiftOS_TheReturn/SaveSystem.cs | 10 ++ ShiftOS_TheReturn/Story.cs | 25 ++-- 9 files changed, 240 insertions(+), 74 deletions(-) diff --git a/ShiftOS.Objects/Save.cs b/ShiftOS.Objects/Save.cs index e0282e8..7891a22 100644 --- a/ShiftOS.Objects/Save.cs +++ b/ShiftOS.Objects/Save.cs @@ -173,6 +173,11 @@ namespace ShiftOS.Objects } public List Users { get; set; } + + /// + /// DO NOT MODIFY THIS. EVER. YOU WILL BREAK THE STORYLINE. Let the engine do it's job. + /// + public string PickupPoint { get; set; } } public class SettingsObject : DynamicObject diff --git a/ShiftOS.WinForms/Applications/Terminal.cs b/ShiftOS.WinForms/Applications/Terminal.cs index a4b77ae..687b2b9 100644 --- a/ShiftOS.WinForms/Applications/Terminal.cs +++ b/ShiftOS.WinForms/Applications/Terminal.cs @@ -410,8 +410,6 @@ namespace ShiftOS.WinForms.Applications public static void FirstSteps() { TerminalBackend.PrefixEnabled = false; - new Thread(() => - { TerminalBackend.InStory = true; Console.WriteLine("Hey there, and welcome to ShiftOS."); Thread.Sleep(2000); @@ -521,8 +519,86 @@ namespace ShiftOS.WinForms.Applications 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 ""sos.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 +te 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 shiftorium.list, shiftorium.info and shiftorium.buy.", + () => + { + 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(); - }).Start(); + }); + + TerminalBackend.PrintPrompt(); + } + + + [Story("first_steps_transition")] + public static void FirstStepsTransition() + { + Story.PushObjective("Earn 1000 Codepoints", "You now know the basics of ShiftOS. Let's get your system up and running with a few upgrades, and get a decent amount of Codepoints.", () => + { + return SaveSystem.CurrentSave.Codepoints >= 1000; + }, + () => + { + Story.Context.MarkComplete(); + Story.Start("victortran_shiftnet"); + }); + + Story.Context.AutoComplete = false; } public void OnSkinLoad() diff --git a/ShiftOS.WinForms/Commands.cs b/ShiftOS.WinForms/Commands.cs index 2d297f5..b04ffe7 100644 --- a/ShiftOS.WinForms/Commands.cs +++ b/ShiftOS.WinForms/Commands.cs @@ -80,7 +80,6 @@ namespace ShiftOS.WinForms } } - [Namespace("coherence")] [RequiresUpgrade("kernel_coherence")] public static class CoherenceCommands diff --git a/ShiftOS.WinForms/Oobe.cs b/ShiftOS.WinForms/Oobe.cs index 96c2bf5..271e1fd 100644 --- a/ShiftOS.WinForms/Oobe.cs +++ b/ShiftOS.WinForms/Oobe.cs @@ -91,6 +91,7 @@ namespace ShiftOS.WinForms slashcount++; if (slashcount == 5) slashcount = 1; + Engine.AudioManager.PlayStream(Properties.Resources.writesound); Thread.Sleep(50); } rtext += Environment.NewLine; @@ -138,7 +139,10 @@ namespace ShiftOS.WinForms TextType("Your computer has been taken over by ShiftOS, and is currently being wiped clean of all existing files and programs."); Thread.Sleep(2000); Clear(); - TextType("I will not share my identity or my intentions at this moment.I will just proceed with the installation.Theres nothing you can do to stop it."); + TextType("I will not share my identity or my intentions at this moment."); + Thread.Sleep(2000); + Clear(); + TextType("I will just proceed with the installation.Theres nothing you can do to stop it."); Thread.Sleep(2000); Clear(); TextType("All I will say, is I need your help.Once ShiftOS is installed, I will explain."); diff --git a/ShiftOS.WinForms/Stories/LegionStory.cs b/ShiftOS.WinForms/Stories/LegionStory.cs index a0fc9bf..8c79f0e 100644 --- a/ShiftOS.WinForms/Stories/LegionStory.cs +++ b/ShiftOS.WinForms/Stories/LegionStory.cs @@ -16,8 +16,8 @@ namespace ShiftOS.WinForms.Stories [Story("victortran_shiftnet")] public static void ShiftnetStoryFeaturingTheBlueSmileyFaceHolyFuckThisFunctionNameIsLong() { - CharacterName = "victor_tran"; - SysName = "theos"; + CharacterName = "aiden"; + SysName = "appscape_main"; bool waiting = false; var installer = new Applications.Installer(); installer.InstallCompleted += () => @@ -35,53 +35,107 @@ namespace ShiftOS.WinForms.Stories AppearanceManager.SetupWindow(term); } - var t = new Thread(() => + 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(() => { - WriteLine("victortran@theos - user connecting to your system.", false); - Thread.Sleep(2000); - WriteLine("Hey there - yes, I am not just a sentient being. I am indeed Victor Tran."); - WriteLine("I am the creator of a Linux desktop environment called theShell."); - WriteLine("I'm in the middle of working on a ShiftOS version of it."); - WriteLine("However, before I start, I feel I need to show you something."); - WriteLine("You have a lot of ShiftOS applications, and you can earn lots of Codepoints - and you already have lots."); - WriteLine("Well, you'd be a perfect candidate for me to install the Shiftnet Client on your system."); - WriteLine("I'll begin the installation right now."); - //Set up an Installer. - waiting = true; - Desktop.InvokeOnWorkerThread(() => - { - Story.Start("installer"); - while (!Shiftorium.UpgradeInstalled("installer")) - Thread.Sleep(20); - AppearanceManager.SetupWindow(installer); - installer.InitiateInstall(new ShiftnetInstallation()); - }); - while (waiting == true) - Thread.Sleep(25); + SaveSystem.CurrentSave.StoriesExperienced.Add("installer"); + SaveSystem.CurrentSave.StoriesExperienced.Add("downloader"); - WriteLine("All installed! Once I disconnect, type win.open to see a list of your new apps."); - WriteLine("The Shiftnet is a vast network of websites only accessible through ShiftOS."); - WriteLine("Think of it as the DarkNet, but much darker, and much more secretive."); - WriteLine("There are lots of apps, games, skins and utilities on the Shiftnet."); - WriteLine("There are also lots of companies offering many services."); - WriteLine("I'd stay on the shiftnet/ cluster though, others may be dangerous."); - WriteLine("I'd also stick to the sites listed on shiftnet/shiftsoft/ping - that site is regularly updated with the most safe Shiftnet sites."); - WriteLine("Oh, that reminds me. I have set you up with ShiftSoft's service provider, Freebie Solutions."); - WriteLine("It's a free provider, but it offers only 256 bytes per second download and upload speeds."); - WriteLine("You may want to go look for another provider when you can afford it."); - WriteLine("Trust me - with this provider, things get slow."); - WriteLine("Anyways, it was nice meeting you, hopefully someday you'll give theShell a try."); + 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.PushObjective("Register with a new Shiftnet service provider.", "You've just unlocked the Shiftnet, which has opened up a whole new world of applications and features for ShiftOS. Before you go nuts with it, you may want to register with a better service provider than Freebie Solutions.", () => + { + return SaveSystem.CurrentSave.ShiftnetSubscription != 0; + }, + () => + { + Story.Context.MarkComplete(); + SaveSystem.SaveGame(); + TerminalBackend.PrintPrompt(); + Story.Start("hacker101_breakingbonds_1"); + }); TerminalBackend.PrefixEnabled = true; - TerminalBackend.PrintPrompt(); - }); - t.IsBackground = true; - t.Start(); + TerminalBackend.PrintPrompt(); - TerminalBackend.PrefixEnabled = false; + Story.Context.AutoComplete = false; + } + + [Story("hacker101_breakingbonds_1")] + 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."); + + 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"); + return flag1 && flag2 && flag3; + }, () => + { + Story.Context.MarkComplete(); + SaveSystem.SaveGame(); + Story.Start("hacker101_breakingbonds_2"); + }); + + TerminalBackend.PrefixEnabled = true; + TerminalBackend.PrintPrompt(); + + Story.Context.AutoComplete = false; } + private static void WriteLine(string text, bool showCharacterName=true) { Console.WriteLine(); @@ -90,15 +144,23 @@ namespace ShiftOS.WinForms.Stories ConsoleEx.Bold = true; ConsoleEx.ForegroundColor = ConsoleColor.DarkMagenta; Console.Write(CharacterName); + ConsoleEx.OnFlush?.Invoke(); Console.ForegroundColor = ConsoleColor.White; Console.Write("@"); + ConsoleEx.OnFlush?.Invoke(); ConsoleEx.ForegroundColor = ConsoleColor.Yellow; Console.Write(SysName + ": "); + ConsoleEx.OnFlush?.Invoke(); } ConsoleEx.ForegroundColor = ConsoleColor.Gray; ConsoleEx.Bold = false; - Console.WriteLine(text); + foreach(var c in text) + { + Console.Write(c); + ConsoleEx.OnFlush?.Invoke(); + Thread.Sleep(45); + } Thread.Sleep(1000); } diff --git a/ShiftOS.WinForms/Tools/ControlManager.cs b/ShiftOS.WinForms/Tools/ControlManager.cs index 548a62a..7fbfd1b 100644 --- a/ShiftOS.WinForms/Tools/ControlManager.cs +++ b/ShiftOS.WinForms/Tools/ControlManager.cs @@ -137,10 +137,14 @@ namespace ShiftOS.WinForms.Tools /// The control to center (this is an extension method - you can call it on a control as though it was a method in that control) public static void CenterParent(this Control ctrl) { - ctrl.Location = new Point( - (ctrl.Parent.Width - ctrl.Width) / 2, - (ctrl.Parent.Height - ctrl.Height) / 2 - ); + try + { + ctrl.Location = new Point( + (ctrl.Parent.Width - ctrl.Width) / 2, + (ctrl.Parent.Height - ctrl.Height) / 2 + ); + } + catch { } } public static void SetupControl(Control ctrl) diff --git a/ShiftOS_TheReturn/Commands.cs b/ShiftOS_TheReturn/Commands.cs index 72bccb1..f37bcb3 100644 --- a/ShiftOS_TheReturn/Commands.cs +++ b/ShiftOS_TheReturn/Commands.cs @@ -538,15 +538,28 @@ Upgrades: {SaveSystem.CurrentSave.CountUpgrades()} installed, "; Console.WriteLine(status); - - if(Story.CurrentObjective != null) + Console.WriteLine("Objectives:"); + try { - Console.WriteLine("CURRENT OBJECTIVE: " + Story.CurrentObjective.Name); - Console.WriteLine("-------------------------------"); - Console.WriteLine(); - Console.WriteLine(Story.CurrentObjective.Description); + if (Story.CurrentObjectives.Count > 0) + { + foreach (var obj in Story.CurrentObjectives) + { + Console.WriteLine(obj.Name); + Console.WriteLine("-------------------------------"); + Console.WriteLine(); + Console.WriteLine(obj.Description); + } + } + else + { + Console.WriteLine(" - No objectives are running. Check back later!"); + } + } + catch + { + Console.WriteLine(" - No objectives are running. Check back later!"); } - return true; } } diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs index 155f002..e98a51e 100644 --- a/ShiftOS_TheReturn/SaveSystem.cs +++ b/ShiftOS_TheReturn/SaveSystem.cs @@ -453,6 +453,16 @@ namespace ShiftOS.Engine Desktop.InvokeOnWorkerThread(new Action(() => Desktop.PopulateAppLauncher())); GameReady?.Invoke(); + + if (!string.IsNullOrWhiteSpace(CurrentSave.PickupPoint)) + { + try + { + Story.Start(CurrentSave.PickupPoint); + TerminalBackend.PrintPrompt(); + } + catch { } + } } /// diff --git a/ShiftOS_TheReturn/Story.cs b/ShiftOS_TheReturn/Story.cs index 848c757..4d1d5cc 100644 --- a/ShiftOS_TheReturn/Story.cs +++ b/ShiftOS_TheReturn/Story.cs @@ -93,33 +93,24 @@ namespace ShiftOS.Engine { public static StoryContext Context { get; private set; } public static event Action StoryComplete; - public static Objective CurrentObjective { get; private set; } + public static List CurrentObjectives { get; private set; } public static void PushObjective(string name, string desc, Func completeFunc, Action onComplete) { - if (CurrentObjective != null) - { - if (CurrentObjective.IsComplete == false) - { - throw new Exception("Cannot start objective - an objective is already running."); - } - else - { - CurrentObjective = null; - } - } - - CurrentObjective = new Objective(name, desc, completeFunc, onComplete); + if (CurrentObjectives == null) + CurrentObjectives = new List(); + var currentObjective = new Objective(name, desc, completeFunc, onComplete); + CurrentObjectives.Add(currentObjective); var t = new Thread(() => { - var obj = CurrentObjective; + var obj = currentObjective; while (!obj.IsComplete) { Thread.Sleep(5000); } + CurrentObjectives.Remove(obj); obj.Complete(); - CurrentObjective = null; }); t.IsBackground = true; t.Start(); @@ -163,9 +154,11 @@ namespace ShiftOS.Engine Method = mth, AutoComplete = true, }; + SaveSystem.CurrentSave.Password = Context.Id; Context.OnComplete += () => { StoryComplete?.Invoke(stid); + SaveSystem.CurrentSave.PickupPoint = null; }; mth.Invoke(null, null); if (Context.AutoComplete) From 5e40ae4e295b17f8acd4b8c3d98dd27d84b9fa37 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 4 Jun 2017 15:53:24 -0400 Subject: [PATCH 27/71] Fix major server reboot. --- ShiftOS.Server/Program.cs | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/ShiftOS.Server/Program.cs b/ShiftOS.Server/Program.cs index e1dcdf2..fa9ebee 100644 --- a/ShiftOS.Server/Program.cs +++ b/ShiftOS.Server/Program.cs @@ -54,17 +54,6 @@ namespace ShiftOS.Server /// public class Program { - /// - /// The admin username. - /// - public static string AdminUsername = "admin"; - - /// - /// The admin password. - /// - public static string AdminPassword = "admin"; - - /// /// The server. /// From 3e11eca70481841b6e2f2253d667944779cfd5fb Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 4 Jun 2017 21:07:43 -0400 Subject: [PATCH 28/71] Fix story autosave --- ShiftOS.Server/Program.cs | 9 +-------- ShiftOS.WinForms/Stories/LegionStory.cs | 2 +- ShiftOS_TheReturn/Story.cs | 2 +- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/ShiftOS.Server/Program.cs b/ShiftOS.Server/Program.cs index fa9ebee..5170ccd 100644 --- a/ShiftOS.Server/Program.cs +++ b/ShiftOS.Server/Program.cs @@ -155,13 +155,7 @@ namespace ShiftOS.Server Console.WriteLine("FUCK. Something HORRIBLE JUST HAPPENED."); }; - AppDomain.CurrentDomain.UnhandledException += (o, a) => - { - if(server.IsOnline == true) - server.Stop(); - System.Diagnostics.Process.Start("ShiftOS.Server.exe"); - }; - + server.OnReceived += (o, a) => { var obj = a.Data.Object; @@ -208,7 +202,6 @@ namespace ShiftOS.Server task.Wait(); */ - RandomUserGenerator.StartThread(); while (server.IsOnline) { diff --git a/ShiftOS.WinForms/Stories/LegionStory.cs b/ShiftOS.WinForms/Stories/LegionStory.cs index 8c79f0e..056fe85 100644 --- a/ShiftOS.WinForms/Stories/LegionStory.cs +++ b/ShiftOS.WinForms/Stories/LegionStory.cs @@ -368,7 +368,7 @@ namespace ShiftOS.WinForms.Stories SetProgress(i); Thread.Sleep(100); } - Story.Start("downloader"); + SaveSystem.CurrentSave.StoriesExperienced.Add("downloader"); SetProgress(0); SetStatus("Dependencies installed."); Thread.Sleep(2000); diff --git a/ShiftOS_TheReturn/Story.cs b/ShiftOS_TheReturn/Story.cs index 4d1d5cc..f473f89 100644 --- a/ShiftOS_TheReturn/Story.cs +++ b/ShiftOS_TheReturn/Story.cs @@ -154,7 +154,7 @@ namespace ShiftOS.Engine Method = mth, AutoComplete = true, }; - SaveSystem.CurrentSave.Password = Context.Id; + SaveSystem.CurrentSave.PickupPoint = Context.Id; Context.OnComplete += () => { StoryComplete?.Invoke(stid); From a152c2c463d7ab45394b4fec84ae46be5105d3fe Mon Sep 17 00:00:00 2001 From: AShifter Date: Mon, 5 Jun 2017 10:01:16 -0600 Subject: [PATCH 29/71] Fixed ShiftLotto (again) Recently, Codepoints have been changed to ULong64. While SuperDoggo (on discord) was playing ShiftLotto, he tried to bet 100cp with only 80cp. The check to make sure you don't overbet failed because ShiftLotto subtracts codepoints*difficulty - currentCodepoints. If this value is negitive, it should give you an error. But, due to the transition to ulong,, this does not work and the check passes, removing (or adding if you're lucky) codepoints, crashing the game. I fixed this by simply changing thechecking statment from subtraction to a Less Than check (<). WOW I TYPED ALOT OF STUFF --- ShiftOS.WinForms/Applications/ShiftLotto.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ShiftOS.WinForms/Applications/ShiftLotto.cs b/ShiftOS.WinForms/Applications/ShiftLotto.cs index 3f940c7..03d051b 100644 --- a/ShiftOS.WinForms/Applications/ShiftLotto.cs +++ b/ShiftOS.WinForms/Applications/ShiftLotto.cs @@ -50,11 +50,11 @@ namespace ShiftOS.WinForms.Applications { timer1.Start(); } - + public void OnSkinLoad() { - + } public bool OnUnload() @@ -64,7 +64,7 @@ namespace ShiftOS.WinForms.Applications public void OnUpgrade() { - + } // The Dynamic Display @@ -82,13 +82,13 @@ namespace ShiftOS.WinForms.Applications int codePoints = Convert.ToInt32(Math.Round(cpUpDown.Value, 0)); int difficulty = Convert.ToInt32(Math.Round(difUpDown.Value, 0)); - if (SaveSystem.CurrentSave.Codepoints <= 9) + if (SaveSystem.CurrentSave.Codepoints < 10) { Infobox.Show("Not enough Codepoints", "You do not have enough Codepoints to use ShiftLotto!"); } else { - if (SaveSystem.CurrentSave.Codepoints - (ulong)(codePoints * difficulty) <= 0) + if (SaveSystem.CurrentSave.Codepoints < (ulong)(codePoints * difficulty)) { Infobox.Show("Not enough Codepoints", "You do not have enough Codepoints to gamble this amount!"); } @@ -110,7 +110,7 @@ namespace ShiftOS.WinForms.Applications // If you win // Add Codepoints - SaveSystem.TransferCodepointsFrom("shiftlotto", jackpot); + SaveSystem.TransferCodepointsFrom("shiftlotto", (ulong)(codePoints * difficulty)); // Infobox Infobox.Show("YOU WON!", "Good Job! " + jackpot.ToString() + " CP has been added to your account. "); @@ -122,13 +122,13 @@ namespace ShiftOS.WinForms.Applications // Remove Codepoints SaveSystem.TransferCodepointsToVoid(jackpot); - + // Infobox Infobox.Show("YOU FAILED!", "Sorry! " + jackpot.ToString() + " CP has been removed from your account."); } - } - } + } + } } } } \ No newline at end of file From e5bd035b4c520a2c8d9f398bb1efe72ebc1ccf80 Mon Sep 17 00:00:00 2001 From: RogueAI42 Date: Sat, 10 Jun 2017 02:50:15 +1000 Subject: [PATCH 30/71] fix a small bad in ShiftoriumFrontend --- ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs index 0ae0803..5dfb98e 100644 --- a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs +++ b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs @@ -47,7 +47,7 @@ namespace ShiftOS.WinForms.Applications public partial class ShiftoriumFrontend : UserControl, IShiftOSWindow { public int CategoryId = 0; - private string[] cats = backend.GetCategories(); + private string[] cats; private ShiftoriumUpgrade[] avail; @@ -94,6 +94,7 @@ namespace ShiftOS.WinForms.Applications private void Populate() { + cats = Shiftorium.GetCategories(); upgrades = new Dictionary[cats.Length]; int numComplete = 0; avail = backend.GetAvailable(); From c40d071d58859e25b3781299b949b91caa0548fe Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 10 Jun 2017 10:17:10 -0400 Subject: [PATCH 31/71] main menu system + sandbox mode --- ShiftOS.Objects/Save.cs | 6 + .../MainMenu/MainMenu.Designer.cs | 147 ++++++++++++++ ShiftOS.WinForms/MainMenu/MainMenu.cs | 100 ++++++++++ ShiftOS.WinForms/MainMenu/MainMenu.resx | 120 +++++++++++ ShiftOS.WinForms/Program.cs | 35 ++-- ShiftOS.WinForms/ShiftOS.WinForms.csproj | 9 + .../ShiftnetSites/ShiftSoft.Designer.cs | 188 +++++++++++++++++- ShiftOS.WinForms/ShiftnetSites/ShiftSoft.cs | 56 ++++++ ShiftOS.WinForms/ShiftnetSites/ShiftSoft.resx | 10 + ShiftOS.WinForms/Stories/LegionStory.cs | 42 ++-- ShiftOS.WinForms/WinformsDesktop.cs | 32 ++- ShiftOS_TheReturn/AppearanceManager.cs | 1 + ShiftOS_TheReturn/SaveSystem.cs | 156 ++++++++++----- ShiftOS_TheReturn/ServerManager.cs | 18 +- ShiftOS_TheReturn/Shiftorium.cs | 3 + ShiftOS_TheReturn/Story.cs | 8 + 16 files changed, 827 insertions(+), 104 deletions(-) create mode 100644 ShiftOS.WinForms/MainMenu/MainMenu.Designer.cs create mode 100644 ShiftOS.WinForms/MainMenu/MainMenu.cs create mode 100644 ShiftOS.WinForms/MainMenu/MainMenu.resx diff --git a/ShiftOS.Objects/Save.cs b/ShiftOS.Objects/Save.cs index 7891a22..6e7f167 100644 --- a/ShiftOS.Objects/Save.cs +++ b/ShiftOS.Objects/Save.cs @@ -76,10 +76,14 @@ namespace ShiftOS.Objects _setCpCallbacks.Remove(callback); } + public bool IsSandbox = false; + public ulong Codepoints { get { + if (IsSandbox == true) + return 0; if (_updTimer == null) _updTimer = new Timer((o) => syncCp(), null, 0, 300000); lock (_cpLock) @@ -89,6 +93,8 @@ namespace ShiftOS.Objects } set { + if (IsSandbox == true) + return; lock (_cpLock) { _cp = value; diff --git a/ShiftOS.WinForms/MainMenu/MainMenu.Designer.cs b/ShiftOS.WinForms/MainMenu/MainMenu.Designer.cs new file mode 100644 index 0000000..62db46d --- /dev/null +++ b/ShiftOS.WinForms/MainMenu/MainMenu.Designer.cs @@ -0,0 +1,147 @@ +namespace ShiftOS.WinForms.MainMenu +{ + partial class MainMenu + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.flmenu = new System.Windows.Forms.FlowLayoutPanel(); + this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.button3 = new System.Windows.Forms.Button(); + this.button4 = new System.Windows.Forms.Button(); + this.button5 = new System.Windows.Forms.Button(); + this.lbticker = new System.Windows.Forms.Label(); + this.flmenu.SuspendLayout(); + this.SuspendLayout(); + // + // flmenu + // + this.flmenu.AutoSize = true; + this.flmenu.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.flmenu.Controls.Add(this.button1); + this.flmenu.Controls.Add(this.button2); + this.flmenu.Controls.Add(this.button3); + this.flmenu.Controls.Add(this.button4); + this.flmenu.Controls.Add(this.button5); + this.flmenu.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; + this.flmenu.Location = new System.Drawing.Point(46, 218); + this.flmenu.Name = "flmenu"; + this.flmenu.Size = new System.Drawing.Size(187, 145); + this.flmenu.TabIndex = 0; + // + // button1 + // + this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.button1.Location = new System.Drawing.Point(3, 3); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(181, 23); + this.button1.TabIndex = 0; + this.button1.Text = "Campaign"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // button2 + // + this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.button2.Location = new System.Drawing.Point(3, 32); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(181, 23); + this.button2.TabIndex = 1; + this.button2.Text = "Sandbox"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // button3 + // + this.button3.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.button3.Location = new System.Drawing.Point(3, 61); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(181, 23); + this.button3.TabIndex = 2; + this.button3.Text = "Settings"; + this.button3.UseVisualStyleBackColor = true; + // + // button4 + // + this.button4.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.button4.Location = new System.Drawing.Point(3, 90); + this.button4.Name = "button4"; + this.button4.Size = new System.Drawing.Size(181, 23); + this.button4.TabIndex = 3; + this.button4.Text = "About"; + this.button4.UseVisualStyleBackColor = true; + // + // button5 + // + this.button5.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.button5.Location = new System.Drawing.Point(3, 119); + this.button5.Name = "button5"; + this.button5.Size = new System.Drawing.Size(181, 23); + this.button5.TabIndex = 4; + this.button5.Text = "Exit"; + this.button5.UseVisualStyleBackColor = true; + this.button5.Click += new System.EventHandler(this.button5_Click); + // + // lbticker + // + this.lbticker.AutoSize = true; + this.lbticker.Location = new System.Drawing.Point(29, 515); + this.lbticker.Name = "lbticker"; + this.lbticker.Size = new System.Drawing.Size(93, 13); + this.lbticker.TabIndex = 1; + this.lbticker.Tag = "header3"; + this.lbticker.Text = "This is a tickerbar."; + // + // MainMenu + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.Black; + this.ClientSize = new System.Drawing.Size(1161, 566); + this.Controls.Add(this.lbticker); + this.Controls.Add(this.flmenu); + this.ForeColor = System.Drawing.Color.White; + this.Name = "MainMenu"; + this.Text = "MainMenu"; + this.Load += new System.EventHandler(this.MainMenu_Load); + this.flmenu.ResumeLayout(false); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.FlowLayoutPanel flmenu; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.Button button3; + private System.Windows.Forms.Button button4; + private System.Windows.Forms.Button button5; + private System.Windows.Forms.Label lbticker; + } +} \ No newline at end of file diff --git a/ShiftOS.WinForms/MainMenu/MainMenu.cs b/ShiftOS.WinForms/MainMenu/MainMenu.cs new file mode 100644 index 0000000..20cd4ec --- /dev/null +++ b/ShiftOS.WinForms/MainMenu/MainMenu.cs @@ -0,0 +1,100 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using ShiftOS.Engine; +using ShiftOS.WinForms.Tools; + +namespace ShiftOS.WinForms.MainMenu +{ + public partial class MainMenu : Form + { + public MainMenu(IDesktop desk) + { + InitializeComponent(); + (desk as WinformsDesktop).ParentMenu = this; + + var tickermove = new Timer(); + var tickerreset = new Timer(); + tickermove.Tick += (o, a) => + { + if(lbticker.Left <= (0 - lbticker.Width)) + { + tickermove.Stop(); + tickerreset.Start(); + } + else + { + lbticker.Top = (this.ClientSize.Height - (lbticker.Height * 2)); + lbticker.Left -= 2; + } + }; + tickerreset.Tick += (o, a) => + { + lbticker.Visible = false; + lbticker.Text = GetTickerMessage(); + lbticker.Left = this.Width; + lbticker.Visible = true; + tickerreset.Stop(); + tickermove.Start(); + }; + + tickermove.Interval = 1; + tickerreset.Interval = 1000; + + flmenu.CenterParent(); + + tickerreset.Start(); + } + + private void MainMenu_Load(object sender, EventArgs e) + { + Tools.ControlManager.SetupControls(this); + + } + + private Random rnd = new Random(); + + private string GetTickerMessage() + { + switch (rnd.Next(0, 10)) + { + case 0: + return "Did you know that you can skin this very menu? Just goes to show how much you can shift it your way."; + case 1: + return "Want to pick up a few skins or mods from the community? Head on over to http://getshiftos.ml/Skins!"; + case 2: + return "Sandbox mode is a special version of ShiftOS that allows you to use the operating system without having to deal with Codepoints, the Shiftorium or having to play through the storyline. Handy..."; + case 3: + return "ArtPad not good enough? You can use an external image editor to create ShiftOS skin textures. Just save your files to the Shared Directory and they'll be imported into ShiftOS on the 1:/ drive."; + case 4: + return "Terminal too weird for ya? You can use the Format Editor to generate your own Terminal command parser. No coding knowledge needed!"; + case 5: + return "Contests are a good way to earn heaps of Codepoints. Head on over to http://getshiftos.ml/Contests for info on current community contests."; + default: + return "Good God. We don't know what to put here."; + } + } + + private void button1_Click(object sender, EventArgs e) + { + Desktop.CurrentDesktop.Show(); + } + + private void button5_Click(object sender, EventArgs e) + { + this.Close(); + } + + private void button2_Click(object sender, EventArgs e) + { + (Desktop.CurrentDesktop as WinformsDesktop).IsSandbox = true; + Desktop.CurrentDesktop.Show(); + } + } +} diff --git a/ShiftOS.WinForms/MainMenu/MainMenu.resx b/ShiftOS.WinForms/MainMenu/MainMenu.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS.WinForms/MainMenu/MainMenu.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ShiftOS.WinForms/Program.cs b/ShiftOS.WinForms/Program.cs index 8f65265..b07d97a 100644 --- a/ShiftOS.WinForms/Program.cs +++ b/ShiftOS.WinForms/Program.cs @@ -50,6 +50,21 @@ namespace ShiftOS.WinForms 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()); + 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; @@ -63,25 +78,11 @@ namespace ShiftOS.WinForms Engine.AudioManager.PlayStream(Properties.Resources.dial_up_modem_02); }; - LoginManager.Init(new GUILoginFrontend()); - CrashHandler.SetGameMetadata(Assembly.GetExecutingAssembly()); - SkinEngine.SetIconProber(new ShiftOSIconProvider()); - ShiftOS.Engine.AudioManager.Init(new ShiftOSAudioProvider()); - Localization.RegisterProvider(new WFLanguageProvider()); - TutorialManager.RegisterTutorial(new Oobe()); - - TerminalBackend.TerminalRequested += () => - { - AppearanceManager.SetupWindow(new Applications.Terminal()); - }; - Infobox.Init(new Dialog()); - FileSkimmerBackend.Init(new WinformsFSFrontend()); - var desk = new WinformsDesktop(); - Desktop.Init(desk); - OutOfBoxExperience.Init(new Oobe()); - AppearanceManager.Initiate(new WinformsWindowManager()); Application.Run(desk); +#else + Application.Run(new MainMenu.MainMenu(desk)); +#endif } } diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index e1afa84..d589ed4 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -356,6 +356,12 @@ + + Form + + + MainMenu.cs + Form @@ -603,6 +609,9 @@ GUILogin.cs + + MainMenu.cs + Oobe.cs diff --git a/ShiftOS.WinForms/ShiftnetSites/ShiftSoft.Designer.cs b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft.Designer.cs index a62b5a8..b3e408f 100644 --- a/ShiftOS.WinForms/ShiftnetSites/ShiftSoft.Designer.cs +++ b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft.Designer.cs @@ -28,27 +28,198 @@ /// private void InitializeComponent() { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ShiftSoft)); this.label1 = new System.Windows.Forms.Label(); + this.pnldivider = new System.Windows.Forms.Panel(); + this.label2 = new System.Windows.Forms.Label(); + this.flbuttons = new System.Windows.Forms.FlowLayoutPanel(); + this.btnhome = new System.Windows.Forms.Button(); + this.btnservices = new System.Windows.Forms.Button(); + this.btnping = new System.Windows.Forms.Button(); + this.pnlhome = new System.Windows.Forms.Panel(); + this.lbwhere = new System.Windows.Forms.Label(); + this.lbdesc = new System.Windows.Forms.Label(); + this.pnlservices = new System.Windows.Forms.Panel(); + this.lbfreebiedesc = new System.Windows.Forms.Label(); + this.lbfreebie = new System.Windows.Forms.Label(); + this.btnjoinfreebie = new System.Windows.Forms.Button(); + this.flbuttons.SuspendLayout(); + this.pnlhome.SuspendLayout(); + this.pnlservices.SuspendLayout(); this.SuspendLayout(); // // label1 // this.label1.AutoSize = true; this.label1.Font = new System.Drawing.Font("Franklin Gothic Heavy", 24.75F, System.Drawing.FontStyle.Italic); - this.label1.Location = new System.Drawing.Point(13, 17); + this.label1.Location = new System.Drawing.Point(13, 8); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(152, 38); this.label1.TabIndex = 0; this.label1.Tag = "keepfont"; this.label1.Text = "Shiftsoft"; // + // pnldivider + // + this.pnldivider.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.pnldivider.Location = new System.Drawing.Point(20, 71); + this.pnldivider.Name = "pnldivider"; + this.pnldivider.Size = new System.Drawing.Size(654, 2); + this.pnldivider.TabIndex = 1; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(17, 46); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(163, 13); + this.label2.TabIndex = 2; + this.label2.Text = "What do you want to shift today?"; + // + // flbuttons + // + this.flbuttons.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.flbuttons.AutoSize = true; + this.flbuttons.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.flbuttons.Controls.Add(this.btnhome); + this.flbuttons.Controls.Add(this.btnservices); + this.flbuttons.Controls.Add(this.btnping); + this.flbuttons.Location = new System.Drawing.Point(515, 17); + this.flbuttons.Name = "flbuttons"; + this.flbuttons.Size = new System.Drawing.Size(159, 29); + this.flbuttons.TabIndex = 3; + // + // btnhome + // + this.btnhome.AutoSize = true; + this.btnhome.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnhome.Location = new System.Drawing.Point(3, 3); + this.btnhome.Name = "btnhome"; + this.btnhome.Size = new System.Drawing.Size(45, 23); + this.btnhome.TabIndex = 0; + this.btnhome.Tag = "header3"; + this.btnhome.Text = "Home"; + this.btnhome.UseVisualStyleBackColor = true; + this.btnhome.Click += new System.EventHandler(this.btnhome_Click); + // + // btnservices + // + this.btnservices.AutoSize = true; + this.btnservices.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnservices.Location = new System.Drawing.Point(54, 3); + this.btnservices.Name = "btnservices"; + this.btnservices.Size = new System.Drawing.Size(58, 23); + this.btnservices.TabIndex = 1; + this.btnservices.Tag = "header3"; + this.btnservices.Text = "Services"; + this.btnservices.UseVisualStyleBackColor = true; + this.btnservices.Click += new System.EventHandler(this.btnservices_Click); + // + // btnping + // + this.btnping.AutoSize = true; + this.btnping.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnping.Location = new System.Drawing.Point(118, 3); + this.btnping.Name = "btnping"; + this.btnping.Size = new System.Drawing.Size(38, 23); + this.btnping.TabIndex = 2; + this.btnping.Tag = "header3"; + this.btnping.Text = "Ping"; + this.btnping.UseVisualStyleBackColor = true; + this.btnping.Click += new System.EventHandler(this.btnping_Click); + // + // pnlhome + // + this.pnlhome.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.pnlhome.Controls.Add(this.lbdesc); + this.pnlhome.Controls.Add(this.lbwhere); + this.pnlhome.Location = new System.Drawing.Point(20, 92); + this.pnlhome.Name = "pnlhome"; + this.pnlhome.Size = new System.Drawing.Size(654, 271); + this.pnlhome.TabIndex = 4; + // + // lbwhere + // + this.lbwhere.AutoSize = true; + this.lbwhere.Location = new System.Drawing.Point(4, 4); + this.lbwhere.Name = "lbwhere"; + this.lbwhere.Size = new System.Drawing.Size(169, 13); + this.lbwhere.TabIndex = 0; + this.lbwhere.Tag = "header2"; + this.lbwhere.Text = "Where do you want to shift today?"; + // + // lbdesc + // + this.lbdesc.Location = new System.Drawing.Point(4, 17); + this.lbdesc.Name = "lbdesc"; + this.lbdesc.Size = new System.Drawing.Size(361, 160); + this.lbdesc.TabIndex = 1; + this.lbdesc.Text = resources.GetString("lbdesc.Text"); + // + // pnlservices + // + this.pnlservices.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.pnlservices.Controls.Add(this.btnjoinfreebie); + this.pnlservices.Controls.Add(this.lbfreebiedesc); + this.pnlservices.Controls.Add(this.lbfreebie); + this.pnlservices.Location = new System.Drawing.Point(20, 92); + this.pnlservices.Name = "pnlservices"; + this.pnlservices.Size = new System.Drawing.Size(654, 271); + this.pnlservices.TabIndex = 5; + // + // lbfreebiedesc + // + this.lbfreebiedesc.Location = new System.Drawing.Point(4, 17); + this.lbfreebiedesc.Name = "lbfreebiedesc"; + this.lbfreebiedesc.Size = new System.Drawing.Size(361, 105); + this.lbfreebiedesc.TabIndex = 1; + this.lbfreebiedesc.Text = resources.GetString("lbfreebiedesc.Text"); + // + // lbfreebie + // + this.lbfreebie.AutoSize = true; + this.lbfreebie.Location = new System.Drawing.Point(4, 4); + this.lbfreebie.Name = "lbfreebie"; + this.lbfreebie.Size = new System.Drawing.Size(88, 13); + this.lbfreebie.TabIndex = 0; + this.lbfreebie.Tag = "header2"; + this.lbfreebie.Text = "Freebie Solutions"; + // + // btnjoinfreebie + // + this.btnjoinfreebie.AutoSize = true; + this.btnjoinfreebie.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnjoinfreebie.Location = new System.Drawing.Point(245, 125); + this.btnjoinfreebie.Name = "btnjoinfreebie"; + this.btnjoinfreebie.Size = new System.Drawing.Size(120, 23); + this.btnjoinfreebie.TabIndex = 2; + this.btnjoinfreebie.Text = "Join Freebie Solutions"; + this.btnjoinfreebie.UseVisualStyleBackColor = true; + this.btnjoinfreebie.Click += new System.EventHandler(this.btnjoinfreebie_Click); + // // ShiftSoft // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.pnlservices); + this.Controls.Add(this.pnlhome); + this.Controls.Add(this.flbuttons); + this.Controls.Add(this.label2); + this.Controls.Add(this.pnldivider); this.Controls.Add(this.label1); this.Name = "ShiftSoft"; - this.Size = new System.Drawing.Size(523, 384); + this.Size = new System.Drawing.Size(694, 384); + this.flbuttons.ResumeLayout(false); + this.flbuttons.PerformLayout(); + this.pnlhome.ResumeLayout(false); + this.pnlhome.PerformLayout(); + this.pnlservices.ResumeLayout(false); + this.pnlservices.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -57,5 +228,18 @@ #endregion private System.Windows.Forms.Label label1; + private System.Windows.Forms.Panel pnldivider; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.FlowLayoutPanel flbuttons; + private System.Windows.Forms.Button btnhome; + private System.Windows.Forms.Button btnservices; + private System.Windows.Forms.Button btnping; + private System.Windows.Forms.Panel pnlhome; + private System.Windows.Forms.Label lbdesc; + private System.Windows.Forms.Label lbwhere; + private System.Windows.Forms.Panel pnlservices; + private System.Windows.Forms.Label lbfreebiedesc; + private System.Windows.Forms.Label lbfreebie; + private System.Windows.Forms.Button btnjoinfreebie; } } diff --git a/ShiftOS.WinForms/ShiftnetSites/ShiftSoft.cs b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft.cs index 18968cd..0d84ecc 100644 --- a/ShiftOS.WinForms/ShiftnetSites/ShiftSoft.cs +++ b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft.cs @@ -25,6 +25,18 @@ namespace ShiftOS.WinForms.ShiftnetSites public void OnSkinLoad() { + pnldivider.Tag = "keepbg"; + pnldivider.BackColor = SkinEngine.LoadedSkin.ControlTextColor; + Tools.ControlManager.SetupControls(flbuttons); + Tools.ControlManager.SetupControls(pnlhome); + Tools.ControlManager.SetupControls(pnlservices); + + lbfreebiedesc.Top = lbfreebie.Top + lbfreebie.Height + 5; + btnjoinfreebie.Top = lbfreebiedesc.Top + lbfreebiedesc.Height + 5; + + SetupFreebieUI(); + + lbdesc.Top = lbwhere.Top + lbwhere.Height + 5; } public void OnUpgrade() @@ -33,6 +45,50 @@ namespace ShiftOS.WinForms.ShiftnetSites public void Setup() { + pnlhome.BringToFront(); + } + + private void btnping_Click(object sender, EventArgs e) + { + GoToUrl?.Invoke("shiftnet/shiftsoft/ping"); + } + + private void btnhome_Click(object sender, EventArgs e) + { + pnlhome.BringToFront(); + } + + private void btnservices_Click(object sender, EventArgs e) + { + pnlservices.BringToFront(); + SetupFreebieUI(); + } + + public void SetupFreebieUI() + { + if(SaveSystem.CurrentSave.ShiftnetSubscription == 0) + { + btnjoinfreebie.Enabled = false; + btnjoinfreebie.Text = "You are already subscribed to Freebie Solutions."; + } + else + { + btnjoinfreebie.Enabled = true; + btnjoinfreebie.Text = "Join Freebie Solutions"; + } + btnjoinfreebie.Left = (lbfreebiedesc.Left + lbfreebiedesc.Width) - btnjoinfreebie.Width; + } + + private void btnjoinfreebie_Click(object sender, EventArgs e) + { + Infobox.PromptYesNo("Switch providers", "Would you like to switch from your current Shiftnet provider, " + Applications.DownloadManager.GetAllSubscriptions()[SaveSystem.CurrentSave.ShiftnetSubscription].Name + ", to Freebie Solutions by ShiftSoft?", (res) => + { + if(res == true) + { + SaveSystem.CurrentSave.ShiftnetSubscription = 0; + Infobox.Show("Switch providers", "The operation has completed successfully."); + } + }); } } } diff --git a/ShiftOS.WinForms/ShiftnetSites/ShiftSoft.resx b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft.resx index 1af7de1..cd314f0 100644 --- a/ShiftOS.WinForms/ShiftnetSites/ShiftSoft.resx +++ b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft.resx @@ -117,4 +117,14 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Welcome to ShiftSoft. We understand the troubles of being locked within a digital society. For some, it's a prison. For others, it's all they know. It's what life means for them. + +But for us, it's a safe-haven. We may all be locked within an evolving operating system with no possibility of escaping, but we can at least develop ways of improving life within this binary world, and that's what we at ShiftSoft are doing. + + + The Shiftnet is a wonderful place full of apps, utilities, enhancements and much more for ShiftOS, but it comes at a cost. + +Freebie Solutions takes that cost away. You get free Shiftnet usage, but are locked to sites listed on Ping and you are limited to 256 byte-per-second downloads. Perfect for those situations where Codepoints and shiftnet connectivity are a needed resource. + \ No newline at end of file diff --git a/ShiftOS.WinForms/Stories/LegionStory.cs b/ShiftOS.WinForms/Stories/LegionStory.cs index 056fe85..c52732e 100644 --- a/ShiftOS.WinForms/Stories/LegionStory.cs +++ b/ShiftOS.WinForms/Stories/LegionStory.cs @@ -74,22 +74,10 @@ namespace ShiftOS.WinForms.Stories 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.PushObjective("Register with a new Shiftnet service provider.", "You've just unlocked the Shiftnet, which has opened up a whole new world of applications and features for ShiftOS. Before you go nuts with it, you may want to register with a better service provider than Freebie Solutions.", () => - { - return SaveSystem.CurrentSave.ShiftnetSubscription != 0; - }, - () => - { - Story.Context.MarkComplete(); - SaveSystem.SaveGame(); - TerminalBackend.PrintPrompt(); - Story.Start("hacker101_breakingbonds_1"); - }); - TerminalBackend.PrefixEnabled = true; - TerminalBackend.PrintPrompt(); - Story.Context.AutoComplete = false; + Story.Context.MarkComplete(); + Story.Start("aiden_shiftnet2"); } [Story("hacker101_breakingbonds_1")] @@ -111,6 +99,9 @@ namespace ShiftOS.WinForms.Stories 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."); + Story.Context.MarkComplete(); + 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 @@ -127,14 +118,25 @@ namespace ShiftOS.WinForms.Stories SaveSystem.SaveGame(); Story.Start("hacker101_breakingbonds_2"); }); - - TerminalBackend.PrefixEnabled = true; - TerminalBackend.PrintPrompt(); - Story.Context.AutoComplete = false; - } + [Story("aiden_shiftnet2")] + public static void AidenShiftnet2() + { + Story.PushObjective("Register with a new Shiftnet service provider.", "You've just unlocked the Shiftnet, which has opened up a whole new world of applications and features for ShiftOS. Before you go nuts with it, you may want to register with a better service provider than Freebie Solutions.", () => + { + return SaveSystem.CurrentSave.ShiftnetSubscription != 0; + }, + () => + { + Story.Context.MarkComplete(); + SaveSystem.SaveGame(); + TerminalBackend.PrintPrompt(); + Story.Start("hacker101_breakingbonds_1"); + }); + Story.Context.AutoComplete = false; + } private static void WriteLine(string text, bool showCharacterName=true) { @@ -159,7 +161,7 @@ namespace ShiftOS.WinForms.Stories { Console.Write(c); ConsoleEx.OnFlush?.Invoke(); - Thread.Sleep(45); + Thread.Sleep(5); } Thread.Sleep(1000); } diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index 4614842..f6c4383 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -50,6 +50,8 @@ namespace ShiftOS.WinForms [Namespace("desktop")] public partial class WinformsDesktop : Form, IDesktop { + public MainMenu.MainMenu ParentMenu = null; + [Command("pushnote")] [RequiresArgument("target")] [RequiresArgument("title")] @@ -921,7 +923,7 @@ namespace ShiftOS.WinForms /// E. private void Desktop_Load(object sender, EventArgs e) { - + SaveSystem.IsSandbox = this.IsSandbox; SaveSystem.Begin(); SetupDesktop(); @@ -964,6 +966,7 @@ namespace ShiftOS.WinForms } private IWindowBorder focused = null; + internal bool IsSandbox = false; public string DesktopName { @@ -1033,10 +1036,17 @@ namespace ShiftOS.WinForms { try { - this.Invoke(new Action(() => + if (this.Visible == true) { - act?.Invoke(); - })); + this.Invoke(new Action(() => + { + act?.Invoke(); + })); + } + else + { + ParentMenu?.Invoke(act); + } } catch { @@ -1105,12 +1115,16 @@ namespace ShiftOS.WinForms public void HideAppLauncher() { - this.Invoke(new Action(() => + try { - currentSettingsPane?.Hide(); - currentSettingsPane = null; - pnladvancedal.Hide(); - })); + this.Invoke(new Action(() => + { + currentSettingsPane?.Hide(); + currentSettingsPane = null; + pnladvancedal.Hide(); + })); + } + catch { } } } diff --git a/ShiftOS_TheReturn/AppearanceManager.cs b/ShiftOS_TheReturn/AppearanceManager.cs index 7cf06c9..e244b77 100644 --- a/ShiftOS_TheReturn/AppearanceManager.cs +++ b/ShiftOS_TheReturn/AppearanceManager.cs @@ -126,6 +126,7 @@ namespace ShiftOS.Engine } + // Provides a list of all open ShiftOS windows. public static List OpenForms = new List(); diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs index e98a51e..e36fee6 100644 --- a/ShiftOS_TheReturn/SaveSystem.cs +++ b/ShiftOS_TheReturn/SaveSystem.cs @@ -67,6 +67,7 @@ namespace ShiftOS.Engine /// Boolean representing whether the save system is ready to be used. /// public static bool Ready = false; + public static bool IsSandbox = false; /// /// Occurs before the save system connects to the ShiftOS Digital Society. @@ -140,64 +141,127 @@ namespace ShiftOS.Engine Console.WriteLine("[simpl-conf] Reading configuration files (global-3.conf)"); Console.WriteLine("[termdb] Building command database from filesystem..."); TerminalBackend.PopulateTerminalCommands(); - Console.WriteLine("[inetd] Connecting to network..."); - Ready = false; - - if (PreDigitalSocietyConnection != null) + if (IsSandbox == false) { - PreDigitalSocietyConnection?.Invoke(); + Console.WriteLine("[inetd] Connecting to network..."); - while (!Ready) + Ready = false; + + if (PreDigitalSocietyConnection != null) { - Thread.Sleep(10); + PreDigitalSocietyConnection?.Invoke(); + + while (!Ready) + { + Thread.Sleep(10); + } } - } - - bool guidReceived = false; - ServerManager.GUIDReceived += (str) => - { - //Connection successful! Stop waiting! - guidReceived = true; - Console.WriteLine("[inetd] Connection successful."); - }; - try - { - - ServerManager.Initiate(UserConfig.Get().DigitalSocietyAddress, UserConfig.Get().DigitalSocietyPort); - //This haults the client until the connection is successful. - while (ServerManager.thisGuid == new Guid()) + bool guidReceived = false; + ServerManager.GUIDReceived += (str) => { - Thread.Sleep(10); + //Connection successful! Stop waiting! + guidReceived = true; + Console.WriteLine("[inetd] Connection successful."); + }; + + try + { + + ServerManager.Initiate(UserConfig.Get().DigitalSocietyAddress, UserConfig.Get().DigitalSocietyPort); + //This haults the client until the connection is successful. + while (ServerManager.thisGuid == new Guid()) + { + Thread.Sleep(10); + } + Console.WriteLine("[inetd] DHCP GUID recieved, finished setup"); + FinishBootstrap(); } - Console.WriteLine("[inetd] DHCP GUID recieved, finished setup"); - FinishBootstrap(); + catch (Exception ex) + { + //No errors, this never gets called. + Console.WriteLine("[inetd] SEVERE: " + ex.Message); + Thread.Sleep(3000); + Console.WriteLine("[sys] SEVERE: Cannot connect to server. Shutting down in 5..."); + Thread.Sleep(1000); + Console.WriteLine("[sys] 4..."); + Thread.Sleep(1000); + Console.WriteLine("[sys] 3..."); + Thread.Sleep(1000); + Console.WriteLine("[sys] 2..."); + Thread.Sleep(1000); + Console.WriteLine("[sys] 1..."); + Thread.Sleep(1000); + Console.WriteLine("[sys] Bye bye."); + System.Diagnostics.Process.GetCurrentProcess().Kill(); + } + + //Nothing happens past this point - but the client IS connected! It shouldn't be stuck in that while loop above. } - catch (Exception ex) + else { - //No errors, this never gets called. - Console.WriteLine("[inetd] SEVERE: " + ex.Message); - Thread.Sleep(3000); - Console.WriteLine("[sys] SEVERE: Cannot connect to server. Shutting down in 5..."); - Thread.Sleep(1000); - Console.WriteLine("[sys] 4..."); - Thread.Sleep(1000); - Console.WriteLine("[sys] 3..."); - Thread.Sleep(1000); - Console.WriteLine("[sys] 2..."); - Thread.Sleep(1000); - Console.WriteLine("[sys] 1..."); - Thread.Sleep(1000); - Console.WriteLine("[sys] Bye bye."); - System.Diagnostics.Process.GetCurrentProcess().Kill(); + Console.WriteLine("[inetd] Sandbox mode initiating..."); + CurrentSave = new Save + { + IsSandbox = true, + Username = "sandbox", + Password = "sandbox", + SystemName = "shiftos", + Users = new List + { + new ClientSave + { + Username = "user", + Password = "", + Permissions = 0 + } + }, + Class = 0, + ID = new Guid(), + Upgrades = new Dictionary(), + CurrentLegions = null, + IsMUDAdmin = false, + IsPatreon = false, + Language = "english", + LastMonthPaid = 0, + MajorVersion = 1, + MinorVersion = 0, + MusicEnabled = false, + MusicVolume = 100, + MyShop = "", + PasswordHashed = false, + PickupPoint = "", + RawReputation = 0.0f, + Revision = 0, + ShiftnetSubscription = 0, + SoundEnabled = true, + StoriesExperienced = null, + StoryPosition = 0, + UniteAuthToken = "", + }; + + CurrentUser = CurrentSave.Users.First(); + + Localization.SetupTHETRUEDefaultLocals(); + + Shiftorium.Init(); + + TerminalBackend.InStory = false; + TerminalBackend.PrefixEnabled = true; + + Desktop.InvokeOnWorkerThread(new Action(() => + { + ShiftOS.Engine.Scripting.LuaInterpreter.RunSft(Paths.GetPath("kernel.sft")); + })); + + + Desktop.InvokeOnWorkerThread(new Action(() => Desktop.PopulateAppLauncher())); + GameReady?.Invoke(); } - //Nothing happens past this point - but the client IS connected! It shouldn't be stuck in that while loop above. - - })); thread.IsBackground = true; thread.Start(); @@ -243,10 +307,6 @@ namespace ShiftOS.Engine Thread.Sleep(10); } - Localization.SetupTHETRUEDefaultLocals(); - - Shiftorium.Init(); - while (CurrentSave.StoryPosition < 1) { Thread.Sleep(10); diff --git a/ShiftOS_TheReturn/ServerManager.cs b/ShiftOS_TheReturn/ServerManager.cs index 1439c0d..be4f086 100644 --- a/ShiftOS_TheReturn/ServerManager.cs +++ b/ShiftOS_TheReturn/ServerManager.cs @@ -302,15 +302,17 @@ Ping: {ServerManager.DigitalSocietyPing} ms /// The message body public static void SendMessage(string name, string contents) { - var sMsg = new ServerMessage + if (!SaveSystem.IsSandbox) { - Name = name, - Contents = contents, - GUID = thisGuid.ToString(), - }; - PingTimer.Start(); - client.Send(new NetObject("msg", sMsg)); - + var sMsg = new ServerMessage + { + Name = name, + Contents = contents, + GUID = thisGuid.ToString(), + }; + PingTimer.Start(); + client.Send(new NetObject("msg", sMsg)); + } } private static bool singleplayer = false; diff --git a/ShiftOS_TheReturn/Shiftorium.cs b/ShiftOS_TheReturn/Shiftorium.cs index 975939f..7faf336 100644 --- a/ShiftOS_TheReturn/Shiftorium.cs +++ b/ShiftOS_TheReturn/Shiftorium.cs @@ -429,6 +429,9 @@ namespace ShiftOS.Engine /// Whether the upgrade is installed. public static bool UpgradeInstalled(string id) { + if (SaveSystem.IsSandbox == true) + return true; + if (string.IsNullOrWhiteSpace(id)) return true; if (SaveSystem.CurrentSave != null) diff --git a/ShiftOS_TheReturn/Story.cs b/ShiftOS_TheReturn/Story.cs index f473f89..e44d2be 100644 --- a/ShiftOS_TheReturn/Story.cs +++ b/ShiftOS_TheReturn/Story.cs @@ -115,8 +115,16 @@ namespace ShiftOS.Engine t.IsBackground = true; t.Start(); + Console.WriteLine(); + ConsoleEx.ForegroundColor = ConsoleColor.Red; + ConsoleEx.Bold = true; Console.WriteLine("NEW OBJECTIVE:"); + Console.WriteLine(); + + ConsoleEx.ForegroundColor = ConsoleColor.White; + ConsoleEx.Bold = false; Console.WriteLine("A new objective has been added to your system. Run sos.status to find out what you need to do."); + TerminalBackend.PrintPrompt(); } From 920e33a2fd329ccbdfeb38ddedd0b4d87e97ed86 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 10 Jun 2017 12:58:09 -0400 Subject: [PATCH 32/71] Fix Shiftorium init bug. --- ShiftOS.WinForms/Program.cs | 1 + ShiftOS_TheReturn/SaveSystem.cs | 41 ++++++++++++++++++--------------- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/ShiftOS.WinForms/Program.cs b/ShiftOS.WinForms/Program.cs index b07d97a..b5fb731 100644 --- a/ShiftOS.WinForms/Program.cs +++ b/ShiftOS.WinForms/Program.cs @@ -59,6 +59,7 @@ namespace ShiftOS.WinForms }; Localization.RegisterProvider(new WFLanguageProvider()); Infobox.Init(new Dialog()); + LoginManager.Init(new WinForms.GUILoginFrontend()); FileSkimmerBackend.Init(new WinformsFSFrontend()); var desk = new WinformsDesktop(); Desktop.Init(desk); diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs index e36fee6..c5a6a51 100644 --- a/ShiftOS_TheReturn/SaveSystem.cs +++ b/ShiftOS_TheReturn/SaveSystem.cs @@ -307,6 +307,8 @@ namespace ShiftOS.Engine Thread.Sleep(10); } + Shiftorium.Init(); + while (CurrentSave.StoryPosition < 1) { Thread.Sleep(10); @@ -633,27 +635,30 @@ namespace ShiftOS.Engine /// public static void SaveGame() { -#if !NOSAVE - if(!Shiftorium.Silent) - Console.WriteLine(""); - if(!Shiftorium.Silent) - Console.Write("{SE_SAVING}... "); - if (SaveSystem.CurrentSave != null) + if (IsSandbox == false) { - Utils.WriteAllText(Paths.GetPath("user.dat"), CurrentSave.UniteAuthToken); - var serialisedSaveFile = JsonConvert.SerializeObject(CurrentSave, Formatting.Indented); - new Thread(() => +#if !NOSAVE + if (!Shiftorium.Silent) + Console.WriteLine(""); + if (!Shiftorium.Silent) + Console.Write("{SE_SAVING}... "); + if (SaveSystem.CurrentSave != null) { - // please don't do networking on the main thread if you're just going to - // discard the response, it's extremely slow - ServerManager.SendMessage("mud_save", serialisedSaveFile); - }) - { IsBackground = false }.Start(); - } - if (!Shiftorium.Silent) - Console.WriteLine(" ...{DONE}."); - System.IO.File.WriteAllText(Paths.SaveFile, Utils.ExportMount(0)); + Utils.WriteAllText(Paths.GetPath("user.dat"), CurrentSave.UniteAuthToken); + var serialisedSaveFile = JsonConvert.SerializeObject(CurrentSave, Formatting.Indented); + new Thread(() => + { + // please don't do networking on the main thread if you're just going to + // discard the response, it's extremely slow + ServerManager.SendMessage("mud_save", serialisedSaveFile); + }) + { IsBackground = false }.Start(); + } + if (!Shiftorium.Silent) + Console.WriteLine(" ...{DONE}."); + System.IO.File.WriteAllText(Paths.SaveFile, Utils.ExportMount(0)); #endif + } } /// From c3deaa23fffb7011efb2b5b0f7fc3e754d21f600 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 10 Jun 2017 22:02:10 -0400 Subject: [PATCH 33/71] Even more menu work. --- ShiftOS.Objects/Save.cs | 78 +------- .../Applications/ShiftoriumFrontend.cs | 2 - .../MainMenu/MainMenu.Designer.cs | 188 +++++++++++++++++- ShiftOS.WinForms/MainMenu/MainMenu.cs | 120 ++++++++++- ShiftOS_TheReturn/AudioManager.cs | 4 + ShiftOS_TheReturn/Paths.cs | 9 + ShiftOS_TheReturn/SaveSystem.cs | 41 ++-- 7 files changed, 342 insertions(+), 100 deletions(-) diff --git a/ShiftOS.Objects/Save.cs b/ShiftOS.Objects/Save.cs index 6e7f167..7323028 100644 --- a/ShiftOS.Objects/Save.cs +++ b/ShiftOS.Objects/Save.cs @@ -40,85 +40,9 @@ namespace ShiftOS.Objects [Obsolete("This save variable is no longer used in Beta 2.4 and above of ShiftOS. Please use ShiftOS.Engine.SaveSystem.CurrentUser.Username to access the current user's username.")] public string Username { get; set; } - private List _setCpCallbacks = new List(); // everything in this list is called by Codepoints.set() and syncCp(). - private ulong _cp = 0; // locally cached codepoints counter - private Object _cpLock = new Object(); // locked when modifying or reading the codepoints counter - private Object _webLock = new Object(); // locked when communicating with the server - private Timer _updTimer; // timer to start a new sync thread every 5 minutes - - // Sync local Codepoints count with the server. - public void syncCp() - { - new Thread(() => - { - lock (_cpLock) - { - lock (_webLock) - { - var uc = new ShiftOS.Unite.UniteClient("", UniteAuthToken); - _cp = uc.GetCodepoints(); - } - } - foreach (Action a in _setCpCallbacks) - a(); - }).Start(); - } - - // we have to write these wrapper functions so we can keep _setCpCallbacks private, - // so that it doesn't get serialised - public void addSetCpCallback(Action callback) - { - _setCpCallbacks.Add(callback); - } - - public void removeSetCpCallback(Action callback) - { - _setCpCallbacks.Remove(callback); - } - public bool IsSandbox = false; - public ulong Codepoints - { - get - { - if (IsSandbox == true) - return 0; - if (_updTimer == null) - _updTimer = new Timer((o) => syncCp(), null, 0, 300000); - lock (_cpLock) - { - return _cp; - } - } - set - { - if (IsSandbox == true) - return; - lock (_cpLock) - { - _cp = value; - new Thread(() => - { - lock (_webLock) - { - try - { - var uc = new ShiftOS.Unite.UniteClient("", UniteAuthToken); - uc.SetCodepoints(value); - } - catch - { } - } - }) - { - IsBackground = false - }.Start(); - } - foreach (Action a in _setCpCallbacks) - a(); - } - } + public ulong Codepoints { get; set; } public Dictionary Upgrades { get; set; } public int StoryPosition { get; set; } diff --git a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs index 5dfb98e..eebd897 100644 --- a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs +++ b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs @@ -59,7 +59,6 @@ namespace ShiftOS.WinForms.Applications public ShiftoriumFrontend() { InitializeComponent(); - SaveSystem.CurrentSave.addSetCpCallback(updatecounter); updatecounter(); Populate(); SetList(); @@ -238,7 +237,6 @@ namespace ShiftOS.WinForms.Applications public bool OnUnload() { - SaveSystem.CurrentSave.removeSetCpCallback(updatecounter); return true; } diff --git a/ShiftOS.WinForms/MainMenu/MainMenu.Designer.cs b/ShiftOS.WinForms/MainMenu/MainMenu.Designer.cs index 62db46d..a056866 100644 --- a/ShiftOS.WinForms/MainMenu/MainMenu.Designer.cs +++ b/ShiftOS.WinForms/MainMenu/MainMenu.Designer.cs @@ -35,7 +35,24 @@ this.button4 = new System.Windows.Forms.Button(); this.button5 = new System.Windows.Forms.Button(); this.lbticker = new System.Windows.Forms.Label(); + this.pnloptions = new System.Windows.Forms.Panel(); + this.txtubase = new System.Windows.Forms.TextBox(); + this.label3 = new System.Windows.Forms.Label(); + this.txtdsport = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this.txtdsaddress = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.opt_btncancel = new System.Windows.Forms.Button(); + this.btnsave = new System.Windows.Forms.Button(); + this.flcampaign = new System.Windows.Forms.FlowLayoutPanel(); + this.btnnewgame = new System.Windows.Forms.Button(); + this.btncontinue = new System.Windows.Forms.Button(); + this.button10 = new System.Windows.Forms.Button(); this.flmenu.SuspendLayout(); + this.pnloptions.SuspendLayout(); + this.flowLayoutPanel1.SuspendLayout(); + this.flcampaign.SuspendLayout(); this.SuspendLayout(); // // flmenu @@ -48,7 +65,7 @@ this.flmenu.Controls.Add(this.button4); this.flmenu.Controls.Add(this.button5); this.flmenu.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; - this.flmenu.Location = new System.Drawing.Point(46, 218); + this.flmenu.Location = new System.Drawing.Point(49, 367); this.flmenu.Name = "flmenu"; this.flmenu.Size = new System.Drawing.Size(187, 145); this.flmenu.TabIndex = 0; @@ -84,6 +101,7 @@ this.button3.TabIndex = 2; this.button3.Text = "Settings"; this.button3.UseVisualStyleBackColor = true; + this.button3.Click += new System.EventHandler(this.button3_Click); // // button4 // @@ -116,12 +134,161 @@ this.lbticker.Tag = "header3"; this.lbticker.Text = "This is a tickerbar."; // + // pnloptions + // + this.pnloptions.Controls.Add(this.txtubase); + this.pnloptions.Controls.Add(this.label3); + this.pnloptions.Controls.Add(this.txtdsport); + this.pnloptions.Controls.Add(this.label2); + this.pnloptions.Controls.Add(this.txtdsaddress); + this.pnloptions.Controls.Add(this.label1); + this.pnloptions.Controls.Add(this.flowLayoutPanel1); + this.pnloptions.Location = new System.Drawing.Point(49, 26); + this.pnloptions.Name = "pnloptions"; + this.pnloptions.Size = new System.Drawing.Size(432, 290); + this.pnloptions.TabIndex = 2; + // + // txtubase + // + this.txtubase.Location = new System.Drawing.Point(146, 133); + this.txtubase.Name = "txtubase"; + this.txtubase.Size = new System.Drawing.Size(225, 20); + this.txtubase.TabIndex = 6; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(22, 136); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(106, 13); + this.label3.TabIndex = 5; + this.label3.Text = "Unite API base URL:"; + // + // txtdsport + // + this.txtdsport.Location = new System.Drawing.Point(146, 85); + this.txtdsport.Name = "txtdsport"; + this.txtdsport.Size = new System.Drawing.Size(225, 20); + this.txtdsport.TabIndex = 4; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(22, 88); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(99, 13); + this.label2.TabIndex = 3; + this.label2.Text = "Digital Society Port:"; + // + // txtdsaddress + // + this.txtdsaddress.Location = new System.Drawing.Point(146, 54); + this.txtdsaddress.Name = "txtdsaddress"; + this.txtdsaddress.Size = new System.Drawing.Size(225, 20); + this.txtdsaddress.TabIndex = 2; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(22, 57); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(118, 13); + this.label1.TabIndex = 1; + this.label1.Text = "Digital Society Address:"; + // + // flowLayoutPanel1 + // + this.flowLayoutPanel1.AutoSize = true; + this.flowLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.flowLayoutPanel1.Controls.Add(this.opt_btncancel); + this.flowLayoutPanel1.Controls.Add(this.btnsave); + this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Bottom; + this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft; + this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 259); + this.flowLayoutPanel1.Name = "flowLayoutPanel1"; + this.flowLayoutPanel1.Size = new System.Drawing.Size(432, 31); + this.flowLayoutPanel1.TabIndex = 0; + // + // opt_btncancel + // + this.opt_btncancel.AutoSize = true; + this.opt_btncancel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.opt_btncancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.opt_btncancel.Location = new System.Drawing.Point(377, 3); + this.opt_btncancel.Name = "opt_btncancel"; + this.opt_btncancel.Size = new System.Drawing.Size(52, 25); + this.opt_btncancel.TabIndex = 0; + this.opt_btncancel.Text = "Cancel"; + this.opt_btncancel.UseVisualStyleBackColor = true; + this.opt_btncancel.Click += new System.EventHandler(this.opt_btncancel_Click); + // + // btnsave + // + this.btnsave.AutoSize = true; + this.btnsave.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnsave.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnsave.Location = new System.Drawing.Point(327, 3); + this.btnsave.Name = "btnsave"; + this.btnsave.Size = new System.Drawing.Size(44, 25); + this.btnsave.TabIndex = 1; + this.btnsave.Text = "Save"; + this.btnsave.UseVisualStyleBackColor = true; + this.btnsave.Click += new System.EventHandler(this.btnsave_Click); + // + // flcampaign + // + this.flcampaign.AutoSize = true; + this.flcampaign.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.flcampaign.Controls.Add(this.btnnewgame); + this.flcampaign.Controls.Add(this.btncontinue); + this.flcampaign.Controls.Add(this.button10); + this.flcampaign.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; + this.flcampaign.Location = new System.Drawing.Point(242, 364); + this.flcampaign.Name = "flcampaign"; + this.flcampaign.Size = new System.Drawing.Size(187, 87); + this.flcampaign.TabIndex = 3; + // + // btnnewgame + // + this.btnnewgame.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnnewgame.Location = new System.Drawing.Point(3, 3); + this.btnnewgame.Name = "btnnewgame"; + this.btnnewgame.Size = new System.Drawing.Size(181, 23); + this.btnnewgame.TabIndex = 0; + this.btnnewgame.Text = "New Game"; + this.btnnewgame.UseVisualStyleBackColor = true; + this.btnnewgame.Click += new System.EventHandler(this.btnnewgame_Click); + // + // btncontinue + // + this.btncontinue.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btncontinue.Location = new System.Drawing.Point(3, 32); + this.btncontinue.Name = "btncontinue"; + this.btncontinue.Size = new System.Drawing.Size(181, 23); + this.btncontinue.TabIndex = 1; + this.btncontinue.Text = "Continue"; + this.btncontinue.UseVisualStyleBackColor = true; + this.btncontinue.Click += new System.EventHandler(this.btncontinue_Click); + // + // button10 + // + this.button10.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.button10.Location = new System.Drawing.Point(3, 61); + this.button10.Name = "button10"; + this.button10.Size = new System.Drawing.Size(181, 23); + this.button10.TabIndex = 4; + this.button10.Text = "Back"; + this.button10.UseVisualStyleBackColor = true; + this.button10.Click += new System.EventHandler(this.button10_Click); + // // MainMenu // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.Black; this.ClientSize = new System.Drawing.Size(1161, 566); + this.Controls.Add(this.flcampaign); + this.Controls.Add(this.pnloptions); this.Controls.Add(this.lbticker); this.Controls.Add(this.flmenu); this.ForeColor = System.Drawing.Color.White; @@ -129,6 +296,11 @@ this.Text = "MainMenu"; this.Load += new System.EventHandler(this.MainMenu_Load); this.flmenu.ResumeLayout(false); + this.pnloptions.ResumeLayout(false); + this.pnloptions.PerformLayout(); + this.flowLayoutPanel1.ResumeLayout(false); + this.flowLayoutPanel1.PerformLayout(); + this.flcampaign.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -143,5 +315,19 @@ private System.Windows.Forms.Button button4; private System.Windows.Forms.Button button5; private System.Windows.Forms.Label lbticker; + private System.Windows.Forms.Panel pnloptions; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; + private System.Windows.Forms.Button opt_btncancel; + private System.Windows.Forms.Button btnsave; + private System.Windows.Forms.TextBox txtubase; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.TextBox txtdsport; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox txtdsaddress; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.FlowLayoutPanel flcampaign; + private System.Windows.Forms.Button btnnewgame; + private System.Windows.Forms.Button btncontinue; + private System.Windows.Forms.Button button10; } } \ No newline at end of file diff --git a/ShiftOS.WinForms/MainMenu/MainMenu.cs b/ShiftOS.WinForms/MainMenu/MainMenu.cs index 20cd4ec..4b510e2 100644 --- a/ShiftOS.WinForms/MainMenu/MainMenu.cs +++ b/ShiftOS.WinForms/MainMenu/MainMenu.cs @@ -47,11 +47,20 @@ namespace ShiftOS.WinForms.MainMenu tickermove.Interval = 1; tickerreset.Interval = 1000; + pnloptions.Hide(); + flcampaign.Hide(); flmenu.CenterParent(); tickerreset.Start(); } + public void HideOptions() + { + pnloptions.Hide(); + flmenu.BringToFront(); + flmenu.CenterParent(); + } + private void MainMenu_Load(object sender, EventArgs e) { Tools.ControlManager.SetupControls(this); @@ -76,6 +85,12 @@ namespace ShiftOS.WinForms.MainMenu return "Terminal too weird for ya? You can use the Format Editor to generate your own Terminal command parser. No coding knowledge needed!"; case 5: return "Contests are a good way to earn heaps of Codepoints. Head on over to http://getshiftos.ml/Contests for info on current community contests."; + case 6: + return "There's no bugs in this game... But if you find some, please submit them to http://getshiftos.ml/Bugs."; + case 7: + return "SHIFTOS - PROPERTY OF MICHAEL VANOVERBEEK. FOR INTERNAL USE ONLY. Build number = sos_tr_133764 [Just kidding. ShiftOS is open-source. Find the code at http://github.com/shiftos-game/ShiftOS!]"; + case 8: + return "Hold your Codepoints against the wall... when they take everything away. Hold your Codepoints against the wall..."; default: return "Good God. We don't know what to put here."; } @@ -83,7 +98,18 @@ namespace ShiftOS.WinForms.MainMenu private void button1_Click(object sender, EventArgs e) { - Desktop.CurrentDesktop.Show(); + if(System.IO.File.Exists(System.IO.Path.Combine(Paths.SaveDirectory, "autosave.save"))) + { + btncontinue.Show(); + } + else + { + btncontinue.Hide(); + } + flmenu.Hide(); + flcampaign.Show(); + flcampaign.BringToFront(); + flcampaign.CenterParent(); } private void button5_Click(object sender, EventArgs e) @@ -96,5 +122,97 @@ namespace ShiftOS.WinForms.MainMenu (Desktop.CurrentDesktop as WinformsDesktop).IsSandbox = true; Desktop.CurrentDesktop.Show(); } + + private void button3_Click(object sender, EventArgs e) + { + var conf = ShiftOS.Objects.UserConfig.Get(); + + txtubase.Text = conf.UniteUrl; + txtdsaddress.Text = conf.DigitalSocietyAddress; + txtdsport.Text = conf.DigitalSocietyPort.ToString(); + + + pnloptions.Show(); + pnloptions.BringToFront(); + pnloptions.CenterParent(); + } + + private void opt_btncancel_Click(object sender, EventArgs e) + { + HideOptions(); + } + + private void btnsave_Click(object sender, EventArgs e) + { + var conf = ShiftOS.Objects.UserConfig.Get(); + + conf.DigitalSocietyAddress = txtdsaddress.Text; + + int p = 0; + + if(int.TryParse(txtdsport.Text, out p) == false) + { + Infobox.Show("Invalid port number", "The Digital Society Port must be a valid whole number between 0 and 65535."); + return; + } + else + { + if(p < 0 || p > 65535) + { + Infobox.Show("Invalid port number", "The Digital Society Port must be a valid whole number between 0 and 65535."); + return; + } + } + + conf.DigitalSocietyPort = p; + + string unite = txtubase.Text; + if (unite.EndsWith("/")) + { + int len = unite.Length; + int index = len - 1; + int end = 1; + unite = unite.Remove(index, end); + } + conf.UniteUrl = unite; + + System.IO.File.WriteAllText("servers.json", Newtonsoft.Json.JsonConvert.SerializeObject(conf, Newtonsoft.Json.Formatting.Indented)); + + HideOptions(); + } + + private void button10_Click(object sender, EventArgs e) + { + flcampaign.Hide(); + flmenu.Show(); + flmenu.BringToFront(); + flmenu.CenterParent(); + } + + private void btncontinue_Click(object sender, EventArgs e) + { + Desktop.CurrentDesktop.Show(); + + } + + private void btnnewgame_Click(object sender, EventArgs e) + { + string path = System.IO.Path.Combine(Paths.SaveDirectory, "autosave.save"); + if (System.IO.File.Exists(path)) + { + Infobox.PromptYesNo("Campaign", "You are about to start a new game, which will erase any previous progress. Are you sure you want to do this?", (result) => + { + if (result == true) + { + System.IO.File.Delete(path); + Desktop.CurrentDesktop.Show(); + } + }); + } + else + { + Desktop.CurrentDesktop.Show(); + } + } } } diff --git a/ShiftOS_TheReturn/AudioManager.cs b/ShiftOS_TheReturn/AudioManager.cs index 0a1a210..0950b55 100644 --- a/ShiftOS_TheReturn/AudioManager.cs +++ b/ShiftOS_TheReturn/AudioManager.cs @@ -125,6 +125,10 @@ namespace ShiftOS.Engine } if (play) { + while(_out.PlaybackState == PlaybackState.Playing) + { + Thread.Sleep(10); + } ShiftOS.Engine.AudioManager.Stop(); _out = new WaveOut(); var mp3 = new WaveFileReader(str); diff --git a/ShiftOS_TheReturn/Paths.cs b/ShiftOS_TheReturn/Paths.cs index 5b75ae6..332cdd3 100644 --- a/ShiftOS_TheReturn/Paths.cs +++ b/ShiftOS_TheReturn/Paths.cs @@ -94,6 +94,15 @@ namespace ShiftOS.Engine } + public static string SaveDirectory + { + get + { + string appdata = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); + return System.IO.Path.Combine(appdata, "ShiftOS", "saves"); + } + } + /// /// Gets all full paths without their keynames. /// diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs index c5a6a51..18f8f78 100644 --- a/ShiftOS_TheReturn/SaveSystem.cs +++ b/ShiftOS_TheReturn/SaveSystem.cs @@ -575,14 +575,14 @@ namespace ShiftOS.Engine public static void ReadSave() { //Migrate old saves. - if(System.IO.Directory.Exists("C:\\ShiftOS2")) + if (System.IO.Directory.Exists("C:\\ShiftOS2")) { Console.WriteLine("Old save detected. Migrating filesystem to MFS..."); foreach (string file in System.IO.Directory.EnumerateDirectories("C:\\ShiftOS2") .Select(d => new DirectoryInfo(d).FullName)) { - if(!Utils.DirectoryExists(file.Replace("C:\\ShiftOS2\\", "0:/").Replace("\\", "/"))) - Utils.CreateDirectory(file.Replace("C:\\ShiftOS2\\", "0:/").Replace("\\", "/")); + if (!Utils.DirectoryExists(file.Replace("C:\\ShiftOS2\\", "0:/").Replace("\\", "/"))) + Utils.CreateDirectory(file.Replace("C:\\ShiftOS2\\", "0:/").Replace("\\", "/")); } foreach (string file in System.IO.Directory.EnumerateFiles("C:\\ShiftOS2")) { @@ -594,25 +594,18 @@ namespace ShiftOS.Engine } + string path = Path.Combine(Paths.SaveDirectory, "autosave.save"); - if (Utils.FileExists(Paths.SaveFileInner)) + if (System.IO.File.Exists(Path.Combine(Paths.SaveDirectory, "autosave.save"))) { - oobe.ShowSaveTransfer(JsonConvert.DeserializeObject(Utils.ReadAllText(Paths.SaveFileInner))); + CurrentSave = JsonConvert.DeserializeObject(System.IO.File.ReadAllText(path)); } else { - if (Utils.FileExists(Paths.GetPath("user.dat"))) - { - string token = Utils.ReadAllText(Paths.GetPath("user.dat")); - - ServerManager.SendMessage("mud_token_login", token); - } - else - { - NewSave(); - } + NewSave(); } + } /// @@ -644,15 +637,25 @@ namespace ShiftOS.Engine Console.Write("{SE_SAVING}... "); if (SaveSystem.CurrentSave != null) { - Utils.WriteAllText(Paths.GetPath("user.dat"), CurrentSave.UniteAuthToken); var serialisedSaveFile = JsonConvert.SerializeObject(CurrentSave, Formatting.Indented); new Thread(() => { - // please don't do networking on the main thread if you're just going to - // discard the response, it's extremely slow - ServerManager.SendMessage("mud_save", serialisedSaveFile); + try + { + // please don't do networking on the main thread if you're just going to + // discard the response, it's extremely slow + ServerManager.SendMessage("mud_save", serialisedSaveFile); + } + catch { } }) { IsBackground = false }.Start(); + if (!System.IO.Directory.Exists(Paths.SaveDirectory)) + { + System.IO.Directory.CreateDirectory(Paths.SaveDirectory); + + } + + System.IO.File.WriteAllText(Path.Combine(Paths.SaveDirectory, "autosave.save"), serialisedSaveFile); } if (!Shiftorium.Silent) Console.WriteLine(" ...{DONE}."); From 107a98686a105468b5f200ebcbd27343c1210ce4 Mon Sep 17 00:00:00 2001 From: RogueAI42 Date: Sun, 11 Jun 2017 17:34:38 +1000 Subject: [PATCH 34/71] ReflectMan Saves The Day.............. Refactored every part in the code that used that damn foreach loop. All assemblies are now loaded on startup into an array, and the results of GetType() on each are concatenated into another array. The parts of the code that were loading the assemblies and scanning them themselves now look to ReflectMan.Types, and all disk I/O is limited to the first time ReflectMan is accessed. While I was there I also replaced some other foreach loops with array comprehensions and such to speed things up - there is a noticeable improvement. It doesn't seem to have broken anything, but I'd appreciate if someone could do more stress testing for me. --- ShiftOS.WinForms/Applications/IconManager.cs | 101 +++++++--------- ShiftOS.WinForms/Applications/Shiftnet.cs | 113 ++++++++---------- .../Applications/ShiftoriumFrontend.cs | 7 +- ShiftOS.WinForms/HackerCommands.cs | 25 +--- ShiftOS.WinForms/Program.cs | 72 +++++------ .../ShiftnetSites/AppscapeMain.cs | 30 ++--- .../ShiftnetSites/MainHomepage.cs | 57 +++------ .../ShiftnetSites/ShiftSoft_Ping.cs | 69 +++++------ ShiftOS.WinForms/WidgetManager.cs | 36 +----- ShiftOS_TheReturn/AppLauncherDaemon.cs | 53 ++------ ShiftOS_TheReturn/AppearanceManager.cs | 20 +--- ShiftOS_TheReturn/Commands.cs | 89 ++++---------- ShiftOS_TheReturn/NotificationDaemon.cs | 21 +--- ShiftOS_TheReturn/ReflectMan.cs | 80 +++++++++++++ ShiftOS_TheReturn/Scripting.cs | 53 +------- ShiftOS_TheReturn/ServerManager.cs | 27 ++--- ShiftOS_TheReturn/ShiftOS.Engine.csproj | 1 + ShiftOS_TheReturn/Shiftorium.cs | 22 +--- ShiftOS_TheReturn/Skinning.cs | 34 +----- ShiftOS_TheReturn/Story.cs | 65 ++++------ ShiftOS_TheReturn/TerminalBackend.cs | 66 ++++------ 21 files changed, 376 insertions(+), 665 deletions(-) create mode 100644 ShiftOS_TheReturn/ReflectMan.cs diff --git a/ShiftOS.WinForms/Applications/IconManager.cs b/ShiftOS.WinForms/Applications/IconManager.cs index 0c6e119..7bbeb34 100644 --- a/ShiftOS.WinForms/Applications/IconManager.cs +++ b/ShiftOS.WinForms/Applications/IconManager.cs @@ -92,70 +92,51 @@ namespace ShiftOS.WinForms.Applications { flbody.Controls.Clear(); //Clear the icon list. - List types = new List(); + Type[] types = Array.FindAll(ReflectMan.Types, x => x.GetCustomAttributes(false).FirstOrDefault(y => y is DefaultIconAttribute) != null); - foreach(var exe in System.IO.Directory.GetFiles(Environment.CurrentDirectory)) + pageCount = types.GetPageCount(pageSize); + + foreach (var type in Array.FindAll(types.GetItemsOnPage(currentPage, pageSize), t => Shiftorium.UpgradeAttributesUnlocked(t))) { - if(exe.ToLower().EndsWith(".exe") || exe.ToLower().EndsWith(".dll")) + var pnl = new Panel(); + pnl.Height = 30; + pnl.Width = flbody.Width - 15; + flbody.Controls.Add(pnl); + pnl.Show(); + var pic = new PictureBox(); + pic.SizeMode = PictureBoxSizeMode.StretchImage; + pic.Size = new Size(24, 24); + pic.Image = GetIcon(type.Name); + pnl.Controls.Add(pic); + pic.Left = 5; + pic.Top = (pnl.Height - pic.Height) / 2; + pic.Show(); + var lbl = new Label(); + lbl.Tag = "header3"; + lbl.AutoSize = true; + lbl.Text = NameChangerBackend.GetNameRaw(type); + ControlManager.SetupControl(lbl); + pnl.Controls.Add(lbl); + lbl.CenterParent(); + lbl.Show(); + var btn = new Button(); + btn.Text = "Change..."; + btn.AutoSize = true; + btn.AutoSizeMode = AutoSizeMode.GrowAndShrink; + pnl.Controls.Add(btn); + btn.Left = (pnl.Width - btn.Width) - 5; + btn.Top = (pnl.Height - btn.Height) / 2; + btn.Click += (o, a) => { - try + var gfp = new GraphicPicker(pic.Image, lbl.Text + " icon", ImageLayout.Stretch, (raw, img, layout) => { - var asm = Assembly.LoadFile(exe); - - var typeList = asm.GetTypes().Where(x => x.GetCustomAttributes(false).FirstOrDefault(y => y is DefaultIconAttribute) != null); - types.AddRange(typeList); - - } - catch { } - } - } - - pageCount = types.ToArray().GetPageCount(pageSize); - - foreach (var type in types.ToArray().GetItemsOnPage(currentPage, pageSize)) - { - if (Shiftorium.UpgradeAttributesUnlocked(type)) - { - var pnl = new Panel(); - pnl.Height = 30; - pnl.Width = flbody.Width - 15; - flbody.Controls.Add(pnl); - pnl.Show(); - var pic = new PictureBox(); - pic.SizeMode = PictureBoxSizeMode.StretchImage; - pic.Size = new Size(24, 24); - pic.Image = GetIcon(type.Name); - pnl.Controls.Add(pic); - pic.Left = 5; - pic.Top = (pnl.Height - pic.Height) / 2; - pic.Show(); - var lbl = new Label(); - lbl.Tag = "header3"; - lbl.AutoSize = true; - lbl.Text = NameChangerBackend.GetNameRaw(type); - ControlManager.SetupControl(lbl); - pnl.Controls.Add(lbl); - lbl.CenterParent(); - lbl.Show(); - var btn = new Button(); - btn.Text = "Change..."; - btn.AutoSize = true; - btn.AutoSizeMode = AutoSizeMode.GrowAndShrink; - pnl.Controls.Add(btn); - btn.Left = (pnl.Width - btn.Width) - 5; - btn.Top = (pnl.Height - btn.Height) / 2; - btn.Click += (o, a) => - { - var gfp = new GraphicPicker(pic.Image, lbl.Text + " icon", ImageLayout.Stretch, (raw, img, layout) => - { - pic.Image = img; - SetIcon(type.Name, raw); - }); - AppearanceManager.SetupDialog(gfp); - }; - btn.Show(); - ControlManager.SetupControls(pnl); - } + pic.Image = img; + SetIcon(type.Name, raw); + }); + AppearanceManager.SetupDialog(gfp); + }; + btn.Show(); + ControlManager.SetupControls(pnl); } btnnext.Visible = (currentPage < pageCount - 1); diff --git a/ShiftOS.WinForms/Applications/Shiftnet.cs b/ShiftOS.WinForms/Applications/Shiftnet.cs index 6ccdb19..136f680 100644 --- a/ShiftOS.WinForms/Applications/Shiftnet.cs +++ b/ShiftOS.WinForms/Applications/Shiftnet.cs @@ -150,79 +150,60 @@ namespace ShiftOS.WinForms.Applications { txturl.Text = url; - foreach(var exe in Directory.GetFiles(Environment.CurrentDirectory)) + try { - if(exe.EndsWith(".exe") || exe.EndsWith(".dll")) + foreach (var type in Array.FindAll(ReflectMan.Types, t => t.GetInterfaces().Contains(typeof(IShiftnetSite)) && t.BaseType == typeof(UserControl) && Shiftorium.UpgradeAttributesUnlocked(t))) { - try + var attribute = type.GetCustomAttributes(false).FirstOrDefault(x => x is ShiftnetSiteAttribute && (x as ShiftnetSiteAttribute).Url == url) as ShiftnetSiteAttribute; + if (attribute != null) { - var asm = Assembly.LoadFile(exe); - foreach (var type in asm.GetTypes()) - { - if (type.GetInterfaces().Contains(typeof(IShiftnetSite))) + var obj = (IShiftnetSite)Activator.CreateInstance(type, null); + obj.GoToUrl += (u) => { - if (type.BaseType == typeof(UserControl)) - { - var attribute = type.GetCustomAttributes(false).FirstOrDefault(x => x is ShiftnetSiteAttribute) as ShiftnetSiteAttribute; - if (attribute != null) - { - if (attribute.Url == url) - { - if (Shiftorium.UpgradeAttributesUnlocked(type)) - { - var obj = (IShiftnetSite)Activator.CreateInstance(type, null); - obj.GoToUrl += (u) => - { - History.Push(CurrentUrl); - NavigateToUrl(u); - }; - obj.GoBack += () => - { - string u = History.Pop(); - Future.Push(u); - NavigateToUrl(u); - }; - CurrentPage = obj; - this.pnlcanvas.Controls.Clear(); - this.pnlcanvas.Controls.Add((UserControl)obj); - ((UserControl)obj).Show(); - ((UserControl)obj).Dock = DockStyle.Fill; - obj.OnUpgrade(); - obj.OnSkinLoad(); - obj.Setup(); - AppearanceManager.SetWindowTitle(this, attribute.Name + " - Shiftnet"); - return; - } - } - } - } - } - } - } - catch (Exception ex) - { - pnlcanvas.Controls.Clear(); - var tlbl = new Label(); - tlbl.Text = "Server error in \"" + url + "\" application."; - tlbl.Tag = "header1"; - tlbl.AutoSize = true; - tlbl.Location = new Point(10, 10); - tlbl.Dock = DockStyle.Top; - pnlcanvas.Controls.Add(tlbl); - tlbl.Show(); - - var crash = new Label(); - crash.Dock = DockStyle.Fill; - crash.AutoSize = false; - crash.Text = ex.ToString(); - pnlcanvas.Controls.Add(crash); - crash.Show(); - crash.BringToFront(); - ControlManager.SetupControls(pnlcanvas); - return; + History.Push(CurrentUrl); + NavigateToUrl(u); + }; + obj.GoBack += () => + { + string u = History.Pop(); + Future.Push(u); + NavigateToUrl(u); + }; + CurrentPage = obj; + this.pnlcanvas.Controls.Clear(); + this.pnlcanvas.Controls.Add((UserControl)obj); + ((UserControl)obj).Show(); + ((UserControl)obj).Dock = DockStyle.Fill; + obj.OnUpgrade(); + obj.OnSkinLoad(); + obj.Setup(); + AppearanceManager.SetWindowTitle(this, attribute.Name + " - Shiftnet"); + return; } } } + catch (Exception ex) + { + pnlcanvas.Controls.Clear(); + var tlbl = new Label(); + tlbl.Text = "Server error in \"" + url + "\" application."; + tlbl.Tag = "header1"; + tlbl.AutoSize = true; + tlbl.Location = new Point(10, 10); + tlbl.Dock = DockStyle.Top; + pnlcanvas.Controls.Add(tlbl); + tlbl.Show(); + + var crash = new Label(); + crash.Dock = DockStyle.Fill; + crash.AutoSize = false; + crash.Text = ex.ToString(); + pnlcanvas.Controls.Add(crash); + crash.Show(); + crash.BringToFront(); + ControlManager.SetupControls(pnlcanvas); + return; + } pnlcanvas.Controls.Clear(); var lbl = new Label(); lbl.Text = "Page not found!"; diff --git a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs index eebd897..6886d98 100644 --- a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs +++ b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs @@ -114,8 +114,12 @@ namespace ShiftOS.WinForms.Applications private void SetList() { - lbnoupgrades.Hide(); lbupgrades.Items.Clear(); + if (upgrades.Length == 0) + return; + lbnoupgrades.Hide(); + if (CategoryId > upgrades.Length) + CategoryId = 0; try { lbupgrades.Items.AddRange(upgrades[CategoryId].Keys.ToArray()); @@ -250,6 +254,7 @@ namespace ShiftOS.WinForms.Applications private void moveCat(short direction) // direction is -1 to move backwards or 1 to move forwards { + if (cats.Length == 0) return; CategoryId += direction; CategoryId %= cats.Length; if (CategoryId < 0) CategoryId += cats.Length; // fix modulo on negatives diff --git a/ShiftOS.WinForms/HackerCommands.cs b/ShiftOS.WinForms/HackerCommands.cs index 316b7fc..dd8bde8 100644 --- a/ShiftOS.WinForms/HackerCommands.cs +++ b/ShiftOS.WinForms/HackerCommands.cs @@ -679,28 +679,13 @@ namespace ShiftOS.WinForms [Command("list", description ="Lists all story IDs.")] public static bool ListIds() { - foreach(var exec in System.IO.Directory.GetFiles(Environment.CurrentDirectory)) - { - if(exec.ToLower().EndsWith(".exe") || exec.ToLower().EndsWith(".dll")) + foreach(var type in ReflectMan.Types) + foreach(var method in type.GetMethods(BindingFlags.Public | BindingFlags.Static)) { - try - { - var asm = Assembly.LoadFile(exec); - { - foreach(var type in asm.GetTypes()) - { - foreach(var method in type.GetMethods(BindingFlags.Public | BindingFlags.Static)) - { - var attr = method.GetCustomAttributes(false).FirstOrDefault(x => x is StoryAttribute); - if (attr != null) - Console.WriteLine(" - " + (attr as StoryAttribute).StoryID); - } - } - } - } - catch { } + var attr = method.GetCustomAttributes(false).FirstOrDefault(x => x is StoryAttribute); + if (attr != null) + Console.WriteLine(" - " + (attr as StoryAttribute).StoryID); } - } return true; } diff --git a/ShiftOS.WinForms/Program.cs b/ShiftOS.WinForms/Program.cs index b5fb731..d3530a0 100644 --- a/ShiftOS.WinForms/Program.cs +++ b/ShiftOS.WinForms/Program.cs @@ -114,53 +114,39 @@ namespace ShiftOS.WinForms { var defaultList = JsonConvert.DeserializeObject>(Properties.Resources.Shiftorium); - foreach(var exe in Directory.GetFiles(Environment.CurrentDirectory)) + foreach (var type in ReflectMan.Types) { - if (exe.EndsWith(".exe") || exe.EndsWith(".dll")) + var attribs = type.GetCustomAttributes(false); + var attrib = attribs.FirstOrDefault(x => x is AppscapeEntryAttribute) as AppscapeEntryAttribute; + if (attrib != null) { - try + var upgrade = new ShiftoriumUpgrade { - var asm = Assembly.LoadFile(exe); - foreach (var type in asm.GetTypes()) - { - var attrib = type.GetCustomAttributes(false).FirstOrDefault(x => x is AppscapeEntryAttribute) as AppscapeEntryAttribute; - if (attrib != null) - { - var upgrade = new ShiftoriumUpgrade - { - Id = attrib.Name.ToLower().Replace(" ", "_"), - Name = attrib.Name, - Description = attrib.Description, - Cost = attrib.Cost, - Category = attrib.Category, - Dependencies = (string.IsNullOrWhiteSpace(attrib.DependencyString)) ? "appscape_handled_nodisplay" : "appscape_handled_nodisplay;" + attrib.DependencyString - }; - defaultList.Add(upgrade); - } - - var sattrib = type.GetCustomAttributes(false).FirstOrDefault(x => x is StpContents) as StpContents; - if (sattrib != null) - { - var upgrade = new ShiftoriumUpgrade - { - Id = sattrib.Upgrade, - Name = sattrib.Name, - Description = "This is a hidden dummy upgrade for the .stp file installation attribute \"" + sattrib.Name + "\".", - Cost = 0, - Category = "If this is shown, there's a bug in the Shiftorium Provider or the user is a supreme Shifter.", - Dependencies = "dummy_nodisplay" - }; - defaultList.Add(upgrade); - } - - } - - - - - } - catch { } + Id = attrib.Name.ToLower().Replace(" ", "_"), + Name = attrib.Name, + Description = attrib.Description, + Cost = attrib.Cost, + Category = attrib.Category, + Dependencies = (string.IsNullOrWhiteSpace(attrib.DependencyString)) ? "appscape_handled_nodisplay" : "appscape_handled_nodisplay;" + attrib.DependencyString + }; + defaultList.Add(upgrade); } + + var sattrib = attribs.FirstOrDefault(x => x is StpContents) as StpContents; + if (sattrib != null) + { + var upgrade = new ShiftoriumUpgrade + { + Id = sattrib.Upgrade, + Name = sattrib.Name, + Description = "This is a hidden dummy upgrade for the .stp file installation attribute \"" + sattrib.Name + "\".", + Cost = 0, + Category = "If this is shown, there's a bug in the Shiftorium Provider or the user is a supreme Shifter.", + Dependencies = "dummy_nodisplay" + }; + defaultList.Add(upgrade); + } + } return defaultList; } diff --git a/ShiftOS.WinForms/ShiftnetSites/AppscapeMain.cs b/ShiftOS.WinForms/ShiftnetSites/AppscapeMain.cs index c7830d0..c9b6f64 100644 --- a/ShiftOS.WinForms/ShiftnetSites/AppscapeMain.cs +++ b/ShiftOS.WinForms/ShiftnetSites/AppscapeMain.cs @@ -207,33 +207,21 @@ namespace ShiftOS.WinForms.ShiftnetSites if (result == true) { SaveSystem.CurrentSave.Codepoints -= upg.Cost; - foreach (var exe in Directory.GetFiles(Environment.CurrentDirectory)) + foreach (var type in ReflectMan.Types) { - if (exe.EndsWith(".exe") || exe.EndsWith(".dll")) + var attrib = type.GetCustomAttributes(false).FirstOrDefault(x => x is AppscapeEntryAttribute) as AppscapeEntryAttribute; + if (attrib != null) { - try + if (attrib.Name == upg.Name) { - var asm = Assembly.LoadFile(exe); - foreach (var type in asm.GetTypes()) - { - 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; - } - } - } + var installer = new Applications.Installer(); + var installation = new AppscapeInstallation(upg.Name, attrib.DownloadSize, upg.ID); + AppearanceManager.SetupWindow(installer); + installer.InitiateInstall(installation); + return; } - catch { } } } - } }); } diff --git a/ShiftOS.WinForms/ShiftnetSites/MainHomepage.cs b/ShiftOS.WinForms/ShiftnetSites/MainHomepage.cs index 6e692a7..10ba809 100644 --- a/ShiftOS.WinForms/ShiftnetSites/MainHomepage.cs +++ b/ShiftOS.WinForms/ShiftnetSites/MainHomepage.cs @@ -39,49 +39,30 @@ namespace ShiftOS.WinForms.ShiftnetSites { //Get the Fundamentals List flfundamentals.Controls.Clear(); - foreach (var exe in Directory.GetFiles(Environment.CurrentDirectory)) + foreach (var type in Array.FindAll(ReflectMan.Types, t => t.GetInterfaces().Contains(typeof(IShiftnetSite)) && t.BaseType == typeof(UserControl) && Shiftorium.UpgradeAttributesUnlocked(t))) { - if (exe.EndsWith(".exe") || exe.EndsWith(".dll")) + var attrs = type.GetCustomAttributes(false); + var attribute = attrs.FirstOrDefault(x => x is ShiftnetSiteAttribute) as ShiftnetSiteAttribute; + if (attribute != null) { - try + if (attrs.OfType().Any()) { - var asm = Assembly.LoadFile(exe); - foreach (var type in asm.GetTypes()) + var dash = new Label(); + dash.Text = " - "; + dash.AutoSize = true; + flfundamentals.Controls.Add(dash); + dash.Show(); + var link = new LinkLabel(); + link.Text = attribute.Name; + link.Click += (o, a) => { - if (type.GetInterfaces().Contains(typeof(IShiftnetSite))) - { - if (type.BaseType == typeof(UserControl)) - { - var attribute = type.GetCustomAttributes(false).FirstOrDefault(x => x is ShiftnetSiteAttribute) as ShiftnetSiteAttribute; - if (attribute != null) - { - if (Shiftorium.UpgradeAttributesUnlocked(type)) - { - if (type.GetCustomAttributes(false).FirstOrDefault(x => x is ShiftnetFundamentalAttribute) != null) - { - var dash = new Label(); - dash.Text = " - "; - dash.AutoSize = true; - flfundamentals.Controls.Add(dash); - dash.Show(); - var link = new LinkLabel(); - link.Text = attribute.Name; - link.Click += (o, a) => - { - GoToUrl?.Invoke(attribute.Url); - }; - flfundamentals.Controls.Add(link); - flfundamentals.SetFlowBreak(link, true); - link.Show(); - link.LinkColor = SkinEngine.LoadedSkin.ControlTextColor; - } - } - } - } - } - } + GoToUrl?.Invoke(attribute.Url); + }; + flfundamentals.Controls.Add(link); + flfundamentals.SetFlowBreak(link, true); + link.Show(); + link.LinkColor = SkinEngine.LoadedSkin.ControlTextColor; } - catch { } } } diff --git a/ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.cs b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.cs index 1593117..9b1c3b4 100644 --- a/ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.cs +++ b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.cs @@ -34,53 +34,38 @@ namespace ShiftOS.WinForms.ShiftnetSites public void SetupListing() { fllist.Controls.Clear(); - foreach(var exec in Directory.GetFiles(Environment.CurrentDirectory)) + foreach (var type in Array.FindAll(ReflectMan.Types, t => t.GetInterfaces().Contains(typeof(IShiftnetSite)))) { - if(exec.ToLower().EndsWith(".exe") || exec.ToLower().EndsWith(".dll")) + var attr = type.GetCustomAttributes(false).FirstOrDefault(x => x is ShiftnetSiteAttribute) as ShiftnetSiteAttribute; + if (attr != null) { - try + if (attr.Url.StartsWith("shiftnet/")) { - var asm = Assembly.LoadFile(exec); - var types = asm.GetTypes(); - foreach (var type in types) + var lnk = new LinkLabel(); + lnk.LinkColor = SkinEngine.LoadedSkin.ControlTextColor; + lnk.Text = attr.Name; + var desc = new Label(); + desc.AutoSize = true; + lnk.AutoSize = true; + desc.MaximumSize = new Size(this.Width / 3, 0); + desc.Text = attr.Description; + desc.Padding = new Padding { - if (type.GetInterfaces().Contains(typeof(IShiftnetSite))) - { - var attr = type.GetCustomAttributes(false).FirstOrDefault(x => x is ShiftnetSiteAttribute) as ShiftnetSiteAttribute; - if (attr != null) - { - if (attr.Url.StartsWith("shiftnet/")) - { - var lnk = new LinkLabel(); - lnk.LinkColor = SkinEngine.LoadedSkin.ControlTextColor; - lnk.Text = attr.Name; - var desc = new Label(); - desc.AutoSize = true; - lnk.AutoSize = true; - desc.MaximumSize = new Size(this.Width / 3, 0); - desc.Text = attr.Description; - desc.Padding = new Padding - { - Bottom = 25, - Top = 0, - Left = 10, - Right = 10 - }; - lnk.Click += (o, a) => - { - GoToUrl?.Invoke(attr.Url); - }; - fllist.Controls.Add(lnk); - fllist.Controls.Add(desc); - ControlManager.SetupControls(lnk); - lnk.Show(); - desc.Show(); - } - } - } - } + Bottom = 25, + Top = 0, + Left = 10, + Right = 10 + }; + lnk.Click += (o, a) => + { + GoToUrl?.Invoke(attr.Url); + }; + fllist.Controls.Add(lnk); + fllist.Controls.Add(desc); + ControlManager.SetupControls(lnk); + lnk.Show(); + desc.Show(); } - catch { } } } } diff --git a/ShiftOS.WinForms/WidgetManager.cs b/ShiftOS.WinForms/WidgetManager.cs index fec09f9..81a97af 100644 --- a/ShiftOS.WinForms/WidgetManager.cs +++ b/ShiftOS.WinForms/WidgetManager.cs @@ -16,36 +16,12 @@ namespace ShiftOS.WinForms { public static Dictionary GetAllWidgetTypes() { - Dictionary types = new Dictionary(); - foreach(var exe in System.IO.Directory.GetFiles(Environment.CurrentDirectory)) - { - if(exe.EndsWith(".exe") || exe.EndsWith(".dll")) - { - try - { - var asm = Assembly.LoadFile(exe); - foreach(var type in asm.GetTypes()) - { - if (type.GetInterfaces().Contains(typeof(IDesktopWidget))) - { - if (Shiftorium.UpgradeAttributesUnlocked(type)) - { - foreach (var attrib in type.GetCustomAttributes(false)) - { - if (attrib is DesktopWidgetAttribute) - { - var dw = attrib as DesktopWidgetAttribute; - types.Add(dw, type); - } - } - } - } - } - } - catch { } - } - } - return types; + var ret = new Dictionary(); + var types = Array.FindAll(ReflectMan.Types, t => t.GetInterfaces().Contains(typeof(IDesktopWidget)) && Shiftorium.UpgradeAttributesUnlocked(t)); + foreach (var type in types) + foreach (var attrib in Array.FindAll(type.GetCustomAttributes(false), a => a is DesktopWidgetAttribute)) + ret.Add(attrib as DesktopWidgetAttribute, type); + return ret; } internal static void SaveDetails(Type type, WidgetDetails location) diff --git a/ShiftOS_TheReturn/AppLauncherDaemon.cs b/ShiftOS_TheReturn/AppLauncherDaemon.cs index 716a6a3..c259556 100644 --- a/ShiftOS_TheReturn/AppLauncherDaemon.cs +++ b/ShiftOS_TheReturn/AppLauncherDaemon.cs @@ -63,55 +63,16 @@ namespace ShiftOS.Engine { List win = new List(); - foreach (var asmExec in System.IO.Directory.GetFiles(Environment.CurrentDirectory)) + foreach (var type in Array.FindAll(ReflectMan.Types, t => t.GetInterfaces().Contains(typeof(IShiftOSWindow)) && Shiftorium.UpgradeAttributesUnlocked(t))) { - if (asmExec.EndsWith(".dll") | asmExec.EndsWith(".exe")) - { - try - { - var asm = Assembly.LoadFrom(asmExec); - - if (asm.GetReferencedAssemblies().Contains("ShiftOS.Engine") || asm.FullName.Contains("ShiftOS.Engine")) + foreach (var attr in type.GetCustomAttributes(false)) + if (!(attr is MultiplayerOnlyAttribute && !KernelWatchdog.MudConnected)) + if (attr is LauncherAttribute) { - foreach (var type in asm.GetTypes()) - { - if (type.GetInterfaces().Contains(typeof(IShiftOSWindow))) - { - bool isAllowed = true; - foreach (var attr in type.GetCustomAttributes(false)) - { - if(attr is MultiplayerOnlyAttribute) - { - if(KernelWatchdog.MudConnected == false) - { - isAllowed = false; - - } - } - if (isAllowed == true) - { - if (attr is LauncherAttribute) - { - if (Shiftorium.UpgradeAttributesUnlocked(type)) - { - var launch = attr as LauncherAttribute; - if (launch.UpgradeInstalled) - { - win.Add(new LauncherItem { DisplayData = launch, LaunchType = type }); - } - } - } - } - } - } - } + var launch = attr as LauncherAttribute; + if (launch.UpgradeInstalled) + win.Add(new LauncherItem { DisplayData = launch, LaunchType = type }); } - } - catch - { - - } - } } foreach(var file in Utils.GetFiles(Paths.GetPath("applauncher"))) diff --git a/ShiftOS_TheReturn/AppearanceManager.cs b/ShiftOS_TheReturn/AppearanceManager.cs index e244b77..76060dd 100644 --- a/ShiftOS_TheReturn/AppearanceManager.cs +++ b/ShiftOS_TheReturn/AppearanceManager.cs @@ -58,25 +58,7 @@ namespace ShiftOS.Engine //HEY LETS FIND THE WINDOWS public static IEnumerable GetAllWindowTypes() { - List types = new List(); - foreach(var file in System.IO.Directory.GetFiles(Environment.CurrentDirectory)) - { - // hey if a thing is an exe or a dll show up plz kthx - if(file.EndsWith(".exe") || file.EndsWith(".dll")) - { - try - { - var asm = Assembly.LoadFile(file); - foreach(var type in asm.GetTypes()) - { - if (type.GetInterfaces().Contains(typeof(IShiftOSWindow))) - types.Add(type); - } - } - catch { } - } - } - return types; + return Array.FindAll(ReflectMan.Types, t => t.GetInterfaces().Contains(typeof(IShiftOSWindow))); } // hey you know that window we just made appear? well give it its title diff --git a/ShiftOS_TheReturn/Commands.cs b/ShiftOS_TheReturn/Commands.cs index f37bcb3..da4fb29 100644 --- a/ShiftOS_TheReturn/Commands.cs +++ b/ShiftOS_TheReturn/Commands.cs @@ -771,84 +771,41 @@ shiftorium.buy{{upgrade:""{upg.ID}""}}"); { var app = args["app"] as string; //ANNND now we start reflecting... - foreach (var asmExec in System.IO.Directory.GetFiles(Environment.CurrentDirectory)) + foreach (var type in Array.FindAll(ReflectMan.Types, t => t.BaseType == typeof(UserControl))) { - if (asmExec.EndsWith(".exe") || asmExec.EndsWith(".dll")) + var attr = type.GetCustomAttributes(false).FirstOrDefault(a => a is WinOpenAttribute && app == (a as WinOpenAttribute).ID); + if (attr != null) { - var asm = Assembly.LoadFile(asmExec); - try + if (SaveSystem.CurrentSave.Upgrades.ContainsKey(app)) { - foreach (var type in asm.GetTypes()) + if (Shiftorium.UpgradeInstalled(app)) { - 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; - } - } - } - } - } + 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..."); } } - catch { } - + else + { + IShiftOSWindow frm = Activator.CreateInstance(type) as IShiftOSWindow; + AppearanceManager.SetupWindow(frm); + return true; + } } } } else { - foreach (var asmExec in System.IO.Directory.GetFiles(Environment.CurrentDirectory)) - { - if (asmExec.EndsWith(".exe") || asmExec.EndsWith(".dll")) - { - try - { - var asm = Assembly.LoadFile(asmExec); - - foreach (var type in asm.GetTypes()) - { - if (type.GetInterfaces().Contains(typeof(IShiftOSWindow))) - { - foreach (var attr in type.GetCustomAttributes(false)) - { - if (attr is WinOpenAttribute) - { - if (Shiftorium.UpgradeAttributesUnlocked(type)) - { - Console.WriteLine("win.open{app:\"" + (attr as WinOpenAttribute).ID + "\"}"); - } - } - } - } - } - } - catch { } - } - } + + foreach (var type in Array.FindAll(ReflectMan.Types, t => t.GetInterfaces().Contains(typeof(IShiftOSWindow)) && Shiftorium.UpgradeAttributesUnlocked(t))) + foreach (var attr in Array.FindAll(type.GetCustomAttributes(false), a => a is WinOpenAttribute)) + if (Shiftorium.UpgradeAttributesUnlocked(type)) + Console.WriteLine("win.open{app:\"" + (attr as WinOpenAttribute).ID + "\"}"); return true; diff --git a/ShiftOS_TheReturn/NotificationDaemon.cs b/ShiftOS_TheReturn/NotificationDaemon.cs index 0725782..a532466 100644 --- a/ShiftOS_TheReturn/NotificationDaemon.cs +++ b/ShiftOS_TheReturn/NotificationDaemon.cs @@ -41,26 +41,7 @@ namespace ShiftOS.Engine /// An array of s containing the found objects. public static Type[] GetAllStatusIcons() { - List lst = new List(); - foreach(var exec in System.IO.Directory.GetFiles(Environment.CurrentDirectory)) - { - if(exec.ToLower().EndsWith(".exe") || exec.ToLower().EndsWith(".dll")) - { - try - { - var asm = Assembly.LoadFile(exec); - foreach(var type in asm.GetTypes().Where(x => x.GetInterfaces().Contains(typeof(IStatusIcon)))) - { - if (Shiftorium.UpgradeAttributesUnlocked(type)) - { - lst.Add(type); - } - } - } - catch { } - } - } - return lst.ToArray(); + return Array.FindAll(ReflectMan.Types, x => x.GetInterfaces().Contains(typeof(IStatusIcon)) && Shiftorium.UpgradeAttributesUnlocked(x)); } diff --git a/ShiftOS_TheReturn/ReflectMan.cs b/ShiftOS_TheReturn/ReflectMan.cs new file mode 100644 index 0000000..a0ead60 --- /dev/null +++ b/ShiftOS_TheReturn/ReflectMan.cs @@ -0,0 +1,80 @@ +/* + * MIT License + * + * Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; + +namespace ShiftOS.Engine +{ + public static class ReflectMan + { + private static Assembly[] asms = null; + public static Assembly[] Asms + { + get + { + if (asms == null) + LoadAssemblies(); + return asms; + } + } + + private static Type[] types = null; + public static Type[] Types + { + get + { + if (types == null) + FindTypes(); + return types; + } + } + + private static void LoadAssemblies() + { + var ret = new List(); + foreach (var exe in Array.FindAll(System.IO.Directory.GetFiles(Environment.CurrentDirectory), n => n.EndsWith(".exe") || n.EndsWith(".dll"))) + try + { + var asm = Assembly.LoadFile(exe); + if (asm.GetReferencedAssemblies().Contains("ShiftOS.Engine") || asm.FullName.Contains("ShiftOS.Engine")) + ret.Add(asm); + } + catch { } // probably not a managed assembly + asms = ret.ToArray(); + } + + private static void FindTypes() + { + var ret = new List(); + foreach (var asm in Asms) + ret.AddRange(asm.GetTypes()); + types = ret.ToArray(); + } + } +} diff --git a/ShiftOS_TheReturn/Scripting.cs b/ShiftOS_TheReturn/Scripting.cs index 5021f50..081a6ae 100644 --- a/ShiftOS_TheReturn/Scripting.cs +++ b/ShiftOS_TheReturn/Scripting.cs @@ -205,55 +205,14 @@ end"); //This temporary proxy() method will be used by the API prober. Lua.proxy = new Func((objName) => { - foreach (var f in System.IO.Directory.GetFiles(Environment.CurrentDirectory)) - { - if (f.EndsWith(".exe") || f.EndsWith(".dll")) - { - try - { - - var asm = Assembly.LoadFile(f); - foreach (var type in asm.GetTypes()) - { - if (type.Name == objName) - { - dynamic dynObj = Activator.CreateInstance(type); - return dynObj; - } - - } - } - catch { } - } - } + dynamic dynObj = ReflectMan.Types.FirstOrDefault(t => t.Name == objName); + if (dynObj != null) + return dynObj; throw new Exception("{CLASS_NOT_FOUND}"); }); - - foreach (var f in System.IO.Directory.GetFiles(Environment.CurrentDirectory)) - { - if (f.EndsWith(".exe") || f.EndsWith(".dll")) - { - try - { - var thisasm = Assembly.LoadFile(f); - foreach (var type in thisasm.GetTypes()) - { - foreach (var attr in type.GetCustomAttributes(false)) - { - if (attr is ExposedAttribute) - { - var eattr = attr as ExposedAttribute; - Lua($"{eattr.Name} = proxy(\"{type.Name}\")"); - } - } - } - } - catch - { - - } - } - } + foreach (var type in ReflectMan.Types) + foreach (var attr in Array.FindAll(type.GetCustomAttributes(false), a => a is ExposedAttribute)) + Lua($"{(attr as ExposedAttribute).Name} = proxy(\"{type.Name}\")"); //Now we can null out the proxy() method as it can cause security risks. Lua.isRunning = new Func(() => { return this.Running; }); Lua.proxy = null; diff --git a/ShiftOS_TheReturn/ServerManager.cs b/ShiftOS_TheReturn/ServerManager.cs index be4f086..e6baa9a 100644 --- a/ShiftOS_TheReturn/ServerManager.cs +++ b/ShiftOS_TheReturn/ServerManager.cs @@ -110,32 +110,19 @@ Ping: {ServerManager.DigitalSocietyPing} ms { string[] split = msg.GUID.Split('|'); bool finished = false; - foreach (var exec in Directory.GetFiles(Environment.CurrentDirectory)) - { - if(exec.ToLower().EndsWith(".exe") || exec.ToLower().EndsWith(".dll")) + if (split[0] == SaveSystem.CurrentSave.SystemName) + foreach(var type in Array.FindAll(ReflectMan.Types, x => x.GetInterfaces().Contains(typeof(Server)) && Shiftorium.UpgradeAttributesUnlocked(x))) { - try + var attrib = type.GetCustomAttributes().FirstOrDefault(x => x is ServerAttribute) as ServerAttribute; + if(attrib != null) { - var asm = Assembly.LoadFile(exec); - foreach(var type in asm.GetTypes().Where(x => x.GetInterfaces().Contains(typeof(Server)))) + if(split[1] == attrib.Port.ToString()) { - var attrib = type.GetCustomAttributes().FirstOrDefault(x => x is ServerAttribute) as ServerAttribute; - if(attrib != null) - { - if(split[0] == SaveSystem.CurrentSave.SystemName && split[1] == attrib.Port.ToString()) - { - if (Shiftorium.UpgradeAttributesUnlocked(type)) - { - type.GetMethods(BindingFlags.Public | BindingFlags.Instance).FirstOrDefault(x => x.Name == "MessageReceived")?.Invoke(Activator.CreateInstance(type), null); - finished = true; - } - } - } + type.GetMethods(BindingFlags.Public | BindingFlags.Instance).FirstOrDefault(x => x.Name == "MessageReceived")?.Invoke(Activator.CreateInstance(type), null); + finished = true; } } - catch { } } - } if (finished == false) { Forward(split[2], "Error", $"{split[0]}:{split[1]}: connection refused"); diff --git a/ShiftOS_TheReturn/ShiftOS.Engine.csproj b/ShiftOS_TheReturn/ShiftOS.Engine.csproj index f70c41e..39299fd 100644 --- a/ShiftOS_TheReturn/ShiftOS.Engine.csproj +++ b/ShiftOS_TheReturn/ShiftOS.Engine.csproj @@ -123,6 +123,7 @@ True Resources.resx + diff --git a/ShiftOS_TheReturn/Shiftorium.cs b/ShiftOS_TheReturn/Shiftorium.cs index 7faf336..0362566 100644 --- a/ShiftOS_TheReturn/Shiftorium.cs +++ b/ShiftOS_TheReturn/Shiftorium.cs @@ -214,23 +214,11 @@ namespace ShiftOS.Engine { upgDb = new List(); //Now we probe for ShiftoriumUpgradeAttributes for mods. - foreach (var file in System.IO.Directory.GetFiles(Environment.CurrentDirectory)) - { - if (file.EndsWith(".exe") || file.EndsWith(".dll")) - { - try - { - var asm = Assembly.LoadFile(file); - foreach (var type in asm.GetTypes()) + foreach (var type in ReflectMan.Types) { if (type.GetInterfaces().Contains(typeof(IShiftoriumProvider))) - { - if (type.GetCustomAttributes().FirstOrDefault(x => x is ShiftoriumProviderAttribute) != null) - { - var _p = Activator.CreateInstance(type, null) as IShiftoriumProvider; - upgDb.AddRange(_p.GetDefaults()); - } - } + if (type.GetCustomAttributes().Any(x => x is ShiftoriumProviderAttribute)) + upgDb.AddRange((Activator.CreateInstance(type, null) as IShiftoriumProvider).GetDefaults()); ShiftoriumUpgradeAttribute attrib = type.GetCustomAttributes(false).FirstOrDefault(x => x is ShiftoriumUpgradeAttribute) as ShiftoriumUpgradeAttribute; @@ -310,10 +298,6 @@ namespace ShiftOS.Engine } } - } - catch { } - } - } diff --git a/ShiftOS_TheReturn/Skinning.cs b/ShiftOS_TheReturn/Skinning.cs index d5114c5..ab2d6b1 100644 --- a/ShiftOS_TheReturn/Skinning.cs +++ b/ShiftOS_TheReturn/Skinning.cs @@ -242,38 +242,16 @@ namespace ShiftOS.Engine /// The resulting icon image. public static Image GetDefaultIcon(string id) { - if (_iconProber == null) + if (_iconProber != null) { - return new Bitmap(16, 16); - } - else - { - foreach (var f in System.IO.Directory.GetFiles(Environment.CurrentDirectory)) + foreach (var type in Array.FindAll(ReflectMan.Types, t => t.Name == id)) { - if (f.EndsWith(".exe") || f.EndsWith(".dll")) - { - try - { - var asm = Assembly.LoadFile(f); - foreach (var type in asm.GetTypes()) - { - if (type.Name == id) - { - foreach (var attr in type.GetCustomAttributes(true)) - { - if (attr is DefaultIconAttribute) - { - return _iconProber.GetIcon(attr as DefaultIconAttribute); - } - } - } - } - } - catch { } - } + var attr = Array.Find(type.GetCustomAttributes(true), a => a is DefaultIconAttribute); + if (attr != null) + return _iconProber.GetIcon(attr as DefaultIconAttribute); } - return new Bitmap(16, 16); } + return new Bitmap(16, 16); } /// diff --git a/ShiftOS_TheReturn/Story.cs b/ShiftOS_TheReturn/Story.cs index e44d2be..c01c055 100644 --- a/ShiftOS_TheReturn/Story.cs +++ b/ShiftOS_TheReturn/Story.cs @@ -134,55 +134,42 @@ namespace ShiftOS.Engine /// The storyline ID to start. public static void Start(string stid) { - foreach (var exec in System.IO.Directory.GetFiles(Environment.CurrentDirectory)) + if (SaveSystem.CurrentSave.StoriesExperienced == null) + SaveSystem.CurrentSave.StoriesExperienced = new List(); + foreach (var type in ReflectMan.Types) { - if(exec.EndsWith(".exe") || exec.EndsWith(".dll")) + foreach (var mth in type.GetMethods(BindingFlags.Public | BindingFlags.Static)) { - try + foreach (var attrib in Array.FindAll(mth.GetCustomAttributes(false), a => a is StoryAttribute)) { - if (SaveSystem.CurrentSave.StoriesExperienced == null) - SaveSystem.CurrentSave.StoriesExperienced = new List(); - var asm = Assembly.LoadFile(exec); - foreach(var type in asm.GetTypes()) + var story = attrib as StoryAttribute; + if (story.StoryID == stid) { - foreach(var mth in type.GetMethods(BindingFlags.Public | BindingFlags.Static)) + new Thread(() => { - foreach(var attrib in mth.GetCustomAttributes(false)) + Context = new Engine.StoryContext { - if(attrib is StoryAttribute) - { - var story = attrib as StoryAttribute; - if(story.StoryID == stid) - { - new Thread(() => - { - Context = new Engine.StoryContext - { - Id = stid, - Method = mth, - AutoComplete = true, - }; - SaveSystem.CurrentSave.PickupPoint = Context.Id; - Context.OnComplete += () => - { - StoryComplete?.Invoke(stid); - SaveSystem.CurrentSave.PickupPoint = null; - }; - mth.Invoke(null, null); - if (Context.AutoComplete) - { - Context.MarkComplete(); - } - }).Start(); - return; - } - } + Id = stid, + Method = mth, + AutoComplete = true, + }; + SaveSystem.CurrentSave.PickupPoint = Context.Id; + Context.OnComplete += () => + { + StoryComplete?.Invoke(stid); + SaveSystem.CurrentSave.PickupPoint = null; + }; + mth.Invoke(null, null); + if (Context.AutoComplete) + { + Context.MarkComplete(); } - } + }).Start(); + return; } } - catch (Exception ex) { throw ex; } } + } #if DEBUG throw new ArgumentException("Story ID not found: " + stid + " - Talk to Michael. NOW."); diff --git a/ShiftOS_TheReturn/TerminalBackend.cs b/ShiftOS_TheReturn/TerminalBackend.cs index 09ef3d6..81ea971 100644 --- a/ShiftOS_TheReturn/TerminalBackend.cs +++ b/ShiftOS_TheReturn/TerminalBackend.cs @@ -295,54 +295,40 @@ namespace ShiftOS.Engine public static void PopulateTerminalCommands() { Commands = new List(); - foreach(var exec in System.IO.Directory.GetFiles(Environment.CurrentDirectory)) + foreach(var type in ReflectMan.Types) { - if(exec.ToLower().EndsWith(".exe") || exec.ToLower().EndsWith(".dll")) + var ns = type.GetCustomAttributes(false).FirstOrDefault(x => x is Namespace) as Namespace; + if(ns != null) { - try + foreach(var mth in type.GetMethods(BindingFlags.Public | BindingFlags.Static)) { - var asm = Assembly.LoadFile(exec); - foreach(var type in asm.GetTypes()) + var cmd = mth.GetCustomAttributes(false).FirstOrDefault(x => x is Command); + if(cmd != null) { - var ns = type.GetCustomAttributes(false).FirstOrDefault(x => x is Namespace) as Namespace; - if(ns != null) + var tc = new TerminalCommand(); + tc.RequiresElevation = !(type.GetCustomAttributes(false).FirstOrDefault(x => x is KernelModeAttribute) == null); + + tc.NamespaceInfo = ns; + + tc.CommandInfo = cmd as Command; + tc.RequiresElevation = tc.RequiresElevation || !(mth.GetCustomAttributes(false).FirstOrDefault(x => x is KernelModeAttribute) == null); + tc.RequiredArguments = new List(); + foreach (var arg in mth.GetCustomAttributes(false).Where(x=>x is RequiresArgument)) { - foreach(var mth in type.GetMethods(BindingFlags.Public | BindingFlags.Static)) - { - var cmd = mth.GetCustomAttributes(false).FirstOrDefault(x => x is Command); - if(cmd != null) - { - var tc = new TerminalCommand(); - tc.RequiresElevation = !(type.GetCustomAttributes(false).FirstOrDefault(x => x is KernelModeAttribute) == null); - - tc.NamespaceInfo = ns; - - tc.CommandInfo = cmd as Command; - tc.RequiresElevation = tc.RequiresElevation || !(mth.GetCustomAttributes(false).FirstOrDefault(x => x is KernelModeAttribute) == null); - tc.RequiredArguments = new List(); - foreach (var arg in mth.GetCustomAttributes(false).Where(x=>x is RequiresArgument)) - { - var rarg = arg as RequiresArgument; - tc.RequiredArguments.Add(rarg.argument); - } - var rupg = mth.GetCustomAttributes(false).FirstOrDefault(x => x is RequiresUpgradeAttribute) as RequiresUpgradeAttribute; - if (rupg != null) - tc.Dependencies = rupg.Upgrade; - else - tc.Dependencies = ""; - tc.CommandType = type; - tc.CommandHandler = mth; - if (!Commands.Contains(tc)) - Commands.Add(tc); - } - } + var rarg = arg as RequiresArgument; + tc.RequiredArguments.Add(rarg.argument); } + var rupg = mth.GetCustomAttributes(false).FirstOrDefault(x => x is RequiresUpgradeAttribute) as RequiresUpgradeAttribute; + if (rupg != null) + tc.Dependencies = rupg.Upgrade; + else + tc.Dependencies = ""; + tc.CommandType = type; + tc.CommandHandler = mth; + if (!Commands.Contains(tc)) + Commands.Add(tc); } } - catch(Exception e) - { - Console.WriteLine("[termdb] Error: " + e.ToString()); - } } } Console.WriteLine("[termdb] " + Commands.Count + " commands found."); From 0d75f701778a0900a58343c4c80c124279bc231f Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 11 Jun 2017 07:41:07 -0400 Subject: [PATCH 35/71] skip server connection if server is offline --- ShiftOS_TheReturn/SaveSystem.cs | 25 ++++++++++++++++--------- ShiftOS_TheReturn/ServerManager.cs | 24 ++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 9 deletions(-) diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs index 18f8f78..b9bef47 100644 --- a/ShiftOS_TheReturn/SaveSystem.cs +++ b/ShiftOS_TheReturn/SaveSystem.cs @@ -163,22 +163,29 @@ namespace ShiftOS.Engine bool guidReceived = false; ServerManager.GUIDReceived += (str) => { - //Connection successful! Stop waiting! - guidReceived = true; + //Connection successful! Stop waiting! + guidReceived = true; Console.WriteLine("[inetd] Connection successful."); }; try { - - ServerManager.Initiate(UserConfig.Get().DigitalSocietyAddress, UserConfig.Get().DigitalSocietyPort); - //This haults the client until the connection is successful. - while (ServerManager.thisGuid == new Guid()) + if (ServerManager.ServerOnline) { - Thread.Sleep(10); + ServerManager.Initiate(UserConfig.Get().DigitalSocietyAddress, UserConfig.Get().DigitalSocietyPort); + //This haults the client until the connection is successful. + while (ServerManager.thisGuid == new Guid()) + { + Thread.Sleep(10); + } + Console.WriteLine("[inetd] DHCP GUID recieved, finished setup"); + FinishBootstrap(); + } + else + { + Console.WriteLine("[inetd] No suitable network interface card found, skipping network connection."); + FinishBootstrap(); } - Console.WriteLine("[inetd] DHCP GUID recieved, finished setup"); - FinishBootstrap(); } catch (Exception ex) { diff --git a/ShiftOS_TheReturn/ServerManager.cs b/ShiftOS_TheReturn/ServerManager.cs index be4f086..00f9653 100644 --- a/ShiftOS_TheReturn/ServerManager.cs +++ b/ShiftOS_TheReturn/ServerManager.cs @@ -38,6 +38,7 @@ using System.Net.Sockets; using System.Diagnostics; using System.IO; using System.Reflection; +using System.Net.NetworkInformation; namespace ShiftOS.Engine { @@ -46,6 +47,29 @@ namespace ShiftOS.Engine /// public static class ServerManager { + + public static bool ServerOnline + { + get + { + try + { + Ping myPing = new Ping(); + String host = UserConfig.Get().DigitalSocietyAddress; + byte[] buffer = new byte[32]; + int timeout = 1000; + PingOptions pingOptions = new PingOptions(); + PingReply reply = myPing.Send(host, timeout, buffer, pingOptions); + return (reply.Status == IPStatus.Success); + } + catch (Exception) + { + return false; + } + } + } + + /// /// Print connection diagnostic information. /// From 7ec048fe8536c9757eda47801af07956b826466d Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 11 Jun 2017 08:21:41 -0400 Subject: [PATCH 36/71] More menu work. --- .../MainMenu/MainMenu.Designer.cs | 41 ++++ ShiftOS.WinForms/MainMenu/MainMenu.cs | 72 +++++-- .../Properties/Resources.Designer.cs | 21 +- ShiftOS.WinForms/Properties/Resources.resx | 189 +++++++++--------- ShiftOS.WinForms/Resources/ShiftOSFull.png | Bin 0 -> 31942 bytes ShiftOS.WinForms/ShiftOS.WinForms.csproj | 1 + 6 files changed, 214 insertions(+), 110 deletions(-) create mode 100644 ShiftOS.WinForms/Resources/ShiftOSFull.png diff --git a/ShiftOS.WinForms/MainMenu/MainMenu.Designer.cs b/ShiftOS.WinForms/MainMenu/MainMenu.Designer.cs index a056866..b716b4e 100644 --- a/ShiftOS.WinForms/MainMenu/MainMenu.Designer.cs +++ b/ShiftOS.WinForms/MainMenu/MainMenu.Designer.cs @@ -49,10 +49,14 @@ this.btnnewgame = new System.Windows.Forms.Button(); this.btncontinue = new System.Windows.Forms.Button(); this.button10 = new System.Windows.Forms.Button(); + this.lbcurrentui = new System.Windows.Forms.Label(); + this.shiftos = new System.Windows.Forms.PictureBox(); + this.lbbuilddetails = new System.Windows.Forms.Label(); this.flmenu.SuspendLayout(); this.pnloptions.SuspendLayout(); this.flowLayoutPanel1.SuspendLayout(); this.flcampaign.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.shiftos)).BeginInit(); this.SuspendLayout(); // // flmenu @@ -281,12 +285,45 @@ this.button10.UseVisualStyleBackColor = true; this.button10.Click += new System.EventHandler(this.button10_Click); // + // lbcurrentui + // + this.lbcurrentui.AutoSize = true; + this.lbcurrentui.Location = new System.Drawing.Point(704, 259); + this.lbcurrentui.Name = "lbcurrentui"; + this.lbcurrentui.Size = new System.Drawing.Size(35, 13); + this.lbcurrentui.TabIndex = 4; + this.lbcurrentui.Tag = "header2"; + this.lbcurrentui.Text = "label4"; + // + // shiftos + // + this.shiftos.Image = global::ShiftOS.WinForms.Properties.Resources.ShiftOSFull; + this.shiftos.Location = new System.Drawing.Point(432, 381); + this.shiftos.Name = "shiftos"; + this.shiftos.Size = new System.Drawing.Size(468, 109); + this.shiftos.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.shiftos.TabIndex = 5; + this.shiftos.TabStop = false; + // + // lbbuilddetails + // + this.lbbuilddetails.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.lbbuilddetails.AutoSize = true; + this.lbbuilddetails.Location = new System.Drawing.Point(1, 553); + this.lbbuilddetails.Name = "lbbuilddetails"; + this.lbbuilddetails.Size = new System.Drawing.Size(35, 13); + this.lbbuilddetails.TabIndex = 6; + this.lbbuilddetails.Text = "label4"; + // // MainMenu // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.Black; this.ClientSize = new System.Drawing.Size(1161, 566); + this.Controls.Add(this.lbbuilddetails); + this.Controls.Add(this.shiftos); + this.Controls.Add(this.lbcurrentui); this.Controls.Add(this.flcampaign); this.Controls.Add(this.pnloptions); this.Controls.Add(this.lbticker); @@ -301,6 +338,7 @@ this.flowLayoutPanel1.ResumeLayout(false); this.flowLayoutPanel1.PerformLayout(); this.flcampaign.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.shiftos)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -329,5 +367,8 @@ private System.Windows.Forms.Button btnnewgame; private System.Windows.Forms.Button btncontinue; private System.Windows.Forms.Button button10; + private System.Windows.Forms.Label lbcurrentui; + private System.Windows.Forms.PictureBox shiftos; + private System.Windows.Forms.Label lbbuilddetails; } } \ No newline at end of file diff --git a/ShiftOS.WinForms/MainMenu/MainMenu.cs b/ShiftOS.WinForms/MainMenu/MainMenu.cs index 4b510e2..e11edc2 100644 --- a/ShiftOS.WinForms/MainMenu/MainMenu.cs +++ b/ShiftOS.WinForms/MainMenu/MainMenu.cs @@ -4,6 +4,7 @@ using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; +using System.Reflection; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; @@ -18,12 +19,60 @@ namespace ShiftOS.WinForms.MainMenu { InitializeComponent(); (desk as WinformsDesktop).ParentMenu = this; + this.FormBorderStyle = FormBorderStyle.None; + this.WindowState = FormWindowState.Maximized; +#if DEBUG + var asm = Assembly.GetExecutingAssembly(); + string asmName = asm.GetName().Name; + string vstring = ""; + var version = asm.GetCustomAttributes(true).FirstOrDefault(x => x is AssemblyVersionAttribute) as AssemblyVersionAttribute; + if (version != null) + vstring = version.Version; + lbbuilddetails.Text = $"{asmName} - version number: {vstring} - THIS IS AN UNSTABLE RELEASE."; + +#else + lbbuilddetails.Hide(); +#endif + } + + public void HideOptions() + { + pnloptions.Hide(); + flmenu.BringToFront(); + flmenu.CenterParent(); + currentMenu = flmenu; + CategoryText = "Main menu"; + } + + public string CategoryText + { + get + { + return lbcurrentui.Text; + } + set + { + lbcurrentui.Text = value; + lbcurrentui.CenterParent(); + lbcurrentui.Top = currentMenu.Top - (lbcurrentui.Height * 2); + } + } + + private Control currentMenu = null; + + private void MainMenu_Load(object sender, EventArgs e) + { + Tools.ControlManager.SetupControls(this); + shiftos.CenterParent(); + shiftos.Top = 35; + + var tickermove = new Timer(); var tickerreset = new Timer(); tickermove.Tick += (o, a) => { - if(lbticker.Left <= (0 - lbticker.Width)) + if (lbticker.Left <= (0 - lbticker.Width)) { tickermove.Stop(); tickerreset.Start(); @@ -52,18 +101,9 @@ namespace ShiftOS.WinForms.MainMenu flmenu.CenterParent(); tickerreset.Start(); - } - public void HideOptions() - { - pnloptions.Hide(); - flmenu.BringToFront(); - flmenu.CenterParent(); - } - - private void MainMenu_Load(object sender, EventArgs e) - { - Tools.ControlManager.SetupControls(this); + currentMenu = flmenu; + CategoryText = "Main menu"; } @@ -110,6 +150,9 @@ namespace ShiftOS.WinForms.MainMenu flcampaign.Show(); flcampaign.BringToFront(); flcampaign.CenterParent(); + currentMenu = flcampaign; + CategoryText = "Campaign"; + } private void button5_Click(object sender, EventArgs e) @@ -135,6 +178,9 @@ namespace ShiftOS.WinForms.MainMenu pnloptions.Show(); pnloptions.BringToFront(); pnloptions.CenterParent(); + currentMenu = pnloptions; + CategoryText = "Settings"; + } private void opt_btncancel_Click(object sender, EventArgs e) @@ -187,6 +233,8 @@ namespace ShiftOS.WinForms.MainMenu flmenu.Show(); flmenu.BringToFront(); flmenu.CenterParent(); + currentMenu = flmenu; + CategoryText = "Main menu"; } private void btncontinue_Click(object sender, EventArgs e) diff --git a/ShiftOS.WinForms/Properties/Resources.Designer.cs b/ShiftOS.WinForms/Properties/Resources.Designer.cs index 0386237..137db4b 100644 --- a/ShiftOS.WinForms/Properties/Resources.Designer.cs +++ b/ShiftOS.WinForms/Properties/Resources.Designer.cs @@ -1092,9 +1092,9 @@ namespace ShiftOS.WinForms.Properties { /// { /// Company: "Shiftcast", /// Name: "NetXtreme Hyper Edition", - /// CostPerMonth: 1500, + /// CostPerMonth: 150, /// DownloadSpeed: 524288, //512 kb/s - /// Description: "It's time to supercharge your Shif [rest of string was truncated]";. + /// Description: "It's time to supercharge your Shift [rest of string was truncated]";. /// internal static string ShiftnetServices { get { @@ -1113,9 +1113,10 @@ namespace ShiftOS.WinForms.Properties { /// Category: "Enhancements", /// }, /// { - /// Name: "Shift Progress Bar", - /// Cost: 150, - /// Description: "Want to customize the look of all ShiftOS Progress Bars? Buy this upgrade today and you'll get the ability to set the foreground an [rest of string was truncated]";. + /// Name: "Icon Manager", + /// Cost: 450, + /// Description: "This tool allows you to add and edit application icons within ShiftOS for the small prive of 450 Codepoints!", + /// Dependencies: "skinning [rest of string was truncated]";. /// internal static string Shiftorium { get { @@ -1133,6 +1134,16 @@ namespace ShiftOS.WinForms.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap ShiftOSFull { + get { + object obj = ResourceManager.GetObject("ShiftOSFull", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/ShiftOS.WinForms/Properties/Resources.resx b/ShiftOS.WinForms/Properties/Resources.resx index d1a3544..05f03c7 100644 --- a/ShiftOS.WinForms/Properties/Resources.resx +++ b/ShiftOS.WinForms/Properties/Resources.resx @@ -830,6 +830,9 @@ ..\Resources\ArtPadlinetool.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\fileicon15.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\SystemIcons\iconshutdown.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -948,9 +951,6 @@ ..\Resources\fileicon3.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\systemicons\iconshiftlotto.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\SnakeyTailR.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -966,6 +966,9 @@ ..\Resources\strings_en.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;iso-8859-1 + + ..\Resources\fileiconsaa.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\SweeperTile5.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -33760,6 +33763,9 @@ ..\Resources\fileicon19.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\SystemIcons\iconorcwrite.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\SystemIcons\iconTextPad.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -33769,14 +33775,11 @@ ..\Resources\Shiftorium.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 - - ..\Resources\fileicon13.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\SystemIcons\iconAudioPlayer.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\SweeperTile0.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\ArtPadsquarerubber.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\fileicon4.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -33784,6 +33787,9 @@ ..\Resources\fileicon0.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\ArtPadRectangle.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\SweeperTileBomb.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -33796,9 +33802,6 @@ ..\Resources\fileicon10.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\SystemIcons\iconfloodgate.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\SystemIcons\iconSnakey.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -33820,8 +33823,11 @@ ..\SystemIcons\iconSkinShifter.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\SystemIcons\iconShiftSweeper.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\iconSpeaker.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Ambient3.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ..\Resources\justthes.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -34208,14 +34214,11 @@ ..\SystemIcons\iconIconManager.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\SnakeyTailL.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\ArtPadtexttool.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\sys_shiftoriumstory.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + + ..\Resources\Ambient7.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ..\SystemIcons\iconshutdown.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -34241,9 +34244,6 @@ ..\Resources\FloppyDriveIcon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\SweeperTileFlag.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\SnakeyHeadD.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -34256,6 +34256,9 @@ ..\Resources\fileicon5.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\SnakeyBG.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\SystemIcons\iconoctocat.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -34265,20 +34268,23 @@ ..\SystemIcons\iconArtpad.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\SystemIcons\iconPong.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\RegularDesktopGlyph.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\SnakeyBody.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\fileicon1.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\systemicons\iconshiftlotto.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\SweeperClickFace.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Ambient9.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - ..\SystemIcons\iconPong.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\SystemIcons\iconfloodgate.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ArtPadpixelplacer.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -34295,18 +34301,24 @@ ..\Resources\languages.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + + ..\Resources\Ambient4.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + ..\Resources\ArtPadcirclerubber.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ArtPaderacer.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\fileiconsaa.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\fileicon13.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\SystemIcons\iconInfoBox.fw.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\SuperDesk screenshot.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\SystemIcons\iconFileOpener.fw.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -34319,15 +34331,21 @@ ..\Resources\fileicon18.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\fileicon17.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\SystemIcons\iconShiftSweeper.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\SystemIcons\iconKnowledgeInput.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Ambient5.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\SystemIcons\iconvirusscanner.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\SweeperTile3.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\ArtPadredo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\SystemIcons\iconDownloader.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -34346,18 +34364,24 @@ ..\Resources\SweeperTile2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\ArtPadfloodfill.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\fileicon8.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\hello.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - ..\Resources\ArtPadpencil.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\SweeperClickFace.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\SnakeyFruit.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Ambient1.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + ..\Resources\fileicon2.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -34370,8 +34394,8 @@ ..\Resources\ArtPadnew.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\ShiftOS.rtf;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\Resources\sys_shiftoriumstory.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 ..\Resources\ArtPadmagnify.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -34385,17 +34409,17 @@ ..\SystemIcons\iconBitnoteWallet.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\ArtPadsquarerubber.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\SystemIcons\icongraphicpicker.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\fileicon1.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\fileicon12.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\SystemIcons\iconvirusscanner.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Ambient2.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\ArtPadpencil.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\fileicon11.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -34403,14 +34427,17 @@ ..\Resources\strings_de.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + + ..\Resources\Ambient8.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + ..\Resources\SweeperTile6.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\ArtPadredo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\SystemIcons\iconKnowledgeInput.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\SystemIcons\iconorcwrite.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\SweeperTile0.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\SystemIcons\iconunitytoggle.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -34418,8 +34445,8 @@ ..\Resources\fileicon9.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\fileicon16.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\SystemIcons\icongraphicpicker.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\SystemIcons\iconBitnoteDigger.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -34427,26 +34454,35 @@ ..\Resources\SweeperTile1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\fileicon15.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\SnakeyTailL.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ArtPadopen.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Ambient6.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\ShiftOS.rtf;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + ..\SystemIcons\iconShiftLetters.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\SnakeyBG.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\fileicon17.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\SweeperLoseFace.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\notestate_connection_full.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\SnakeyTailD.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\ArtPadfloodfill.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\fileicon16.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\SystemIcons\iconFileSaver.fw.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -34558,8 +34594,8 @@ ..\Resources\ShiftnetServices.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 - - ..\Resources\ArtPadRectangle.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\SweeperTileFlag.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\systemicons\iconformateditor.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -34570,40 +34606,7 @@ ..\Resources\SweeperTile8.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\SuperDesk screenshot.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Ambient1.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Resources\Ambient2.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Resources\Ambient3.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Resources\Ambient4.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Resources\Ambient5.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Resources\Ambient6.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Resources\Ambient7.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Resources\Ambient8.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Resources\Ambient9.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Resources\notestate_connection_full.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\iconSpeaker.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\ShiftOSFull.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a \ No newline at end of file diff --git a/ShiftOS.WinForms/Resources/ShiftOSFull.png b/ShiftOS.WinForms/Resources/ShiftOSFull.png new file mode 100644 index 0000000000000000000000000000000000000000..2d61a458ddcab7f9a0782a239b864025f0c4e9a9 GIT binary patch literal 31942 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
    J1p9hxZnbVa9-bv7_ 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 F{{!Fjd71zK literal 0 HcmV?d00001 diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index d589ed4..e0a53ea 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -874,6 +874,7 @@ + From c0017e35a46eb20e7ba2717009171eedaf9785e7 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 11 Jun 2017 17:58:35 -0400 Subject: [PATCH 37/71] Creation of new games is possible again! --- ShiftOS.WinForms/Applications/Terminal.cs | 2 +- ShiftOS.WinForms/Controls/TerminalBox.cs | 2 + ShiftOS.WinForms/Oobe.cs | 127 +-------------- ShiftOS.WinForms/OobeStory.cs | 32 +++- .../UniteSignupDialog.Designer.cs | 147 ++++-------------- ShiftOS.WinForms/UniteSignupDialog.cs | 103 +++--------- ShiftOS.WinForms/UniteSignupDialog.resx | 11 -- ShiftOS_TheReturn/SaveSystem.cs | 6 +- ShiftOS_TheReturn/Story.cs | 1 + 9 files changed, 91 insertions(+), 340 deletions(-) diff --git a/ShiftOS.WinForms/Applications/Terminal.cs b/ShiftOS.WinForms/Applications/Terminal.cs index 687b2b9..0470d68 100644 --- a/ShiftOS.WinForms/Applications/Terminal.cs +++ b/ShiftOS.WinForms/Applications/Terminal.cs @@ -624,7 +624,7 @@ Your goal: Earn 1,000 Codepoints."); { if (AppearanceManager.OpenForms.Count <= 1) { - Console.WriteLine(""); + //Console.WriteLine(""); Console.WriteLine("{WIN_CANTCLOSETERMINAL}"); try { diff --git a/ShiftOS.WinForms/Controls/TerminalBox.cs b/ShiftOS.WinForms/Controls/TerminalBox.cs index c188321..b454a77 100644 --- a/ShiftOS.WinForms/Controls/TerminalBox.cs +++ b/ShiftOS.WinForms/Controls/TerminalBox.cs @@ -63,6 +63,7 @@ namespace ShiftOS.WinForms.Controls public void Write(string text) { + Thread.Sleep(5); this.HideSelection = true; this.SelectionColor = ControlManager.ConvertColor(ConsoleEx.ForegroundColor); this.SelectionBackColor = ControlManager.ConvertColor(ConsoleEx.BackgroundColor); @@ -86,6 +87,7 @@ namespace ShiftOS.WinForms.Controls public void WriteLine(string text) { + Thread.Sleep(5); Engine.AudioManager.PlayStream(Properties.Resources.writesound); this.HideSelection = true; this.SelectionColor = ControlManager.ConvertColor(ConsoleEx.ForegroundColor); diff --git a/ShiftOS.WinForms/Oobe.cs b/ShiftOS.WinForms/Oobe.cs index 271e1fd..b2f8cd2 100644 --- a/ShiftOS.WinForms/Oobe.cs +++ b/ShiftOS.WinForms/Oobe.cs @@ -194,137 +194,14 @@ namespace ShiftOS.WinForms } + [Obsolete("Unite code stub.")] public void PromptForLogin() { - Infobox.Show("Login", "Since the last time you've played ShiftOS, some changes have been made to the login system. You must now login using your website credentials.", () => - { - Infobox.PromptYesNo("Website account", "Do you have an account at http://getshiftos.ml?", (hasAccount) => - { - if(hasAccount == true) - { - var loginDialog = new UniteLoginDialog((success)=> - { - string token = success; - var uClient = new UniteClient("http://getshiftos.ml", token); - Infobox.Show("Welcome to ShiftOS.", $"Hello, {uClient.GetDisplayName()}! We've signed you into your account. We'll now try to link your ShiftOS account with your save file.", () => - { - ServerMessageReceived smr = null; - smr = (msg) => - { - if (msg.Name == "mud_savefile") - { - ServerManager.MessageReceived -= smr; - SaveSystem.CurrentSave = JsonConvert.DeserializeObject(msg.Contents); - SaveSystem.SaveGame(); - } - else if(msg.Name=="mud_login_denied") - { - ServerManager.MessageReceived -= smr; - LinkSaveFile(token); - } - }; - ServerManager.MessageReceived += smr; - ServerManager.SendMessage("mud_token_login", token); - }); - }); - AppearanceManager.SetupDialog(loginDialog); - } - else - { - var signupDialog = new UniteSignupDialog((token) => - { - ServerMessageReceived smr = null; - smr = (msg) => - { - ServerManager.MessageReceived -= smr; - if (msg.Name == "mud_savefile") - { - SaveSystem.CurrentSave = JsonConvert.DeserializeObject(msg.Contents); - SaveSystem.SaveGame(); - } - else if (msg.Name == "mud_login_denied") - { - LinkSaveFile(token); - } - }; - ServerManager.MessageReceived += smr; - ServerManager.SendMessage("mud_token_login", token); - - }); - AppearanceManager.SetupDialog(signupDialog); - } - }); - }); } + [Obsolete("Unite code stub.")] public void LinkSaveFile(string token) { - if (Utils.FileExists(Paths.GetPath("user.dat"))) - { - try - { - var details = JsonConvert.DeserializeObject(Utils.ReadAllText(Paths.GetPath("user.dat"))); - ServerMessageReceived smr = null; - bool msgreceived = false; - bool found = false; - smr = (msg) => - { - if (msg.Name == "mud_savefile") - { - var save = JsonConvert.DeserializeObject(msg.Contents); - save.UniteAuthToken = token; - Infobox.Show("Migration complete.", "We have migrated your old save file to the new system successfully. You can still log in using the old system on old builds of ShiftOS.", () => - { - SaveSystem.CurrentSave = save; - SaveSystem.SaveGame(); - found = true; - msgreceived = true; - }); - } - else if (msg.Name == "mud_login_denied") - { - found = false; - msgreceived = true; - } - ServerManager.MessageReceived -= smr; - }; - ServerManager.MessageReceived += smr; - ServerManager.SendMessage("mud_login", JsonConvert.SerializeObject(new - { - username = details.Username, - password = details.Password - })); - while (msgreceived == false) - Thread.Sleep(10); - if (found == true) - return; - } - catch - { - - } - } - - var client = new UniteClient("http://getshiftos.ml", token); - var sve = new Save(); - sve.Username = client.GetEmail(); - sve.Password = Guid.NewGuid().ToString(); - sve.SystemName = client.GetSysName(); - sve.UniteAuthToken = token; - sve.Codepoints = 0; - sve.Upgrades = new Dictionary(); - sve.ID = Guid.NewGuid(); - sve.StoriesExperienced = new List(); - sve.StoriesExperienced.Add("mud_fundamentals"); - Infobox.Show("Welcome to ShiftOS.", "Welcome to ShiftOS, " + client.GetDisplayName() + ". We have created a save file for you. Now, go on and Shift It Your Way.", () => - { - sve.StoryPosition = 8675309; - SaveSystem.CurrentSave = sve; - Shiftorium.Silent = true; - SaveSystem.SaveGame(); - Shiftorium.Silent = false; - - }); } public void ForceReboot() diff --git a/ShiftOS.WinForms/OobeStory.cs b/ShiftOS.WinForms/OobeStory.cs index 8d86b9e..f2a4930 100644 --- a/ShiftOS.WinForms/OobeStory.cs +++ b/ShiftOS.WinForms/OobeStory.cs @@ -143,7 +143,37 @@ namespace ShiftOS.WinForms Console.WriteLine(); Console.WriteLine("Next, let's get user information."); Console.WriteLine(); - ShiftOS.Engine.OutOfBoxExperience.PromptForLogin(); + Desktop.InvokeOnWorkerThread(() => + { + var uSignUpDialog = new UniteSignupDialog((result) => + { + var sve = new Save(); + sve.SystemName = result.SystemName; + sve.Codepoints = 0; + sve.Upgrades = new Dictionary(); + sve.ID = Guid.NewGuid(); + sve.StoriesExperienced = new List(); + sve.StoriesExperienced.Add("mud_fundamentals"); + sve.Users = new List + { + new ClientSave + { + Username = "root", + Password = result.RootPassword, + Permissions = 0 + } + }; + + sve.StoryPosition = 8675309; + SaveSystem.CurrentSave = sve; + Shiftorium.Silent = true; + SaveSystem.SaveGame(); + Shiftorium.Silent = false; + + + }); + AppearanceManager.SetupDialog(uSignUpDialog); + }); } private static bool isValid(string text, string chars) diff --git a/ShiftOS.WinForms/UniteSignupDialog.Designer.cs b/ShiftOS.WinForms/UniteSignupDialog.Designer.cs index a1509d7..52c06b7 100644 --- a/ShiftOS.WinForms/UniteSignupDialog.Designer.cs +++ b/ShiftOS.WinForms/UniteSignupDialog.Designer.cs @@ -28,165 +28,83 @@ /// private void InitializeComponent() { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UniteSignupDialog)); this.btnlogin = new System.Windows.Forms.Button(); - this.txtpassword = new System.Windows.Forms.TextBox(); - this.txtusername = new System.Windows.Forms.TextBox(); - this.label3 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); - this.txtconfirm = new System.Windows.Forms.TextBox(); - this.label4 = new System.Windows.Forms.Label(); - this.txtdisplay = new System.Windows.Forms.TextBox(); + this.txtsys = new System.Windows.Forms.TextBox(); this.label5 = new System.Windows.Forms.Label(); - this.label6 = new System.Windows.Forms.Label(); - this.txtsysname = new System.Windows.Forms.TextBox(); + this.txtroot = new System.Windows.Forms.TextBox(); this.label7 = new System.Windows.Forms.Label(); this.SuspendLayout(); // // btnlogin // this.btnlogin.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.btnlogin.Location = new System.Drawing.Point(462, 479); + this.btnlogin.Location = new System.Drawing.Point(462, 168); this.btnlogin.Name = "btnlogin"; this.btnlogin.Size = new System.Drawing.Size(75, 23); this.btnlogin.TabIndex = 11; - this.btnlogin.Text = "Submit"; + this.btnlogin.Text = "{UI_SUBMIT}"; this.btnlogin.UseVisualStyleBackColor = true; this.btnlogin.Click += new System.EventHandler(this.btnlogin_Click); // - // txtpassword - // - this.txtpassword.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.txtpassword.Location = new System.Drawing.Point(113, 133); - this.txtpassword.Name = "txtpassword"; - this.txtpassword.Size = new System.Drawing.Size(424, 20); - this.txtpassword.TabIndex = 10; - this.txtpassword.UseSystemPasswordChar = true; - // - // txtusername - // - this.txtusername.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.txtusername.Location = new System.Drawing.Point(113, 100); - this.txtusername.Name = "txtusername"; - this.txtusername.Size = new System.Drawing.Size(424, 20); - this.txtusername.TabIndex = 9; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(17, 136); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(56, 13); - this.label3.TabIndex = 8; - this.label3.Text = "Password:"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(17, 103); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(76, 13); - this.label2.TabIndex = 7; - this.label2.Text = "Email Address:"; - // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(17, 36); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(120, 13); + this.label1.Size = new System.Drawing.Size(169, 13); this.label1.TabIndex = 6; this.label1.Tag = "header2"; - this.label1.Text = "Create ShiftOS Account"; + this.label1.Text = "{INIT_SYSTEM_PREPARATION}"; // - // txtconfirm + // txtsys // - this.txtconfirm.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + this.txtsys.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.txtconfirm.Location = new System.Drawing.Point(113, 159); - this.txtconfirm.Name = "txtconfirm"; - this.txtconfirm.Size = new System.Drawing.Size(424, 20); - this.txtconfirm.TabIndex = 13; - this.txtconfirm.UseSystemPasswordChar = true; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(17, 162); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(45, 13); - this.label4.TabIndex = 12; - this.label4.Text = "Confirm:"; - // - // txtdisplay - // - this.txtdisplay.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.txtdisplay.Location = new System.Drawing.Point(113, 197); - this.txtdisplay.Name = "txtdisplay"; - this.txtdisplay.Size = new System.Drawing.Size(424, 20); - this.txtdisplay.TabIndex = 15; + this.txtsys.Location = new System.Drawing.Point(113, 100); + this.txtsys.Name = "txtsys"; + this.txtsys.Size = new System.Drawing.Size(424, 20); + this.txtsys.TabIndex = 15; // // label5 // this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(17, 200); + this.label5.Location = new System.Drawing.Point(17, 103); this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(73, 13); + this.label5.Size = new System.Drawing.Size(116, 13); this.label5.TabIndex = 14; - this.label5.Text = "Display name:"; + this.label5.Text = "{SE_SYSTEM_NAME}"; // - // label6 + // txtroot // - this.label6.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + this.txtroot.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.label6.Location = new System.Drawing.Point(20, 267); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(517, 209); - this.label6.TabIndex = 16; - this.label6.Text = resources.GetString("label6.Text"); - // - // txtsysname - // - this.txtsysname.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.txtsysname.Location = new System.Drawing.Point(113, 223); - this.txtsysname.Name = "txtsysname"; - this.txtsysname.Size = new System.Drawing.Size(424, 20); - this.txtsysname.TabIndex = 18; + this.txtroot.Location = new System.Drawing.Point(113, 126); + this.txtroot.Name = "txtroot"; + this.txtroot.Size = new System.Drawing.Size(424, 20); + this.txtroot.TabIndex = 18; // // label7 // this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(17, 226); + this.label7.Location = new System.Drawing.Point(17, 129); this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(73, 13); + this.label7.Size = new System.Drawing.Size(135, 13); this.label7.TabIndex = 17; - this.label7.Text = "System name:"; + this.label7.Text = "{SE_ROOT_PASSWORD}"; // // UniteSignupDialog // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.txtsysname); + this.Controls.Add(this.txtroot); this.Controls.Add(this.label7); - this.Controls.Add(this.label6); - this.Controls.Add(this.txtdisplay); + this.Controls.Add(this.txtsys); this.Controls.Add(this.label5); - this.Controls.Add(this.txtconfirm); - this.Controls.Add(this.label4); this.Controls.Add(this.btnlogin); - this.Controls.Add(this.txtpassword); - this.Controls.Add(this.txtusername); - this.Controls.Add(this.label3); - this.Controls.Add(this.label2); this.Controls.Add(this.label1); this.Name = "UniteSignupDialog"; - this.Size = new System.Drawing.Size(555, 519); + this.Size = new System.Drawing.Size(555, 208); this.ResumeLayout(false); this.PerformLayout(); @@ -195,17 +113,10 @@ #endregion private System.Windows.Forms.Button btnlogin; - private System.Windows.Forms.TextBox txtpassword; - private System.Windows.Forms.TextBox txtusername; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label1; - private System.Windows.Forms.TextBox txtconfirm; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.TextBox txtdisplay; + private System.Windows.Forms.TextBox txtsys; private System.Windows.Forms.Label label5; - private System.Windows.Forms.Label label6; - private System.Windows.Forms.TextBox txtsysname; + private System.Windows.Forms.TextBox txtroot; private System.Windows.Forms.Label label7; } } diff --git a/ShiftOS.WinForms/UniteSignupDialog.cs b/ShiftOS.WinForms/UniteSignupDialog.cs index 7d0fd33..b2b5052 100644 --- a/ShiftOS.WinForms/UniteSignupDialog.cs +++ b/ShiftOS.WinForms/UniteSignupDialog.cs @@ -16,13 +16,19 @@ namespace ShiftOS.WinForms { public partial class UniteSignupDialog : UserControl, IShiftOSWindow { - public UniteSignupDialog(Action callback) + public class SignupCredentials + { + public string SystemName { get; set; } + public string RootPassword { get; set; } + } + + public UniteSignupDialog(Action callback) { InitializeComponent(); Callback = callback; } - private Action Callback { get; set; } + private Action Callback { get; set; } public void OnLoad() @@ -45,92 +51,25 @@ namespace ShiftOS.WinForms private void btnlogin_Click(object sender, EventArgs e) { - string u = txtusername.Text; - string p = txtpassword.Text; + string sys = txtsys.Text; + string root = txtroot.Text; - if (string.IsNullOrWhiteSpace(u)) + if (string.IsNullOrWhiteSpace(sys)) { - Infobox.Show("Please enter a username.", "You must enter a proper email address."); + Infobox.Show("{TITLE_EMPTY_SYSNAME}", "{MSG_EMPTY_SYSNAME}"); + return; + } + if(sys.Length < 5) + { + Infobox.Show("{TITLE_VALIDATION_ERROR}", "{MSG_VALIDATION_ERROR_SYSNAME_LENGTH}"); return; } - if (string.IsNullOrWhiteSpace(p)) + Callback?.Invoke(new SignupCredentials { - Infobox.Show("Please enter a password.", "You must enter a valid password."); - return; - } - - if(p != txtconfirm.Text) - { - Infobox.Show("Passwords don't match.", "The \"Password\" and \"Confirm\" boxes must match."); - return; - } - - if (string.IsNullOrWhiteSpace(txtdisplay.Text)) - { - Infobox.Show("Empty display name", "Please choose a proper display name."); - return; - } - - if (string.IsNullOrWhiteSpace(txtsysname.Text)) - { - Infobox.Show("Empty system name", "Please name your computer!"); - return; - } - - if(p.Length < 7) - { - Infobox.Show("Password error", "Your password must have at least 7 characters."); - return; - } - - if (!(p.Any(char.IsUpper) && - p.Any(char.IsLower) && - p.Any(char.IsDigit))) - { - Infobox.Show("Password error", "Your password must contain at least one uppercase, lowercase, digit and symbol character."); - return; - } - - if (!u.Contains("@")) - { - Infobox.Show("Valid email required.", "You must specify a valid email address."); - return; - } - - try - { - var webrequest = HttpWebRequest.Create(UserConfig.Get().UniteUrl + "/Auth/Register?appname=ShiftOS&appdesc=ShiftOS+client&version=1_0_beta_2_4&displayname=" + txtdisplay.Text + "&sysname=" + txtsysname.Text); - string base64 = Convert.ToBase64String(Encoding.UTF8.GetBytes($"{u}:{p}")); - webrequest.Headers.Add("Authentication: Basic " + base64); - var response = webrequest.GetResponse(); - var str = response.GetResponseStream(); - var reader = new System.IO.StreamReader(str); - string result = reader.ReadToEnd(); - if (result.StartsWith("{")) - { - var exc = JsonConvert.DeserializeObject(result); - Infobox.Show("Error", exc.Message); - return; - } - reader.Close(); - str.Close(); - str.Dispose(); - response.Dispose(); - Callback?.Invoke(result); - AppearanceManager.Close(this); - } -#if DEBUG - catch (Exception ex) - { - Infobox.Show("Error", ex.ToString()); - } -#else - catch - { - Infobox.Show("Login failed.", "The login attempt failed due to an incorrect username and password pair."); - } -#endif + SystemName = sys, + RootPassword = root + }); } } diff --git a/ShiftOS.WinForms/UniteSignupDialog.resx b/ShiftOS.WinForms/UniteSignupDialog.resx index 5fecdcd..1af7de1 100644 --- a/ShiftOS.WinForms/UniteSignupDialog.resx +++ b/ShiftOS.WinForms/UniteSignupDialog.resx @@ -117,15 +117,4 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Your ShiftOS Account is your gateway to the world of ShiftOS. - -What does this account do for you? - - - It holds all your Codepoints, Shiftorium Upgrades, and other in-game save details in a secure spot. - - It gives you access to the ShiftOS Forums, Wiki, Developer Blog and the bugtracker. - - It gives you your own personal profile that you can shift your own way - just like you can ShiftOS. - -You can customize more information for this account at http://getshiftos.ml/, but first, we must create it. - \ No newline at end of file diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs index b9bef47..a4e79a7 100644 --- a/ShiftOS_TheReturn/SaveSystem.cs +++ b/ShiftOS_TheReturn/SaveSystem.cs @@ -527,8 +527,10 @@ namespace ShiftOS.Engine { try { - Story.Start(CurrentSave.PickupPoint); - TerminalBackend.PrintPrompt(); + if (Story.Context == null) + { + Story.Start(CurrentSave.PickupPoint); + } } catch { } } diff --git a/ShiftOS_TheReturn/Story.cs b/ShiftOS_TheReturn/Story.cs index c01c055..2b00686 100644 --- a/ShiftOS_TheReturn/Story.cs +++ b/ShiftOS_TheReturn/Story.cs @@ -109,6 +109,7 @@ namespace ShiftOS.Engine { Thread.Sleep(5000); } + Thread.Sleep(500); CurrentObjectives.Remove(obj); obj.Complete(); }); From 388835c96a1ace2fc8f317ecb10981da76aeac05 Mon Sep 17 00:00:00 2001 From: RogueAI42 Date: Mon, 12 Jun 2017 22:38:53 +1000 Subject: [PATCH 38/71] fixed ShiftFS save simple --- ShiftOS_TheReturn/SaveSystem.cs | 73 +++++++++++++++------------------ 1 file changed, 32 insertions(+), 41 deletions(-) diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs index a4e79a7..a3a992c 100644 --- a/ShiftOS_TheReturn/SaveSystem.cs +++ b/ShiftOS_TheReturn/SaveSystem.cs @@ -163,29 +163,22 @@ namespace ShiftOS.Engine bool guidReceived = false; ServerManager.GUIDReceived += (str) => { - //Connection successful! Stop waiting! - guidReceived = true; + //Connection successful! Stop waiting! + guidReceived = true; Console.WriteLine("[inetd] Connection successful."); }; try { - if (ServerManager.ServerOnline) + + ServerManager.Initiate(UserConfig.Get().DigitalSocietyAddress, UserConfig.Get().DigitalSocietyPort); + //This haults the client until the connection is successful. + while (ServerManager.thisGuid == new Guid()) { - ServerManager.Initiate(UserConfig.Get().DigitalSocietyAddress, UserConfig.Get().DigitalSocietyPort); - //This haults the client until the connection is successful. - while (ServerManager.thisGuid == new Guid()) - { - Thread.Sleep(10); - } - Console.WriteLine("[inetd] DHCP GUID recieved, finished setup"); - FinishBootstrap(); - } - else - { - Console.WriteLine("[inetd] No suitable network interface card found, skipping network connection."); - FinishBootstrap(); + Thread.Sleep(10); } + Console.WriteLine("[inetd] DHCP GUID recieved, finished setup"); + FinishBootstrap(); } catch (Exception ex) { @@ -527,10 +520,8 @@ namespace ShiftOS.Engine { try { - if (Story.Context == null) - { - Story.Start(CurrentSave.PickupPoint); - } + Story.Start(CurrentSave.PickupPoint); + TerminalBackend.PrintPrompt(); } catch { } } @@ -637,40 +628,40 @@ namespace ShiftOS.Engine /// public static void SaveGame() { - if (IsSandbox == false) - { #if !NOSAVE - if (!Shiftorium.Silent) - Console.WriteLine(""); - if (!Shiftorium.Silent) - Console.Write("{SE_SAVING}... "); - if (SaveSystem.CurrentSave != null) + if (!IsSandbox) { - var serialisedSaveFile = JsonConvert.SerializeObject(CurrentSave, Formatting.Indented); - new Thread(() => + if (!Shiftorium.Silent) + Console.WriteLine(""); + if (!Shiftorium.Silent) + Console.Write("{SE_SAVING}... "); + if (SaveSystem.CurrentSave != null) { - try + var serialisedSaveFile = JsonConvert.SerializeObject(CurrentSave, Formatting.Indented); + new Thread(() => { + try + { // please don't do networking on the main thread if you're just going to // discard the response, it's extremely slow ServerManager.SendMessage("mud_save", serialisedSaveFile); + } + catch { } + }) + { IsBackground = false }.Start(); + if (!System.IO.Directory.Exists(Paths.SaveDirectory)) + { + System.IO.Directory.CreateDirectory(Paths.SaveDirectory); + } - catch { } - }) - { IsBackground = false }.Start(); - if (!System.IO.Directory.Exists(Paths.SaveDirectory)) - { - System.IO.Directory.CreateDirectory(Paths.SaveDirectory); + System.IO.File.WriteAllText(Path.Combine(Paths.SaveDirectory, "autosave.save"), serialisedSaveFile); } - - System.IO.File.WriteAllText(Path.Combine(Paths.SaveDirectory, "autosave.save"), serialisedSaveFile); + if (!Shiftorium.Silent) + Console.WriteLine(" ...{DONE}."); } - if (!Shiftorium.Silent) - Console.WriteLine(" ...{DONE}."); System.IO.File.WriteAllText(Paths.SaveFile, Utils.ExportMount(0)); #endif - } } /// From d1538e742bf075c680d7f6a42b0ad5583a18d379 Mon Sep 17 00:00:00 2001 From: Rylan/wowmom98 Date: Mon, 12 Jun 2017 21:52:38 -0400 Subject: [PATCH 39/71] Loading joke thing --- ShiftOS_TheReturn/SaveSystem.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs index a3a992c..b35277b 100644 --- a/ShiftOS_TheReturn/SaveSystem.cs +++ b/ShiftOS_TheReturn/SaveSystem.cs @@ -79,6 +79,7 @@ namespace ShiftOS.Engine /// public static Save CurrentSave { get; set; } + /// /// Start the entire ShiftOS engine. /// @@ -104,6 +105,8 @@ namespace ShiftOS.Engine Localization.SetupTHETRUEDefaultLocals(); SkinEngine.Init(); + Random rnd = new Random(); + int loadingJoke1 = rnd.Next(5); TerminalBackend.OpenTerminal(); @@ -138,7 +141,19 @@ namespace ShiftOS.Engine Console.WriteLine("[sfs] Loading SFS driver v3"); Thread.Sleep(100); Console.WriteLine("[sfs] 4096 blocks read."); + if (loadingJoke1 == 0) + Console.WriteLine("[sos] Getting good and ready..."); + if (loadingJoke1 == 1) + Console.WriteLine("[sos] Shifting the OS..."); + if (loadingJoke1 == 2) + Console.WriteLine("[sos] Placing things everywhere..."); + if (loadingJoke1 == 3) + Console.WriteLine("[sos] Making an an errors..."); + if (loadingJoke1 == 4) + Console.WriteLine("[sos] Testing to see if this OS is indeed on..."); + Thread.Sleep(50); Console.WriteLine("[simpl-conf] Reading configuration files (global-3.conf)"); + Thread.Sleep(20); Console.WriteLine("[termdb] Building command database from filesystem..."); TerminalBackend.PopulateTerminalCommands(); From 428533fec2721d7119e23a5a6b2aaac0e6107982 Mon Sep 17 00:00:00 2001 From: RogueAI42 Date: Tue, 13 Jun 2017 18:27:37 +1000 Subject: [PATCH 40/71] Let's try that again........ seems like I somehow got an old copy of SaveSystem.cs and committed that, re-introducing the game's dependency on Unite, which is dead, press F to pay respects. --- ShiftOS_TheReturn/SaveSystem.cs | 88 +++++++++++++++------------------ 1 file changed, 41 insertions(+), 47 deletions(-) diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs index b35277b..a4e79a7 100644 --- a/ShiftOS_TheReturn/SaveSystem.cs +++ b/ShiftOS_TheReturn/SaveSystem.cs @@ -79,7 +79,6 @@ namespace ShiftOS.Engine /// public static Save CurrentSave { get; set; } - /// /// Start the entire ShiftOS engine. /// @@ -105,8 +104,6 @@ namespace ShiftOS.Engine Localization.SetupTHETRUEDefaultLocals(); SkinEngine.Init(); - Random rnd = new Random(); - int loadingJoke1 = rnd.Next(5); TerminalBackend.OpenTerminal(); @@ -141,19 +138,7 @@ namespace ShiftOS.Engine Console.WriteLine("[sfs] Loading SFS driver v3"); Thread.Sleep(100); Console.WriteLine("[sfs] 4096 blocks read."); - if (loadingJoke1 == 0) - Console.WriteLine("[sos] Getting good and ready..."); - if (loadingJoke1 == 1) - Console.WriteLine("[sos] Shifting the OS..."); - if (loadingJoke1 == 2) - Console.WriteLine("[sos] Placing things everywhere..."); - if (loadingJoke1 == 3) - Console.WriteLine("[sos] Making an an errors..."); - if (loadingJoke1 == 4) - Console.WriteLine("[sos] Testing to see if this OS is indeed on..."); - Thread.Sleep(50); Console.WriteLine("[simpl-conf] Reading configuration files (global-3.conf)"); - Thread.Sleep(20); Console.WriteLine("[termdb] Building command database from filesystem..."); TerminalBackend.PopulateTerminalCommands(); @@ -178,22 +163,29 @@ namespace ShiftOS.Engine bool guidReceived = false; ServerManager.GUIDReceived += (str) => { - //Connection successful! Stop waiting! - guidReceived = true; + //Connection successful! Stop waiting! + guidReceived = true; Console.WriteLine("[inetd] Connection successful."); }; try { - - ServerManager.Initiate(UserConfig.Get().DigitalSocietyAddress, UserConfig.Get().DigitalSocietyPort); - //This haults the client until the connection is successful. - while (ServerManager.thisGuid == new Guid()) + if (ServerManager.ServerOnline) { - Thread.Sleep(10); + ServerManager.Initiate(UserConfig.Get().DigitalSocietyAddress, UserConfig.Get().DigitalSocietyPort); + //This haults the client until the connection is successful. + while (ServerManager.thisGuid == new Guid()) + { + Thread.Sleep(10); + } + Console.WriteLine("[inetd] DHCP GUID recieved, finished setup"); + FinishBootstrap(); + } + else + { + Console.WriteLine("[inetd] No suitable network interface card found, skipping network connection."); + FinishBootstrap(); } - Console.WriteLine("[inetd] DHCP GUID recieved, finished setup"); - FinishBootstrap(); } catch (Exception ex) { @@ -535,8 +527,10 @@ namespace ShiftOS.Engine { try { - Story.Start(CurrentSave.PickupPoint); - TerminalBackend.PrintPrompt(); + if (Story.Context == null) + { + Story.Start(CurrentSave.PickupPoint); + } } catch { } } @@ -643,40 +637,40 @@ namespace ShiftOS.Engine /// public static void SaveGame() { + if (IsSandbox == false) + { #if !NOSAVE - if (!IsSandbox) + if (!Shiftorium.Silent) + Console.WriteLine(""); + if (!Shiftorium.Silent) + Console.Write("{SE_SAVING}... "); + if (SaveSystem.CurrentSave != null) { - if (!Shiftorium.Silent) - Console.WriteLine(""); - if (!Shiftorium.Silent) - Console.Write("{SE_SAVING}... "); - if (SaveSystem.CurrentSave != null) + var serialisedSaveFile = JsonConvert.SerializeObject(CurrentSave, Formatting.Indented); + new Thread(() => { - var serialisedSaveFile = JsonConvert.SerializeObject(CurrentSave, Formatting.Indented); - new Thread(() => + try { - try - { // please don't do networking on the main thread if you're just going to // discard the response, it's extremely slow ServerManager.SendMessage("mud_save", serialisedSaveFile); - } - catch { } - }) - { IsBackground = false }.Start(); - if (!System.IO.Directory.Exists(Paths.SaveDirectory)) - { - System.IO.Directory.CreateDirectory(Paths.SaveDirectory); - } + catch { } + }) + { IsBackground = false }.Start(); + if (!System.IO.Directory.Exists(Paths.SaveDirectory)) + { + System.IO.Directory.CreateDirectory(Paths.SaveDirectory); - System.IO.File.WriteAllText(Path.Combine(Paths.SaveDirectory, "autosave.save"), serialisedSaveFile); } - if (!Shiftorium.Silent) - Console.WriteLine(" ...{DONE}."); + + System.IO.File.WriteAllText(Path.Combine(Paths.SaveDirectory, "autosave.save"), serialisedSaveFile); } + if (!Shiftorium.Silent) + Console.WriteLine(" ...{DONE}."); System.IO.File.WriteAllText(Paths.SaveFile, Utils.ExportMount(0)); #endif + } } /// From a2db5d39096cbf4d32412ad40168769ca63d9493 Mon Sep 17 00:00:00 2001 From: RogueAI42 Date: Tue, 13 Jun 2017 18:29:25 +1000 Subject: [PATCH 41/71] ... what the hell is going on --- ShiftOS_TheReturn/SaveSystem.cs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs index a4e79a7..14e6dcd 100644 --- a/ShiftOS_TheReturn/SaveSystem.cs +++ b/ShiftOS_TheReturn/SaveSystem.cs @@ -79,6 +79,7 @@ namespace ShiftOS.Engine /// public static Save CurrentSave { get; set; } + /// /// Start the entire ShiftOS engine. /// @@ -104,6 +105,8 @@ namespace ShiftOS.Engine Localization.SetupTHETRUEDefaultLocals(); SkinEngine.Init(); + Random rnd = new Random(); + int loadingJoke1 = rnd.Next(5); TerminalBackend.OpenTerminal(); @@ -138,7 +141,19 @@ namespace ShiftOS.Engine Console.WriteLine("[sfs] Loading SFS driver v3"); Thread.Sleep(100); Console.WriteLine("[sfs] 4096 blocks read."); + if (loadingJoke1 == 0) + Console.WriteLine("[sos] Getting good and ready..."); + if (loadingJoke1 == 1) + Console.WriteLine("[sos] Shifting the OS..."); + if (loadingJoke1 == 2) + Console.WriteLine("[sos] Placing things everywhere..."); + if (loadingJoke1 == 3) + Console.WriteLine("[sos] Making an an errors..."); + if (loadingJoke1 == 4) + Console.WriteLine("[sos] Testing to see if this OS is indeed on..."); + Thread.Sleep(50); Console.WriteLine("[simpl-conf] Reading configuration files (global-3.conf)"); + Thread.Sleep(20); Console.WriteLine("[termdb] Building command database from filesystem..."); TerminalBackend.PopulateTerminalCommands(); @@ -637,7 +652,7 @@ namespace ShiftOS.Engine /// public static void SaveGame() { - if (IsSandbox == false) + if (!IsSandbox) { #if !NOSAVE if (!Shiftorium.Silent) @@ -668,9 +683,9 @@ namespace ShiftOS.Engine } if (!Shiftorium.Silent) Console.WriteLine(" ...{DONE}."); - System.IO.File.WriteAllText(Paths.SaveFile, Utils.ExportMount(0)); #endif } + System.IO.File.WriteAllText(Paths.SaveFile, Utils.ExportMount(0)); } /// From 2acfa34596061a9236bb6a9df1e3f3a0c01d6ff0 Mon Sep 17 00:00:00 2001 From: RogueAI42 Date: Tue, 13 Jun 2017 20:06:38 +1000 Subject: [PATCH 42/71] Python API It uses a meta-language and a CSharpCodeProvider on startup. I will release a tutorial on the forums soon showing how to use it. This commit also adds an extremely basic loading screen which shows while Desktop is getting everything ready. Which can take a while if you have any Python mods. Thanks, IronPython. --- ModLauncher/App.config | 8 + ShiftOS.MFSProfiler/App.config | 8 + .../App.config | 8 + ShiftOS.Modding.VirtualMachine/App.config | 8 + ShiftOS.Updater/App.config | 8 + ShiftOS.WinForms/App.config | 8 + ShiftOS.WinForms/MainMenu/Loading.Designer.cs | 66 + ShiftOS.WinForms/MainMenu/Loading.cs | 31 + ShiftOS.WinForms/MainMenu/Loading.resx | 120 + ShiftOS.WinForms/MainMenu/MainMenu.cs | 13 +- .../Properties/Resources.Designer.cs | 15 +- ShiftOS.WinForms/ShiftOS.WinForms.csproj | 11 + ShiftOS_TheReturn/App.config | 8 + ShiftOS_TheReturn/Commands.cs | 3 +- ShiftOS_TheReturn/Lib/BaseHTTPServer.py | 614 + ShiftOS_TheReturn/Lib/Bastion.py | 180 + ShiftOS_TheReturn/Lib/CGIHTTPServer.py | 378 + ShiftOS_TheReturn/Lib/ConfigParser.py | 753 + ShiftOS_TheReturn/Lib/Cookie.py | 773 + ShiftOS_TheReturn/Lib/DocXMLRPCServer.py | 279 + ShiftOS_TheReturn/Lib/HTMLParser.py | 475 + ShiftOS_TheReturn/Lib/MimeWriter.py | 186 + ShiftOS_TheReturn/Lib/Queue.py | 244 + ShiftOS_TheReturn/Lib/SimpleHTTPServer.py | 235 + ShiftOS_TheReturn/Lib/SimpleXMLRPCServer.py | 708 + ShiftOS_TheReturn/Lib/SocketServer.py | 731 + ShiftOS_TheReturn/Lib/StringIO.py | 324 + ShiftOS_TheReturn/Lib/UserDict.py | 213 + ShiftOS_TheReturn/Lib/UserList.py | 88 + ShiftOS_TheReturn/Lib/UserString.py | 228 + ShiftOS_TheReturn/Lib/_LWPCookieJar.py | 170 + ShiftOS_TheReturn/Lib/_MozillaCookieJar.py | 149 + ShiftOS_TheReturn/Lib/__future__.py | 128 + ShiftOS_TheReturn/Lib/__phello__.foo.py | 1 + ShiftOS_TheReturn/Lib/_abcoll.py | 695 + ShiftOS_TheReturn/Lib/_osx_support.py | 502 + ShiftOS_TheReturn/Lib/_pyio.py | 2037 +++ ShiftOS_TheReturn/Lib/_strptime.py | 478 + ShiftOS_TheReturn/Lib/_threading_local.py | 251 + ShiftOS_TheReturn/Lib/_weakrefset.py | 204 + ShiftOS_TheReturn/Lib/abc.py | 185 + ShiftOS_TheReturn/Lib/aifc.py | 989 ++ ShiftOS_TheReturn/Lib/antigravity.py | 4 + ShiftOS_TheReturn/Lib/anydbm.py | 85 + ShiftOS_TheReturn/Lib/argparse.py | 2374 +++ ShiftOS_TheReturn/Lib/ast.py | 311 + ShiftOS_TheReturn/Lib/asynchat.py | 321 + ShiftOS_TheReturn/Lib/asyncore.py | 659 + ShiftOS_TheReturn/Lib/atexit.py | 65 + ShiftOS_TheReturn/Lib/audiodev.py | 260 + ShiftOS_TheReturn/Lib/base64.py | 367 + ShiftOS_TheReturn/Lib/bdb.py | 645 + ShiftOS_TheReturn/Lib/binhex.py | 518 + ShiftOS_TheReturn/Lib/bisect.py | 92 + ShiftOS_TheReturn/Lib/calendar.py | 713 + ShiftOS_TheReturn/Lib/cgi.py | 1059 ++ ShiftOS_TheReturn/Lib/cgitb.py | 323 + ShiftOS_TheReturn/Lib/chunk.py | 169 + ShiftOS_TheReturn/Lib/cmd.py | 404 + ShiftOS_TheReturn/Lib/code.py | 310 + ShiftOS_TheReturn/Lib/codecs.py | 1113 ++ ShiftOS_TheReturn/Lib/codeop.py | 168 + ShiftOS_TheReturn/Lib/collections.py | 742 + ShiftOS_TheReturn/Lib/colorsys.py | 156 + ShiftOS_TheReturn/Lib/commands.py | 90 + ShiftOS_TheReturn/Lib/compileall.py | 227 + ShiftOS_TheReturn/Lib/contextlib.py | 154 + ShiftOS_TheReturn/Lib/cookielib.py | 1810 +++ ShiftOS_TheReturn/Lib/copy.py | 433 + ShiftOS_TheReturn/Lib/csv.py | 456 + ShiftOS_TheReturn/Lib/ctypes/__init__.py | 554 + ShiftOS_TheReturn/Lib/ctypes/_endian.py | 61 + .../Lib/ctypes/macholib/__init__.py | 9 + ShiftOS_TheReturn/Lib/ctypes/macholib/dyld.py | 166 + .../Lib/ctypes/macholib/dylib.py | 63 + .../Lib/ctypes/macholib/framework.py | 65 + ShiftOS_TheReturn/Lib/ctypes/util.py | 271 + ShiftOS_TheReturn/Lib/ctypes/wintypes.py | 181 + ShiftOS_TheReturn/Lib/decimal.py | 6214 +++++++ ShiftOS_TheReturn/Lib/difflib.py | 2057 +++ ShiftOS_TheReturn/Lib/dircache.py | 41 + ShiftOS_TheReturn/Lib/dis.py | 224 + ShiftOS_TheReturn/Lib/distutils/__init__.py | 13 + .../Lib/distutils/archive_util.py | 243 + .../Lib/distutils/bcppcompiler.py | 394 + ShiftOS_TheReturn/Lib/distutils/ccompiler.py | 1096 ++ ShiftOS_TheReturn/Lib/distutils/cmd.py | 457 + .../Lib/distutils/command/__init__.py | 33 + .../Lib/distutils/command/bdist.py | 146 + .../Lib/distutils/command/bdist_dumb.py | 133 + .../Lib/distutils/command/bdist_rpm.py | 588 + .../Lib/distutils/command/bdist_wininst.py | 368 + .../Lib/distutils/command/build.py | 147 + .../Lib/distutils/command/build_clib.py | 209 + .../Lib/distutils/command/build_ext.py | 768 + .../Lib/distutils/command/build_py.py | 394 + .../Lib/distutils/command/build_scripts.py | 131 + .../Lib/distutils/command/check.py | 149 + .../Lib/distutils/command/clean.py | 80 + .../Lib/distutils/command/config.py | 357 + .../Lib/distutils/command/install.py | 672 + .../Lib/distutils/command/install_data.py | 81 + .../Lib/distutils/command/install_egg_info.py | 78 + .../Lib/distutils/command/install_headers.py | 51 + .../Lib/distutils/command/install_lib.py | 219 + .../Lib/distutils/command/install_scripts.py | 64 + .../Lib/distutils/command/register.py | 315 + .../Lib/distutils/command/sdist.py | 477 + .../Lib/distutils/command/upload.py | 194 + ShiftOS_TheReturn/Lib/distutils/config.py | 116 + ShiftOS_TheReturn/Lib/distutils/core.py | 239 + .../Lib/distutils/cygwinccompiler.py | 463 + ShiftOS_TheReturn/Lib/distutils/debug.py | 7 + ShiftOS_TheReturn/Lib/distutils/dep_util.py | 89 + ShiftOS_TheReturn/Lib/distutils/dir_util.py | 214 + ShiftOS_TheReturn/Lib/distutils/dist.py | 1249 ++ .../Lib/distutils/emxccompiler.py | 319 + ShiftOS_TheReturn/Lib/distutils/errors.py | 88 + ShiftOS_TheReturn/Lib/distutils/extension.py | 255 + .../Lib/distutils/fancy_getopt.py | 484 + ShiftOS_TheReturn/Lib/distutils/file_util.py | 239 + ShiftOS_TheReturn/Lib/distutils/filelist.py | 343 + ShiftOS_TheReturn/Lib/distutils/log.py | 71 + .../Lib/distutils/msvccompiler.py | 659 + ShiftOS_TheReturn/Lib/distutils/spawn.py | 226 + ShiftOS_TheReturn/Lib/distutils/sysconfig.py | 483 + ShiftOS_TheReturn/Lib/distutils/text_file.py | 304 + .../Lib/distutils/unixccompiler.py | 310 + ShiftOS_TheReturn/Lib/distutils/util.py | 477 + ShiftOS_TheReturn/Lib/distutils/version.py | 299 + .../Lib/distutils/versionpredicate.py | 164 + ShiftOS_TheReturn/Lib/doctest.py | 2817 ++++ ShiftOS_TheReturn/Lib/dumbdbm.py | 249 + ShiftOS_TheReturn/Lib/dummy_thread.py | 145 + ShiftOS_TheReturn/Lib/dummy_threading.py | 78 + ShiftOS_TheReturn/Lib/email/__init__.py | 123 + ShiftOS_TheReturn/Lib/email/_parseaddr.py | 497 + ShiftOS_TheReturn/Lib/email/base64mime.py | 183 + ShiftOS_TheReturn/Lib/email/charset.py | 397 + ShiftOS_TheReturn/Lib/email/encoders.py | 82 + ShiftOS_TheReturn/Lib/email/errors.py | 57 + ShiftOS_TheReturn/Lib/email/feedparser.py | 505 + ShiftOS_TheReturn/Lib/email/generator.py | 371 + ShiftOS_TheReturn/Lib/email/header.py | 514 + ShiftOS_TheReturn/Lib/email/iterators.py | 73 + ShiftOS_TheReturn/Lib/email/message.py | 797 + ShiftOS_TheReturn/Lib/email/mime/__init__.py | 0 .../Lib/email/mime/application.py | 36 + ShiftOS_TheReturn/Lib/email/mime/audio.py | 73 + ShiftOS_TheReturn/Lib/email/mime/base.py | 26 + ShiftOS_TheReturn/Lib/email/mime/image.py | 46 + ShiftOS_TheReturn/Lib/email/mime/message.py | 34 + ShiftOS_TheReturn/Lib/email/mime/multipart.py | 47 + .../Lib/email/mime/nonmultipart.py | 22 + ShiftOS_TheReturn/Lib/email/mime/text.py | 30 + ShiftOS_TheReturn/Lib/email/parser.py | 91 + ShiftOS_TheReturn/Lib/email/quoprimime.py | 336 + ShiftOS_TheReturn/Lib/email/utils.py | 323 + ShiftOS_TheReturn/Lib/encodings/__init__.py | 157 + ShiftOS_TheReturn/Lib/encodings/aliases.py | 527 + ShiftOS_TheReturn/Lib/encodings/ascii.py | 50 + .../Lib/encodings/base64_codec.py | 80 + ShiftOS_TheReturn/Lib/encodings/bz2_codec.py | 103 + ShiftOS_TheReturn/Lib/encodings/charmap.py | 69 + ShiftOS_TheReturn/Lib/encodings/cp037.py | 307 + ShiftOS_TheReturn/Lib/encodings/cp1006.py | 307 + ShiftOS_TheReturn/Lib/encodings/cp1026.py | 307 + ShiftOS_TheReturn/Lib/encodings/cp1140.py | 307 + ShiftOS_TheReturn/Lib/encodings/cp1250.py | 307 + ShiftOS_TheReturn/Lib/encodings/cp1251.py | 307 + ShiftOS_TheReturn/Lib/encodings/cp1252.py | 307 + ShiftOS_TheReturn/Lib/encodings/cp1253.py | 307 + ShiftOS_TheReturn/Lib/encodings/cp1254.py | 307 + ShiftOS_TheReturn/Lib/encodings/cp1255.py | 307 + ShiftOS_TheReturn/Lib/encodings/cp1256.py | 307 + ShiftOS_TheReturn/Lib/encodings/cp1257.py | 307 + ShiftOS_TheReturn/Lib/encodings/cp1258.py | 307 + ShiftOS_TheReturn/Lib/encodings/cp424.py | 307 + ShiftOS_TheReturn/Lib/encodings/cp437.py | 698 + ShiftOS_TheReturn/Lib/encodings/cp500.py | 307 + ShiftOS_TheReturn/Lib/encodings/cp720.py | 309 + ShiftOS_TheReturn/Lib/encodings/cp737.py | 698 + ShiftOS_TheReturn/Lib/encodings/cp775.py | 697 + ShiftOS_TheReturn/Lib/encodings/cp850.py | 698 + ShiftOS_TheReturn/Lib/encodings/cp852.py | 698 + ShiftOS_TheReturn/Lib/encodings/cp855.py | 698 + ShiftOS_TheReturn/Lib/encodings/cp856.py | 307 + ShiftOS_TheReturn/Lib/encodings/cp857.py | 694 + ShiftOS_TheReturn/Lib/encodings/cp858.py | 698 + ShiftOS_TheReturn/Lib/encodings/cp860.py | 698 + ShiftOS_TheReturn/Lib/encodings/cp861.py | 698 + ShiftOS_TheReturn/Lib/encodings/cp862.py | 698 + ShiftOS_TheReturn/Lib/encodings/cp863.py | 698 + ShiftOS_TheReturn/Lib/encodings/cp864.py | 690 + ShiftOS_TheReturn/Lib/encodings/cp865.py | 698 + ShiftOS_TheReturn/Lib/encodings/cp866.py | 698 + ShiftOS_TheReturn/Lib/encodings/cp869.py | 689 + ShiftOS_TheReturn/Lib/encodings/cp874.py | 307 + ShiftOS_TheReturn/Lib/encodings/cp875.py | 307 + ShiftOS_TheReturn/Lib/encodings/hex_codec.py | 80 + ShiftOS_TheReturn/Lib/encodings/hp_roman8.py | 152 + ShiftOS_TheReturn/Lib/encodings/idna.py | 288 + ShiftOS_TheReturn/Lib/encodings/iso8859_1.py | 307 + ShiftOS_TheReturn/Lib/encodings/iso8859_10.py | 307 + ShiftOS_TheReturn/Lib/encodings/iso8859_11.py | 307 + ShiftOS_TheReturn/Lib/encodings/iso8859_13.py | 307 + ShiftOS_TheReturn/Lib/encodings/iso8859_14.py | 307 + ShiftOS_TheReturn/Lib/encodings/iso8859_15.py | 307 + ShiftOS_TheReturn/Lib/encodings/iso8859_16.py | 307 + ShiftOS_TheReturn/Lib/encodings/iso8859_2.py | 307 + ShiftOS_TheReturn/Lib/encodings/iso8859_3.py | 307 + ShiftOS_TheReturn/Lib/encodings/iso8859_4.py | 307 + ShiftOS_TheReturn/Lib/encodings/iso8859_5.py | 307 + ShiftOS_TheReturn/Lib/encodings/iso8859_6.py | 307 + ShiftOS_TheReturn/Lib/encodings/iso8859_7.py | 307 + ShiftOS_TheReturn/Lib/encodings/iso8859_8.py | 307 + ShiftOS_TheReturn/Lib/encodings/iso8859_9.py | 307 + ShiftOS_TheReturn/Lib/encodings/koi8_r.py | 307 + ShiftOS_TheReturn/Lib/encodings/koi8_u.py | 307 + ShiftOS_TheReturn/Lib/encodings/latin_1.py | 50 + ShiftOS_TheReturn/Lib/encodings/mac_arabic.py | 698 + .../Lib/encodings/mac_centeuro.py | 307 + .../Lib/encodings/mac_croatian.py | 307 + .../Lib/encodings/mac_cyrillic.py | 307 + ShiftOS_TheReturn/Lib/encodings/mac_farsi.py | 307 + ShiftOS_TheReturn/Lib/encodings/mac_greek.py | 307 + .../Lib/encodings/mac_iceland.py | 307 + ShiftOS_TheReturn/Lib/encodings/mac_latin2.py | 183 + ShiftOS_TheReturn/Lib/encodings/mac_roman.py | 307 + .../Lib/encodings/mac_romanian.py | 307 + .../Lib/encodings/mac_turkish.py | 307 + ShiftOS_TheReturn/Lib/encodings/mbcs.py | 47 + ShiftOS_TheReturn/Lib/encodings/palmos.py | 83 + ShiftOS_TheReturn/Lib/encodings/ptcp154.py | 175 + ShiftOS_TheReturn/Lib/encodings/punycode.py | 238 + .../Lib/encodings/quopri_codec.py | 76 + .../Lib/encodings/raw_unicode_escape.py | 45 + ShiftOS_TheReturn/Lib/encodings/rot_13.py | 119 + .../Lib/encodings/string_escape.py | 38 + ShiftOS_TheReturn/Lib/encodings/tis_620.py | 307 + ShiftOS_TheReturn/Lib/encodings/undefined.py | 49 + .../Lib/encodings/unicode_escape.py | 45 + .../Lib/encodings/unicode_internal.py | 45 + ShiftOS_TheReturn/Lib/encodings/utf_16.py | 126 + ShiftOS_TheReturn/Lib/encodings/utf_16_be.py | 42 + ShiftOS_TheReturn/Lib/encodings/utf_16_le.py | 42 + ShiftOS_TheReturn/Lib/encodings/utf_32.py | 150 + ShiftOS_TheReturn/Lib/encodings/utf_32_be.py | 37 + ShiftOS_TheReturn/Lib/encodings/utf_32_le.py | 37 + ShiftOS_TheReturn/Lib/encodings/utf_7.py | 38 + ShiftOS_TheReturn/Lib/encodings/utf_8.py | 42 + ShiftOS_TheReturn/Lib/encodings/utf_8_sig.py | 117 + ShiftOS_TheReturn/Lib/encodings/uu_codec.py | 130 + ShiftOS_TheReturn/Lib/encodings/zlib_codec.py | 103 + ShiftOS_TheReturn/Lib/ensurepip/__init__.py | 238 + ShiftOS_TheReturn/Lib/ensurepip/__main__.py | 4 + .../_bundled/pip-8.1.1-py2.py3-none-any.whl | Bin 0 -> 1197706 bytes .../setuptools-20.10.1-py2.py3-none-any.whl | Bin 0 -> 509211 bytes ShiftOS_TheReturn/Lib/ensurepip/_uninstall.py | 30 + ShiftOS_TheReturn/Lib/filecmp.py | 296 + ShiftOS_TheReturn/Lib/fileinput.py | 405 + ShiftOS_TheReturn/Lib/fnmatch.py | 120 + ShiftOS_TheReturn/Lib/formatter.py | 445 + ShiftOS_TheReturn/Lib/fpformat.py | 145 + ShiftOS_TheReturn/Lib/fractions.py | 605 + ShiftOS_TheReturn/Lib/ftplib.py | 1078 ++ ShiftOS_TheReturn/Lib/functools.py | 100 + ShiftOS_TheReturn/Lib/genericpath.py | 113 + ShiftOS_TheReturn/Lib/getopt.py | 210 + ShiftOS_TheReturn/Lib/getpass.py | 179 + ShiftOS_TheReturn/Lib/gettext.py | 594 + ShiftOS_TheReturn/Lib/glob.py | 100 + ShiftOS_TheReturn/Lib/gzip.py | 527 + ShiftOS_TheReturn/Lib/hashlib.py | 221 + ShiftOS_TheReturn/Lib/heapq.py | 485 + ShiftOS_TheReturn/Lib/hmac.py | 136 + ShiftOS_TheReturn/Lib/htmlentitydefs.py | 273 + ShiftOS_TheReturn/Lib/htmllib.py | 491 + ShiftOS_TheReturn/Lib/httplib.py | 1445 ++ ShiftOS_TheReturn/Lib/ihooks.py | 554 + ShiftOS_TheReturn/Lib/imaplib.py | 1536 ++ ShiftOS_TheReturn/Lib/imghdr.py | 159 + ShiftOS_TheReturn/Lib/importlib/__init__.py | 38 + ShiftOS_TheReturn/Lib/imputil.py | 725 + ShiftOS_TheReturn/Lib/inspect.py | 1064 ++ ShiftOS_TheReturn/Lib/io.py | 90 + ShiftOS_TheReturn/Lib/json/__init__.py | 352 + ShiftOS_TheReturn/Lib/json/decoder.py | 383 + ShiftOS_TheReturn/Lib/json/encoder.py | 448 + ShiftOS_TheReturn/Lib/json/scanner.py | 67 + ShiftOS_TheReturn/Lib/json/tool.py | 40 + ShiftOS_TheReturn/Lib/keyword.py | 93 + ShiftOS_TheReturn/Lib/lib2to3/__init__.py | 1 + ShiftOS_TheReturn/Lib/lib2to3/__main__.py | 4 + ShiftOS_TheReturn/Lib/lib2to3/btm_matcher.py | 168 + ShiftOS_TheReturn/Lib/lib2to3/btm_utils.py | 283 + ShiftOS_TheReturn/Lib/lib2to3/fixer_base.py | 189 + ShiftOS_TheReturn/Lib/lib2to3/fixer_util.py | 432 + .../Lib/lib2to3/fixes/__init__.py | 1 + .../Lib/lib2to3/fixes/fix_apply.py | 59 + .../Lib/lib2to3/fixes/fix_asserts.py | 34 + .../Lib/lib2to3/fixes/fix_basestring.py | 14 + .../Lib/lib2to3/fixes/fix_buffer.py | 22 + .../Lib/lib2to3/fixes/fix_callable.py | 37 + .../Lib/lib2to3/fixes/fix_dict.py | 107 + .../Lib/lib2to3/fixes/fix_except.py | 93 + .../Lib/lib2to3/fixes/fix_exec.py | 40 + .../Lib/lib2to3/fixes/fix_execfile.py | 52 + .../Lib/lib2to3/fixes/fix_exitfunc.py | 72 + .../Lib/lib2to3/fixes/fix_filter.py | 76 + .../Lib/lib2to3/fixes/fix_funcattrs.py | 21 + .../Lib/lib2to3/fixes/fix_future.py | 22 + .../Lib/lib2to3/fixes/fix_getcwdu.py | 19 + .../Lib/lib2to3/fixes/fix_has_key.py | 110 + .../Lib/lib2to3/fixes/fix_idioms.py | 152 + .../Lib/lib2to3/fixes/fix_import.py | 99 + .../Lib/lib2to3/fixes/fix_imports.py | 145 + .../Lib/lib2to3/fixes/fix_imports2.py | 16 + .../Lib/lib2to3/fixes/fix_input.py | 26 + .../Lib/lib2to3/fixes/fix_intern.py | 46 + .../Lib/lib2to3/fixes/fix_isinstance.py | 52 + .../Lib/lib2to3/fixes/fix_itertools.py | 43 + .../lib2to3/fixes/fix_itertools_imports.py | 57 + .../Lib/lib2to3/fixes/fix_long.py | 19 + .../Lib/lib2to3/fixes/fix_map.py | 91 + .../Lib/lib2to3/fixes/fix_metaclass.py | 228 + .../Lib/lib2to3/fixes/fix_methodattrs.py | 24 + ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_ne.py | 23 + .../Lib/lib2to3/fixes/fix_next.py | 103 + .../Lib/lib2to3/fixes/fix_nonzero.py | 21 + .../Lib/lib2to3/fixes/fix_numliterals.py | 28 + .../Lib/lib2to3/fixes/fix_operator.py | 96 + .../Lib/lib2to3/fixes/fix_paren.py | 44 + .../Lib/lib2to3/fixes/fix_print.py | 87 + .../Lib/lib2to3/fixes/fix_raise.py | 90 + .../Lib/lib2to3/fixes/fix_raw_input.py | 17 + .../Lib/lib2to3/fixes/fix_reduce.py | 35 + .../Lib/lib2to3/fixes/fix_renames.py | 70 + .../Lib/lib2to3/fixes/fix_repr.py | 23 + .../Lib/lib2to3/fixes/fix_set_literal.py | 53 + .../Lib/lib2to3/fixes/fix_standarderror.py | 18 + .../Lib/lib2to3/fixes/fix_sys_exc.py | 30 + .../Lib/lib2to3/fixes/fix_throw.py | 56 + .../Lib/lib2to3/fixes/fix_tuple_params.py | 175 + .../Lib/lib2to3/fixes/fix_types.py | 62 + .../Lib/lib2to3/fixes/fix_unicode.py | 42 + .../Lib/lib2to3/fixes/fix_urllib.py | 197 + .../Lib/lib2to3/fixes/fix_ws_comma.py | 39 + .../Lib/lib2to3/fixes/fix_xrange.py | 73 + .../Lib/lib2to3/fixes/fix_xreadlines.py | 25 + .../Lib/lib2to3/fixes/fix_zip.py | 35 + ShiftOS_TheReturn/Lib/lib2to3/main.py | 269 + ShiftOS_TheReturn/Lib/lib2to3/patcomp.py | 205 + .../Lib/lib2to3/pgen2/__init__.py | 4 + ShiftOS_TheReturn/Lib/lib2to3/pgen2/conv.py | 257 + ShiftOS_TheReturn/Lib/lib2to3/pgen2/driver.py | 157 + .../Lib/lib2to3/pgen2/grammar.py | 185 + .../Lib/lib2to3/pgen2/literals.py | 60 + ShiftOS_TheReturn/Lib/lib2to3/pgen2/parse.py | 201 + ShiftOS_TheReturn/Lib/lib2to3/pgen2/pgen.py | 386 + ShiftOS_TheReturn/Lib/lib2to3/pgen2/token.py | 83 + .../Lib/lib2to3/pgen2/tokenize.py | 502 + ShiftOS_TheReturn/Lib/lib2to3/pygram.py | 40 + ShiftOS_TheReturn/Lib/lib2to3/pytree.py | 887 + ShiftOS_TheReturn/Lib/lib2to3/refactor.py | 747 + ShiftOS_TheReturn/Lib/linecache.py | 139 + ShiftOS_TheReturn/Lib/locale.py | 2064 +++ ShiftOS_TheReturn/Lib/logging/__init__.py | 1744 ++ ShiftOS_TheReturn/Lib/logging/config.py | 919 ++ ShiftOS_TheReturn/Lib/logging/handlers.py | 1227 ++ ShiftOS_TheReturn/Lib/macpath.py | 216 + ShiftOS_TheReturn/Lib/macurl2path.py | 77 + ShiftOS_TheReturn/Lib/mailbox.py | 2240 +++ ShiftOS_TheReturn/Lib/mailcap.py | 255 + ShiftOS_TheReturn/Lib/markupbase.py | 396 + ShiftOS_TheReturn/Lib/md5.py | 14 + ShiftOS_TheReturn/Lib/mhlib.py | 1005 ++ ShiftOS_TheReturn/Lib/mimetools.py | 250 + ShiftOS_TheReturn/Lib/mimetypes.py | 598 + ShiftOS_TheReturn/Lib/mimify.py | 468 + ShiftOS_TheReturn/Lib/modulefinder.py | 716 + ShiftOS_TheReturn/Lib/multifile.py | 162 + .../Lib/multiprocessing/__init__.py | 281 + .../Lib/multiprocessing/connection.py | 477 + .../Lib/multiprocessing/dummy/__init__.py | 153 + .../Lib/multiprocessing/dummy/connection.py | 87 + .../Lib/multiprocessing/forking.py | 526 + ShiftOS_TheReturn/Lib/multiprocessing/heap.py | 254 + .../Lib/multiprocessing/managers.py | 1117 ++ ShiftOS_TheReturn/Lib/multiprocessing/pool.py | 744 + .../Lib/multiprocessing/process.py | 323 + .../Lib/multiprocessing/queues.py | 395 + .../Lib/multiprocessing/reduction.py | 215 + .../Lib/multiprocessing/sharedctypes.py | 271 + .../Lib/multiprocessing/synchronize.py | 344 + ShiftOS_TheReturn/Lib/multiprocessing/util.py | 350 + ShiftOS_TheReturn/Lib/mutex.py | 55 + ShiftOS_TheReturn/Lib/netrc.py | 145 + ShiftOS_TheReturn/Lib/new.py | 17 + ShiftOS_TheReturn/Lib/nntplib.py | 636 + ShiftOS_TheReturn/Lib/ntpath.py | 550 + ShiftOS_TheReturn/Lib/nturl2path.py | 68 + ShiftOS_TheReturn/Lib/numbers.py | 391 + ShiftOS_TheReturn/Lib/opcode.py | 192 + ShiftOS_TheReturn/Lib/optparse.py | 1704 ++ ShiftOS_TheReturn/Lib/os.py | 742 + ShiftOS_TheReturn/Lib/os2emxpath.py | 160 + ShiftOS_TheReturn/Lib/pdb.py | 1341 ++ ShiftOS_TheReturn/Lib/pickle.py | 1397 ++ ShiftOS_TheReturn/Lib/pickletools.py | 2274 +++ ShiftOS_TheReturn/Lib/pipes.py | 278 + ShiftOS_TheReturn/Lib/pkgutil.py | 591 + ShiftOS_TheReturn/Lib/platform.py | 1604 ++ ShiftOS_TheReturn/Lib/plistlib.py | 474 + ShiftOS_TheReturn/Lib/popen2.py | 201 + ShiftOS_TheReturn/Lib/poplib.py | 427 + ShiftOS_TheReturn/Lib/posixfile.py | 237 + ShiftOS_TheReturn/Lib/posixpath.py | 439 + ShiftOS_TheReturn/Lib/pprint.py | 346 + ShiftOS_TheReturn/Lib/profile.py | 610 + ShiftOS_TheReturn/Lib/pstats.py | 705 + ShiftOS_TheReturn/Lib/py_compile.py | 118 + ShiftOS_TheReturn/Lib/pyclbr.py | 344 + ShiftOS_TheReturn/Lib/pydoc.py | 2409 +++ ShiftOS_TheReturn/Lib/pydoc_data/__init__.py | 0 ShiftOS_TheReturn/Lib/pydoc_data/topics.py | 13325 ++++++++++++++++ ShiftOS_TheReturn/Lib/quopri.py | 237 + ShiftOS_TheReturn/Lib/random.py | 910 ++ ShiftOS_TheReturn/Lib/repr.py | 132 + ShiftOS_TheReturn/Lib/rexec.py | 588 + ShiftOS_TheReturn/Lib/rfc822.py | 1016 ++ ShiftOS_TheReturn/Lib/rlcompleter.py | 172 + ShiftOS_TheReturn/Lib/robotparser.py | 233 + ShiftOS_TheReturn/Lib/runpy.py | 290 + ShiftOS_TheReturn/Lib/sched.py | 134 + ShiftOS_TheReturn/Lib/sets.py | 557 + ShiftOS_TheReturn/Lib/sgmllib.py | 553 + ShiftOS_TheReturn/Lib/sha.py | 15 + ShiftOS_TheReturn/Lib/shelve.py | 243 + ShiftOS_TheReturn/Lib/shlex.py | 292 + ShiftOS_TheReturn/Lib/shutil.py | 564 + .../Lib/site-packages/README.txt | 2 + ShiftOS_TheReturn/Lib/site.py | 604 + ShiftOS_TheReturn/Lib/smtpd.py | 555 + ShiftOS_TheReturn/Lib/smtplib.py | 883 + ShiftOS_TheReturn/Lib/sndhdr.py | 228 + ShiftOS_TheReturn/Lib/sqlite3/__init__.py | 32 + ShiftOS_TheReturn/Lib/sqlite3/dbapi2.py | 90 + ShiftOS_TheReturn/Lib/sqlite3/dump.py | 70 + ShiftOS_TheReturn/Lib/sre_compile.py | 596 + ShiftOS_TheReturn/Lib/sre_constants.py | 263 + ShiftOS_TheReturn/Lib/sre_parse.py | 834 + ShiftOS_TheReturn/Lib/ssl.py | 1037 ++ ShiftOS_TheReturn/Lib/stat.py | 96 + ShiftOS_TheReturn/Lib/statvfs.py | 18 + ShiftOS_TheReturn/Lib/string.py | 656 + ShiftOS_TheReturn/Lib/stringold.py | 432 + ShiftOS_TheReturn/Lib/stringprep.py | 272 + ShiftOS_TheReturn/Lib/struct.py | 3 + ShiftOS_TheReturn/Lib/subprocess.py | 1748 ++ ShiftOS_TheReturn/Lib/sunau.py | 493 + ShiftOS_TheReturn/Lib/sunaudio.py | 49 + ShiftOS_TheReturn/Lib/symbol.py | 114 + ShiftOS_TheReturn/Lib/sysconfig.py | 642 + ShiftOS_TheReturn/Lib/tabnanny.py | 329 + ShiftOS_TheReturn/Lib/tarfile.py | 2628 +++ ShiftOS_TheReturn/Lib/telnetlib.py | 791 + ShiftOS_TheReturn/Lib/tempfile.py | 640 + ShiftOS_TheReturn/Lib/textwrap.py | 429 + ShiftOS_TheReturn/Lib/this.py | 28 + ShiftOS_TheReturn/Lib/threading.py | 1322 ++ ShiftOS_TheReturn/Lib/timeit.py | 343 + ShiftOS_TheReturn/Lib/toaiff.py | 110 + ShiftOS_TheReturn/Lib/token.py | 140 + ShiftOS_TheReturn/Lib/tokenize.py | 449 + ShiftOS_TheReturn/Lib/trace.py | 819 + ShiftOS_TheReturn/Lib/traceback.py | 320 + ShiftOS_TheReturn/Lib/types.py | 86 + ShiftOS_TheReturn/Lib/unittest/__init__.py | 69 + ShiftOS_TheReturn/Lib/unittest/__main__.py | 12 + ShiftOS_TheReturn/Lib/unittest/case.py | 1076 ++ ShiftOS_TheReturn/Lib/unittest/loader.py | 316 + ShiftOS_TheReturn/Lib/unittest/main.py | 236 + ShiftOS_TheReturn/Lib/unittest/result.py | 193 + ShiftOS_TheReturn/Lib/unittest/runner.py | 196 + ShiftOS_TheReturn/Lib/unittest/signals.py | 71 + ShiftOS_TheReturn/Lib/unittest/suite.py | 303 + ShiftOS_TheReturn/Lib/unittest/util.py | 156 + ShiftOS_TheReturn/Lib/urllib.py | 1660 ++ ShiftOS_TheReturn/Lib/urllib2.py | 1489 ++ ShiftOS_TheReturn/Lib/urlparse.py | 428 + ShiftOS_TheReturn/Lib/user.py | 48 + ShiftOS_TheReturn/Lib/uu.py | 196 + ShiftOS_TheReturn/Lib/uuid.py | 597 + ShiftOS_TheReturn/Lib/warnings.py | 422 + ShiftOS_TheReturn/Lib/wave.py | 517 + ShiftOS_TheReturn/Lib/weakref.py | 458 + ShiftOS_TheReturn/Lib/webbrowser.py | 704 + ShiftOS_TheReturn/Lib/whichdb.py | 117 + ShiftOS_TheReturn/Lib/wsgiref/__init__.py | 23 + ShiftOS_TheReturn/Lib/wsgiref/handlers.py | 450 + ShiftOS_TheReturn/Lib/wsgiref/headers.py | 169 + .../Lib/wsgiref/simple_server.py | 163 + ShiftOS_TheReturn/Lib/wsgiref/util.py | 165 + ShiftOS_TheReturn/Lib/wsgiref/validate.py | 432 + ShiftOS_TheReturn/Lib/xdrlib.py | 248 + ShiftOS_TheReturn/Lib/xml/__init__.py | 41 + ShiftOS_TheReturn/Lib/xml/dom/NodeFilter.py | 27 + ShiftOS_TheReturn/Lib/xml/dom/__init__.py | 139 + ShiftOS_TheReturn/Lib/xml/dom/domreg.py | 99 + ShiftOS_TheReturn/Lib/xml/dom/minicompat.py | 110 + ShiftOS_TheReturn/Lib/xml/dom/minidom.py | 1941 +++ ShiftOS_TheReturn/Lib/xml/dom/pulldom.py | 351 + ShiftOS_TheReturn/Lib/xml/dom/xmlbuilder.py | 386 + .../Lib/xml/etree/ElementInclude.py | 142 + .../Lib/xml/etree/ElementPath.py | 303 + .../Lib/xml/etree/ElementTree.py | 1684 ++ .../Lib/xml/etree/SimpleXMLTreeBuilder.py | 143 + ShiftOS_TheReturn/Lib/xml/etree/__init__.py | 33 + ShiftOS_TheReturn/Lib/xml/parsers/__init__.py | 8 + ShiftOS_TheReturn/Lib/xml/sax/__init__.py | 108 + ShiftOS_TheReturn/Lib/xml/sax/_exceptions.py | 131 + ShiftOS_TheReturn/Lib/xml/sax/handler.py | 342 + ShiftOS_TheReturn/Lib/xml/sax/saxutils.py | 353 + ShiftOS_TheReturn/Lib/xml/sax/xmlreader.py | 381 + ShiftOS_TheReturn/Lib/xmllib.py | 930 ++ ShiftOS_TheReturn/Lib/xmlrpclib.py | 1656 ++ ShiftOS_TheReturn/Lib/zipfile.py | 1541 ++ .../Properties/Resources.Designer.cs | 74 +- ShiftOS_TheReturn/Properties/Resources.resx | 3 + ShiftOS_TheReturn/PythonAPI.cs | 309 + ShiftOS_TheReturn/ReflectMan.cs | 45 +- ShiftOS_TheReturn/Resources/pywintemplate.txt | 68 + ShiftOS_TheReturn/ShiftOS.Engine.csproj | 1575 ++ ShiftOS_TheReturn/packages.config | 4 + 535 files changed, 208623 insertions(+), 65 deletions(-) create mode 100644 ShiftOS.WinForms/MainMenu/Loading.Designer.cs create mode 100644 ShiftOS.WinForms/MainMenu/Loading.cs create mode 100644 ShiftOS.WinForms/MainMenu/Loading.resx create mode 100644 ShiftOS_TheReturn/Lib/BaseHTTPServer.py create mode 100644 ShiftOS_TheReturn/Lib/Bastion.py create mode 100644 ShiftOS_TheReturn/Lib/CGIHTTPServer.py create mode 100644 ShiftOS_TheReturn/Lib/ConfigParser.py create mode 100644 ShiftOS_TheReturn/Lib/Cookie.py create mode 100644 ShiftOS_TheReturn/Lib/DocXMLRPCServer.py create mode 100644 ShiftOS_TheReturn/Lib/HTMLParser.py create mode 100644 ShiftOS_TheReturn/Lib/MimeWriter.py create mode 100644 ShiftOS_TheReturn/Lib/Queue.py create mode 100644 ShiftOS_TheReturn/Lib/SimpleHTTPServer.py create mode 100644 ShiftOS_TheReturn/Lib/SimpleXMLRPCServer.py create mode 100644 ShiftOS_TheReturn/Lib/SocketServer.py create mode 100644 ShiftOS_TheReturn/Lib/StringIO.py create mode 100644 ShiftOS_TheReturn/Lib/UserDict.py create mode 100644 ShiftOS_TheReturn/Lib/UserList.py create mode 100644 ShiftOS_TheReturn/Lib/UserString.py create mode 100644 ShiftOS_TheReturn/Lib/_LWPCookieJar.py create mode 100644 ShiftOS_TheReturn/Lib/_MozillaCookieJar.py create mode 100644 ShiftOS_TheReturn/Lib/__future__.py create mode 100644 ShiftOS_TheReturn/Lib/__phello__.foo.py create mode 100644 ShiftOS_TheReturn/Lib/_abcoll.py create mode 100644 ShiftOS_TheReturn/Lib/_osx_support.py create mode 100644 ShiftOS_TheReturn/Lib/_pyio.py create mode 100644 ShiftOS_TheReturn/Lib/_strptime.py create mode 100644 ShiftOS_TheReturn/Lib/_threading_local.py create mode 100644 ShiftOS_TheReturn/Lib/_weakrefset.py create mode 100644 ShiftOS_TheReturn/Lib/abc.py create mode 100644 ShiftOS_TheReturn/Lib/aifc.py create mode 100644 ShiftOS_TheReturn/Lib/antigravity.py create mode 100644 ShiftOS_TheReturn/Lib/anydbm.py create mode 100644 ShiftOS_TheReturn/Lib/argparse.py create mode 100644 ShiftOS_TheReturn/Lib/ast.py create mode 100644 ShiftOS_TheReturn/Lib/asynchat.py create mode 100644 ShiftOS_TheReturn/Lib/asyncore.py create mode 100644 ShiftOS_TheReturn/Lib/atexit.py create mode 100644 ShiftOS_TheReturn/Lib/audiodev.py create mode 100644 ShiftOS_TheReturn/Lib/base64.py create mode 100644 ShiftOS_TheReturn/Lib/bdb.py create mode 100644 ShiftOS_TheReturn/Lib/binhex.py create mode 100644 ShiftOS_TheReturn/Lib/bisect.py create mode 100644 ShiftOS_TheReturn/Lib/calendar.py create mode 100644 ShiftOS_TheReturn/Lib/cgi.py create mode 100644 ShiftOS_TheReturn/Lib/cgitb.py create mode 100644 ShiftOS_TheReturn/Lib/chunk.py create mode 100644 ShiftOS_TheReturn/Lib/cmd.py create mode 100644 ShiftOS_TheReturn/Lib/code.py create mode 100644 ShiftOS_TheReturn/Lib/codecs.py create mode 100644 ShiftOS_TheReturn/Lib/codeop.py create mode 100644 ShiftOS_TheReturn/Lib/collections.py create mode 100644 ShiftOS_TheReturn/Lib/colorsys.py create mode 100644 ShiftOS_TheReturn/Lib/commands.py create mode 100644 ShiftOS_TheReturn/Lib/compileall.py create mode 100644 ShiftOS_TheReturn/Lib/contextlib.py create mode 100644 ShiftOS_TheReturn/Lib/cookielib.py create mode 100644 ShiftOS_TheReturn/Lib/copy.py create mode 100644 ShiftOS_TheReturn/Lib/csv.py create mode 100644 ShiftOS_TheReturn/Lib/ctypes/__init__.py create mode 100644 ShiftOS_TheReturn/Lib/ctypes/_endian.py create mode 100644 ShiftOS_TheReturn/Lib/ctypes/macholib/__init__.py create mode 100644 ShiftOS_TheReturn/Lib/ctypes/macholib/dyld.py create mode 100644 ShiftOS_TheReturn/Lib/ctypes/macholib/dylib.py create mode 100644 ShiftOS_TheReturn/Lib/ctypes/macholib/framework.py create mode 100644 ShiftOS_TheReturn/Lib/ctypes/util.py create mode 100644 ShiftOS_TheReturn/Lib/ctypes/wintypes.py create mode 100644 ShiftOS_TheReturn/Lib/decimal.py create mode 100644 ShiftOS_TheReturn/Lib/difflib.py create mode 100644 ShiftOS_TheReturn/Lib/dircache.py create mode 100644 ShiftOS_TheReturn/Lib/dis.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/__init__.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/archive_util.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/bcppcompiler.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/ccompiler.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/cmd.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/command/__init__.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/command/bdist.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/command/bdist_dumb.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/command/bdist_rpm.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/command/bdist_wininst.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/command/build.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/command/build_clib.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/command/build_ext.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/command/build_py.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/command/build_scripts.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/command/check.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/command/clean.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/command/config.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/command/install.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/command/install_data.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/command/install_egg_info.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/command/install_headers.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/command/install_lib.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/command/install_scripts.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/command/register.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/command/sdist.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/command/upload.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/config.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/core.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/cygwinccompiler.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/debug.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/dep_util.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/dir_util.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/dist.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/emxccompiler.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/errors.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/extension.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/fancy_getopt.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/file_util.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/filelist.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/log.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/msvccompiler.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/spawn.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/sysconfig.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/text_file.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/unixccompiler.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/util.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/version.py create mode 100644 ShiftOS_TheReturn/Lib/distutils/versionpredicate.py create mode 100644 ShiftOS_TheReturn/Lib/doctest.py create mode 100644 ShiftOS_TheReturn/Lib/dumbdbm.py create mode 100644 ShiftOS_TheReturn/Lib/dummy_thread.py create mode 100644 ShiftOS_TheReturn/Lib/dummy_threading.py create mode 100644 ShiftOS_TheReturn/Lib/email/__init__.py create mode 100644 ShiftOS_TheReturn/Lib/email/_parseaddr.py create mode 100644 ShiftOS_TheReturn/Lib/email/base64mime.py create mode 100644 ShiftOS_TheReturn/Lib/email/charset.py create mode 100644 ShiftOS_TheReturn/Lib/email/encoders.py create mode 100644 ShiftOS_TheReturn/Lib/email/errors.py create mode 100644 ShiftOS_TheReturn/Lib/email/feedparser.py create mode 100644 ShiftOS_TheReturn/Lib/email/generator.py create mode 100644 ShiftOS_TheReturn/Lib/email/header.py create mode 100644 ShiftOS_TheReturn/Lib/email/iterators.py create mode 100644 ShiftOS_TheReturn/Lib/email/message.py create mode 100644 ShiftOS_TheReturn/Lib/email/mime/__init__.py create mode 100644 ShiftOS_TheReturn/Lib/email/mime/application.py create mode 100644 ShiftOS_TheReturn/Lib/email/mime/audio.py create mode 100644 ShiftOS_TheReturn/Lib/email/mime/base.py create mode 100644 ShiftOS_TheReturn/Lib/email/mime/image.py create mode 100644 ShiftOS_TheReturn/Lib/email/mime/message.py create mode 100644 ShiftOS_TheReturn/Lib/email/mime/multipart.py create mode 100644 ShiftOS_TheReturn/Lib/email/mime/nonmultipart.py create mode 100644 ShiftOS_TheReturn/Lib/email/mime/text.py create mode 100644 ShiftOS_TheReturn/Lib/email/parser.py create mode 100644 ShiftOS_TheReturn/Lib/email/quoprimime.py create mode 100644 ShiftOS_TheReturn/Lib/email/utils.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/__init__.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/aliases.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/ascii.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/base64_codec.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/bz2_codec.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/charmap.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/cp037.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/cp1006.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/cp1026.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/cp1140.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/cp1250.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/cp1251.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/cp1252.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/cp1253.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/cp1254.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/cp1255.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/cp1256.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/cp1257.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/cp1258.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/cp424.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/cp437.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/cp500.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/cp720.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/cp737.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/cp775.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/cp850.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/cp852.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/cp855.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/cp856.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/cp857.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/cp858.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/cp860.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/cp861.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/cp862.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/cp863.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/cp864.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/cp865.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/cp866.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/cp869.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/cp874.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/cp875.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/hex_codec.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/hp_roman8.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/idna.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/iso8859_1.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/iso8859_10.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/iso8859_11.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/iso8859_13.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/iso8859_14.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/iso8859_15.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/iso8859_16.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/iso8859_2.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/iso8859_3.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/iso8859_4.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/iso8859_5.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/iso8859_6.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/iso8859_7.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/iso8859_8.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/iso8859_9.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/koi8_r.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/koi8_u.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/latin_1.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/mac_arabic.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/mac_centeuro.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/mac_croatian.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/mac_cyrillic.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/mac_farsi.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/mac_greek.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/mac_iceland.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/mac_latin2.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/mac_roman.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/mac_romanian.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/mac_turkish.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/mbcs.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/palmos.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/ptcp154.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/punycode.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/quopri_codec.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/raw_unicode_escape.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/rot_13.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/string_escape.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/tis_620.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/undefined.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/unicode_escape.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/unicode_internal.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/utf_16.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/utf_16_be.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/utf_16_le.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/utf_32.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/utf_32_be.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/utf_32_le.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/utf_7.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/utf_8.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/utf_8_sig.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/uu_codec.py create mode 100644 ShiftOS_TheReturn/Lib/encodings/zlib_codec.py create mode 100644 ShiftOS_TheReturn/Lib/ensurepip/__init__.py create mode 100644 ShiftOS_TheReturn/Lib/ensurepip/__main__.py create mode 100644 ShiftOS_TheReturn/Lib/ensurepip/_bundled/pip-8.1.1-py2.py3-none-any.whl create mode 100644 ShiftOS_TheReturn/Lib/ensurepip/_bundled/setuptools-20.10.1-py2.py3-none-any.whl create mode 100644 ShiftOS_TheReturn/Lib/ensurepip/_uninstall.py create mode 100644 ShiftOS_TheReturn/Lib/filecmp.py create mode 100644 ShiftOS_TheReturn/Lib/fileinput.py create mode 100644 ShiftOS_TheReturn/Lib/fnmatch.py create mode 100644 ShiftOS_TheReturn/Lib/formatter.py create mode 100644 ShiftOS_TheReturn/Lib/fpformat.py create mode 100644 ShiftOS_TheReturn/Lib/fractions.py create mode 100644 ShiftOS_TheReturn/Lib/ftplib.py create mode 100644 ShiftOS_TheReturn/Lib/functools.py create mode 100644 ShiftOS_TheReturn/Lib/genericpath.py create mode 100644 ShiftOS_TheReturn/Lib/getopt.py create mode 100644 ShiftOS_TheReturn/Lib/getpass.py create mode 100644 ShiftOS_TheReturn/Lib/gettext.py create mode 100644 ShiftOS_TheReturn/Lib/glob.py create mode 100644 ShiftOS_TheReturn/Lib/gzip.py create mode 100644 ShiftOS_TheReturn/Lib/hashlib.py create mode 100644 ShiftOS_TheReturn/Lib/heapq.py create mode 100644 ShiftOS_TheReturn/Lib/hmac.py create mode 100644 ShiftOS_TheReturn/Lib/htmlentitydefs.py create mode 100644 ShiftOS_TheReturn/Lib/htmllib.py create mode 100644 ShiftOS_TheReturn/Lib/httplib.py create mode 100644 ShiftOS_TheReturn/Lib/ihooks.py create mode 100644 ShiftOS_TheReturn/Lib/imaplib.py create mode 100644 ShiftOS_TheReturn/Lib/imghdr.py create mode 100644 ShiftOS_TheReturn/Lib/importlib/__init__.py create mode 100644 ShiftOS_TheReturn/Lib/imputil.py create mode 100644 ShiftOS_TheReturn/Lib/inspect.py create mode 100644 ShiftOS_TheReturn/Lib/io.py create mode 100644 ShiftOS_TheReturn/Lib/json/__init__.py create mode 100644 ShiftOS_TheReturn/Lib/json/decoder.py create mode 100644 ShiftOS_TheReturn/Lib/json/encoder.py create mode 100644 ShiftOS_TheReturn/Lib/json/scanner.py create mode 100644 ShiftOS_TheReturn/Lib/json/tool.py create mode 100644 ShiftOS_TheReturn/Lib/keyword.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/__init__.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/__main__.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/btm_matcher.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/btm_utils.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixer_base.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixer_util.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/__init__.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_apply.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_asserts.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_basestring.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_buffer.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_callable.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_dict.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_except.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_exec.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_execfile.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_exitfunc.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_filter.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_funcattrs.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_future.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_getcwdu.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_has_key.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_idioms.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_import.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_imports.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_imports2.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_input.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_intern.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_isinstance.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_itertools.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_itertools_imports.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_long.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_map.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_metaclass.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_methodattrs.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_ne.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_next.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_nonzero.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_numliterals.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_operator.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_paren.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_print.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_raise.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_raw_input.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_reduce.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_renames.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_repr.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_set_literal.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_standarderror.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_sys_exc.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_throw.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_tuple_params.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_types.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_unicode.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_urllib.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_ws_comma.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_xrange.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_xreadlines.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/fixes/fix_zip.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/main.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/patcomp.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/pgen2/__init__.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/pgen2/conv.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/pgen2/driver.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/pgen2/grammar.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/pgen2/literals.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/pgen2/parse.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/pgen2/pgen.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/pgen2/token.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/pgen2/tokenize.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/pygram.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/pytree.py create mode 100644 ShiftOS_TheReturn/Lib/lib2to3/refactor.py create mode 100644 ShiftOS_TheReturn/Lib/linecache.py create mode 100644 ShiftOS_TheReturn/Lib/locale.py create mode 100644 ShiftOS_TheReturn/Lib/logging/__init__.py create mode 100644 ShiftOS_TheReturn/Lib/logging/config.py create mode 100644 ShiftOS_TheReturn/Lib/logging/handlers.py create mode 100644 ShiftOS_TheReturn/Lib/macpath.py create mode 100644 ShiftOS_TheReturn/Lib/macurl2path.py create mode 100644 ShiftOS_TheReturn/Lib/mailbox.py create mode 100644 ShiftOS_TheReturn/Lib/mailcap.py create mode 100644 ShiftOS_TheReturn/Lib/markupbase.py create mode 100644 ShiftOS_TheReturn/Lib/md5.py create mode 100644 ShiftOS_TheReturn/Lib/mhlib.py create mode 100644 ShiftOS_TheReturn/Lib/mimetools.py create mode 100644 ShiftOS_TheReturn/Lib/mimetypes.py create mode 100644 ShiftOS_TheReturn/Lib/mimify.py create mode 100644 ShiftOS_TheReturn/Lib/modulefinder.py create mode 100644 ShiftOS_TheReturn/Lib/multifile.py create mode 100644 ShiftOS_TheReturn/Lib/multiprocessing/__init__.py create mode 100644 ShiftOS_TheReturn/Lib/multiprocessing/connection.py create mode 100644 ShiftOS_TheReturn/Lib/multiprocessing/dummy/__init__.py create mode 100644 ShiftOS_TheReturn/Lib/multiprocessing/dummy/connection.py create mode 100644 ShiftOS_TheReturn/Lib/multiprocessing/forking.py create mode 100644 ShiftOS_TheReturn/Lib/multiprocessing/heap.py create mode 100644 ShiftOS_TheReturn/Lib/multiprocessing/managers.py create mode 100644 ShiftOS_TheReturn/Lib/multiprocessing/pool.py create mode 100644 ShiftOS_TheReturn/Lib/multiprocessing/process.py create mode 100644 ShiftOS_TheReturn/Lib/multiprocessing/queues.py create mode 100644 ShiftOS_TheReturn/Lib/multiprocessing/reduction.py create mode 100644 ShiftOS_TheReturn/Lib/multiprocessing/sharedctypes.py create mode 100644 ShiftOS_TheReturn/Lib/multiprocessing/synchronize.py create mode 100644 ShiftOS_TheReturn/Lib/multiprocessing/util.py create mode 100644 ShiftOS_TheReturn/Lib/mutex.py create mode 100644 ShiftOS_TheReturn/Lib/netrc.py create mode 100644 ShiftOS_TheReturn/Lib/new.py create mode 100644 ShiftOS_TheReturn/Lib/nntplib.py create mode 100644 ShiftOS_TheReturn/Lib/ntpath.py create mode 100644 ShiftOS_TheReturn/Lib/nturl2path.py create mode 100644 ShiftOS_TheReturn/Lib/numbers.py create mode 100644 ShiftOS_TheReturn/Lib/opcode.py create mode 100644 ShiftOS_TheReturn/Lib/optparse.py create mode 100644 ShiftOS_TheReturn/Lib/os.py create mode 100644 ShiftOS_TheReturn/Lib/os2emxpath.py create mode 100644 ShiftOS_TheReturn/Lib/pdb.py create mode 100644 ShiftOS_TheReturn/Lib/pickle.py create mode 100644 ShiftOS_TheReturn/Lib/pickletools.py create mode 100644 ShiftOS_TheReturn/Lib/pipes.py create mode 100644 ShiftOS_TheReturn/Lib/pkgutil.py create mode 100644 ShiftOS_TheReturn/Lib/platform.py create mode 100644 ShiftOS_TheReturn/Lib/plistlib.py create mode 100644 ShiftOS_TheReturn/Lib/popen2.py create mode 100644 ShiftOS_TheReturn/Lib/poplib.py create mode 100644 ShiftOS_TheReturn/Lib/posixfile.py create mode 100644 ShiftOS_TheReturn/Lib/posixpath.py create mode 100644 ShiftOS_TheReturn/Lib/pprint.py create mode 100644 ShiftOS_TheReturn/Lib/profile.py create mode 100644 ShiftOS_TheReturn/Lib/pstats.py create mode 100644 ShiftOS_TheReturn/Lib/py_compile.py create mode 100644 ShiftOS_TheReturn/Lib/pyclbr.py create mode 100644 ShiftOS_TheReturn/Lib/pydoc.py create mode 100644 ShiftOS_TheReturn/Lib/pydoc_data/__init__.py create mode 100644 ShiftOS_TheReturn/Lib/pydoc_data/topics.py create mode 100644 ShiftOS_TheReturn/Lib/quopri.py create mode 100644 ShiftOS_TheReturn/Lib/random.py create mode 100644 ShiftOS_TheReturn/Lib/repr.py create mode 100644 ShiftOS_TheReturn/Lib/rexec.py create mode 100644 ShiftOS_TheReturn/Lib/rfc822.py create mode 100644 ShiftOS_TheReturn/Lib/rlcompleter.py create mode 100644 ShiftOS_TheReturn/Lib/robotparser.py create mode 100644 ShiftOS_TheReturn/Lib/runpy.py create mode 100644 ShiftOS_TheReturn/Lib/sched.py create mode 100644 ShiftOS_TheReturn/Lib/sets.py create mode 100644 ShiftOS_TheReturn/Lib/sgmllib.py create mode 100644 ShiftOS_TheReturn/Lib/sha.py create mode 100644 ShiftOS_TheReturn/Lib/shelve.py create mode 100644 ShiftOS_TheReturn/Lib/shlex.py create mode 100644 ShiftOS_TheReturn/Lib/shutil.py create mode 100644 ShiftOS_TheReturn/Lib/site-packages/README.txt create mode 100644 ShiftOS_TheReturn/Lib/site.py create mode 100644 ShiftOS_TheReturn/Lib/smtpd.py create mode 100644 ShiftOS_TheReturn/Lib/smtplib.py create mode 100644 ShiftOS_TheReturn/Lib/sndhdr.py create mode 100644 ShiftOS_TheReturn/Lib/sqlite3/__init__.py create mode 100644 ShiftOS_TheReturn/Lib/sqlite3/dbapi2.py create mode 100644 ShiftOS_TheReturn/Lib/sqlite3/dump.py create mode 100644 ShiftOS_TheReturn/Lib/sre_compile.py create mode 100644 ShiftOS_TheReturn/Lib/sre_constants.py create mode 100644 ShiftOS_TheReturn/Lib/sre_parse.py create mode 100644 ShiftOS_TheReturn/Lib/ssl.py create mode 100644 ShiftOS_TheReturn/Lib/stat.py create mode 100644 ShiftOS_TheReturn/Lib/statvfs.py create mode 100644 ShiftOS_TheReturn/Lib/string.py create mode 100644 ShiftOS_TheReturn/Lib/stringold.py create mode 100644 ShiftOS_TheReturn/Lib/stringprep.py create mode 100644 ShiftOS_TheReturn/Lib/struct.py create mode 100644 ShiftOS_TheReturn/Lib/subprocess.py create mode 100644 ShiftOS_TheReturn/Lib/sunau.py create mode 100644 ShiftOS_TheReturn/Lib/sunaudio.py create mode 100644 ShiftOS_TheReturn/Lib/symbol.py create mode 100644 ShiftOS_TheReturn/Lib/sysconfig.py create mode 100644 ShiftOS_TheReturn/Lib/tabnanny.py create mode 100644 ShiftOS_TheReturn/Lib/tarfile.py create mode 100644 ShiftOS_TheReturn/Lib/telnetlib.py create mode 100644 ShiftOS_TheReturn/Lib/tempfile.py create mode 100644 ShiftOS_TheReturn/Lib/textwrap.py create mode 100644 ShiftOS_TheReturn/Lib/this.py create mode 100644 ShiftOS_TheReturn/Lib/threading.py create mode 100644 ShiftOS_TheReturn/Lib/timeit.py create mode 100644 ShiftOS_TheReturn/Lib/toaiff.py create mode 100644 ShiftOS_TheReturn/Lib/token.py create mode 100644 ShiftOS_TheReturn/Lib/tokenize.py create mode 100644 ShiftOS_TheReturn/Lib/trace.py create mode 100644 ShiftOS_TheReturn/Lib/traceback.py create mode 100644 ShiftOS_TheReturn/Lib/types.py create mode 100644 ShiftOS_TheReturn/Lib/unittest/__init__.py create mode 100644 ShiftOS_TheReturn/Lib/unittest/__main__.py create mode 100644 ShiftOS_TheReturn/Lib/unittest/case.py create mode 100644 ShiftOS_TheReturn/Lib/unittest/loader.py create mode 100644 ShiftOS_TheReturn/Lib/unittest/main.py create mode 100644 ShiftOS_TheReturn/Lib/unittest/result.py create mode 100644 ShiftOS_TheReturn/Lib/unittest/runner.py create mode 100644 ShiftOS_TheReturn/Lib/unittest/signals.py create mode 100644 ShiftOS_TheReturn/Lib/unittest/suite.py create mode 100644 ShiftOS_TheReturn/Lib/unittest/util.py create mode 100644 ShiftOS_TheReturn/Lib/urllib.py create mode 100644 ShiftOS_TheReturn/Lib/urllib2.py create mode 100644 ShiftOS_TheReturn/Lib/urlparse.py create mode 100644 ShiftOS_TheReturn/Lib/user.py create mode 100644 ShiftOS_TheReturn/Lib/uu.py create mode 100644 ShiftOS_TheReturn/Lib/uuid.py create mode 100644 ShiftOS_TheReturn/Lib/warnings.py create mode 100644 ShiftOS_TheReturn/Lib/wave.py create mode 100644 ShiftOS_TheReturn/Lib/weakref.py create mode 100644 ShiftOS_TheReturn/Lib/webbrowser.py create mode 100644 ShiftOS_TheReturn/Lib/whichdb.py create mode 100644 ShiftOS_TheReturn/Lib/wsgiref/__init__.py create mode 100644 ShiftOS_TheReturn/Lib/wsgiref/handlers.py create mode 100644 ShiftOS_TheReturn/Lib/wsgiref/headers.py create mode 100644 ShiftOS_TheReturn/Lib/wsgiref/simple_server.py create mode 100644 ShiftOS_TheReturn/Lib/wsgiref/util.py create mode 100644 ShiftOS_TheReturn/Lib/wsgiref/validate.py create mode 100644 ShiftOS_TheReturn/Lib/xdrlib.py create mode 100644 ShiftOS_TheReturn/Lib/xml/__init__.py create mode 100644 ShiftOS_TheReturn/Lib/xml/dom/NodeFilter.py create mode 100644 ShiftOS_TheReturn/Lib/xml/dom/__init__.py create mode 100644 ShiftOS_TheReturn/Lib/xml/dom/domreg.py create mode 100644 ShiftOS_TheReturn/Lib/xml/dom/minicompat.py create mode 100644 ShiftOS_TheReturn/Lib/xml/dom/minidom.py create mode 100644 ShiftOS_TheReturn/Lib/xml/dom/pulldom.py create mode 100644 ShiftOS_TheReturn/Lib/xml/dom/xmlbuilder.py create mode 100644 ShiftOS_TheReturn/Lib/xml/etree/ElementInclude.py create mode 100644 ShiftOS_TheReturn/Lib/xml/etree/ElementPath.py create mode 100644 ShiftOS_TheReturn/Lib/xml/etree/ElementTree.py create mode 100644 ShiftOS_TheReturn/Lib/xml/etree/SimpleXMLTreeBuilder.py create mode 100644 ShiftOS_TheReturn/Lib/xml/etree/__init__.py create mode 100644 ShiftOS_TheReturn/Lib/xml/parsers/__init__.py create mode 100644 ShiftOS_TheReturn/Lib/xml/sax/__init__.py create mode 100644 ShiftOS_TheReturn/Lib/xml/sax/_exceptions.py create mode 100644 ShiftOS_TheReturn/Lib/xml/sax/handler.py create mode 100644 ShiftOS_TheReturn/Lib/xml/sax/saxutils.py create mode 100644 ShiftOS_TheReturn/Lib/xml/sax/xmlreader.py create mode 100644 ShiftOS_TheReturn/Lib/xmllib.py create mode 100644 ShiftOS_TheReturn/Lib/xmlrpclib.py create mode 100644 ShiftOS_TheReturn/Lib/zipfile.py create mode 100644 ShiftOS_TheReturn/PythonAPI.cs create mode 100644 ShiftOS_TheReturn/Resources/pywintemplate.txt diff --git a/ModLauncher/App.config b/ModLauncher/App.config index 757ddce..4e65683 100644 --- a/ModLauncher/App.config +++ b/ModLauncher/App.config @@ -13,6 +13,14 @@ + + + + + + + + \ No newline at end of file diff --git a/ShiftOS.MFSProfiler/App.config b/ShiftOS.MFSProfiler/App.config index a0a13df..b899c11 100644 --- a/ShiftOS.MFSProfiler/App.config +++ b/ShiftOS.MFSProfiler/App.config @@ -14,6 +14,14 @@ + + + + + + + + \ No newline at end of file diff --git a/ShiftOS.Modding.VB.LegacySkinConverter/App.config b/ShiftOS.Modding.VB.LegacySkinConverter/App.config index 757ddce..4e65683 100644 --- a/ShiftOS.Modding.VB.LegacySkinConverter/App.config +++ b/ShiftOS.Modding.VB.LegacySkinConverter/App.config @@ -13,6 +13,14 @@ + + + + + + + + \ No newline at end of file diff --git a/ShiftOS.Modding.VirtualMachine/App.config b/ShiftOS.Modding.VirtualMachine/App.config index 757ddce..4e65683 100644 --- a/ShiftOS.Modding.VirtualMachine/App.config +++ b/ShiftOS.Modding.VirtualMachine/App.config @@ -13,6 +13,14 @@ + + + + + + + + \ No newline at end of file diff --git a/ShiftOS.Updater/App.config b/ShiftOS.Updater/App.config index 757ddce..4e65683 100644 --- a/ShiftOS.Updater/App.config +++ b/ShiftOS.Updater/App.config @@ -13,6 +13,14 @@ + + + + + + + + \ No newline at end of file diff --git a/ShiftOS.WinForms/App.config b/ShiftOS.WinForms/App.config index a0a13df..b899c11 100644 --- a/ShiftOS.WinForms/App.config +++ b/ShiftOS.WinForms/App.config @@ -14,6 +14,14 @@ + + + + + + + + \ No newline at end of file diff --git a/ShiftOS.WinForms/MainMenu/Loading.Designer.cs b/ShiftOS.WinForms/MainMenu/Loading.Designer.cs new file mode 100644 index 0000000..95619d9 --- /dev/null +++ b/ShiftOS.WinForms/MainMenu/Loading.Designer.cs @@ -0,0 +1,66 @@ +namespace ShiftOS.WinForms.MainMenu +{ + partial class Loading + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // label + // + this.label.Dock = System.Windows.Forms.DockStyle.Fill; + this.label.Font = new System.Drawing.Font("Tahoma", 72F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label.ForeColor = System.Drawing.Color.White; + this.label.Location = new System.Drawing.Point(0, 0); + this.label.Name = "label"; + this.label.Size = new System.Drawing.Size(284, 262); + this.label.TabIndex = 0; + this.label.Text = "Loading..."; + this.label.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // Loading + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.Black; + this.ClientSize = new System.Drawing.Size(284, 262); + this.Controls.Add(this.label); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.Name = "Loading"; + this.Text = "Loading"; + this.WindowState = System.Windows.Forms.FormWindowState.Maximized; + this.Shown += new System.EventHandler(this.Loading_FormShown); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Label label; + } +} \ No newline at end of file diff --git a/ShiftOS.WinForms/MainMenu/Loading.cs b/ShiftOS.WinForms/MainMenu/Loading.cs new file mode 100644 index 0000000..555f1d4 --- /dev/null +++ b/ShiftOS.WinForms/MainMenu/Loading.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using ShiftOS.Engine; + +namespace ShiftOS.WinForms.MainMenu +{ + public partial class Loading : Form + { + public Loading() + { + InitializeComponent(); + } + + private void Loading_FormShown(object sender, EventArgs e) + { + // This hideous timer thing is the most reliable way to make the form update + // before it starts doing stuff. + var callback = new Timer(); + callback.Tick += (o, a) => { Desktop.CurrentDesktop.Show(); Hide(); callback.Stop(); }; + callback.Interval = 1; + callback.Start(); + } + } +} diff --git a/ShiftOS.WinForms/MainMenu/Loading.resx b/ShiftOS.WinForms/MainMenu/Loading.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS.WinForms/MainMenu/Loading.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ShiftOS.WinForms/MainMenu/MainMenu.cs b/ShiftOS.WinForms/MainMenu/MainMenu.cs index e11edc2..1936fec 100644 --- a/ShiftOS.WinForms/MainMenu/MainMenu.cs +++ b/ShiftOS.WinForms/MainMenu/MainMenu.cs @@ -15,6 +15,11 @@ namespace ShiftOS.WinForms.MainMenu { public partial class MainMenu : Form { + private void StartGame() + { + new Loading().Show(); + } + public MainMenu(IDesktop desk) { InitializeComponent(); @@ -163,7 +168,7 @@ namespace ShiftOS.WinForms.MainMenu private void button2_Click(object sender, EventArgs e) { (Desktop.CurrentDesktop as WinformsDesktop).IsSandbox = true; - Desktop.CurrentDesktop.Show(); + StartGame(); } private void button3_Click(object sender, EventArgs e) @@ -239,7 +244,7 @@ namespace ShiftOS.WinForms.MainMenu private void btncontinue_Click(object sender, EventArgs e) { - Desktop.CurrentDesktop.Show(); + StartGame(); } @@ -253,13 +258,13 @@ namespace ShiftOS.WinForms.MainMenu if (result == true) { System.IO.File.Delete(path); - Desktop.CurrentDesktop.Show(); + StartGame(); } }); } else { - Desktop.CurrentDesktop.Show(); + StartGame(); } } } diff --git a/ShiftOS.WinForms/Properties/Resources.Designer.cs b/ShiftOS.WinForms/Properties/Resources.Designer.cs index 137db4b..2cba3c9 100644 --- a/ShiftOS.WinForms/Properties/Resources.Designer.cs +++ b/ShiftOS.WinForms/Properties/Resources.Designer.cs @@ -1094,7 +1094,7 @@ namespace ShiftOS.WinForms.Properties { /// Name: "NetXtreme Hyper Edition", /// CostPerMonth: 150, /// DownloadSpeed: 524288, //512 kb/s - /// Description: "It's time to supercharge your Shift [rest of string was truncated]";. + /// Description: "It's time to supercharge your Shiftnet experience. [rest of string was truncated]";. /// internal static string ShiftnetServices { get { @@ -1116,7 +1116,8 @@ namespace ShiftOS.WinForms.Properties { /// Name: "Icon Manager", /// Cost: 450, /// Description: "This tool allows you to add and edit application icons within ShiftOS for the small prive of 450 Codepoints!", - /// Dependencies: "skinning [rest of string was truncated]";. + /// Dependencies: "skinning", + /// Category [rest of string was truncated]";. /// internal static string Shiftorium { get { @@ -1126,7 +1127,7 @@ namespace ShiftOS.WinForms.Properties { /// /// Looks up a localized string similar to {\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff0\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi0\deflang1033\deflangfe1033\themelang1033\themelangfe0\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;} - ///{\f37\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;}{\f38\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0302020204030204}Calibri Light;}{\fl [rest of string was truncated]";. + ///{\f37\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;}{\f38\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0302020204030204}Calibri Light;}{\flo [rest of string was truncated]";. /// internal static string ShiftOS { get { @@ -1275,7 +1276,8 @@ namespace ShiftOS.WinForms.Properties { ///Eine kurze Erklärung wie du das Terminal benutzt lautet wiefolgt. Du kannst das command 'sos.help' benutzen um eine Liste aller commands aufzurufen. Schreib es ///einfach in das Terminal und drücke <enter> um alle commands anzuzeigen. /// - ///Commands können mit argumenten versehen werden, indem du ein key-value Paar in einem {} Block hinter dem command angibst. Zum Be [rest of string was truncated]";. + ///Commands können mit argumenten versehen werden, indem du ein key-value Paar in einem {} Block hinter dem command angibst. Zum Beispiel: + /// [rest of string was truncated]";. /// internal static string strings_de { get { @@ -1294,7 +1296,8 @@ namespace ShiftOS.WinForms.Properties { ///Commands can be sent arguments by specifying a key-value pair inside a {} block at the end of the command. For example: /// ///some.command{print:\"hello\"} - ///math.add{op1 [rest of string was truncated]";. + ///math.add{op1:1,op2:2} + /// [rest of string was truncated]";. /// internal static string strings_en { get { @@ -1482,7 +1485,7 @@ namespace ShiftOS.WinForms.Properties { /// "Before you can begin with ShiftOS, you'll need to know a few things about it.", /// "One: Terminal command syntax.", /// "Inside ShiftOS, the bulk of your time is going to be spent within the Terminal.", - /// "The Terminal is an application that starts up when you turn on your computer. It allows you to execute system commands, ope [rest of string was truncated]";. + /// "The Terminal is an application that starts up when you turn on your computer. It allows you to execute system commands, open program [rest of string was truncated]";. /// internal static string sys_shiftoriumstory { get { diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index e0a53ea..31de44e 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -37,6 +37,7 @@ ..\packages\CommonMark.NET.0.15.0\lib\net45\CommonMark.dll True + ..\packages\NAudio.1.8.0\lib\net35\NAudio.dll @@ -356,6 +357,12 @@ + + Form + + + Loading.cs + Form @@ -609,6 +616,9 @@ GUILogin.cs + + Loading.cs + MainMenu.cs @@ -875,6 +885,7 @@ + diff --git a/ShiftOS_TheReturn/App.config b/ShiftOS_TheReturn/App.config index a0a13df..b899c11 100644 --- a/ShiftOS_TheReturn/App.config +++ b/ShiftOS_TheReturn/App.config @@ -14,6 +14,14 @@ + + + + + + + + \ No newline at end of file diff --git a/ShiftOS_TheReturn/Commands.cs b/ShiftOS_TheReturn/Commands.cs index da4fb29..6f3ab15 100644 --- a/ShiftOS_TheReturn/Commands.cs +++ b/ShiftOS_TheReturn/Commands.cs @@ -804,8 +804,7 @@ shiftorium.buy{{upgrade:""{upg.ID}""}}"); foreach (var type in Array.FindAll(ReflectMan.Types, t => t.GetInterfaces().Contains(typeof(IShiftOSWindow)) && Shiftorium.UpgradeAttributesUnlocked(t))) foreach (var attr in Array.FindAll(type.GetCustomAttributes(false), a => a is WinOpenAttribute)) - if (Shiftorium.UpgradeAttributesUnlocked(type)) - Console.WriteLine("win.open{app:\"" + (attr as WinOpenAttribute).ID + "\"}"); + Console.WriteLine("win.open{app:\"" + (attr as WinOpenAttribute).ID + "\"}"); return true; diff --git a/ShiftOS_TheReturn/Lib/BaseHTTPServer.py b/ShiftOS_TheReturn/Lib/BaseHTTPServer.py new file mode 100644 index 0000000..3df3323 --- /dev/null +++ b/ShiftOS_TheReturn/Lib/BaseHTTPServer.py @@ -0,0 +1,614 @@ +"""HTTP server base class. + +Note: the class in this module doesn't implement any HTTP request; see +SimpleHTTPServer for simple implementations of GET, HEAD and POST +(including CGI scripts). It does, however, optionally implement HTTP/1.1 +persistent connections, as of version 0.3. + +Contents: + +- BaseHTTPRequestHandler: HTTP request handler base class +- test: test function + +XXX To do: + +- log requests even later (to capture byte count) +- log user-agent header and other interesting goodies +- send error log to separate file +""" + + +# See also: +# +# HTTP Working Group T. Berners-Lee +# INTERNET-DRAFT R. T. Fielding +# H. Frystyk Nielsen +# Expires September 8, 1995 March 8, 1995 +# +# URL: http://www.ics.uci.edu/pub/ietf/http/draft-ietf-http-v10-spec-00.txt +# +# and +# +# Network Working Group R. Fielding +# Request for Comments: 2616 et al +# Obsoletes: 2068 June 1999 +# Category: Standards Track +# +# URL: http://www.faqs.org/rfcs/rfc2616.html + +# Log files +# --------- +# +# Here's a quote from the NCSA httpd docs about log file format. +# +# | The logfile format is as follows. Each line consists of: +# | +# | host rfc931 authuser [DD/Mon/YYYY:hh:mm:ss] "request" ddd bbbb +# | +# | host: Either the DNS name or the IP number of the remote client +# | rfc931: Any information returned by identd for this person, +# | - otherwise. +# | authuser: If user sent a userid for authentication, the user name, +# | - otherwise. +# | DD: Day +# | Mon: Month (calendar name) +# | YYYY: Year +# | hh: hour (24-hour format, the machine's timezone) +# | mm: minutes +# | ss: seconds +# | request: The first line of the HTTP request as sent by the client. +# | ddd: the status code returned by the server, - if not available. +# | bbbb: the total number of bytes sent, +# | *not including the HTTP/1.0 header*, - if not available +# | +# | You can determine the name of the file accessed through request. +# +# (Actually, the latter is only true if you know the server configuration +# at the time the request was made!) + +__version__ = "0.3" + +__all__ = ["HTTPServer", "BaseHTTPRequestHandler"] + +import sys +import time +import socket # For gethostbyaddr() +from warnings import filterwarnings, catch_warnings +with catch_warnings(): + if sys.py3kwarning: + filterwarnings("ignore", ".*mimetools has been removed", + DeprecationWarning) + import mimetools +import SocketServer + +# Default error message template +DEFAULT_ERROR_MESSAGE = """\ + +Error response + + +

    Error response

    +

    Error code %(code)d. +

    Message: %(message)s. +

    Error code explanation: %(code)s = %(explain)s. + +""" + +DEFAULT_ERROR_CONTENT_TYPE = "text/html" + +def _quote_html(html): + return html.replace("&", "&").replace("<", "<").replace(">", ">") + +class HTTPServer(SocketServer.TCPServer): + + allow_reuse_address = 1 # Seems to make sense in testing environment + + def server_bind(self): + """Override server_bind to store the server name.""" + SocketServer.TCPServer.server_bind(self) + host, port = self.socket.getsockname()[:2] + self.server_name = socket.getfqdn(host) + self.server_port = port + + +class BaseHTTPRequestHandler(SocketServer.StreamRequestHandler): + + """HTTP request handler base class. + + The following explanation of HTTP serves to guide you through the + code as well as to expose any misunderstandings I may have about + HTTP (so you don't need to read the code to figure out I'm wrong + :-). + + HTTP (HyperText Transfer Protocol) is an extensible protocol on + top of a reliable stream transport (e.g. TCP/IP). The protocol + recognizes three parts to a request: + + 1. One line identifying the request type and path + 2. An optional set of RFC-822-style headers + 3. An optional data part + + The headers and data are separated by a blank line. + + The first line of the request has the form + + + + where is a (case-sensitive) keyword such as GET or POST, + is a string containing path information for the request, + and should be the string "HTTP/1.0" or "HTTP/1.1". + is encoded using the URL encoding scheme (using %xx to signify + the ASCII character with hex code xx). + + The specification specifies that lines are separated by CRLF but + for compatibility with the widest range of clients recommends + servers also handle LF. Similarly, whitespace in the request line + is treated sensibly (allowing multiple spaces between components + and allowing trailing whitespace). + + Similarly, for output, lines ought to be separated by CRLF pairs + but most clients grok LF characters just fine. + + If the first line of the request has the form + + + + (i.e. is left out) then this is assumed to be an HTTP + 0.9 request; this form has no optional headers and data part and + the reply consists of just the data. + + The reply form of the HTTP 1.x protocol again has three parts: + + 1. One line giving the response code + 2. An optional set of RFC-822-style headers + 3. The data + + Again, the headers and data are separated by a blank line. + + The response code line has the form + + + + where is the protocol version ("HTTP/1.0" or "HTTP/1.1"), + is a 3-digit response code indicating success or + failure of the request, and is an optional + human-readable string explaining what the response code means. + + This server parses the request and the headers, and then calls a + function specific to the request type (). Specifically, + a request SPAM will be handled by a method do_SPAM(). If no + such method exists the server sends an error response to the + client. If it exists, it is called with no arguments: + + do_SPAM() + + Note that the request name is case sensitive (i.e. SPAM and spam + are different requests). + + The various request details are stored in instance variables: + + - client_address is the client IP address in the form (host, + port); + + - command, path and version are the broken-down request line; + + - headers is an instance of mimetools.Message (or a derived + class) containing the header information; + + - rfile is a file object open for reading positioned at the + start of the optional input data part; + + - wfile is a file object open for writing. + + IT IS IMPORTANT TO ADHERE TO THE PROTOCOL FOR WRITING! + + The first thing to be written must be the response line. Then + follow 0 or more header lines, then a blank line, and then the + actual data (if any). The meaning of the header lines depends on + the command executed by the server; in most cases, when data is + returned, there should be at least one header line of the form + + Content-type: / + + where and should be registered MIME types, + e.g. "text/html" or "text/plain". + + """ + + # The Python system version, truncated to its first component. + sys_version = "Python/" + sys.version.split()[0] + + # The server software version. You may want to override this. + # The format is multiple whitespace-separated strings, + # where each string is of the form name[/version]. + server_version = "BaseHTTP/" + __version__ + + # The default request version. This only affects responses up until + # the point where the request line is parsed, so it mainly decides what + # the client gets back when sending a malformed request line. + # Most web servers default to HTTP 0.9, i.e. don't send a status line. + default_request_version = "HTTP/0.9" + + def parse_request(self): + """Parse a request (internal). + + The request should be stored in self.raw_requestline; the results + are in self.command, self.path, self.request_version and + self.headers. + + Return True for success, False for failure; on failure, an + error is sent back. + + """ + self.command = None # set in case of error on the first line + self.request_version = version = self.default_request_version + self.close_connection = 1 + requestline = self.raw_requestline + requestline = requestline.rstrip('\r\n') + self.requestline = requestline + words = requestline.split() + if len(words) == 3: + command, path, version = words + if version[:5] != 'HTTP/': + self.send_error(400, "Bad request version (%r)" % version) + return False + try: + base_version_number = version.split('/', 1)[1] + version_number = base_version_number.split(".") + # RFC 2145 section 3.1 says there can be only one "." and + # - major and minor numbers MUST be treated as + # separate integers; + # - HTTP/2.4 is a lower version than HTTP/2.13, which in + # turn is lower than HTTP/12.3; + # - Leading zeros MUST be ignored by recipients. + if len(version_number) != 2: + raise ValueError + version_number = int(version_number[0]), int(version_number[1]) + except (ValueError, IndexError): + self.send_error(400, "Bad request version (%r)" % version) + return False + if version_number >= (1, 1) and self.protocol_version >= "HTTP/1.1": + self.close_connection = 0 + if version_number >= (2, 0): + self.send_error(505, + "Invalid HTTP Version (%s)" % base_version_number) + return False + elif len(words) == 2: + command, path = words + self.close_connection = 1 + if command != 'GET': + self.send_error(400, + "Bad HTTP/0.9 request type (%r)" % command) + return False + elif not words: + return False + else: + self.send_error(400, "Bad request syntax (%r)" % requestline) + return False + self.command, self.path, self.request_version = command, path, version + + # Examine the headers and look for a Connection directive + self.headers = self.MessageClass(self.rfile, 0) + + conntype = self.headers.get('Connection', "") + if conntype.lower() == 'close': + self.close_connection = 1 + elif (conntype.lower() == 'keep-alive' and + self.protocol_version >= "HTTP/1.1"): + self.close_connection = 0 + return True + + def handle_one_request(self): + """Handle a single HTTP request. + + You normally don't need to override this method; see the class + __doc__ string for information on how to handle specific HTTP + commands such as GET and POST. + + """ + try: + self.raw_requestline = self.rfile.readline(65537) + if len(self.raw_requestline) > 65536: + self.requestline = '' + self.request_version = '' + self.command = '' + self.send_error(414) + return + if not self.raw_requestline: + self.close_connection = 1 + return + if not self.parse_request(): + # An error code has been sent, just exit + return + mname = 'do_' + self.command + if not hasattr(self, mname): + self.send_error(501, "Unsupported method (%r)" % self.command) + return + method = getattr(self, mname) + method() + self.wfile.flush() #actually send the response if not already done. + except socket.timeout, e: + #a read or a write timed out. Discard this connection + self.log_error("Request timed out: %r", e) + self.close_connection = 1 + return + + def handle(self): + """Handle multiple requests if necessary.""" + self.close_connection = 1 + + self.handle_one_request() + while not self.close_connection: + self.handle_one_request() + + def send_error(self, code, message=None): + """Send and log an error reply. + + Arguments are the error code, and a detailed message. + The detailed message defaults to the short entry matching the + response code. + + This sends an error response (so it must be called before any + output has been generated), logs the error, and finally sends + a piece of HTML explaining the error to the user. + + """ + + try: + short, long = self.responses[code] + except KeyError: + short, long = '???', '???' + if message is None: + message = short + explain = long + self.log_error("code %d, message %s", code, message) + self.send_response(code, message) + self.send_header('Connection', 'close') + + # Message body is omitted for cases described in: + # - RFC7230: 3.3. 1xx, 204(No Content), 304(Not Modified) + # - RFC7231: 6.3.6. 205(Reset Content) + content = None + if code >= 200 and code not in (204, 205, 304): + # HTML encode to prevent Cross Site Scripting attacks + # (see bug #1100201) + content = (self.error_message_format % { + 'code': code, + 'message': _quote_html(message), + 'explain': explain + }) + self.send_header("Content-Type", self.error_content_type) + self.end_headers() + + if self.command != 'HEAD' and content: + self.wfile.write(content) + + error_message_format = DEFAULT_ERROR_MESSAGE + error_content_type = DEFAULT_ERROR_CONTENT_TYPE + + def send_response(self, code, message=None): + """Send the response header and log the response code. + + Also send two standard headers with the server software + version and the current date. + + """ + self.log_request(code) + if message is None: + if code in self.responses: + message = self.responses[code][0] + else: + message = '' + if self.request_version != 'HTTP/0.9': + self.wfile.write("%s %d %s\r\n" % + (self.protocol_version, code, message)) + # print (self.protocol_version, code, message) + self.send_header('Server', self.version_string()) + self.send_header('Date', self.date_time_string()) + + def send_header(self, keyword, value): + """Send a MIME header.""" + if self.request_version != 'HTTP/0.9': + self.wfile.write("%s: %s\r\n" % (keyword, value)) + + if keyword.lower() == 'connection': + if value.lower() == 'close': + self.close_connection = 1 + elif value.lower() == 'keep-alive': + self.close_connection = 0 + + def end_headers(self): + """Send the blank line ending the MIME headers.""" + if self.request_version != 'HTTP/0.9': + self.wfile.write("\r\n") + + def log_request(self, code='-', size='-'): + """Log an accepted request. + + This is called by send_response(). + + """ + + self.log_message('"%s" %s %s', + self.requestline, str(code), str(size)) + + def log_error(self, format, *args): + """Log an error. + + This is called when a request cannot be fulfilled. By + default it passes the message on to log_message(). + + Arguments are the same as for log_message(). + + XXX This should go to the separate error log. + + """ + + self.log_message(format, *args) + + def log_message(self, format, *args): + """Log an arbitrary message. + + This is used by all other logging functions. Override + it if you have specific logging wishes. + + The first argument, FORMAT, is a format string for the + message to be logged. If the format string contains + any % escapes requiring parameters, they should be + specified as subsequent arguments (it's just like + printf!). + + The client ip address and current date/time are prefixed to every + message. + + """ + + sys.stderr.write("%s - - [%s] %s\n" % + (self.client_address[0], + self.log_date_time_string(), + format%args)) + + def version_string(self): + """Return the server software version string.""" + return self.server_version + ' ' + self.sys_version + + def date_time_string(self, timestamp=None): + """Return the current date and time formatted for a message header.""" + if timestamp is None: + timestamp = time.time() + year, month, day, hh, mm, ss, wd, y, z = time.gmtime(timestamp) + s = "%s, %02d %3s %4d %02d:%02d:%02d GMT" % ( + self.weekdayname[wd], + day, self.monthname[month], year, + hh, mm, ss) + return s + + def log_date_time_string(self): + """Return the current time formatted for logging.""" + now = time.time() + year, month, day, hh, mm, ss, x, y, z = time.localtime(now) + s = "%02d/%3s/%04d %02d:%02d:%02d" % ( + day, self.monthname[month], year, hh, mm, ss) + return s + + weekdayname = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] + + monthname = [None, + 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', + 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] + + def address_string(self): + """Return the client address formatted for logging. + + This version looks up the full hostname using gethostbyaddr(), + and tries to find a name that contains at least one dot. + + """ + + host, port = self.client_address[:2] + return socket.getfqdn(host) + + # Essentially static class variables + + # The version of the HTTP protocol we support. + # Set this to HTTP/1.1 to enable automatic keepalive + protocol_version = "HTTP/1.0" + + # The Message-like class used to parse headers + MessageClass = mimetools.Message + + # Table mapping response codes to messages; entries have the + # form {code: (shortmessage, longmessage)}. + # See RFC 2616. + responses = { + 100: ('Continue', 'Request received, please continue'), + 101: ('Switching Protocols', + 'Switching to new protocol; obey Upgrade header'), + + 200: ('OK', 'Request fulfilled, document follows'), + 201: ('Created', 'Document created, URL follows'), + 202: ('Accepted', + 'Request accepted, processing continues off-line'), + 203: ('Non-Authoritative Information', 'Request fulfilled from cache'), + 204: ('No Content', 'Request fulfilled, nothing follows'), + 205: ('Reset Content', 'Clear input form for further input.'), + 206: ('Partial Content', 'Partial content follows.'), + + 300: ('Multiple Choices', + 'Object has several resources -- see URI list'), + 301: ('Moved Permanently', 'Object moved permanently -- see URI list'), + 302: ('Found', 'Object moved temporarily -- see URI list'), + 303: ('See Other', 'Object moved -- see Method and URL list'), + 304: ('Not Modified', + 'Document has not changed since given time'), + 305: ('Use Proxy', + 'You must use proxy specified in Location to access this ' + 'resource.'), + 307: ('Temporary Redirect', + 'Object moved temporarily -- see URI list'), + + 400: ('Bad Request', + 'Bad request syntax or unsupported method'), + 401: ('Unauthorized', + 'No permission -- see authorization schemes'), + 402: ('Payment Required', + 'No payment -- see charging schemes'), + 403: ('Forbidden', + 'Request forbidden -- authorization will not help'), + 404: ('Not Found', 'Nothing matches the given URI'), + 405: ('Method Not Allowed', + 'Specified method is invalid for this resource.'), + 406: ('Not Acceptable', 'URI not available in preferred format.'), + 407: ('Proxy Authentication Required', 'You must authenticate with ' + 'this proxy before proceeding.'), + 408: ('Request Timeout', 'Request timed out; try again later.'), + 409: ('Conflict', 'Request conflict.'), + 410: ('Gone', + 'URI no longer exists and has been permanently removed.'), + 411: ('Length Required', 'Client must specify Content-Length.'), + 412: ('Precondition Failed', 'Precondition in headers is false.'), + 413: ('Request Entity Too Large', 'Entity is too large.'), + 414: ('Request-URI Too Long', 'URI is too long.'), + 415: ('Unsupported Media Type', 'Entity body in unsupported format.'), + 416: ('Requested Range Not Satisfiable', + 'Cannot satisfy request range.'), + 417: ('Expectation Failed', + 'Expect condition could not be satisfied.'), + + 500: ('Internal Server Error', 'Server got itself in trouble'), + 501: ('Not Implemented', + 'Server does not support this operation'), + 502: ('Bad Gateway', 'Invalid responses from another server/proxy.'), + 503: ('Service Unavailable', + 'The server cannot process the request due to a high load'), + 504: ('Gateway Timeout', + 'The gateway server did not receive a timely response'), + 505: ('HTTP Version Not Supported', 'Cannot fulfill request.'), + } + + +def test(HandlerClass = BaseHTTPRequestHandler, + ServerClass = HTTPServer, protocol="HTTP/1.0"): + """Test the HTTP request handler class. + + This runs an HTTP server on port 8000 (or the first command line + argument). + + """ + + if sys.argv[1:]: + port = int(sys.argv[1]) + else: + port = 8000 + server_address = ('', port) + + HandlerClass.protocol_version = protocol + httpd = ServerClass(server_address, HandlerClass) + + sa = httpd.socket.getsockname() + print "Serving HTTP on", sa[0], "port", sa[1], "..." + httpd.serve_forever() + + +if __name__ == '__main__': + test() diff --git a/ShiftOS_TheReturn/Lib/Bastion.py b/ShiftOS_TheReturn/Lib/Bastion.py new file mode 100644 index 0000000..d0dddbf --- /dev/null +++ b/ShiftOS_TheReturn/Lib/Bastion.py @@ -0,0 +1,180 @@ +"""Bastionification utility. + +A bastion (for another object -- the 'original') is an object that has +the same methods as the original but does not give access to its +instance variables. Bastions have a number of uses, but the most +obvious one is to provide code executing in restricted mode with a +safe interface to an object implemented in unrestricted mode. + +The bastionification routine has an optional second argument which is +a filter function. Only those methods for which the filter method +(called with the method name as argument) returns true are accessible. +The default filter method returns true unless the method name begins +with an underscore. + +There are a number of possible implementations of bastions. We use a +'lazy' approach where the bastion's __getattr__() discipline does all +the work for a particular method the first time it is used. This is +usually fastest, especially if the user doesn't call all available +methods. The retrieved methods are stored as instance variables of +the bastion, so the overhead is only occurred on the first use of each +method. + +Detail: the bastion class has a __repr__() discipline which includes +the repr() of the original object. This is precomputed when the +bastion is created. + +""" +from warnings import warnpy3k +warnpy3k("the Bastion module has been removed in Python 3.0", stacklevel=2) +del warnpy3k + +__all__ = ["BastionClass", "Bastion"] + +from types import MethodType + + +class BastionClass: + + """Helper class used by the Bastion() function. + + You could subclass this and pass the subclass as the bastionclass + argument to the Bastion() function, as long as the constructor has + the same signature (a get() function and a name for the object). + + """ + + def __init__(self, get, name): + """Constructor. + + Arguments: + + get - a function that gets the attribute value (by name) + name - a human-readable name for the original object + (suggestion: use repr(object)) + + """ + self._get_ = get + self._name_ = name + + def __repr__(self): + """Return a representation string. + + This includes the name passed in to the constructor, so that + if you print the bastion during debugging, at least you have + some idea of what it is. + + """ + return "" % self._name_ + + def __getattr__(self, name): + """Get an as-yet undefined attribute value. + + This calls the get() function that was passed to the + constructor. The result is stored as an instance variable so + that the next time the same attribute is requested, + __getattr__() won't be invoked. + + If the get() function raises an exception, this is simply + passed on -- exceptions are not cached. + + """ + attribute = self._get_(name) + self.__dict__[name] = attribute + return attribute + + +def Bastion(object, filter = lambda name: name[:1] != '_', + name=None, bastionclass=BastionClass): + """Create a bastion for an object, using an optional filter. + + See the Bastion module's documentation for background. + + Arguments: + + object - the original object + filter - a predicate that decides whether a function name is OK; + by default all names are OK that don't start with '_' + name - the name of the object; default repr(object) + bastionclass - class used to create the bastion; default BastionClass + + """ + + raise RuntimeError, "This code is not secure in Python 2.2 and later" + + # Note: we define *two* ad-hoc functions here, get1 and get2. + # Both are intended to be called in the same way: get(name). + # It is clear that the real work (getting the attribute + # from the object and calling the filter) is done in get1. + # Why can't we pass get1 to the bastion? Because the user + # would be able to override the filter argument! With get2, + # overriding the default argument is no security loophole: + # all it does is call it. + # Also notice that we can't place the object and filter as + # instance variables on the bastion object itself, since + # the user has full access to all instance variables! + + def get1(name, object=object, filter=filter): + """Internal function for Bastion(). See source comments.""" + if filter(name): + attribute = getattr(object, name) + if type(attribute) == MethodType: + return attribute + raise AttributeError, name + + def get2(name, get1=get1): + """Internal function for Bastion(). See source comments.""" + return get1(name) + + if name is None: + name = repr(object) + return bastionclass(get2, name) + + +def _test(): + """Test the Bastion() function.""" + class Original: + def __init__(self): + self.sum = 0 + def add(self, n): + self._add(n) + def _add(self, n): + self.sum = self.sum + n + def total(self): + return self.sum + o = Original() + b = Bastion(o) + testcode = """if 1: + b.add(81) + b.add(18) + print "b.total() =", b.total() + try: + print "b.sum =", b.sum, + except: + print "inaccessible" + else: + print "accessible" + try: + print "b._add =", b._add, + except: + print "inaccessible" + else: + print "accessible" + try: + print "b._get_.func_defaults =", map(type, b._get_.func_defaults), + except: + print "inaccessible" + else: + print "accessible" + \n""" + exec testcode + print '='*20, "Using rexec:", '='*20 + import rexec + r = rexec.RExec() + m = r.add_module('__main__') + m.b = b + r.r_exec(testcode) + + +if __name__ == '__main__': + _test() diff --git a/ShiftOS_TheReturn/Lib/CGIHTTPServer.py b/ShiftOS_TheReturn/Lib/CGIHTTPServer.py new file mode 100644 index 0000000..5620083 --- /dev/null +++ b/ShiftOS_TheReturn/Lib/CGIHTTPServer.py @@ -0,0 +1,378 @@ +"""CGI-savvy HTTP Server. + +This module builds on SimpleHTTPServer by implementing GET and POST +requests to cgi-bin scripts. + +If the os.fork() function is not present (e.g. on Windows), +os.popen2() is used as a fallback, with slightly altered semantics; if +that function is not present either (e.g. on Macintosh), only Python +scripts are supported, and they are executed by the current process. + +In all cases, the implementation is intentionally naive -- all +requests are executed sychronously. + +SECURITY WARNING: DON'T USE THIS CODE UNLESS YOU ARE INSIDE A FIREWALL +-- it may execute arbitrary Python code or external programs. + +Note that status code 200 is sent prior to execution of a CGI script, so +scripts cannot send other status codes such as 302 (redirect). +""" + + +__version__ = "0.4" + +__all__ = ["CGIHTTPRequestHandler"] + +import os +import sys +import urllib +import BaseHTTPServer +import SimpleHTTPServer +import select +import copy + + +class CGIHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): + + """Complete HTTP server with GET, HEAD and POST commands. + + GET and HEAD also support running CGI scripts. + + The POST command is *only* implemented for CGI scripts. + + """ + + # Determine platform specifics + have_fork = hasattr(os, 'fork') + have_popen2 = hasattr(os, 'popen2') + have_popen3 = hasattr(os, 'popen3') + + # Make rfile unbuffered -- we need to read one line and then pass + # the rest to a subprocess, so we can't use buffered input. + rbufsize = 0 + + def do_POST(self): + """Serve a POST request. + + This is only implemented for CGI scripts. + + """ + + if self.is_cgi(): + self.run_cgi() + else: + self.send_error(501, "Can only POST to CGI scripts") + + def send_head(self): + """Version of send_head that support CGI scripts""" + if self.is_cgi(): + return self.run_cgi() + else: + return SimpleHTTPServer.SimpleHTTPRequestHandler.send_head(self) + + def is_cgi(self): + """Test whether self.path corresponds to a CGI script. + + Returns True and updates the cgi_info attribute to the tuple + (dir, rest) if self.path requires running a CGI script. + Returns False otherwise. + + If any exception is raised, the caller should assume that + self.path was rejected as invalid and act accordingly. + + The default implementation tests whether the normalized url + path begins with one of the strings in self.cgi_directories + (and the next character is a '/' or the end of the string). + """ + collapsed_path = _url_collapse_path(self.path) + dir_sep = collapsed_path.find('/', 1) + head, tail = collapsed_path[:dir_sep], collapsed_path[dir_sep+1:] + if head in self.cgi_directories: + self.cgi_info = head, tail + return True + return False + + cgi_directories = ['/cgi-bin', '/htbin'] + + def is_executable(self, path): + """Test whether argument path is an executable file.""" + return executable(path) + + def is_python(self, path): + """Test whether argument path is a Python script.""" + head, tail = os.path.splitext(path) + return tail.lower() in (".py", ".pyw") + + def run_cgi(self): + """Execute a CGI script.""" + dir, rest = self.cgi_info + path = dir + '/' + rest + i = path.find('/', len(dir)+1) + while i >= 0: + nextdir = path[:i] + nextrest = path[i+1:] + + scriptdir = self.translate_path(nextdir) + if os.path.isdir(scriptdir): + dir, rest = nextdir, nextrest + i = path.find('/', len(dir)+1) + else: + break + + # find an explicit query string, if present. + rest, _, query = rest.partition('?') + + # dissect the part after the directory name into a script name & + # a possible additional path, to be stored in PATH_INFO. + i = rest.find('/') + if i >= 0: + script, rest = rest[:i], rest[i:] + else: + script, rest = rest, '' + + scriptname = dir + '/' + script + scriptfile = self.translate_path(scriptname) + if not os.path.exists(scriptfile): + self.send_error(404, "No such CGI script (%r)" % scriptname) + return + if not os.path.isfile(scriptfile): + self.send_error(403, "CGI script is not a plain file (%r)" % + scriptname) + return + ispy = self.is_python(scriptname) + if not ispy: + if not (self.have_fork or self.have_popen2 or self.have_popen3): + self.send_error(403, "CGI script is not a Python script (%r)" % + scriptname) + return + if not self.is_executable(scriptfile): + self.send_error(403, "CGI script is not executable (%r)" % + scriptname) + return + + # Reference: http://hoohoo.ncsa.uiuc.edu/cgi/env.html + # XXX Much of the following could be prepared ahead of time! + env = copy.deepcopy(os.environ) + env['SERVER_SOFTWARE'] = self.version_string() + env['SERVER_NAME'] = self.server.server_name + env['GATEWAY_INTERFACE'] = 'CGI/1.1' + env['SERVER_PROTOCOL'] = self.protocol_version + env['SERVER_PORT'] = str(self.server.server_port) + env['REQUEST_METHOD'] = self.command + uqrest = urllib.unquote(rest) + env['PATH_INFO'] = uqrest + env['PATH_TRANSLATED'] = self.translate_path(uqrest) + env['SCRIPT_NAME'] = scriptname + if query: + env['QUERY_STRING'] = query + host = self.address_string() + if host != self.client_address[0]: + env['REMOTE_HOST'] = host + env['REMOTE_ADDR'] = self.client_address[0] + authorization = self.headers.getheader("authorization") + if authorization: + authorization = authorization.split() + if len(authorization) == 2: + import base64, binascii + env['AUTH_TYPE'] = authorization[0] + if authorization[0].lower() == "basic": + try: + authorization = base64.decodestring(authorization[1]) + except binascii.Error: + pass + else: + authorization = authorization.split(':') + if len(authorization) == 2: + env['REMOTE_USER'] = authorization[0] + # XXX REMOTE_IDENT + if self.headers.typeheader is None: + env['CONTENT_TYPE'] = self.headers.type + else: + env['CONTENT_TYPE'] = self.headers.typeheader + length = self.headers.getheader('content-length') + if length: + env['CONTENT_LENGTH'] = length + referer = self.headers.getheader('referer') + if referer: + env['HTTP_REFERER'] = referer + accept = [] + for line in self.headers.getallmatchingheaders('accept'): + if line[:1] in "\t\n\r ": + accept.append(line.strip()) + else: + accept = accept + line[7:].split(',') + env['HTTP_ACCEPT'] = ','.join(accept) + ua = self.headers.getheader('user-agent') + if ua: + env['HTTP_USER_AGENT'] = ua + co = filter(None, self.headers.getheaders('cookie')) + if co: + env['HTTP_COOKIE'] = ', '.join(co) + # XXX Other HTTP_* headers + # Since we're setting the env in the parent, provide empty + # values to override previously set values + for k in ('QUERY_STRING', 'REMOTE_HOST', 'CONTENT_LENGTH', + 'HTTP_USER_AGENT', 'HTTP_COOKIE', 'HTTP_REFERER'): + env.setdefault(k, "") + + self.send_response(200, "Script output follows") + + decoded_query = query.replace('+', ' ') + + if self.have_fork: + # Unix -- fork as we should + args = [script] + if '=' not in decoded_query: + args.append(decoded_query) + nobody = nobody_uid() + self.wfile.flush() # Always flush before forking + pid = os.fork() + if pid != 0: + # Parent + pid, sts = os.waitpid(pid, 0) + # throw away additional data [see bug #427345] + while select.select([self.rfile], [], [], 0)[0]: + if not self.rfile.read(1): + break + if sts: + self.log_error("CGI script exit status %#x", sts) + return + # Child + try: + try: + os.setuid(nobody) + except os.error: + pass + os.dup2(self.rfile.fileno(), 0) + os.dup2(self.wfile.fileno(), 1) + os.execve(scriptfile, args, env) + except: + self.server.handle_error(self.request, self.client_address) + os._exit(127) + + else: + # Non Unix - use subprocess + import subprocess + cmdline = [scriptfile] + if self.is_python(scriptfile): + interp = sys.executable + if interp.lower().endswith("w.exe"): + # On Windows, use python.exe, not pythonw.exe + interp = interp[:-5] + interp[-4:] + cmdline = [interp, '-u'] + cmdline + if '=' not in query: + cmdline.append(query) + + self.log_message("command: %s", subprocess.list2cmdline(cmdline)) + try: + nbytes = int(length) + except (TypeError, ValueError): + nbytes = 0 + p = subprocess.Popen(cmdline, + stdin = subprocess.PIPE, + stdout = subprocess.PIPE, + stderr = subprocess.PIPE, + env = env + ) + if self.command.lower() == "post" and nbytes > 0: + data = self.rfile.read(nbytes) + else: + data = None + # throw away additional data [see bug #427345] + while select.select([self.rfile._sock], [], [], 0)[0]: + if not self.rfile._sock.recv(1): + break + stdout, stderr = p.communicate(data) + self.wfile.write(stdout) + if stderr: + self.log_error('%s', stderr) + p.stderr.close() + p.stdout.close() + status = p.returncode + if status: + self.log_error("CGI script exit status %#x", status) + else: + self.log_message("CGI script exited OK") + + +def _url_collapse_path(path): + """ + Given a URL path, remove extra '/'s and '.' path elements and collapse + any '..' references and returns a colllapsed path. + + Implements something akin to RFC-2396 5.2 step 6 to parse relative paths. + The utility of this function is limited to is_cgi method and helps + preventing some security attacks. + + Returns: The reconstituted URL, which will always start with a '/'. + + Raises: IndexError if too many '..' occur within the path. + + """ + # Query component should not be involved. + path, _, query = path.partition('?') + path = urllib.unquote(path) + + # Similar to os.path.split(os.path.normpath(path)) but specific to URL + # path semantics rather than local operating system semantics. + path_parts = path.split('/') + head_parts = [] + for part in path_parts[:-1]: + if part == '..': + head_parts.pop() # IndexError if more '..' than prior parts + elif part and part != '.': + head_parts.append( part ) + if path_parts: + tail_part = path_parts.pop() + if tail_part: + if tail_part == '..': + head_parts.pop() + tail_part = '' + elif tail_part == '.': + tail_part = '' + else: + tail_part = '' + + if query: + tail_part = '?'.join((tail_part, query)) + + splitpath = ('/' + '/'.join(head_parts), tail_part) + collapsed_path = "/".join(splitpath) + + return collapsed_path + + +nobody = None + +def nobody_uid(): + """Internal routine to get nobody's uid""" + global nobody + if nobody: + return nobody + try: + import pwd + except ImportError: + return -1 + try: + nobody = pwd.getpwnam('nobody')[2] + except KeyError: + nobody = 1 + max(map(lambda x: x[2], pwd.getpwall())) + return nobody + + +def executable(path): + """Test for executable file.""" + try: + st = os.stat(path) + except os.error: + return False + return st.st_mode & 0111 != 0 + + +def test(HandlerClass = CGIHTTPRequestHandler, + ServerClass = BaseHTTPServer.HTTPServer): + SimpleHTTPServer.test(HandlerClass, ServerClass) + + +if __name__ == '__main__': + test() diff --git a/ShiftOS_TheReturn/Lib/ConfigParser.py b/ShiftOS_TheReturn/Lib/ConfigParser.py new file mode 100644 index 0000000..7e6cdbc --- /dev/null +++ b/ShiftOS_TheReturn/Lib/ConfigParser.py @@ -0,0 +1,753 @@ +"""Configuration file parser. + +A setup file consists of sections, lead by a "[section]" header, +and followed by "name: value" entries, with continuations and such in +the style of RFC 822. + +The option values can contain format strings which refer to other values in +the same section, or values in a special [DEFAULT] section. + +For example: + + something: %(dir)s/whatever + +would resolve the "%(dir)s" to the value of dir. All reference +expansions are done late, on demand. + +Intrinsic defaults can be specified by passing them into the +ConfigParser constructor as a dictionary. + +class: + +ConfigParser -- responsible for parsing a list of + configuration files, and managing the parsed database. + + methods: + + __init__(defaults=None) + create the parser and specify a dictionary of intrinsic defaults. The + keys must be strings, the values must be appropriate for %()s string + interpolation. Note that `__name__' is always an intrinsic default; + its value is the section's name. + + sections() + return all the configuration section names, sans DEFAULT + + has_section(section) + return whether the given section exists + + has_option(section, option) + return whether the given option exists in the given section + + options(section) + return list of configuration options for the named section + + read(filenames) + read and parse the list of named configuration files, given by + name. A single filename is also allowed. Non-existing files + are ignored. Return list of successfully read files. + + readfp(fp, filename=None) + read and parse one configuration file, given as a file object. + The filename defaults to fp.name; it is only used in error + messages (if fp has no `name' attribute, the string `' is used). + + get(section, option, raw=False, vars=None) + return a string value for the named option. All % interpolations are + expanded in the return values, based on the defaults passed into the + constructor and the DEFAULT section. Additional substitutions may be + provided using the `vars' argument, which must be a dictionary whose + contents override any pre-existing defaults. + + getint(section, options) + like get(), but convert value to an integer + + getfloat(section, options) + like get(), but convert value to a float + + getboolean(section, options) + like get(), but convert value to a boolean (currently case + insensitively defined as 0, false, no, off for False, and 1, true, + yes, on for True). Returns False or True. + + items(section, raw=False, vars=None) + return a list of tuples with (name, value) for each option + in the section. + + remove_section(section) + remove the given file section and all its options + + remove_option(section, option) + remove the given option from the given section + + set(section, option, value) + set the given option + + write(fp) + write the configuration state in .ini format +""" + +try: + from collections import OrderedDict as _default_dict +except ImportError: + # fallback for setup.py which hasn't yet built _collections + _default_dict = dict + +import re + +__all__ = ["NoSectionError", "DuplicateSectionError", "NoOptionError", + "InterpolationError", "InterpolationDepthError", + "InterpolationSyntaxError", "ParsingError", + "MissingSectionHeaderError", + "ConfigParser", "SafeConfigParser", "RawConfigParser", + "DEFAULTSECT", "MAX_INTERPOLATION_DEPTH"] + +DEFAULTSECT = "DEFAULT" + +MAX_INTERPOLATION_DEPTH = 10 + + + +# exception classes +class Error(Exception): + """Base class for ConfigParser exceptions.""" + + def _get_message(self): + """Getter for 'message'; needed only to override deprecation in + BaseException.""" + return self.__message + + def _set_message(self, value): + """Setter for 'message'; needed only to override deprecation in + BaseException.""" + self.__message = value + + # BaseException.message has been deprecated since Python 2.6. To prevent + # DeprecationWarning from popping up over this pre-existing attribute, use + # a new property that takes lookup precedence. + message = property(_get_message, _set_message) + + def __init__(self, msg=''): + self.message = msg + Exception.__init__(self, msg) + + def __repr__(self): + return self.message + + __str__ = __repr__ + +class NoSectionError(Error): + """Raised when no section matches a requested option.""" + + def __init__(self, section): + Error.__init__(self, 'No section: %r' % (section,)) + self.section = section + self.args = (section, ) + +class DuplicateSectionError(Error): + """Raised when a section is multiply-created.""" + + def __init__(self, section): + Error.__init__(self, "Section %r already exists" % section) + self.section = section + self.args = (section, ) + +class NoOptionError(Error): + """A requested option was not found.""" + + def __init__(self, option, section): + Error.__init__(self, "No option %r in section: %r" % + (option, section)) + self.option = option + self.section = section + self.args = (option, section) + +class InterpolationError(Error): + """Base class for interpolation-related exceptions.""" + + def __init__(self, option, section, msg): + Error.__init__(self, msg) + self.option = option + self.section = section + self.args = (option, section, msg) + +class InterpolationMissingOptionError(InterpolationError): + """A string substitution required a setting which was not available.""" + + def __init__(self, option, section, rawval, reference): + msg = ("Bad value substitution:\n" + "\tsection: [%s]\n" + "\toption : %s\n" + "\tkey : %s\n" + "\trawval : %s\n" + % (section, option, reference, rawval)) + InterpolationError.__init__(self, option, section, msg) + self.reference = reference + self.args = (option, section, rawval, reference) + +class InterpolationSyntaxError(InterpolationError): + """Raised when the source text into which substitutions are made + does not conform to the required syntax.""" + +class InterpolationDepthError(InterpolationError): + """Raised when substitutions are nested too deeply.""" + + def __init__(self, option, section, rawval): + msg = ("Value interpolation too deeply recursive:\n" + "\tsection: [%s]\n" + "\toption : %s\n" + "\trawval : %s\n" + % (section, option, rawval)) + InterpolationError.__init__(self, option, section, msg) + self.args = (option, section, rawval) + +class ParsingError(Error): + """Raised when a configuration file does not follow legal syntax.""" + + def __init__(self, filename): + Error.__init__(self, 'File contains parsing errors: %s' % filename) + self.filename = filename + self.errors = [] + self.args = (filename, ) + + def append(self, lineno, line): + self.errors.append((lineno, line)) + self.message += '\n\t[line %2d]: %s' % (lineno, line) + +class MissingSectionHeaderError(ParsingError): + """Raised when a key-value pair is found before any section header.""" + + def __init__(self, filename, lineno, line): + Error.__init__( + self, + 'File contains no section headers.\nfile: %s, line: %d\n%r' % + (filename, lineno, line)) + self.filename = filename + self.lineno = lineno + self.line = line + self.args = (filename, lineno, line) + + +class RawConfigParser: + def __init__(self, defaults=None, dict_type=_default_dict, + allow_no_value=False): + self._dict = dict_type + self._sections = self._dict() + self._defaults = self._dict() + if allow_no_value: + self._optcre = self.OPTCRE_NV + else: + self._optcre = self.OPTCRE + if defaults: + for key, value in defaults.items(): + self._defaults[self.optionxform(key)] = value + + def defaults(self): + return self._defaults + + def sections(self): + """Return a list of section names, excluding [DEFAULT]""" + # self._sections will never have [DEFAULT] in it + return self._sections.keys() + + def add_section(self, section): + """Create a new section in the configuration. + + Raise DuplicateSectionError if a section by the specified name + already exists. Raise ValueError if name is DEFAULT or any of it's + case-insensitive variants. + """ + if section.lower() == "default": + raise ValueError, 'Invalid section name: %s' % section + + if section in self._sections: + raise DuplicateSectionError(section) + self._sections[section] = self._dict() + + def has_section(self, section): + """Indicate whether the named section is present in the configuration. + + The DEFAULT section is not acknowledged. + """ + return section in self._sections + + def options(self, section): + """Return a list of option names for the given section name.""" + try: + opts = self._sections[section].copy() + except KeyError: + raise NoSectionError(section) + opts.update(self._defaults) + if '__name__' in opts: + del opts['__name__'] + return opts.keys() + + def read(self, filenames): + """Read and parse a filename or a list of filenames. + + Files that cannot be opened are silently ignored; this is + designed so that you can specify a list of potential + configuration file locations (e.g. current directory, user's + home directory, systemwide directory), and all existing + configuration files in the list will be read. A single + filename may also be given. + + Return list of successfully read files. + """ + if isinstance(filenames, basestring): + filenames = [filenames] + read_ok = [] + for filename in filenames: + try: + fp = open(filename) + except IOError: + continue + self._read(fp, filename) + fp.close() + read_ok.append(filename) + return read_ok + + def readfp(self, fp, filename=None): + """Like read() but the argument must be a file-like object. + + The `fp' argument must have a `readline' method. Optional + second argument is the `filename', which if not given, is + taken from fp.name. If fp has no `name' attribute, `' is + used. + + """ + if filename is None: + try: + filename = fp.name + except AttributeError: + filename = '' + self._read(fp, filename) + + def get(self, section, option): + opt = self.optionxform(option) + if section not in self._sections: + if section != DEFAULTSECT: + raise NoSectionError(section) + if opt in self._defaults: + return self._defaults[opt] + else: + raise NoOptionError(option, section) + elif opt in self._sections[section]: + return self._sections[section][opt] + elif opt in self._defaults: + return self._defaults[opt] + else: + raise NoOptionError(option, section) + + def items(self, section): + try: + d2 = self._sections[section] + except KeyError: + if section != DEFAULTSECT: + raise NoSectionError(section) + d2 = self._dict() + d = self._defaults.copy() + d.update(d2) + if "__name__" in d: + del d["__name__"] + return d.items() + + def _get(self, section, conv, option): + return conv(self.get(section, option)) + + def getint(self, section, option): + return self._get(section, int, option) + + def getfloat(self, section, option): + return self._get(section, float, option) + + _boolean_states = {'1': True, 'yes': True, 'true': True, 'on': True, + '0': False, 'no': False, 'false': False, 'off': False} + + def getboolean(self, section, option): + v = self.get(section, option) + if v.lower() not in self._boolean_states: + raise ValueError, 'Not a boolean: %s' % v + return self._boolean_states[v.lower()] + + def optionxform(self, optionstr): + return optionstr.lower() + + def has_option(self, section, option): + """Check for the existence of a given option in a given section.""" + if not section or section == DEFAULTSECT: + option = self.optionxform(option) + return option in self._defaults + elif section not in self._sections: + return False + else: + option = self.optionxform(option) + return (option in self._sections[section] + or option in self._defaults) + + def set(self, section, option, value=None): + """Set an option.""" + if not section or section == DEFAULTSECT: + sectdict = self._defaults + else: + try: + sectdict = self._sections[section] + except KeyError: + raise NoSectionError(section) + sectdict[self.optionxform(option)] = value + + def write(self, fp): + """Write an .ini-format representation of the configuration state.""" + if self._defaults: + fp.write("[%s]\n" % DEFAULTSECT) + for (key, value) in self._defaults.items(): + fp.write("%s = %s\n" % (key, str(value).replace('\n', '\n\t'))) + fp.write("\n") + for section in self._sections: + fp.write("[%s]\n" % section) + for (key, value) in self._sections[section].items(): + if key == "__name__": + continue + if (value is not None) or (self._optcre == self.OPTCRE): + key = " = ".join((key, str(value).replace('\n', '\n\t'))) + fp.write("%s\n" % (key)) + fp.write("\n") + + def remove_option(self, section, option): + """Remove an option.""" + if not section or section == DEFAULTSECT: + sectdict = self._defaults + else: + try: + sectdict = self._sections[section] + except KeyError: + raise NoSectionError(section) + option = self.optionxform(option) + existed = option in sectdict + if existed: + del sectdict[option] + return existed + + def remove_section(self, section): + """Remove a file section.""" + existed = section in self._sections + if existed: + del self._sections[section] + return existed + + # + # Regular expressions for parsing section headers and options. + # + SECTCRE = re.compile( + r'\[' # [ + r'(?P

    [^]]+)' # very permissive! + r'\]' # ] + ) + OPTCRE = re.compile( + r'(?P