diff options
Diffstat (limited to 'ShiftOS.WinForms')
19 files changed, 1244 insertions, 163 deletions
diff --git a/ShiftOS.WinForms/Applications/ButtonMaster.Designer.cs b/ShiftOS.WinForms/Applications/ButtonMaster.Designer.cs new file mode 100644 index 0000000..0ba9b96 --- /dev/null +++ b/ShiftOS.WinForms/Applications/ButtonMaster.Designer.cs @@ -0,0 +1,181 @@ +namespace ShiftOS.WinForms.Applications +{ + partial class ButtonMaster + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ButtonMaster)); + this.startpnl = new System.Windows.Forms.Panel(); + this.quitbtn = new System.Windows.Forms.Button(); + this.playbtn = new System.Windows.Forms.Button(); + this.difficultysel = new System.Windows.Forms.ListBox(); + this.label3 = new System.Windows.Forms.Label(); + this.desclabel = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.scorecounter = new System.Windows.Forms.Label(); + this.startpnl.SuspendLayout(); + this.SuspendLayout(); + // + // startpnl + // + this.startpnl.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.startpnl.Controls.Add(this.quitbtn); + this.startpnl.Controls.Add(this.playbtn); + this.startpnl.Controls.Add(this.difficultysel); + this.startpnl.Controls.Add(this.label3); + this.startpnl.Controls.Add(this.desclabel); + this.startpnl.Controls.Add(this.label2); + this.startpnl.Controls.Add(this.label1); + this.startpnl.Location = new System.Drawing.Point(27, 31); + this.startpnl.Name = "startpnl"; + this.startpnl.Size = new System.Drawing.Size(580, 409); + this.startpnl.TabIndex = 0; + // + // quitbtn + // + this.quitbtn.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.quitbtn.Location = new System.Drawing.Point(291, 303); + this.quitbtn.Name = "quitbtn"; + this.quitbtn.Size = new System.Drawing.Size(58, 23); + this.quitbtn.TabIndex = 7; + this.quitbtn.Text = "Quit"; + this.quitbtn.UseVisualStyleBackColor = true; + this.quitbtn.Click += new System.EventHandler(this.quitbtn_Click); + // + // playbtn + // + this.playbtn.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.playbtn.Location = new System.Drawing.Point(229, 303); + this.playbtn.Name = "playbtn"; + this.playbtn.Size = new System.Drawing.Size(56, 23); + this.playbtn.TabIndex = 6; + this.playbtn.Text = "Play"; + this.playbtn.UseVisualStyleBackColor = true; + this.playbtn.Click += new System.EventHandler(this.playbtn_Click); + // + // difficultysel + // + this.difficultysel.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.difficultysel.FormattingEnabled = true; + this.difficultysel.Location = new System.Drawing.Point(152, 202); + this.difficultysel.Name = "difficultysel"; + this.difficultysel.Size = new System.Drawing.Size(276, 95); + this.difficultysel.TabIndex = 5; + // + // label3 + // + this.label3.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label3.Location = new System.Drawing.Point(243, 179); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(79, 20); + this.label3.TabIndex = 4; + this.label3.Tag = "header2"; + this.label3.Text = "Difficulty"; + // + // desclabel + // + this.desclabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.desclabel.Location = new System.Drawing.Point(3, 67); + this.desclabel.Name = "desclabel"; + this.desclabel.Size = new System.Drawing.Size(577, 112); + this.desclabel.TabIndex = 2; + this.desclabel.Tag = ""; + this.desclabel.Text = resources.GetString("desclabel.Text"); + this.desclabel.TextAlign = System.Drawing.ContentAlignment.TopCenter; + // + // label2 + // + this.label2.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(235, 37); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(105, 13); + this.label2.TabIndex = 1; + this.label2.Text = "by Appscape Games"; + // + // label1 + // + this.label1.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.Location = new System.Drawing.Point(211, 12); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(152, 25); + this.label1.TabIndex = 0; + this.label1.Tag = "header1"; + this.label1.Text = "ButtonMaster"; + // + // scorecounter + // + this.scorecounter.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.scorecounter.BackColor = System.Drawing.Color.Transparent; + this.scorecounter.Font = new System.Drawing.Font("Courier New", 15.75F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.scorecounter.ForeColor = System.Drawing.Color.Red; + this.scorecounter.Location = new System.Drawing.Point(548, 454); + this.scorecounter.Name = "scorecounter"; + this.scorecounter.Size = new System.Drawing.Size(92, 26); + this.scorecounter.TabIndex = 1; + this.scorecounter.Tag = "keepfont keepfg keepbg"; + this.scorecounter.Text = "score"; + this.scorecounter.TextAlign = System.Drawing.ContentAlignment.BottomRight; + this.scorecounter.Visible = false; + // + // ButtonMaster + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackgroundImage = global::ShiftOS.WinForms.Properties.Resources.BlueBlueVerticalGradient; + this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.Controls.Add(this.scorecounter); + this.Controls.Add(this.startpnl); + this.Name = "ButtonMaster"; + this.Size = new System.Drawing.Size(640, 480); + this.startpnl.ResumeLayout(false); + this.startpnl.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Panel startpnl; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label desclabel; + private System.Windows.Forms.ListBox difficultysel; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Button playbtn; + private System.Windows.Forms.Button quitbtn; + private System.Windows.Forms.Label scorecounter; + } +} diff --git a/ShiftOS.WinForms/Applications/ButtonMaster.cs b/ShiftOS.WinForms/Applications/ButtonMaster.cs new file mode 100644 index 0000000..722bb14 --- /dev/null +++ b/ShiftOS.WinForms/Applications/ButtonMaster.cs @@ -0,0 +1,176 @@ +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.Applications +{ + // Behold... The ShiftOS program that doesn't use threading. + [WinOpen("buttonmaster")] + [Launcher("Button Master", false, "", "Games")] + [AppscapeEntry("buttonmaster", "ButtonMaster", "Can you click all the buttons in 60 seconds?", 300, 10000)] + public partial class ButtonMaster : UserControl, IShiftOSWindow + { + public ushort Buttons; + public double Codepoints, Loss; + private ulong RoundedCodepoints { get { return (ulong) Math.Round(Codepoints); } } + public Timer clock = new Timer(); + private ButtonObject[] ButtonObjects; + private static ButtonMasterDifficulty[] difficulties = new ButtonMasterDifficulty[] + { + new ButtonMasterDifficulty("Easy", 24, 500), + new ButtonMasterDifficulty("Medium", 48, 1000), + new ButtonMasterDifficulty("Hard", 100, 2000), + new ButtonMasterDifficulty("Super Hard", 500, 10000) + }; + public ButtonMaster() + { + InitializeComponent(); + difficultysel.Items.AddRange(difficulties); + difficultysel.SelectedIndex = 0; + clock.Interval = 20; + clock.Tick += gameloop; + } + + public void OnLoad() + { + } + + public void OnSkinLoad() + { + + } + + public bool OnUnload() + { + return true; + } + + public void OnUpgrade() + { + + } + + private void quitbtn_Click(object sender, EventArgs e) + { + AppearanceManager.Close(this); + } + + private void playbtn_Click(object sender, EventArgs e) + { + var difficulty = difficultysel.SelectedItem as ButtonMasterDifficulty; + Buttons = difficulty.Buttons; + Codepoints = difficulty.Codepoints; + Loss = difficulty.Codepoints / 3000.0; + startpnl.Hide(); + scorecounter.Text = difficulty.Codepoints.ToString(); + scorecounter.Show(); + ButtonObjects = new ButtonObject[Buttons]; + for (ushort i = 0; i < Buttons; i++) + ButtonObjects[i] = new ButtonObject(this); + Controls.AddRange(ButtonObjects.Select(b => b.ctl).ToArray()); + clock.Start(); + } + + private void StopGame(string text) + { + desclabel.Text = text; + startpnl.Show(); + clock.Stop(); + scorecounter.Hide(); + foreach (var b in ButtonObjects) + { + clock.Tick -= b.move; + Controls.Remove(b.ctl); + } + } + + private void gameloop(object sender, EventArgs e) + { + if (Codepoints <= 0) + { + Codepoints = 0; + string text = String.Format("You lost. There were {0} buttons to go.", Buttons); + if (difficultysel.SelectedIndex > 0) + text += " Try an easier difficulty?"; + StopGame(text); + } + else if (Buttons <= 0) + { + SaveSystem.CurrentSave.Codepoints += RoundedCodepoints; + string text = String.Format("You won! {0} Codepoints have been transferred to your system.", RoundedCodepoints); + StopGame(text); + } + else + { + Codepoints -= Loss; + scorecounter.Text = RoundedCodepoints.ToString(); + } + } + } + public class ButtonMasterDifficulty + { + public string Name { get; private set; } + public ushort Buttons { get; private set; } + public uint Codepoints { get; private set; } + public string Display { get; private set; } + public override string ToString() + { + return Display; + } + public ButtonMasterDifficulty(string in_Name, ushort in_Buttons, uint in_Codepoints) + { + Name = in_Name; + Buttons = in_Buttons; + Codepoints = in_Codepoints; + Display = String.Format("{0} ({1} Buttons, {2} Codepoints)", Name, Buttons, Codepoints); + } + } + + public class ButtonObject + { + public Button ctl; + public sbyte xspeed, yspeed; + public ButtonMaster parent; + private static Random rnd = new Random(); + public void move(object sender, EventArgs e) + { + ctl.Top += yspeed; + if (ctl.Top < 0 || ctl.Bottom > parent.Height) + yspeed = (sbyte)(Math.Abs(yspeed) * -(ctl.Top / Math.Abs(ctl.Top))); // Change the sign of yspeed to be the opposite of that of ctl.Top + ctl.Left += xspeed; + if (ctl.Left < 0 || ctl.Right > parent.Width) + xspeed = (sbyte)(Math.Abs(xspeed) * -(ctl.Left / Math.Abs(ctl.Left))); + } + public void click(object sender, EventArgs e) + { + parent.Buttons--; + ctl.Hide(); + parent.clock.Tick -= move; + } + public ButtonObject(ButtonMaster in_parent) + { + xspeed = (sbyte) rnd.Next(10, 20); + yspeed = (sbyte) rnd.Next(10, 20); + parent = in_parent; + parent.clock.Tick += move; + ctl = new Button(); + ctl.Click += click; + ctl.Top = rnd.Next(parent.Height); + ctl.Left = rnd.Next(parent.Width); + ctl.Width = 75; + ctl.Height = 23; + ctl.Text = "Click"; + // Time to invoke a private method using reflection. What could possibly go wrong? + // This stops the player from just holding down space to beat the level. + typeof(Button).GetMethod("SetStyle", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).Invoke(ctl, new object[] { ControlStyles.Selectable, false }); + } + + } +} diff --git a/ShiftOS.WinForms/Applications/ButtonMaster.resx b/ShiftOS.WinForms/Applications/ButtonMaster.resx new file mode 100644 index 0000000..6742cee --- /dev/null +++ b/ShiftOS.WinForms/Applications/ButtonMaster.resx @@ -0,0 +1,130 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <data name="desclabel.Text" xml:space="preserve"> + <value>In the game of ButtonMaster, dozens of buttons bounce +around the window. Your task is to click all of them in +60 seconds. The quicker you pull it off, the more points +you earn. + +In this special ShiftOS version, any points you earn are +added to your Codepoints balance at the end of the game. +So, what are you waiting for?</value> + </data> +</root>
\ No newline at end of file diff --git a/ShiftOS.WinForms/Applications/Chat.Designer.cs b/ShiftOS.WinForms/Applications/Chat.Designer.cs index 7bfa4dd..622bf1a 100644 --- a/ShiftOS.WinForms/Applications/Chat.Designer.cs +++ b/ShiftOS.WinForms/Applications/Chat.Designer.cs @@ -65,9 +65,12 @@ namespace ShiftOS.WinForms.Applications this.toolStrip1 = new System.Windows.Forms.ToolStrip(); this.tschatid = new System.Windows.Forms.ToolStripLabel(); this.tsuserdata = new System.Windows.Forms.ToolStripLabel(); + this.lbtyping = new System.Windows.Forms.ToolStripLabel(); this.tsbottombar = new System.Windows.Forms.ToolStrip(); this.txtuserinput = new System.Windows.Forms.ToolStripTextBox(); this.btnsend = new System.Windows.Forms.ToolStripButton(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.btnsendfile = new System.Windows.Forms.ToolStripButton(); this.panel1.SuspendLayout(); this.pnlstart.SuspendLayout(); this.flowLayoutPanel1.SuspendLayout(); @@ -179,7 +182,10 @@ namespace ShiftOS.WinForms.Applications // this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.tschatid, - this.tsuserdata}); + this.tsuserdata, + this.lbtyping, + this.toolStripSeparator1, + this.btnsendfile}); this.toolStrip1.Location = new System.Drawing.Point(0, 0); this.toolStrip1.Name = "toolStrip1"; this.toolStrip1.Size = new System.Drawing.Size(633, 25); @@ -198,6 +204,12 @@ namespace ShiftOS.WinForms.Applications this.tsuserdata.Size = new System.Drawing.Size(86, 22); this.tsuserdata.Text = "toolStripLabel1"; // + // lbtyping + // + this.lbtyping.Name = "lbtyping"; + this.lbtyping.Size = new System.Drawing.Size(86, 22); + this.lbtyping.Text = "toolStripLabel1"; + // // tsbottombar // this.tsbottombar.Dock = System.Windows.Forms.DockStyle.Bottom; @@ -227,6 +239,21 @@ namespace ShiftOS.WinForms.Applications this.btnsend.Text = "Send"; this.btnsend.Click += new System.EventHandler(this.btnsend_Click); // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25); + // + // btnsendfile + // + this.btnsendfile.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.btnsendfile.Image = ((System.Drawing.Image)(resources.GetObject("btnsendfile.Image"))); + this.btnsendfile.ImageTransparentColor = System.Drawing.Color.Magenta; + this.btnsendfile.Name = "btnsendfile"; + this.btnsendfile.Size = new System.Drawing.Size(65, 22); + this.btnsendfile.Text = "Send a file"; + this.btnsendfile.Click += new System.EventHandler(this.btnsendfile_Click); + // // Chat // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -265,5 +292,8 @@ namespace ShiftOS.WinForms.Applications private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; private System.Windows.Forms.TextBox txtchatid; private System.Windows.Forms.Button btnjoin; + private System.Windows.Forms.ToolStripLabel lbtyping; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; + private System.Windows.Forms.ToolStripButton btnsendfile; } } diff --git a/ShiftOS.WinForms/Applications/Chat.cs b/ShiftOS.WinForms/Applications/Chat.cs index 2abf5eb..5be7b0c 100644 --- a/ShiftOS.WinForms/Applications/Chat.cs +++ b/ShiftOS.WinForms/Applications/Chat.cs @@ -49,6 +49,41 @@ namespace ShiftOS.WinForms.Applications InitializeComponent(); } + public event Action<ShiftOS.Objects.ShiftFS.File> FileSent; + + public string Typing + { + get + { + return lbtyping.Text; + } + set + { + this.Invoke(new Action(() => + { + if (string.IsNullOrWhiteSpace(value)) + { + lbtyping.Visible = false; + } + else + { + lbtyping.Text = value + " is typing..."; + lbtyping.Visible = true; + } + })); + } + } + + public void ShowChat() + { + this.Invoke(new Action(() => + { + pnlstart.Hide(); + rtbchat.Show(); + rtbchat.BringToFront(); + })); + } + public void OnLoad() { AllInstances.Add(this); @@ -86,7 +121,7 @@ namespace ShiftOS.WinForms.Applications private void txtuserinput_KeyDown(object sender, KeyEventArgs e) { - if(e.KeyCode == Keys.Enter) + if (e.KeyCode == Keys.Enter) { e.SuppressKeyPress = true; @@ -108,7 +143,7 @@ namespace ShiftOS.WinForms.Applications public static void SendMessage(string user, string destination, string msg) { - foreach(var chat in AllInstances) + foreach (var chat in AllInstances) { chat.PostMessage(user, destination, msg); } @@ -138,62 +173,14 @@ namespace ShiftOS.WinForms.Applications txtuserinput.Text = ""; } - [Story("story_thefennfamily")] - public static void Story_TheFennFamily() + private void btnsendfile_Click(object sender, EventArgs e) { - bool complete = false; - Infobox.Show("SimpleSRC", "A direct message has been sent to you on SimpleSRC from user \"maureenfenn@trisys\".", () => + FileSkimmerBackend.GetFile(new[] { "" }, FileOpenerStyle.Open, (file) => { - string ch = "maureenfenn@trisys"; - var c = new Chat(); - c.ChatID = ch; - AppearanceManager.SetupWindow(c); - string you = $"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}"; - - var t = new Thread(() => - { - SendMessage(you, ch, "User has joined the chat."); - Thread.Sleep(2000); - SendMessage(ch, ch, "Hello, " + you + ". My name is Maureen. Maureen Fenn."); - Thread.Sleep(2500); - SendMessage(ch, ch, "I am the author of the various Tri applications you may see on Appscape."); - Thread.Sleep(2000); - SendMessage(ch, ch, "I need your help with something..."); - Thread.Sleep(2500); - SendMessage(ch, ch, "Firstly, a little backstory. There was a time in ShiftOS when none of us were connected."); - Thread.Sleep(2500); - SendMessage(ch, ch, "There wasn't a Digital Society, we didn't have chat applications or anything..."); - Thread.Sleep(2000); - SendMessage(ch, ch, "All we had was the Shiftnet."); - Thread.Sleep(2500); - SendMessage(ch, ch, "However, in 2016, something happened called the \"connected revolution\". It was like, the invention of the Internet - it was huge for the world of ShiftOS."); - Thread.Sleep(2500); - SendMessage(ch, ch, "Before this, the only way you could earn Codepoints was through playing games in ShiftOS."); - Thread.Sleep(2500); - SendMessage(ch, ch, "I was the one who coded those games, and I would put them on a Shiftnet website that you can still access today, shiftnet/main/shiftgames."); - Thread.Sleep(2500); - SendMessage(ch, ch, "But when the Connected Revolution took place, things got difficult. My son, Nalyr Fenn, was born, and people stopped using my software and instead moved on to hacking eachother and stealing peoples' Codepoints."); - Thread.Sleep(2500); - SendMessage(ch, ch, "When Nalyr's sentience levels reached near human - i.e, he grew up, we decided to start TriOffice. It was a huge success, thanks to Aiden Nirh, the guy who runs Appscape."); - Thread.Sleep(2500); - SendMessage(ch, ch, "However... a few months ago he cut contact with us and we stopped receiving Codepoints from TriOffice."); - Thread.Sleep(2500); - SendMessage(ch, ch, "I'm running low - I can't afford to keep my system running much longer. You have to help!"); - Thread.Sleep(2500); - SendMessage(ch, ch, "Perhaps, you could breach Aiden's server and look for clues as to why he's against us? I'll reward you with the last Codepoints I have."); - Thread.Sleep(2500); - SendMessage(you, ch, "Alright, I'm in - but I don't know where to begin..."); - Thread.Sleep(2500); - SendMessage(ch, ch, "A little birdie tells me you know about the RTS exploits going around... Try using that on Aiden's server. You can find his systemname on Appscape under \"Contact Us.\" He has a mailserver on Appscape - and also has RTS on the same server."); - Thread.Sleep(2500); - SendMessage(ch, ch, "Good luck... My life depends on you!"); - complete = true; - }); - t.IsBackground = true; - t.Start(); + var finf = ShiftOS.Objects.ShiftFS.Utils.GetFileInfo(file); + PostMessage($"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}", ChatID, "<user sent a file: " + finf.Name + ">"); + FileSent?.Invoke(finf); }); - while (!complete) - Thread.Sleep(10); } } } diff --git a/ShiftOS.WinForms/Applications/Chat.resx b/ShiftOS.WinForms/Applications/Chat.resx index e4a35ad..1787168 100644 --- a/ShiftOS.WinForms/Applications/Chat.resx +++ b/ShiftOS.WinForms/Applications/Chat.resx @@ -120,16 +120,25 @@ <metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>17, 17</value> </metadata> + <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> + <data name="btnsendfile.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value> + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG + YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 + 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw + bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc + VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9 + c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32 + Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo + mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+ + kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D + TgDQASA1MVpwzwAAAABJRU5ErkJggg== +</value> + </data> <metadata name="tsbottombar.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>122, 17</value> </metadata> - <metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> - <value>17, 17</value> - </metadata> - <metadata name="tsbottombar.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> - <value>122, 17</value> - </metadata> - <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <data name="btnsend.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <value> iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 diff --git a/ShiftOS.WinForms/Applications/FileSkimmer.Designer.cs b/ShiftOS.WinForms/Applications/FileSkimmer.Designer.cs index 4df58c3..91891ba 100644 --- a/ShiftOS.WinForms/Applications/FileSkimmer.Designer.cs +++ b/ShiftOS.WinForms/Applications/FileSkimmer.Designer.cs @@ -65,23 +65,24 @@ namespace ShiftOS.WinForms.Applications this.moveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.pinToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.pnlconnect = new System.Windows.Forms.Panel(); - this.lbctitle = new System.Windows.Forms.Label(); - this.lbcdesc = new System.Windows.Forms.Label(); - this.pnlcreds = new System.Windows.Forms.Panel(); - this.label1 = new System.Windows.Forms.Label(); - this.txtcsys = new System.Windows.Forms.TextBox(); - this.txtcuser = new System.Windows.Forms.TextBox(); - this.label2 = new System.Windows.Forms.Label(); - this.txtcpass = new System.Windows.Forms.TextBox(); - this.label3 = new System.Windows.Forms.Label(); this.flcbuttons = new System.Windows.Forms.FlowLayoutPanel(); this.btncancel = new System.Windows.Forms.Button(); this.btnok = new System.Windows.Forms.Button(); + this.pnlcreds = new System.Windows.Forms.Panel(); + this.txtcpass = new System.Windows.Forms.TextBox(); + this.label3 = new System.Windows.Forms.Label(); + this.txtcuser = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this.txtcsys = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.lbcdesc = new System.Windows.Forms.Label(); + this.lbctitle = new System.Windows.Forms.Label(); + this.disconnectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.panel1.SuspendLayout(); this.menuStrip1.SuspendLayout(); this.pnlconnect.SuspendLayout(); - this.pnlcreds.SuspendLayout(); this.flcbuttons.SuspendLayout(); + this.pnlcreds.SuspendLayout(); this.SuspendLayout(); // // lvitems @@ -131,6 +132,7 @@ namespace ShiftOS.WinForms.Applications this.newFolderToolStripMenuItem, this.deleteToolStripMenuItem, this.connectToRemoteServerToolStripMenuItem, + this.disconnectToolStripMenuItem, this.copyToolStripMenuItem, this.moveToolStripMenuItem, this.pinToolStripMenuItem}); @@ -194,24 +196,40 @@ namespace ShiftOS.WinForms.Applications this.pnlconnect.TabIndex = 4; this.pnlconnect.Visible = false; // - // lbctitle + // flcbuttons // - this.lbctitle.AutoSize = true; - this.lbctitle.Location = new System.Drawing.Point(13, 18); - this.lbctitle.Name = "lbctitle"; - this.lbctitle.Size = new System.Drawing.Size(133, 13); - this.lbctitle.TabIndex = 0; - this.lbctitle.Tag = "header3"; - this.lbctitle.Text = "Connect to Remote Server"; + this.flcbuttons.AutoSize = true; + this.flcbuttons.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.flcbuttons.Controls.Add(this.btncancel); + this.flcbuttons.Controls.Add(this.btnok); + this.flcbuttons.Location = new System.Drawing.Point(116, 256); + this.flcbuttons.Name = "flcbuttons"; + this.flcbuttons.Size = new System.Drawing.Size(94, 29); + this.flcbuttons.TabIndex = 3; // - // lbcdesc + // btncancel // - this.lbcdesc.Location = new System.Drawing.Point(46, 51); - this.lbcdesc.Name = "lbcdesc"; - this.lbcdesc.Size = new System.Drawing.Size(357, 54); - this.lbcdesc.TabIndex = 1; - this.lbcdesc.Text = resources.GetString("lbcdesc.Text"); - this.lbcdesc.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.btncancel.AutoSize = true; + this.btncancel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btncancel.Location = new System.Drawing.Point(3, 3); + this.btncancel.Name = "btncancel"; + this.btncancel.Size = new System.Drawing.Size(50, 23); + this.btncancel.TabIndex = 0; + this.btncancel.Text = "Cancel"; + this.btncancel.UseVisualStyleBackColor = true; + this.btncancel.Click += new System.EventHandler(this.btncancel_Click); + // + // btnok + // + this.btnok.AutoSize = true; + this.btnok.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnok.Location = new System.Drawing.Point(59, 3); + this.btnok.Name = "btnok"; + this.btnok.Size = new System.Drawing.Size(32, 23); + this.btnok.TabIndex = 1; + this.btnok.Text = "OK"; + this.btnok.UseVisualStyleBackColor = true; + this.btnok.Click += new System.EventHandler(this.btnok_Click); // // pnlcreds // @@ -226,23 +244,23 @@ namespace ShiftOS.WinForms.Applications this.pnlcreds.Size = new System.Drawing.Size(300, 104); this.pnlcreds.TabIndex = 2; // - // label1 + // txtcpass // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(12, 13); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(73, 13); - this.label1.TabIndex = 0; - this.label1.Text = "System name:"; + this.txtcpass.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtcpass.Location = new System.Drawing.Point(91, 62); + this.txtcpass.Name = "txtcpass"; + this.txtcpass.Size = new System.Drawing.Size(196, 20); + this.txtcpass.TabIndex = 5; // - // txtcsys + // label3 // - this.txtcsys.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.txtcsys.Location = new System.Drawing.Point(91, 10); - this.txtcsys.Name = "txtcsys"; - this.txtcsys.Size = new System.Drawing.Size(196, 20); - this.txtcsys.TabIndex = 1; + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(12, 65); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(56, 13); + this.label3.TabIndex = 4; + this.label3.Text = "Password:"; // // txtcuser // @@ -262,58 +280,50 @@ namespace ShiftOS.WinForms.Applications this.label2.TabIndex = 2; this.label2.Text = "Username:"; // - // txtcpass + // txtcsys // - this.txtcpass.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + this.txtcsys.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.txtcpass.Location = new System.Drawing.Point(91, 62); - this.txtcpass.Name = "txtcpass"; - this.txtcpass.Size = new System.Drawing.Size(196, 20); - this.txtcpass.TabIndex = 5; + this.txtcsys.Location = new System.Drawing.Point(91, 10); + this.txtcsys.Name = "txtcsys"; + this.txtcsys.Size = new System.Drawing.Size(196, 20); + this.txtcsys.TabIndex = 1; // - // label3 + // label1 // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(12, 65); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(56, 13); - this.label3.TabIndex = 4; - this.label3.Text = "Password:"; + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(12, 13); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(73, 13); + this.label1.TabIndex = 0; + this.label1.Text = "System name:"; // - // flcbuttons + // lbcdesc // - this.flcbuttons.AutoSize = true; - this.flcbuttons.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.flcbuttons.Controls.Add(this.btncancel); - this.flcbuttons.Controls.Add(this.btnok); - this.flcbuttons.Location = new System.Drawing.Point(116, 256); - this.flcbuttons.Name = "flcbuttons"; - this.flcbuttons.Size = new System.Drawing.Size(94, 29); - this.flcbuttons.TabIndex = 3; + this.lbcdesc.Location = new System.Drawing.Point(46, 51); + this.lbcdesc.Name = "lbcdesc"; + this.lbcdesc.Size = new System.Drawing.Size(357, 54); + this.lbcdesc.TabIndex = 1; + this.lbcdesc.Text = resources.GetString("lbcdesc.Text"); + this.lbcdesc.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // - // btncancel + // lbctitle // - this.btncancel.AutoSize = true; - this.btncancel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.btncancel.Location = new System.Drawing.Point(3, 3); - this.btncancel.Name = "btncancel"; - this.btncancel.Size = new System.Drawing.Size(50, 23); - this.btncancel.TabIndex = 0; - this.btncancel.Text = "Cancel"; - this.btncancel.UseVisualStyleBackColor = true; - this.btncancel.Click += new System.EventHandler(this.btncancel_Click); + this.lbctitle.AutoSize = true; + this.lbctitle.Location = new System.Drawing.Point(13, 18); + this.lbctitle.Name = "lbctitle"; + this.lbctitle.Size = new System.Drawing.Size(133, 13); + this.lbctitle.TabIndex = 0; + this.lbctitle.Tag = "header3"; + this.lbctitle.Text = "Connect to Remote Server"; // - // btnok + // disconnectToolStripMenuItem // - this.btnok.AutoSize = true; - this.btnok.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.btnok.Location = new System.Drawing.Point(59, 3); - this.btnok.Name = "btnok"; - this.btnok.Size = new System.Drawing.Size(32, 23); - this.btnok.TabIndex = 1; - this.btnok.Text = "OK"; - this.btnok.UseVisualStyleBackColor = true; - this.btnok.Click += new System.EventHandler(this.btnok_Click); + this.disconnectToolStripMenuItem.Name = "disconnectToolStripMenuItem"; + this.disconnectToolStripMenuItem.Size = new System.Drawing.Size(78, 20); + this.disconnectToolStripMenuItem.Text = "Disconnect"; + this.disconnectToolStripMenuItem.Visible = false; + this.disconnectToolStripMenuItem.Click += new System.EventHandler(this.disconnectToolStripMenuItem_Click); // // FileSkimmer // @@ -330,10 +340,10 @@ namespace ShiftOS.WinForms.Applications this.menuStrip1.PerformLayout(); this.pnlconnect.ResumeLayout(false); this.pnlconnect.PerformLayout(); - this.pnlcreds.ResumeLayout(false); - this.pnlcreds.PerformLayout(); this.flcbuttons.ResumeLayout(false); this.flcbuttons.PerformLayout(); + this.pnlcreds.ResumeLayout(false); + this.pnlcreds.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -365,5 +375,6 @@ namespace ShiftOS.WinForms.Applications private System.Windows.Forms.Label label1; private System.Windows.Forms.Label lbcdesc; private System.Windows.Forms.Label lbctitle; + private System.Windows.Forms.ToolStripMenuItem disconnectToolStripMenuItem; } }
\ No newline at end of file diff --git a/ShiftOS.WinForms/Applications/FileSkimmer.cs b/ShiftOS.WinForms/Applications/FileSkimmer.cs index 34f9e9c..3e17420 100644 --- a/ShiftOS.WinForms/Applications/FileSkimmer.cs +++ b/ShiftOS.WinForms/Applications/FileSkimmer.cs @@ -55,11 +55,14 @@ namespace ShiftOS.WinForms.Applications public static void DisconnectRemote() { - OnDisconnect?.Invoke(); - CurrentRemoteUser = new Objects.ClientSave(); - if (!string.IsNullOrWhiteSpace(OpenConnection.SystemName)) - Infobox.Show("Connections terminated.", "All outbound File Skimmer connections have been terminated."); - OpenConnection = new ShiftOSEnvironment(); + Desktop.InvokeOnWorkerThread(() => + { + OnDisconnect?.Invoke(); + CurrentRemoteUser = new Objects.ClientSave(); + if (!string.IsNullOrWhiteSpace(OpenConnection.SystemName)) + Infobox.Show("Connections terminated.", "All outbound File Skimmer connections have been terminated."); + OpenConnection = new ShiftOSEnvironment(); + }); } public FileSkimmer() @@ -74,6 +77,8 @@ namespace ShiftOS.WinForms.Applications private void FileSkimmer_OnDisconnect() { + connectToRemoteServerToolStripMenuItem.Text = "Start Remote Session"; + disconnectToolStripMenuItem.Visible = false; currentdir = "__system"; ResetList(); } @@ -576,6 +581,7 @@ namespace ShiftOS.WinForms.Applications ChangeDirectory("2:"); pnlconnect.Hide(); connectToRemoteServerToolStripMenuItem.Text = "Reauthenticate"; + disconnectToolStripMenuItem.Visible = true; return; } Infobox.Show("Access denied.", "Authentication failed for the specified user. Connection aborted."); @@ -589,5 +595,10 @@ namespace ShiftOS.WinForms.Applications t.IsBackground = true; t.Start(); } + + private void disconnectToolStripMenuItem_Click(object sender, EventArgs e) + { + DisconnectRemote(); + } } } diff --git a/ShiftOS.WinForms/Commands.cs b/ShiftOS.WinForms/Commands.cs index c7d8f5b..c9e9376 100644 --- a/ShiftOS.WinForms/Commands.cs +++ b/ShiftOS.WinForms/Commands.cs @@ -49,7 +49,10 @@ namespace ShiftOS.Engine [Command("clear", description = "{DESC_CLEAR}")] public static bool Clear() { - AppearanceManager.ConsoleOut.Clear(); + Desktop.InvokeOnWorkerThread(() => + { + AppearanceManager.ConsoleOut.Clear(); + }); return true; } } diff --git a/ShiftOS.WinForms/MissionCommands.cs b/ShiftOS.WinForms/MissionCommands.cs new file mode 100644 index 0000000..d295392 --- /dev/null +++ b/ShiftOS.WinForms/MissionCommands.cs @@ -0,0 +1,116 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ShiftOS.Engine; + +namespace ShiftOS.WinForms +{ + [RequiresUpgrade("hacker101_breakingbonds_3")] + public static class MissionCommands + { + public static List<MissionAttribute> GetMissionsList() + { + var missions = new List<MissionAttribute>(); + foreach (var type in ReflectMan.Types) + { + foreach (var method in type.GetMethods(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static)) + { + var attrib = method.GetCustomAttributes(false).FirstOrDefault(x => x is MissionAttribute) as MissionAttribute; + if (attrib != null) + { + if (Shiftorium.UpgradeAttributesUnlocked(method)) + { + if (!Shiftorium.UpgradeInstalled(attrib.StoryID)) + { + missions.Add(attrib); + } + } + } + } + } + return missions; + } + + [Command("missions", description = "Lists all available missions.")] + public static void ShowAll() + { + ConsoleEx.ForegroundColor = ConsoleColor.Yellow; + ConsoleEx.Bold = true; + Console.WriteLine(" - Missions - "); + + var missions = GetMissionsList(); + + ConsoleEx.ForegroundColor = ConsoleColor.White; + ConsoleEx.Bold = false; + if(missions.Count == 0) + { + Console.WriteLine("No missions available. Check back later!"); + } + else + { + foreach(var mission in missions) + { + Console.WriteLine(); + Console.WriteLine(mission.Name); + Console.WriteLine("--------------------------"); + Console.WriteLine(); + Console.WriteLine(mission.Description); + Console.WriteLine(); + Console.WriteLine("assigner: " + mission.Assigner); + Console.WriteLine("reward: " + mission.CodepointAward + " Codepoints"); + Console.WriteLine("To start this mission, run:"); + ConsoleEx.Bold = true; + Console.WriteLine("startmission --id " + missions.IndexOf(mission)); + } + } + + Console.WriteLine(); + + Console.WriteLine("Story progress:"); + ConsoleEx.Bold = true; + ConsoleEx.ForegroundColor = ConsoleColor.Cyan; + double percentage = GetMissionPercentage() * 100; + Console.WriteLine(percentage.ToString("#.##") + "%"); + } + + public static double GetMissionPercentage() + { + int missionsFound = 0; + int missionsComplete = 0; + foreach(var type in ReflectMan.Types) + { + foreach (var mth in type.GetMethods(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static)) + { + var missionAttrib = mth.GetCustomAttributes(false).FirstOrDefault(x => x is MissionAttribute) as MissionAttribute; + if (missionAttrib != null) + { + missionsFound++; + if (Shiftorium.UpgradeInstalled(missionAttrib.StoryID)) + missionsComplete++; + } + + } + } + double percentage = (double)missionsComplete / (double)missionsFound; + return percentage; + } + + [Command("startmission", description = "Starts the specified mission.")] + [RequiresArgument("id")] + public static void StartMission(Dictionary<string, object> args) + { + var id = Convert.ToInt32(args["id"].ToString()); + var missions = GetMissionsList(); + if (id < 0 || id >= missions.Count) + Console.WriteLine("Error: Mission ID not found."); + else + { + var mission = missions[id]; + Story.Start(mission.StoryID); + } + } + + } +} diff --git a/ShiftOS.WinForms/Program.cs b/ShiftOS.WinForms/Program.cs index 9ec0ede..c73f067 100644 --- a/ShiftOS.WinForms/Program.cs +++ b/ShiftOS.WinForms/Program.cs @@ -71,7 +71,7 @@ namespace ShiftOS.WinForms Action completed = null; completed = () => { - SaveSystem.Ready = true; + SaveSystem.Ready.Set(); Engine.AudioManager.PlayCompleted -= completed; AudioManager.StartAmbientLoop(); }; diff --git a/ShiftOS.WinForms/Properties/Resources.Designer.cs b/ShiftOS.WinForms/Properties/Resources.Designer.cs index 83515c4..9dcd2fd 100644 --- a/ShiftOS.WinForms/Properties/Resources.Designer.cs +++ b/ShiftOS.WinForms/Properties/Resources.Designer.cs @@ -160,6 +160,35 @@ namespace ShiftOS.WinForms.Properties { } /// <summary> + /// Looks up a localized string similar to { + /// "Name": "appscape_main", + /// "Files": [], + /// "Subdirectories": [ + /// { + /// "Name": "bans", + /// "Files": [ + /// { + /// "Name": "hacker101.txt", + /// "Data": "RGF0ZTogMTAvMy8yMDE4DQpVc2VyOiBoYWNrZXIxMDENCg0KQmFuIHR5cGU6IEF1dG9tYXRlZA0KDQpEZXNjcmlwdGlvbjoNCg0KVGhpcyB1c2VyIGhhcyBiZWVuIGJhbm5lZCBieSB0aGUgYXV0b21hdGVkIGFudGktaGFja2luZyBzeXN0ZW0gZm9yIGNyZWF0aW9uIG9mIG1hbGljaW91cyBzb2Z0d2FyZSBhbmQgZXhwbG9pdGF0aW9uIHV0aWxpdGllcy4=", + /// "HeaderData": null, + /// "ReadAccessToLo [rest of string was truncated]";. + /// </summary> + internal static string AppscapeServerFS { + get { + return ResourceManager.GetString("AppscapeServerFS", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to RGF0ZTogMDQvMS8yMDE4DQpVc2VyOiBtYXVyZWVuX2Zlbm4NCg0KQmFuIHR5cGU6IENlYXNlIGFuZCBkZXNpc3QgKERldlgpDQoNCkRlc2NyaXB0aW9uOg0KDQpEZXZYIGhhcyBzZW50IGEgY2Vhc2UgYW5kIGRlc2lzdCByZXF1ZXN0IHRvIEFwcHNjYXBlIGZvciBob3N0aW5nIHRoaXMgdXNlcidzIGFwcGxpY2F0aW9ucyBhbmQgc2VuZGluZyBwcm9maXRzIG92ZXIuIFRoaXMgdXNlcidzIHNvZnR3YXJlIHdpbGwgbm90IGJlIHB1bGxlZCwgYnV0IGFsbCBDb2RlcG9pbnRzIGVhcm5lZCBmcm9tIGl0IHdpbGwgbm90IGJlIHJlZGlyZWN0ZWQgYW5kIHRoZSB1c2VyIHdpbGwgbm90IGJlIGFibGUgdG8gYWNjZXNzIHRoZWlyIGRldmVsb3BtZW50IHBhbmVsLg==. + /// </summary> + internal static string AppscapeWantedFile { + get { + return ResourceManager.GetString("AppscapeWantedFile", resourceCulture); + } + } + + /// <summary> /// Looks up a localized resource of type System.Drawing.Bitmap. /// </summary> internal static System.Drawing.Bitmap ArtPadcirclerubber { @@ -362,6 +391,26 @@ namespace ShiftOS.WinForms.Properties { /// <summary> /// Looks up a localized resource of type System.Drawing.Bitmap. /// </summary> + internal static System.Drawing.Bitmap BlueBlueVerticalGradient { + get { + object obj = ResourceManager.GetObject("BlueBlueVerticalGradient", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// <summary> + /// Looks up a localized resource of type System.Byte[]. + /// </summary> + internal static byte[] brute { + get { + object obj = ResourceManager.GetObject("brute", resourceCulture); + return ((byte[])(obj)); + } + } + + /// <summary> + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// </summary> internal static System.Drawing.Bitmap DefaultMouse { get { object obj = ResourceManager.GetObject("DefaultMouse", resourceCulture); @@ -1111,7 +1160,8 @@ namespace ShiftOS.WinForms.Properties { /// "ReadAccessToLowUsers": false, /// "permissions": 0 /// }, - /// [rest of string was truncated]";. + /// { + /// "Name" [rest of string was truncated]";. /// </summary> internal static string PebcakDevelFS { get { @@ -1145,7 +1195,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]";. /// </summary> internal static string ShiftnetServices { get { @@ -1167,7 +1217,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]";. /// </summary> internal static string Shiftorium { get { @@ -1177,7 +1228,7 @@ namespace ShiftOS.WinForms.Properties { /// <summary> /// 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]";. /// </summary> internal static string ShiftOS { get { @@ -1326,7 +1377,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]";. /// </summary> internal static string strings_de { get { @@ -1351,7 +1403,7 @@ namespace ShiftOS.WinForms.Properties { /// "{GEN_WELCOME}": "Welcome to ShiftOS.", /// "{GEN_SYSTEMNAME}": "System name", /// "{GEN_PASSWORD}": "Password", - /// "{GEN_LPROMPT [rest of string was truncated]";. + /// "{GEN_LPROMPT}": "%sysname lo [rest of string was truncated]";. /// </summary> internal static string strings_en { get { @@ -1375,7 +1427,8 @@ namespace ShiftOS.WinForms.Properties { /// "{GEN_CURRENTPROCESSES}": "Les procèdures actuelles", /// "{GEN_WELCOME}": "Bienvenue au ShiftOS.", /// "{GEN_SYSTEMNAME}": "Nom de système", - /// "{GEN_PASSWORD}": "Mot de [rest of string was truncated]";. + /// "{GEN_PASSWORD}": "Mot de passe", + /// "{GEN [rest of string was truncated]";. /// </summary> internal static string strings_fr { get { @@ -1563,7 +1616,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]";. /// </summary> internal static string sys_shiftoriumstory { get { diff --git a/ShiftOS.WinForms/Properties/Resources.resx b/ShiftOS.WinForms/Properties/Resources.resx index 8390f39..1e47fbf 100644 --- a/ShiftOS.WinForms/Properties/Resources.resx +++ b/ShiftOS.WinForms/Properties/Resources.resx @@ -34618,7 +34618,20 @@ <data name="strings_fr" type="System.Resources.ResXFileRef, System.Windows.Forms"> <value>..\Resources\strings_fr.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value> </data> + <data name="AppscapeServerFS" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Resources\AppscapeServerFS.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value> + </data> + <data name="AppscapeWantedFile" xml:space="preserve"> + <value>RGF0ZTogMDQvMS8yMDE4DQpVc2VyOiBtYXVyZWVuX2Zlbm4NCg0KQmFuIHR5cGU6IENlYXNlIGFuZCBkZXNpc3QgKERldlgpDQoNCkRlc2NyaXB0aW9uOg0KDQpEZXZYIGhhcyBzZW50IGEgY2Vhc2UgYW5kIGRlc2lzdCByZXF1ZXN0IHRvIEFwcHNjYXBlIGZvciBob3N0aW5nIHRoaXMgdXNlcidzIGFwcGxpY2F0aW9ucyBhbmQgc2VuZGluZyBwcm9maXRzIG92ZXIuIFRoaXMgdXNlcidzIHNvZnR3YXJlIHdpbGwgbm90IGJlIHB1bGxlZCwgYnV0IGFsbCBDb2RlcG9pbnRzIGVhcm5lZCBmcm9tIGl0IHdpbGwgbm90IGJlIHJlZGlyZWN0ZWQgYW5kIHRoZSB1c2VyIHdpbGwgbm90IGJlIGFibGUgdG8gYWNjZXNzIHRoZWlyIGRldmVsb3BtZW50IHBhbmVsLg==</value> + <comment>The file that Maureen Fenn wants to see in the Appscape Troubles storyline.</comment> + </data> + <data name="brute" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Resources\brute.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </data> <data name="PebcakDevelFS" type="System.Resources.ResXFileRef, System.Windows.Forms"> <value>..\Resources\PebcakDevelFS.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value> </data> + <data name="BlueBlueVerticalGradient" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Resources\BlueBlueVerticalGradient.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + </data> </root>
\ No newline at end of file diff --git a/ShiftOS.WinForms/Resources/AppscapeServerFS.txt b/ShiftOS.WinForms/Resources/AppscapeServerFS.txt new file mode 100644 index 0000000..214581d --- /dev/null +++ b/ShiftOS.WinForms/Resources/AppscapeServerFS.txt @@ -0,0 +1,52 @@ +{ + "Name": "appscape_main", + "Files": [], + "Subdirectories": [ + { + "Name": "bans", + "Files": [ + { + "Name": "hacker101.txt", + "Data": "RGF0ZTogMTAvMy8yMDE4DQpVc2VyOiBoYWNrZXIxMDENCg0KQmFuIHR5cGU6IEF1dG9tYXRlZA0KDQpEZXNjcmlwdGlvbjoNCg0KVGhpcyB1c2VyIGhhcyBiZWVuIGJhbm5lZCBieSB0aGUgYXV0b21hdGVkIGFudGktaGFja2luZyBzeXN0ZW0gZm9yIGNyZWF0aW9uIG9mIG1hbGljaW91cyBzb2Z0d2FyZSBhbmQgZXhwbG9pdGF0aW9uIHV0aWxpdGllcy4=", + "HeaderData": null, + "ReadAccessToLowUsers": false, + "permissions": 0 + }, + { + "Name": "maureen_fenn.txt", + "Data": "RGF0ZTogMDQvMS8yMDE4DQpVc2VyOiBtYXVyZWVuX2Zlbm4NCg0KQmFuIHR5cGU6IENlYXNlIGFuZCBkZXNpc3QgKERldlgpDQoNCkRlc2NyaXB0aW9uOg0KDQpEZXZYIGhhcyBzZW50IGEgY2Vhc2UgYW5kIGRlc2lzdCByZXF1ZXN0IHRvIEFwcHNjYXBlIGZvciBob3N0aW5nIHRoaXMgdXNlcidzIGFwcGxpY2F0aW9ucyBhbmQgc2VuZGluZyBwcm9maXRzIG92ZXIuIFRoaXMgdXNlcidzIHNvZnR3YXJlIHdpbGwgbm90IGJlIHB1bGxlZCwgYnV0IGFsbCBDb2RlcG9pbnRzIGVhcm5lZCBmcm9tIGl0IHdpbGwgbm90IGJlIHJlZGlyZWN0ZWQgYW5kIHRoZSB1c2VyIHdpbGwgbm90IGJlIGFibGUgdG8gYWNjZXNzIHRoZWlyIGRldmVsb3BtZW50IHBhbmVsLg==", + "HeaderData": null, + "ReadAccessToLowUsers": false, + "permissions": 0 + } + ], + "Subdirectories": [], + "ReadAccessToLowUsers": false, + "permissions": 3 + }, + { + "Name": "feedback", + "Files": [ + { + "Name": "better_feedback_system.txt", + "Data": "VXNlcjogYW5vbnltb3VzDQpEYXRlOiAyNS8xMi8yMDE3DQpUaXRsZTogQmV0dGVyIGZlZWRiYWNrIHN5c3RlbS4NCg0KRGVzY3JpcHRpb246DQoNCldoeSBtdXN0IHdlIEZUUCBpbnRvIHlvdXIgc3lzdGVtIHRvIGxlYXZlIGZlZWRiYWNrIGZvciBBcHBzY2FwZT8gSSBrbm93IHRoYXQgeW91J3ZlIGdvdCB0aGlzIGFjY291bnQgdGlnaHRseSBsb2NrZWQgYW5kIGl0IGNhbiBvbmx5IGFjY2VzcyB0aGlzIHBhcnQgb2YgeW91ciBjb21wdXRlciwgYnV0IGl0J3MgdGhlIERpZ2l0YWwgU29jaWV0eS4gU29tZW9uZSdzIGdvbm5hIGJyZWFrIHRoaXMuIENhbid0IHdlIGF0IGxlYXN0IGhhdmUgYSBtb3JlIHNlY3VyZSBTTVRQLWJhc2VkIGZlZWRiYWNrIHN5c3RlbT8gT3IgZXZlbiBhIGZvcm0gb24gQXBwc2NhcGUncyB3ZWJzaXRlPw0KDQpSZXBseToNCg0KQ29tZSBvbiBtYW4hIEl0J3MgQ2hyaXN0bWFzLCB5b3UncmUgZ29ubmEgbWFrZSBtZSBjb2RlPyBJJ20gdHJ5aW5nIHRvIHNwZW5kIHRpbWUgd2l0aCB0aGUgZmFtaWx5IGhlcmUuLi4gd2FpdCBhIG1pbnV0ZS4uLiB1aGhoLi4uIG5ldmVybWluZC4gSSdtIGFjdHVhbGx5IHdvcmtpbmcgb24gdGhhdCBhcyB3ZSBzcGVhay4=", + "HeaderData": null, + "ReadAccessToLowUsers": false, + "permissions": 0 + }, + { + "Name": "screenshots.txt", + "Data": "VXNlcjogYW5vbnltb3VzDQpEYXRlOiAwNC8xMi8yMDE3DQpUaXRsZTogQnJpbmcgYmFjayBzY3JlZW5zaG90cy4NCg0KRGVzY3JpcHRpb246DQoNCkJhY2sgaW4gdGhlIG9sZGVuIGRheXMsIGJlZm9yZSB0aGUgRGlnaXRhbCBTb2NpZXR5LCBBcHBzY2FwZSBoYWQgZGVjZW50IHNjcmVlbnNob3RzIGZvciBpdHMgYXBwcy4gV2h5IGNhbid0IHdlIGhhdmUgdGhlbSBpbiBtb2Rlcm4gQXBwc2NhcGU/DQoNClJlcGx5Og0KDQpUaGUgU2hpZnRuZXQgaXMgaW4gaXRzIGVuZmFuY3kgYXQgdGhpcyB0aW1lLi4uIGV2ZXIgc2luY2UgRGV2WCBtYWRlIGl0IGFuIG9mZmljaWFsIHBhcnQgb2YgU2hpZnRPUyBhbmQgcmV3cm90ZSB0aGUgcGFnZSB0ZW1wbGF0aW5nIHN5c3RlbSwgSSBoYXZlbid0IGxlYXJuZWQgeWV0IGhvdyB0byBkZWFsIHdpdGggcGljdHVyZXMuIEknbGwgbG9vayBpbnRvIGl0IHRob3VnaC4gSSBzdXJlIGRvIG1pc3MgdGhlIG9sZGVyIFNoaWZ0bmV0Li4u", + "HeaderData": null, + "ReadAccessToLowUsers": false, + "permissions": 0 + } + ], + "Subdirectories": [], + "ReadAccessToLowUsers": false, + "permissions": 0 + } + ], + "ReadAccessToLowUsers": false, + "permissions": 3 +}
\ No newline at end of file diff --git a/ShiftOS.WinForms/Resources/BlueBlueVerticalGradient.png b/ShiftOS.WinForms/Resources/BlueBlueVerticalGradient.png Binary files differnew file mode 100644 index 0000000..bf65ce7 --- /dev/null +++ b/ShiftOS.WinForms/Resources/BlueBlueVerticalGradient.png diff --git a/ShiftOS.WinForms/Resources/brute.mp3 b/ShiftOS.WinForms/Resources/brute.mp3 Binary files differnew file mode 100644 index 0000000..ae20cc2 --- /dev/null +++ b/ShiftOS.WinForms/Resources/brute.mp3 diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index f287540..92cbf28 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -71,6 +71,12 @@ <Compile Include="Applications\About.Designer.cs"> <DependentUpon>About.cs</DependentUpon> </Compile> + <Compile Include="Applications\ButtonMaster.cs"> + <SubType>UserControl</SubType> + </Compile> + <Compile Include="Applications\ButtonMaster.Designer.cs"> + <DependentUpon>ButtonMaster.cs</DependentUpon> + </Compile> <Compile Include="Applications\Clock.cs"> <SubType>UserControl</SubType> </Compile> @@ -357,6 +363,7 @@ <Compile Include="MainMenu\MainMenu.Designer.cs"> <DependentUpon>MainMenu.cs</DependentUpon> </Compile> + <Compile Include="MissionCommands.cs" /> <Compile Include="Oobe.cs"> <SubType>Form</SubType> </Compile> @@ -482,6 +489,9 @@ <EmbeddedResource Include="Applications\About.resx"> <DependentUpon>About.cs</DependentUpon> </EmbeddedResource> + <EmbeddedResource Include="Applications\ButtonMaster.resx"> + <DependentUpon>ButtonMaster.cs</DependentUpon> + </EmbeddedResource> <EmbeddedResource Include="Applications\Clock.resx"> <DependentUpon>Clock.cs</DependentUpon> </EmbeddedResource> @@ -873,6 +883,9 @@ <None Include="Resources\Ambient8.mp3" /> <None Include="Resources\Ambient9.mp3" /> <None Include="Resources\austmicrotrends.png" /> + <None Include="Resources\brute.mp3" /> + <None Include="Resources\AppscapeServerFS.txt" /> + <None Include="Resources\BlueBlueVerticalGradient.png" /> <Content Include="Resources\fileiconcf.bmp" /> <None Include="Resources\infobox.wav" /> <None Include="Resources\typesound.wav" /> diff --git a/ShiftOS.WinForms/Stories/LegionStory.cs b/ShiftOS.WinForms/Stories/LegionStory.cs index 0723a37..1eff0e9 100644 --- a/ShiftOS.WinForms/Stories/LegionStory.cs +++ b/ShiftOS.WinForms/Stories/LegionStory.cs @@ -6,6 +6,7 @@ using System.Threading; using System.Threading.Tasks; using Newtonsoft.Json; using ShiftOS.Engine; +using ShiftOS.Objects; namespace ShiftOS.WinForms.Stories { @@ -80,8 +81,168 @@ namespace ShiftOS.WinForms.Stories Story.Context.MarkComplete(); Story.Start("aiden_shiftnet2"); } + + [RequiresUpgrade("appscape_troubles")] + [Mission("appscape_troubles_end", "Appscape Troubles: Lifting The Ban", "Maureen's been banned from Appscape. Let's see if we can get Aiden to reverse that.", 1200l, "maureen_fenn")] + public static void AppscapeTroublesEnd() + { + Applications.Chat chat = null; + Desktop.InvokeOnWorkerThread(() => + { + chat = OpenChat(); + }); + while (chat == null) + Thread.Sleep(10); + chat.ShowChat(); + chat.ChatID = "maureen_fenn@trisys"; + CurrentChat = chat; + SendChatMessage("maureen_fenn", "I just talked to hacker101 about our little issue here..."); + SendChatMessage("maureen_fenn", "He tried to get Aiden to lighten up, but he's too hell-bent on making DevX happy."); + SendChatMessage("maureen_fenn", "But, I think we've gotten a plan."); + SendChatMessage("hacker101", "<user joined chat>"); + chat.ChatID = "maureen_fenn@trisys, hacker101@pebcak"; + SendChatMessage("hacker101", "We meet again, " + SaveSystem.CurrentUser.Username + "..."); + SendChatMessage("hacker101", "Maureen tells me you've used your hacking skills to steal a document from Aiden Nirh."); + SendChatMessage("hacker101", "I hope he didn't find out about brute..."); + SendChatMessage("maureen_fenn", "Ugh... brute? That thing? That's not hacking."); + SendChatMessage("maureen_fenn", "You're just turning " + SaveSystem.CurrentUser.Username + " into a script-kiddie."); + SendChatMessage("maureen_fenn", SaveSystem.CurrentUser.Username + ", you want REAL hacking? Why don't you come to me after we're done here. I'll show you how REAL sentiences get their way."); + SendChatMessage("hacker101", "HEY. You gotta give Brute some credit. It's good at cracking passwords."); + SendChatMessage("maureen_fenn", "Well, what happens if the user runs into a firewall block? Brute ain't going to help with that."); + SendChatMessage("hacker101", "....whatever. Let's just get on with this."); + SendChatMessage("hacker101", "We need to get rid of that cease and desist ban."); + SendChatMessage("hacker101", "Firstly, let's review the document."); + SendChatMessage("hacker101", "<sent a file: maureen_fenn.txt>"); + var bytes = Convert.FromBase64String(Properties.Resources.AppscapeWantedFile); + chat.PostMessage("maureen_fenn.txt", chat.ChatID, Encoding.UTF8.GetString(bytes)); + SendChatMessage("hacker101", "I ain't no lawyer but I can tell you right now that C&D is bull."); + SendChatMessage("hacker101", "Guess this is just DevX's way of saying he can't stand you, Maureen."); + SendChatMessage("hacker101", "I want you to know that unlike him, I can. I... I..."); + SendChatMessage("maureen_fenn", "..Nope, nope. Let's not go there. You're getting a bit creepy, hacker."); + SendChatMessage("hacker101", "Whoops. Oh well... We need to show DevX who's boss."); + SendChatMessage("hacker101", "Maybe, " + SaveSystem.CurrentUser.Username + " can help us."); + SendChatMessage("maureen_fenn", "Maybe they can... and meybe Aiden can as well."); + SendChatMessage("hacker101", "No, he's convinced that we're the bad guys."); + SendChatMessage("hacker101", "He's got me banned because of brute."); + SendChatMessage("maureen_fenn", "Lol, banned... for BRUTE? That little harmless tool? Bahahahaha."); + SendChatMessage(SaveSystem.CurrentUser.Username, "Will you two stop bickering at eachother about Brute and hacker101's love for Maureen and let us get on with this? I could be playing Pong right now."); + SendChatMessage("maureen_fenn", "Right. We need to gather as much evidence against DevX as possible."); + SendChatMessage("hacker101", "Then, we need to send it all to Aiden, right? We'll need " + SaveSystem.CurrentUser.Username + " to do that."); + SendChatMessage("maureen_fenn", "Alrighty, " + SaveSystem.CurrentUser.Username + ". You're on our team. We'll have any tasks we need you to do in your missions list."); + SendChatMessage("maureen_fenn", "Oh yeah, and here's a couple Codepoints as compensation for helping us out."); + Story.Context.MarkComplete(); + Thread.Sleep(5000); + Desktop.InvokeOnWorkerThread(() => + { + AppearanceManager.Close(chat); + }); + } + + [RequiresUpgrade("hacker101_breakingbonds_3")] + [Mission("appscape_troubles", "Appscape Troubles", "You know how to do some basic hacking, now you've got a chance to exercise it.", 750l, "maureen_fenn")] + public static void AppscapeTroubles() + { + Applications.Chat chat = null; + Desktop.InvokeOnWorkerThread(() => + { + chat = OpenChat(); + }); + while (chat == null) + Thread.Sleep(10); + chat.ShowChat(); + chat.ChatID = "maureen_fenn@trisys"; + CurrentChat = chat; + SendChatMessage("maureen_fenn", "Hello there, " + SaveSystem.CurrentUser.Username + ". My name is Maureen."); + SendChatMessage("maureen_fenn", "I'm the developer of the various Tri apps you may've seen around the Shiftnet."); + Story.Context.AutoComplete = false; + SendChatMessage("maureen_fenn", "I have a bit of a problem that may need your assistance.."); + SendChatMessage("maureen_fenn", "I struck a deal with Aiden Nirh to put my software on his site and split the profits in half with me and him."); + SendChatMessage("maureen_fenn", "But lately, even though many people have been buying my software, I've been getting nothing for it."); + SendChatMessage("maureen_fenn", "Now I have barely enough Codepoints to keep my development environment online..."); + SendChatMessage("maureen_fenn", "My friend, you know him as hacker101, he's told me that you know how to hack."); + SendChatMessage("maureen_fenn", "Can you bust into Aiden's server and see if he's gotten any documents or anything indicating why he's not paying me?"); + SendChatMessage("maureen_fenn", "He likes to document a lot of things about what he does and he likes to store those docs on his central Appscape server. Maybe there's something on there about me..."); + SendChatMessage("maureen_fenn", "You can find connection details for his server on Appscape's Contact page."); + SendChatMessage("maureen_fenn", "The guy has pretty good security though... so be careful."); + SendChatMessage("maureen_fenn", "When you find the right file, I'd download it to your system and just send it through SimpleSRC."); + + + VirtualEnvironments.Create("appscape_main", new List<ClientSave> + { + new ClientSave + { + Username = "aiden", + Password = GenRandomPassword(), + Permissions = UserPermissions.Root, + }, + new ClientSave + { + Username = "feedback", + Password = "", + Permissions = UserPermissions.Guest + } + }, 15000l, JsonConvert.DeserializeObject<ShiftOS.Objects.ShiftFS.Directory>(Properties.Resources.AppscapeServerFS)); + + bool validFileSent = false; + chat.FileSent += (file) => + { + if (Convert.ToBase64String(file.Data) == Properties.Resources.AppscapeWantedFile) + validFileSent = true; + }; - [Story("hacker101_breakingbonds_3")] + Story.Context.AutoComplete = false; + + Story.PushObjective("Appscape Troubles: The Secret", "Maureen has asked you to find out why Aiden Nirh, the maintainer of Appscape, isn't paying her half the profits for her TriOffice suite. Time to use your hacking skills... just like before.", + () => { return validFileSent; }, + () => + { + SendChatMessage("maureen_fenn", "File received."); + SendChatMessage("maureen_fenn", "Awwww, come on, man! You can't tell me I got banned due to a cease and desist from DevX... That bastard... DevX, I mean."); + SendChatMessage("maureen_fenn", "Anyways, I'll talk to Aiden about that... if I can... or maybe you can? Either way, here's your Codepoints."); + Story.Context.MarkComplete(); + Thread.Sleep(5000); + Desktop.InvokeOnWorkerThread(() => + { + AppearanceManager.Close(chat); + }); + + }); + + + } + + private static Applications.Chat CurrentChat; + + public static void SendChatMessage(string who, string msg) + { + CurrentChat.Typing = who; + foreach(var c in msg) + { + Thread.Sleep(75); + } + CurrentChat?.PostMessage(who, CurrentChat?.ChatID, msg); + CurrentChat.Typing = ""; + Thread.Sleep(500); + } + + public static Applications.Chat OpenChat() + { + var chatbrd = AppearanceManager.OpenForms.FirstOrDefault(x => x.ParentWindow is Applications.Chat); + Applications.Chat chat = null; + if(chatbrd == null) + { + chat = new Applications.Chat(); + AppearanceManager.SetupWindow(chat); + } + else + { + chat = chatbrd.ParentWindow as Applications.Chat; + } + return chat; + } + + + [Mission("hacker101_breakingbonds_3", "Breaking the Bonds", "It's time you've learned how to hack.", 500l, "hacker101")] public static void BreakingTheBonds_Outro() { Story.Context.AutoComplete = false; @@ -163,6 +324,29 @@ namespace ShiftOS.WinForms.Stories } VirtualEnvironments.Clear(); Applications.FileSkimmer.DisconnectRemote(); + WriteLine("Connections terminated I see.. Alright. Have fun with those dummy documents - you can keep them if you'd like. There's nothing important in them."); + WriteLine("That's one thing you can do with brute and other hacking utilities. I'd recommend buying some of brute's Shiftorium upgrades to make it faster and more efficient."); + WriteLine("Also, along the way, you're going to find a lot of new tricks. Some of them will require more than just brute to get into."); + WriteLine("So be on the lookout on the Shiftnet for other hacking-related tools. You won't find any on Appscape, however..."); + WriteLine("That darn Aiden Nirh guy can't stand hackers."); + WriteLine("Looking at your logs, I see he's contacted you before... Seriously... don't let him find out about brute. He'll report it directly to DevX."); + WriteLine("Oh yeah, one more thing... that virus scanner... you may want to scan any files that you transfer from other systems with it."); + WriteLine("You never know what sorts of digital filth is hidden within such innocent-looking files."); + WriteLine("ALWAYS scan before opening - because if you open a file containing malicious code, it'll get run. It's just how ShiftOS's kernel works."); + WriteLine("Oh yeah, one last thing. Things are going to start getting pretty open in the Digital Society.."); + WriteLine("Multiple people are going to want you to help them out with multiple things."); + WriteLine("I've written a little command-line utility that'll help you keep track of these missions and see how far you've gotten."); + WriteLine("Use the missions command to list out all the available missions, then use the startmission command to start one."); + WriteLine("When you complete a mission, you'll earn Codepoints depending on the mission."); + WriteLine("Allow me to demonstrate..."); + Console.WriteLine("User has disconnected."); + + + + Story.Context.MarkComplete(); + TerminalBackend.PrefixEnabled = true; + SaveSystem.SaveGame(); + TerminalBackend.PrintPrompt(); }); }); } @@ -173,6 +357,8 @@ namespace ShiftOS.WinForms.Stories //just to annoy victor tran } + const string VALID_PASSWORD_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-_"; + public static string GenRandomPassword() { var rnd = new Random(); @@ -180,7 +366,8 @@ namespace ShiftOS.WinForms.Stories string pass = ""; for(int i = 0; i < len; i++) { - pass += (char)rnd.Next(255); + char c = VALID_PASSWORD_CHARS[rnd.Next(VALID_PASSWORD_CHARS.Length)]; + pass += c; } return pass; } diff --git a/ShiftOS.WinForms/VirtualEnvironments.cs b/ShiftOS.WinForms/VirtualEnvironments.cs index 5faa6ff..fb39569 100644 --- a/ShiftOS.WinForms/VirtualEnvironments.cs +++ b/ShiftOS.WinForms/VirtualEnvironments.cs @@ -2,7 +2,9 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using System.Threading; using System.Threading.Tasks; +using ShiftOS.Engine; namespace ShiftOS.WinForms { @@ -27,6 +29,113 @@ namespace ShiftOS.WinForms _environments.Clear(); } + const string VALID_PASSWORD_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-_"; + + + [RequiresUpgrade("brute")] + [Command("brute")] + public static void Brute() + { + TerminalBackend.PrefixEnabled = false; + bool cracked = false; + var brute = Properties.Resources.brute; + var str = new System.IO.MemoryStream(brute); + var reader = new NAudio.Wave.Mp3FileReader(str); + var _out = new NAudio.Wave.WaveOut(); + _out.Init(reader); + _out.PlaybackStopped += (o, a) => + { + if (cracked == false) + { + cracked = true; + TerminalCommands.Clear(); + ConsoleEx.Bold = true; + ConsoleEx.ForegroundColor = ConsoleColor.Red; + Console.WriteLine(" - access denied - "); + ConsoleEx.ForegroundColor = ConsoleColor.Gray; + ConsoleEx.Bold = false; + ConsoleEx.Italic = true; + Console.WriteLine("password could not be cracked before connection termination."); + } + TerminalBackend.PrefixEnabled = true; + TerminalBackend.PrintPrompt(); + _out.Dispose(); + reader.Dispose(); + str.Dispose(); + }; + _out.Play(); + + var t = new Thread(() => + { + + + Console.WriteLine("brute - version 1.0"); + Console.WriteLine("Copyright (c) 2018 hacker101. All rights reserved."); + Console.WriteLine(); + Thread.Sleep(4000); + Console.WriteLine("Scanning outbound connections..."); + if (string.IsNullOrWhiteSpace(Applications.FileSkimmer.OpenConnection.SystemName)) + { + Thread.Sleep(2000); + Console.WriteLine(" - no outbound connections to scan, aborting - "); + _out.Stop(); + _out.Dispose(); + reader.Dispose(); + str.Dispose(); + } + else + { + Thread.Sleep(2000); + var con = Applications.FileSkimmer.OpenConnection; + Console.WriteLine($@"{con.SystemName} +------------------ + +Active connection: ftp, rts +System name: {con.SystemName} +Users: {con.Users.Count}"); + Thread.Sleep(500); + var user = con.Users.FirstOrDefault(x => x.Permissions == Objects.UserPermissions.Root); + if (user == null) + Console.WriteLine(" - no users found with root access - this is a shiftos bug - "); + else + { + Console.WriteLine(" - starting bruteforce attack on user: " + user.Username + " - "); + var rnd = new Random(); + + char[] pass = new char[user.Password.Length]; + for (int i = 0; i < pass.Length; i++) + { + if (cracked == true) + break; + while (pass[i] != user.Password[i]) + { + if (cracked == true) + break; + char c = VALID_PASSWORD_CHARS[rnd.Next(VALID_PASSWORD_CHARS.Length)]; + if (char.IsLetterOrDigit(c)) + { + pass[i] = c; + Console.WriteLine(new string(pass)); + Console.WriteLine(); + Thread.Sleep(1); + } + } + } + if (cracked == false) + { + cracked = true; + TerminalCommands.Clear(); + Console.WriteLine(" - credentials cracked. -"); + Console.WriteLine($@"sysname: {con.SystemName} +user: {user.Username} +password: {user.Password}"); + } + } + } + }); + t.Start(); + } + public static ShiftOSEnvironment Get(string sysname) { return _environments.FirstOrDefault(x => x.SystemName == sysname); |
