aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ShiftOS.Modding.VirtualMachine/App.config14
-rw-r--r--ShiftOS.Modding.VirtualMachine/Form1.Designer.cs143
-rw-r--r--ShiftOS.Modding.VirtualMachine/Form1.cs265
-rw-r--r--ShiftOS.Modding.VirtualMachine/Form1.resx123
-rw-r--r--ShiftOS.Modding.VirtualMachine/Program.cs20
-rw-r--r--ShiftOS.Modding.VirtualMachine/Properties/AssemblyInfo.cs36
-rw-r--r--ShiftOS.Modding.VirtualMachine/Properties/Resources.Designer.cs71
-rw-r--r--ShiftOS.Modding.VirtualMachine/Properties/Resources.resx117
-rw-r--r--ShiftOS.Modding.VirtualMachine/Properties/Settings.Designer.cs30
-rw-r--r--ShiftOS.Modding.VirtualMachine/Properties/Settings.settings7
-rw-r--r--ShiftOS.Modding.VirtualMachine/ShiftOS.Modding.VirtualMachine.csproj104
-rw-r--r--ShiftOS.Objects/Save.cs60
-rw-r--r--ShiftOS.Server/Program.cs39
-rw-r--r--ShiftOS.WinForms/Applications/Shiftnet.Designer.cs139
-rw-r--r--ShiftOS.WinForms/Applications/Shiftnet.cs167
-rw-r--r--ShiftOS.WinForms/Applications/Shiftnet.resx120
-rw-r--r--ShiftOS.WinForms/FakeSetupScreen.Designer.cs110
-rw-r--r--ShiftOS.WinForms/FakeSetupScreen.cs10
-rw-r--r--ShiftOS.WinForms/Oobe.cs9
-rw-r--r--ShiftOS.WinForms/Program.cs4
-rw-r--r--ShiftOS.WinForms/ShiftOS.WinForms.csproj13
-rw-r--r--ShiftOS.WinForms/ShiftOSAudioProvider.cs16
-rw-r--r--ShiftOS.WinForms/Tools/ControlManager.cs9
-rw-r--r--ShiftOS.WinForms/packages.config1
-rw-r--r--ShiftOS_TheReturn.sln6
-rw-r--r--ShiftOS_TheReturn/AudioManager.cs4
-rw-r--r--ShiftOS_TheReturn/SaveSystem.cs19
-rw-r--r--ShiftOS_TheReturn/Scripting.cs43
28 files changed, 1674 insertions, 25 deletions
diff --git a/ShiftOS.Modding.VirtualMachine/App.config b/ShiftOS.Modding.VirtualMachine/App.config
new file mode 100644
index 0000000..71a06ba
--- /dev/null
+++ b/ShiftOS.Modding.VirtualMachine/App.config
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+ <startup>
+ <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
+ </startup>
+ <runtime>
+ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+ <dependentAssembly>
+ <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
+ </dependentAssembly>
+ </assemblyBinding>
+ </runtime>
+</configuration> \ No newline at end of file
diff --git a/ShiftOS.Modding.VirtualMachine/Form1.Designer.cs b/ShiftOS.Modding.VirtualMachine/Form1.Designer.cs
new file mode 100644
index 0000000..0fdd122
--- /dev/null
+++ b/ShiftOS.Modding.VirtualMachine/Form1.Designer.cs
@@ -0,0 +1,143 @@
+namespace ShiftOS.Modding.VirtualMachine
+{
+ partial class Form1
+ {
+ /// <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 Windows Form 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()
+ {
+ this.menuStrip1 = new System.Windows.Forms.MenuStrip();
+ this.vMToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.openBinaryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.debugToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.viewStackToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.viewRegistersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.viewMemoryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.screen = new System.Windows.Forms.Panel();
+ this.menuStrip1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // menuStrip1
+ //
+ this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.vMToolStripMenuItem,
+ this.debugToolStripMenuItem});
+ this.menuStrip1.Location = new System.Drawing.Point(0, 0);
+ this.menuStrip1.Name = "menuStrip1";
+ this.menuStrip1.Size = new System.Drawing.Size(448, 24);
+ this.menuStrip1.TabIndex = 0;
+ this.menuStrip1.Text = "menuStrip1";
+ //
+ // vMToolStripMenuItem
+ //
+ this.vMToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.openBinaryToolStripMenuItem,
+ this.exitToolStripMenuItem});
+ this.vMToolStripMenuItem.Name = "vMToolStripMenuItem";
+ this.vMToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
+ this.vMToolStripMenuItem.Text = "VM";
+ //
+ // openBinaryToolStripMenuItem
+ //
+ this.openBinaryToolStripMenuItem.Name = "openBinaryToolStripMenuItem";
+ this.openBinaryToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.openBinaryToolStripMenuItem.Text = "Open binary";
+ this.openBinaryToolStripMenuItem.Click += new System.EventHandler(this.openBinaryToolStripMenuItem_Click);
+ //
+ // exitToolStripMenuItem
+ //
+ this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
+ this.exitToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.exitToolStripMenuItem.Text = "Exit";
+ this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
+ //
+ // debugToolStripMenuItem
+ //
+ this.debugToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.viewStackToolStripMenuItem,
+ this.viewRegistersToolStripMenuItem,
+ this.viewMemoryToolStripMenuItem});
+ this.debugToolStripMenuItem.Name = "debugToolStripMenuItem";
+ this.debugToolStripMenuItem.Size = new System.Drawing.Size(54, 20);
+ this.debugToolStripMenuItem.Text = "Debug";
+ //
+ // viewStackToolStripMenuItem
+ //
+ this.viewStackToolStripMenuItem.Name = "viewStackToolStripMenuItem";
+ this.viewStackToolStripMenuItem.Size = new System.Drawing.Size(147, 22);
+ this.viewStackToolStripMenuItem.Text = "View stack";
+ //
+ // viewRegistersToolStripMenuItem
+ //
+ this.viewRegistersToolStripMenuItem.Name = "viewRegistersToolStripMenuItem";
+ this.viewRegistersToolStripMenuItem.Size = new System.Drawing.Size(147, 22);
+ this.viewRegistersToolStripMenuItem.Text = "View registers";
+ //
+ // viewMemoryToolStripMenuItem
+ //
+ this.viewMemoryToolStripMenuItem.Name = "viewMemoryToolStripMenuItem";
+ this.viewMemoryToolStripMenuItem.Size = new System.Drawing.Size(147, 22);
+ this.viewMemoryToolStripMenuItem.Text = "View memory";
+ //
+ // screen
+ //
+ this.screen.BackColor = System.Drawing.Color.Black;
+ this.screen.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.screen.Location = new System.Drawing.Point(0, 24);
+ this.screen.Name = "screen";
+ this.screen.Size = new System.Drawing.Size(448, 267);
+ this.screen.TabIndex = 1;
+ this.screen.Tag = "keepbg";
+ //
+ // Form1
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.screen);
+ this.Controls.Add(this.menuStrip1);
+ this.Name = "Form1";
+ this.Size = new System.Drawing.Size(448, 291);
+ this.menuStrip1.ResumeLayout(false);
+ this.menuStrip1.PerformLayout();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.MenuStrip menuStrip1;
+ private System.Windows.Forms.Panel screen;
+ private System.Windows.Forms.ToolStripMenuItem vMToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem openBinaryToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem debugToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem viewStackToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem viewRegistersToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem viewMemoryToolStripMenuItem;
+ }
+}
+
diff --git a/ShiftOS.Modding.VirtualMachine/Form1.cs b/ShiftOS.Modding.VirtualMachine/Form1.cs
new file mode 100644
index 0000000..78722a9
--- /dev/null
+++ b/ShiftOS.Modding.VirtualMachine/Form1.cs
@@ -0,0 +1,265 @@
+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.Objects.ShiftFS;
+
+namespace ShiftOS.Modding.VirtualMachine
+{
+ [Launcher("ShiftOS Virtual Machine", false)]
+ public partial class Form1 : UserControl, IShiftOSWindow
+ {
+ private byte[] memory = null; //program binary
+ private int programCounter = 0; //current byte
+ private Stack<int> stack = null; //stack
+ private int[] registers = null; //registers
+ private int currentRegister = 0;
+
+
+ public Form1()
+ {
+ InitializeComponent();
+ }
+
+ public void OnLoad()
+ {
+ }
+
+ public void Execute()
+ {
+ switch ((OpCodes)memory[programCounter])
+ {
+ case OpCodes.DoNothing:
+
+ break;
+ case OpCodes.Add:
+ registers[currentRegister] = registers[currentRegister] + registers[currentRegister + 1];
+ break;
+ case OpCodes.Subtract:
+ registers[currentRegister] = registers[currentRegister] - registers[currentRegister + 1];
+ break;
+ case OpCodes.Multiply:
+ registers[currentRegister] = registers[currentRegister] * registers[currentRegister + 1];
+ break;
+ case OpCodes.Divide:
+ registers[currentRegister] = registers[currentRegister] / registers[currentRegister + 1];
+ break;
+ case OpCodes.Increment:
+ registers[currentRegister]++;
+ break;
+ case OpCodes.Decrement:
+ registers[currentRegister]--;
+ break;
+ case OpCodes.MoveUp:
+ currentRegister++;
+ break;
+ case OpCodes.MoveDown:
+ currentRegister--;
+ break;
+ case OpCodes.Error:
+ Infobox.Show("Error", "An error has occurred inside the VM, we will now halt it.");
+ break;
+ case OpCodes.Jump:
+ stack.Push(programCounter);
+ programCounter = registers[currentRegister];
+ break;
+ case OpCodes.Zero:
+ registers[currentRegister] = 0;
+ break;
+ case OpCodes.Return:
+ programCounter = memory.Length;
+ break;
+ case OpCodes.JumpBack:
+ programCounter = stack.Pop();
+ break;
+ case OpCodes.Out:
+ Console.Write(registers[currentRegister]);
+ break;
+ }
+ }
+
+ public void OnSkinLoad()
+ {
+ }
+
+ public bool OnUnload()
+ {
+ return true;
+ }
+
+ public void OnUpgrade()
+ {
+ }
+
+ private void exitToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ AppearanceManager.Close(this);
+ }
+
+ public void Start()
+ {
+ var th = new System.Threading.Thread(() =>
+ {
+ while(programCounter < memory.Length)
+ {
+ Execute();
+ programCounter++;
+ }
+ });
+ th.IsBackground = true;
+ th.Start();
+ }
+
+ private void openBinaryToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ FileSkimmerBackend.GetFile(new[] { ".svm" }, FileOpenerStyle.Open, new Action<string>((program) =>
+ {
+ memory = Utils.ReadAllBytes(program);
+ programCounter = 0;
+ stack = new Stack<int>();
+ registers = new int[64000];
+ currentRegister = 0;
+ Start();
+ }));
+ }
+ }
+
+ [Namespace("svm")]
+ public static class Compiler
+ {
+ public static byte[] Compile(string prg)
+ {
+ List<OpCodes> program = new List<OpCodes>();
+ foreach(var statement in prg.Split(new[] { ";" }, StringSplitOptions.RemoveEmptyEntries))
+ {
+ if (!string.IsNullOrEmpty(statement))
+ {
+ string[] statements = statement.Split(' ');
+ switch (statements[0])
+ {
+ case "increment":
+ program.Add(OpCodes.Increment);
+ break;
+ case "decrement":
+ program.Add(OpCodes.Decrement);
+ break;
+ case "mvup":
+ program.Add(OpCodes.MoveUp);
+ break;
+ case "mvdn":
+ program.Add(OpCodes.MoveDown);
+ break;
+ case "set":
+ program.Add(OpCodes.Zero);
+ for(int i = 0; i <= Convert.ToInt32(statements[1]); i++)
+ {
+ program.Add(OpCodes.Increment);
+ }
+ break;
+ case "+":
+ program.Add(OpCodes.Add);
+ break;
+ case "-":
+ program.Add(OpCodes.Subtract);
+ break;
+ case "*":
+ program.Add(OpCodes.Multiply);
+ break;
+ case "/":
+ program.Add(OpCodes.Divide);
+ break;
+ case "out":
+ program.Add(OpCodes.Out);
+ break;
+ case "return":
+ program.Add(OpCodes.Return);
+ break;
+ case "jump":
+ program.Add(OpCodes.Jump);
+ break;
+ case "back":
+ program.Add(OpCodes.JumpBack);
+ break;
+ }
+ }
+ }
+
+ byte[] newPrg = new byte[program.Count];
+ foreach(var oc in program)
+ {
+ newPrg[program.IndexOf(oc)] = (byte)oc;
+ }
+ return newPrg;
+
+ }
+
+ [Command("compile")]
+ [RequiresArgument("input")]
+ [RequiresArgument("output")]
+ public static bool CompileCommand(Dictionary<string, object> args)
+ {
+ string input = args["input"] as string;
+ string output = args["output"] as string;
+ if (!Utils.FileExists(input))
+ {
+ Console.WriteLine("The file you requested does not exist.");
+ return true;
+ }
+
+ if (!output.EndsWith(".svm"))
+ output += ".svm";
+
+ byte[] program = Compile(Utils.ReadAllText(input));
+ Utils.WriteAllBytes(output, program);
+ return true;
+ }
+
+ [Command("read")]
+ [RequiresArgument("input")]
+ public static bool ReadFile(Dictionary<string, object> args)
+ {
+ string input = args["input"] as string;
+ if (Utils.FileExists(input))
+ {
+ foreach(var b in Utils.ReadAllBytes(input))
+ {
+ Console.WriteLine((OpCodes)b);
+ }
+ }
+ else
+ {
+ Console.WriteLine("File doesn't exist.");
+ }
+
+ return true;
+ }
+ }
+
+
+
+ public enum OpCodes : byte
+ {
+ DoNothing = 0x00,
+ Zero = 0x11,
+ Add = 0x01,
+ Subtract = 0x02,
+ Multiply = 0x03,
+ Divide = 0x04,
+ MoveUp = 0x05,
+ MoveDown = 0x051,
+ Increment = 0x06,
+ Decrement = 0x061,
+ Out = 0x07,
+ Jump = 0x08,
+ Return = 0x081,
+ JumpBack = 0x082,
+ Error = 0x9,
+
+ }
+}
diff --git a/ShiftOS.Modding.VirtualMachine/Form1.resx b/ShiftOS.Modding.VirtualMachine/Form1.resx
new file mode 100644
index 0000000..d5494e3
--- /dev/null
+++ b/ShiftOS.Modding.VirtualMachine/Form1.resx
@@ -0,0 +1,123 @@
+<?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>
+ <metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 17</value>
+ </metadata>
+</root> \ No newline at end of file
diff --git a/ShiftOS.Modding.VirtualMachine/Program.cs b/ShiftOS.Modding.VirtualMachine/Program.cs
new file mode 100644
index 0000000..3d78ad8
--- /dev/null
+++ b/ShiftOS.Modding.VirtualMachine/Program.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace ShiftOS.Modding.VirtualMachine
+{
+ static class Program
+ {
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ [STAThread]
+ static void Main()
+ {
+ ShiftOS.WinForms.Program.Main();
+ }
+ }
+}
diff --git a/ShiftOS.Modding.VirtualMachine/Properties/AssemblyInfo.cs b/ShiftOS.Modding.VirtualMachine/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..b801b95
--- /dev/null
+++ b/ShiftOS.Modding.VirtualMachine/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("ShiftOS.Modding.VirtualMachine")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("ShiftOS.Modding.VirtualMachine")]
+[assembly: AssemblyCopyright("Copyright © 2017")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("ff0b1831-ac9f-4093-9747-ddae4467516a")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/ShiftOS.Modding.VirtualMachine/Properties/Resources.Designer.cs b/ShiftOS.Modding.VirtualMachine/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..5806ad1
--- /dev/null
+++ b/ShiftOS.Modding.VirtualMachine/Properties/Resources.Designer.cs
@@ -0,0 +1,71 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace ShiftOS.Modding.VirtualMachine.Properties
+{
+
+
+ /// <summary>
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ /// </summary>
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources
+ {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources()
+ {
+ }
+
+ /// <summary>
+ /// Returns the cached ResourceManager instance used by this class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager
+ {
+ get
+ {
+ if ((resourceMan == null))
+ {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ShiftOS.Modding.VirtualMachine.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ /// <summary>
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture
+ {
+ get
+ {
+ return resourceCulture;
+ }
+ set
+ {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/ShiftOS.Modding.VirtualMachine/Properties/Resources.resx b/ShiftOS.Modding.VirtualMachine/Properties/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/ShiftOS.Modding.VirtualMachine/Properties/Resources.resx
@@ -0,0 +1,117 @@
+<?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.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: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" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ </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" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ </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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root> \ No newline at end of file
diff --git a/ShiftOS.Modding.VirtualMachine/Properties/Settings.Designer.cs b/ShiftOS.Modding.VirtualMachine/Properties/Settings.Designer.cs
new file mode 100644
index 0000000..be5ff59
--- /dev/null
+++ b/ShiftOS.Modding.VirtualMachine/Properties/Settings.Designer.cs
@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace ShiftOS.Modding.VirtualMachine.Properties
+{
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+ {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default
+ {
+ get
+ {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/ShiftOS.Modding.VirtualMachine/Properties/Settings.settings b/ShiftOS.Modding.VirtualMachine/Properties/Settings.settings
new file mode 100644
index 0000000..3964565
--- /dev/null
+++ b/ShiftOS.Modding.VirtualMachine/Properties/Settings.settings
@@ -0,0 +1,7 @@
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
+ <Profiles>
+ <Profile Name="(Default)" />
+ </Profiles>
+ <Settings />
+</SettingsFile>
diff --git a/ShiftOS.Modding.VirtualMachine/ShiftOS.Modding.VirtualMachine.csproj b/ShiftOS.Modding.VirtualMachine/ShiftOS.Modding.VirtualMachine.csproj
new file mode 100644
index 0000000..7759e5e
--- /dev/null
+++ b/ShiftOS.Modding.VirtualMachine/ShiftOS.Modding.VirtualMachine.csproj
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{FF0B1831-AC9F-4093-9747-DDAE4467516A}</ProjectGuid>
+ <OutputType>WinExe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>ShiftOS.Modding.VirtualMachine</RootNamespace>
+ <AssemblyName>ShiftOS.Modding.VirtualMachine</AssemblyName>
+ <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Deployment" />
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.Net.Http" />
+ <Reference Include="System.Windows.Forms" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Form1.cs">
+ <SubType>UserControl</SubType>
+ </Compile>
+ <Compile Include="Form1.Designer.cs">
+ <DependentUpon>Form1.cs</DependentUpon>
+ </Compile>
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <EmbeddedResource Include="Form1.resx">
+ <DependentUpon>Form1.cs</DependentUpon>
+ </EmbeddedResource>
+ <EmbeddedResource Include="Properties\Resources.resx">
+ <Generator>ResXFileCodeGenerator</Generator>
+ <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
+ <Compile Include="Properties\Resources.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Resources.resx</DependentUpon>
+ </Compile>
+ <None Include="Properties\Settings.settings">
+ <Generator>SettingsSingleFileGenerator</Generator>
+ <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+ </None>
+ <Compile Include="Properties\Settings.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Settings.settings</DependentUpon>
+ <DesignTimeSharedInput>True</DesignTimeSharedInput>
+ </Compile>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="App.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\ShiftOS.Objects\ShiftOS.Objects.csproj">
+ <Project>{a069089a-8962-4607-b2b2-4cf4a371066e}</Project>
+ <Name>ShiftOS.Objects</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\ShiftOS.WinForms\ShiftOS.WinForms.csproj">
+ <Project>{2295d2e2-3a00-4e02-b66f-b961ac329fe6}</Project>
+ <Name>ShiftOS.WinForms</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\ShiftOS_TheReturn\ShiftOS.Engine.csproj">
+ <Project>{7c979b07-0585-4033-a110-e5555b9d6651}</Project>
+ <Name>ShiftOS.Engine</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project> \ No newline at end of file
diff --git a/ShiftOS.Objects/Save.cs b/ShiftOS.Objects/Save.cs
index 787423d..c7fe43c 100644
--- a/ShiftOS.Objects/Save.cs
+++ b/ShiftOS.Objects/Save.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Dynamic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -23,15 +24,15 @@ namespace ShiftOS.Objects
public string Password { get; set; }
public string SystemName { get; set; }
- public string DiscourseName { get; set; }
-
- /// <summary>
- /// If the user has entered their Discourse account into ShiftOS, this is the password they gave.
- ///
- /// ANY developer caught abusing this property will have their dev status revoked and their account PERMANENTLY SUSPENDED. - Michael
- /// </summary>
- public string DiscoursePass { get; set; }
+ private dynamic _settings = new SettingsObject();
+ public dynamic Settings
+ {
+ get
+ {
+ return _settings;
+ }
+ }
public int CountUpgrades()
{
@@ -44,4 +45,47 @@ namespace ShiftOS.Objects
return count;
}
}
+
+ public class SettingsObject : DynamicObject
+ {
+ private Dictionary<string, object> _settings = null;
+
+ public SettingsObject()
+ {
+ _settings = new Dictionary<string, object>();
+ }
+
+ public override IEnumerable<string> GetDynamicMemberNames()
+ {
+ return _settings.Keys.ToArray();
+ }
+
+ public override bool TryGetMember(GetMemberBinder binder, out object result)
+ {
+ if (_settings.ContainsKey(binder.Name))
+ {
+ result = _settings[binder.Name];
+ return true;
+ }
+ else
+ {
+ result = null;
+ return false;
+ }
+ }
+
+ public override bool TrySetMember(SetMemberBinder binder, object value)
+ {
+ if (_settings.ContainsKey(binder.Name))
+ {
+ _settings[binder.Name] = value;
+ }
+ else
+ {
+ _settings.Add(binder.Name, value);
+ }
+
+ return true;
+ }
+ }
}
diff --git a/ShiftOS.Server/Program.cs b/ShiftOS.Server/Program.cs
index e6c3a3f..138764f 100644
--- a/ShiftOS.Server/Program.cs
+++ b/ShiftOS.Server/Program.cs
@@ -654,8 +654,45 @@ Contents:
}
}
-
break;
+ case "shiftnet_get":
+ string surl = args["url"] as string;
+ while (surl.EndsWith("/"))
+ {
+ surl = surl.Remove(surl.Length - 1, 1);
+ }
+ if (File.Exists(surl))
+ {
+ server.DispatchTo(new Guid(msg.GUID), new NetObject("shiftnet_got", new ServerMessage
+ {
+ Name = "shiftnet_file",
+ GUID = "server",
+ Contents = File.ReadAllText(surl)
+ }));
+ }
+ else if (File.Exists(surl + "/home.rnp"))
+ {
+ server.DispatchTo(new Guid(msg.GUID), new NetObject("shiftnet_got", new ServerMessage
+ {
+ Name = "shiftnet_file",
+ GUID = "server",
+ Contents = File.ReadAllText(surl + "/home.rnp")
+ }));
+
+ }
+ else
+ {
+ server.DispatchTo(new Guid(msg.GUID), new NetObject("shiftnet_got", new ServerMessage
+ {
+ Name = "shiftnet_file",
+ GUID = "server",
+ Contents = (File.Exists("notfound.md") == true) ? File.ReadAllText("notfound.md") : @"# Not found.
+
+The page you requested at was not found on this multi-user domain."
+ }));
+
+ }
+ break;
case "mud_scanvirus":
Dictionary<string, string> _virusDB = new Dictionary<string, string>();
diff --git a/ShiftOS.WinForms/Applications/Shiftnet.Designer.cs b/ShiftOS.WinForms/Applications/Shiftnet.Designer.cs
new file mode 100644
index 0000000..8ac9ea5
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/Shiftnet.Designer.cs
@@ -0,0 +1,139 @@
+namespace ShiftOS.WinForms.Applications
+{
+ partial class Shiftnet
+ {
+ /// <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()
+ {
+ this.flcontrols = new System.Windows.Forms.FlowLayoutPanel();
+ this.btnback = new System.Windows.Forms.Button();
+ this.btnforward = new System.Windows.Forms.Button();
+ this.txturl = new System.Windows.Forms.TextBox();
+ this.btngo = new System.Windows.Forms.Button();
+ this.wbcanvas = new System.Windows.Forms.WebBrowser();
+ this.flcontrols.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // flcontrols
+ //
+ this.flcontrols.AutoSize = true;
+ this.flcontrols.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.flcontrols.Controls.Add(this.btnback);
+ this.flcontrols.Controls.Add(this.btnforward);
+ this.flcontrols.Controls.Add(this.txturl);
+ this.flcontrols.Controls.Add(this.btngo);
+ this.flcontrols.Dock = System.Windows.Forms.DockStyle.Top;
+ this.flcontrols.Location = new System.Drawing.Point(0, 0);
+ this.flcontrols.Name = "flcontrols";
+ this.flcontrols.Size = new System.Drawing.Size(805, 29);
+ this.flcontrols.TabIndex = 0;
+ //
+ // btnback
+ //
+ this.btnback.AutoSize = true;
+ this.btnback.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.btnback.Location = new System.Drawing.Point(3, 3);
+ this.btnback.Name = "btnback";
+ this.btnback.Size = new System.Drawing.Size(23, 23);
+ this.btnback.TabIndex = 0;
+ this.btnback.Text = "<";
+ this.btnback.UseVisualStyleBackColor = true;
+ this.btnback.Click += new System.EventHandler(this.btnback_Click);
+ //
+ // btnforward
+ //
+ this.btnforward.AutoSize = true;
+ this.btnforward.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.btnforward.Location = new System.Drawing.Point(32, 3);
+ this.btnforward.Name = "btnforward";
+ this.btnforward.Size = new System.Drawing.Size(23, 23);
+ this.btnforward.TabIndex = 1;
+ this.btnforward.Text = ">";
+ this.btnforward.UseVisualStyleBackColor = true;
+ this.btnforward.Click += new System.EventHandler(this.btnforward_Click);
+ //
+ // txturl
+ //
+ this.txturl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.txturl.Location = new System.Drawing.Point(61, 3);
+ this.txturl.Name = "txturl";
+ this.txturl.Size = new System.Drawing.Size(702, 20);
+ this.txturl.TabIndex = 2;
+ this.txturl.WordWrap = false;
+ this.txturl.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txturl_KeyDown);
+ //
+ // btngo
+ //
+ this.btngo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.btngo.AutoSize = true;
+ this.btngo.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.btngo.Location = new System.Drawing.Point(769, 3);
+ this.btngo.Name = "btngo";
+ this.btngo.Size = new System.Drawing.Size(31, 23);
+ this.btngo.TabIndex = 3;
+ this.btngo.Text = "Go";
+ this.btngo.UseVisualStyleBackColor = true;
+ this.btngo.Click += new System.EventHandler(this.btngo_Click);
+ //
+ // wbcanvas
+ //
+ this.wbcanvas.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.wbcanvas.IsWebBrowserContextMenuEnabled = false;
+ this.wbcanvas.Location = new System.Drawing.Point(0, 29);
+ this.wbcanvas.MinimumSize = new System.Drawing.Size(20, 20);
+ this.wbcanvas.Name = "wbcanvas";
+ this.wbcanvas.ScriptErrorsSuppressed = true;
+ this.wbcanvas.Size = new System.Drawing.Size(805, 510);
+ this.wbcanvas.TabIndex = 1;
+ this.wbcanvas.WebBrowserShortcutsEnabled = false;
+ this.wbcanvas.Navigating += new System.Windows.Forms.WebBrowserNavigatingEventHandler(this.wbcanvas_Navigating);
+ //
+ // Shiftnet
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.wbcanvas);
+ this.Controls.Add(this.flcontrols);
+ this.Name = "Shiftnet";
+ this.Size = new System.Drawing.Size(805, 539);
+ this.flcontrols.ResumeLayout(false);
+ this.flcontrols.PerformLayout();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.FlowLayoutPanel flcontrols;
+ private System.Windows.Forms.Button btnback;
+ private System.Windows.Forms.Button btnforward;
+ private System.Windows.Forms.TextBox txturl;
+ private System.Windows.Forms.Button btngo;
+ private System.Windows.Forms.WebBrowser wbcanvas;
+ }
+}
diff --git a/ShiftOS.WinForms/Applications/Shiftnet.cs b/ShiftOS.WinForms/Applications/Shiftnet.cs
new file mode 100644
index 0000000..d4183a4
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/Shiftnet.cs
@@ -0,0 +1,167 @@
+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 Newtonsoft.Json;
+using static ShiftOS.Engine.SkinEngine;
+
+namespace ShiftOS.WinForms.Applications
+{
+ [Launcher("Shiftnet", false)]
+ public partial class Shiftnet : UserControl, IShiftOSWindow
+ {
+ public Shiftnet()
+ {
+ InitializeComponent();
+ ServerManager.MessageReceived += (msg) =>
+ {
+ try
+ {
+ if (msg.Name == "shiftnet_file")
+ {
+ this.Invoke(new Action(() =>
+ {
+ wbcanvas.DocumentText = ConstructHtml(msg.Contents);
+ }));
+ }
+ }
+ catch
+ {
+
+ }
+ };
+ }
+
+ public string ConstructHtml(string markdown)
+ {
+ string html = $@"<html>
+ <head>
+ <style>
+ <!-- Skin the web page -->
+ body {{
+ background-color: rgb({LoadedSkin.ControlColor.R}, {LoadedSkin.ControlColor.G}, {LoadedSkin.ControlColor.B});
+ color: rgb({LoadedSkin.ControlTextColor.R}, {LoadedSkin.ControlTextColor.G}, {LoadedSkin.ControlTextColor.B});
+ font-family: ""{LoadedSkin.MainFont.Name}"";
+ font-size: {LoadedSkin.MainFont.Size}em;
+ }}
+
+ h1 {{
+ font-family: ""{LoadedSkin.HeaderFont.Name}"";
+ font-size: {LoadedSkin.HeaderFont.Size}em;
+ }}
+
+ h2 {{
+ font-family: ""{LoadedSkin.Header2Font.Name}"";
+ font-size: {LoadedSkin.Header2Font.Size}em;
+ }}
+
+ h3 {{
+ font-family: ""{LoadedSkin.Header3Font.Name}"";
+ font-size: {LoadedSkin.Header3Font.Size}em;
+ }}
+
+ </style>
+ </head>
+ <body>
+ <markdown/>
+ </body>
+</html>";
+
+ string body = CommonMark.CommonMarkConverter.Convert(markdown);
+
+ html = html.Replace("<markdown/>", body);
+ return html;
+ }
+
+ public string CurrentUrl { get; set; }
+
+
+ private void wbcanvas_Navigating(object sender, WebBrowserNavigatingEventArgs e)
+ {
+ if (CurrentUrl != e.Url.ToString())
+ {
+ e.Cancel = true;
+ Future.Clear();
+ ShiftnetNavigate(e.Url.ToString());
+ }
+ }
+
+ public Stack<string> History = new Stack<string>();
+ public Stack<string> Future = new Stack<string>();
+
+ public void ShiftnetNavigate(string Url, bool pushHistory = true)
+ {
+ if (!string.IsNullOrEmpty(CurrentUrl) && pushHistory)
+ History.Push(CurrentUrl);
+ CurrentUrl = Url;
+
+ ServerManager.SendMessage("shiftnet_get", JsonConvert.SerializeObject(new
+ {
+ url = Url
+ }));
+ }
+
+ public void OnLoad()
+ {
+ ShiftnetNavigate("shiftnet/main");
+ }
+
+ public void OnSkinLoad()
+ {
+ ShiftnetNavigate(CurrentUrl);
+ }
+
+ public bool OnUnload()
+ {
+ return true;
+ }
+
+ public void OnUpgrade()
+ {
+ }
+
+ private void btnback_Click(object sender, EventArgs e)
+ {
+ string hist = History.Pop();
+ if (!string.IsNullOrEmpty(hist))
+ {
+ Future.Push(hist);
+ ShiftnetNavigate(hist, false);
+ }
+ }
+
+ private void btnforward_Click(object sender, EventArgs e)
+ {
+ string fut = Future.Pop();
+ if (!string.IsNullOrEmpty(fut))
+ {
+ ShiftnetNavigate(fut);
+ }
+ }
+
+ private void btngo_Click(object sender, EventArgs e)
+ {
+ if (!string.IsNullOrWhiteSpace(txturl.Text))
+ {
+ Future.Clear();
+
+ ShiftnetNavigate(txturl.Text);
+ }
+ }
+
+ private void txturl_KeyDown(object sender, KeyEventArgs e)
+ {
+ if(e.KeyCode == Keys.Enter)
+ {
+ btngo_Click(sender, EventArgs.Empty);
+ e.SuppressKeyPress = true;
+ }
+ }
+ }
+}
diff --git a/ShiftOS.WinForms/Applications/Shiftnet.resx b/ShiftOS.WinForms/Applications/Shiftnet.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/Shiftnet.resx
@@ -0,0 +1,120 @@
+<?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>
+</root> \ No newline at end of file
diff --git a/ShiftOS.WinForms/FakeSetupScreen.Designer.cs b/ShiftOS.WinForms/FakeSetupScreen.Designer.cs
index b54737f..8fc7708 100644
--- a/ShiftOS.WinForms/FakeSetupScreen.Designer.cs
+++ b/ShiftOS.WinForms/FakeSetupScreen.Designer.cs
@@ -60,6 +60,14 @@
this.label9 = new System.Windows.Forms.Label();
this.txtrsys = new System.Windows.Forms.TextBox();
this.label11 = new System.Windows.Forms.Label();
+ this.pglogin = new System.Windows.Forms.Panel();
+ this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
+ this.label12 = new System.Windows.Forms.Label();
+ this.textBox1 = new System.Windows.Forms.TextBox();
+ this.label13 = new System.Windows.Forms.Label();
+ this.textBox2 = new System.Windows.Forms.TextBox();
+ this.label15 = new System.Windows.Forms.Label();
+ this.button1 = new System.Windows.Forms.Button();
this.flbuttons.SuspendLayout();
this.page1.SuspendLayout();
this.page2.SuspendLayout();
@@ -68,6 +76,8 @@
this.page4.SuspendLayout();
this.pgrereg.SuspendLayout();
this.tableLayoutPanel2.SuspendLayout();
+ this.pglogin.SuspendLayout();
+ this.tableLayoutPanel3.SuspendLayout();
this.SuspendLayout();
//
// pnlheader
@@ -403,11 +413,97 @@
this.label11.TabIndex = 3;
this.label11.Text = "User information";
//
+ // pglogin
+ //
+ this.pglogin.Controls.Add(this.tableLayoutPanel3);
+ this.pglogin.Controls.Add(this.label15);
+ this.pglogin.Controls.Add(this.button1);
+ this.pglogin.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.pglogin.Location = new System.Drawing.Point(138, 0);
+ this.pglogin.Name = "pglogin";
+ this.pglogin.Size = new System.Drawing.Size(352, 300);
+ this.pglogin.TabIndex = 9;
+ //
+ // tableLayoutPanel3
+ //
+ this.tableLayoutPanel3.AutoSize = true;
+ this.tableLayoutPanel3.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.tableLayoutPanel3.ColumnCount = 2;
+ this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
+ this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
+ this.tableLayoutPanel3.Controls.Add(this.label12, 0, 0);
+ this.tableLayoutPanel3.Controls.Add(this.textBox1, 1, 0);
+ this.tableLayoutPanel3.Controls.Add(this.label13, 0, 1);
+ this.tableLayoutPanel3.Controls.Add(this.textBox2, 1, 1);
+ this.tableLayoutPanel3.Location = new System.Drawing.Point(20, 61);
+ this.tableLayoutPanel3.Name = "tableLayoutPanel3";
+ this.tableLayoutPanel3.RowCount = 3;
+ this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
+ this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
+ this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
+ this.tableLayoutPanel3.Size = new System.Drawing.Size(212, 72);
+ this.tableLayoutPanel3.TabIndex = 4;
+ //
+ // label12
+ //
+ this.label12.AutoSize = true;
+ this.label12.Location = new System.Drawing.Point(3, 0);
+ this.label12.Name = "label12";
+ this.label12.Size = new System.Drawing.Size(58, 13);
+ this.label12.TabIndex = 0;
+ this.label12.Text = "Username:";
+ //
+ // textBox1
+ //
+ this.textBox1.Location = new System.Drawing.Point(109, 3);
+ this.textBox1.Name = "textBox1";
+ this.textBox1.Size = new System.Drawing.Size(100, 20);
+ this.textBox1.TabIndex = 1;
+ //
+ // label13
+ //
+ this.label13.AutoSize = true;
+ this.label13.Location = new System.Drawing.Point(3, 26);
+ this.label13.Name = "label13";
+ this.label13.Size = new System.Drawing.Size(56, 13);
+ this.label13.TabIndex = 2;
+ this.label13.Text = "Password:";
+ //
+ // textBox2
+ //
+ this.textBox2.Location = new System.Drawing.Point(109, 29);
+ this.textBox2.Name = "textBox2";
+ this.textBox2.PasswordChar = '*';
+ this.textBox2.Size = new System.Drawing.Size(100, 20);
+ this.textBox2.TabIndex = 3;
+ //
+ // label15
+ //
+ this.label15.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.label15.Font = new System.Drawing.Font("Microsoft Sans Serif", 13F);
+ this.label15.Location = new System.Drawing.Point(16, 9);
+ this.label15.Name = "label15";
+ this.label15.Size = new System.Drawing.Size(321, 26);
+ this.label15.TabIndex = 3;
+ this.label15.Text = "User information";
+ //
+ // button1
+ //
+ this.button1.Location = new System.Drawing.Point(129, 142);
+ this.button1.Name = "button1";
+ this.button1.Size = new System.Drawing.Size(75, 21);
+ this.button1.TabIndex = 4;
+ this.button1.Text = "Register";
+ this.button1.UseVisualStyleBackColor = true;
+ this.button1.Click += new System.EventHandler(this.button1_Click);
+ //
// FakeSetupScreen
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(490, 329);
+ this.Controls.Add(this.pglogin);
this.Controls.Add(this.pgrereg);
this.Controls.Add(this.page3);
this.Controls.Add(this.page4);
@@ -420,7 +516,7 @@
this.MinimizeBox = false;
this.Name = "FakeSetupScreen";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
- this.Text = "FakeSetupScreen";
+ this.Text = "ShiftOS";
this.TopMost = true;
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FakeSetupScreen_FormClosing);
this.flbuttons.ResumeLayout(false);
@@ -436,6 +532,10 @@
this.pgrereg.PerformLayout();
this.tableLayoutPanel2.ResumeLayout(false);
this.tableLayoutPanel2.PerformLayout();
+ this.pglogin.ResumeLayout(false);
+ this.pglogin.PerformLayout();
+ this.tableLayoutPanel3.ResumeLayout(false);
+ this.tableLayoutPanel3.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@@ -475,5 +575,13 @@
private System.Windows.Forms.Label label9;
private System.Windows.Forms.TextBox txtrsys;
private System.Windows.Forms.Label label11;
+ private System.Windows.Forms.Panel pglogin;
+ private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3;
+ private System.Windows.Forms.Label label12;
+ private System.Windows.Forms.TextBox textBox1;
+ private System.Windows.Forms.Label label13;
+ private System.Windows.Forms.TextBox textBox2;
+ private System.Windows.Forms.Label label15;
+ private System.Windows.Forms.Button button1;
}
} \ No newline at end of file
diff --git a/ShiftOS.WinForms/FakeSetupScreen.cs b/ShiftOS.WinForms/FakeSetupScreen.cs
index cc38d9b..a30b66c 100644
--- a/ShiftOS.WinForms/FakeSetupScreen.cs
+++ b/ShiftOS.WinForms/FakeSetupScreen.cs
@@ -191,6 +191,9 @@ So make sure your password is secure enough that it can't be guessed, but easy f
this.CanClose = true;
this.Close();
break;
+ case 10:
+ pglogin.BringToFront();
+ break;
}
}
@@ -262,5 +265,12 @@ So make sure your password is secure enough that it can't be guessed, but easy f
currentPage++;
SetupUI();
}
+
+ private void button1_Click(object sender, EventArgs e)
+ {
+ ShiftOS.Objects.ShiftFS.Utils.Delete(Paths.GetPath("user.dat"));
+ System.IO.File.WriteAllText(Paths.SaveFile, ShiftOS.Objects.ShiftFS.Utils.ExportMount(0));
+ Application.Restart();
+ }
}
}
diff --git a/ShiftOS.WinForms/Oobe.cs b/ShiftOS.WinForms/Oobe.cs
index e4fc510..761aa29 100644
--- a/ShiftOS.WinForms/Oobe.cs
+++ b/ShiftOS.WinForms/Oobe.cs
@@ -249,7 +249,14 @@ namespace ShiftOS.WinForms
public void PromptForLogin()
{
- throw new NotImplementedException();
+ this.Show();
+ this.TopMost = true;
+ lblHijack.Text = "";
+ textgeninput = lblhackwords;
+
+ var fsw = new FakeSetupScreen(this, 10);
+ fsw.Show();
+ fsw.TopMost = true;
}
public void StartTrailer()
diff --git a/ShiftOS.WinForms/Program.cs b/ShiftOS.WinForms/Program.cs
index 30a29e2..144dc56 100644
--- a/ShiftOS.WinForms/Program.cs
+++ b/ShiftOS.WinForms/Program.cs
@@ -36,13 +36,13 @@ using ShiftOS.WinForms.Tools;
namespace ShiftOS.WinForms
{
- static class Program
+ public static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
- static void Main()
+ public static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj
index 3cc3b4f..0b247f3 100644
--- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj
+++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj
@@ -33,6 +33,10 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
+ <Reference Include="CommonMark, Version=0.1.0.0, Culture=neutral, PublicKeyToken=001ef8810438905d, processorArchitecture=MSIL">
+ <HintPath>..\packages\CommonMark.NET.0.15.0\lib\net45\CommonMark.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
@@ -143,6 +147,12 @@
<Compile Include="Applications\Shifter.Designer.cs">
<DependentUpon>Shifter.cs</DependentUpon>
</Compile>
+ <Compile Include="Applications\Shiftnet.cs">
+ <SubType>UserControl</SubType>
+ </Compile>
+ <Compile Include="Applications\Shiftnet.Designer.cs">
+ <DependentUpon>Shiftnet.cs</DependentUpon>
+ </Compile>
<Compile Include="Applications\ShiftoriumFrontend.cs">
<SubType>UserControl</SubType>
</Compile>
@@ -264,6 +274,9 @@
<EmbeddedResource Include="Applications\Shifter.resx">
<DependentUpon>Shifter.cs</DependentUpon>
</EmbeddedResource>
+ <EmbeddedResource Include="Applications\Shiftnet.resx">
+ <DependentUpon>Shiftnet.cs</DependentUpon>
+ </EmbeddedResource>
<EmbeddedResource Include="Applications\ShiftoriumFrontend.resx">
<DependentUpon>ShiftoriumFrontend.cs</DependentUpon>
</EmbeddedResource>
diff --git a/ShiftOS.WinForms/ShiftOSAudioProvider.cs b/ShiftOS.WinForms/ShiftOSAudioProvider.cs
index f217325..52cbc92 100644
--- a/ShiftOS.WinForms/ShiftOSAudioProvider.cs
+++ b/ShiftOS.WinForms/ShiftOSAudioProvider.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
+using System.Threading;
using System.Threading.Tasks;
using Newtonsoft.Json;
using ShiftOS.Engine;
@@ -19,18 +20,27 @@ namespace ShiftOS.WinForms
}
}
- private float _vol = 1.0f;
public float Volume
{
get
{
- return _vol;
+ if (SaveSystem.CurrentSave == null)
+ return 1.0f;
+ try
+ {
+ return SaveSystem.CurrentSave.Settings.audioVolume;
+ }
+ catch
+ {
+ SaveSystem.CurrentSave.Settings.audioVolume = 1.0f;
+ return 1.0f;
+ }
}
set
{
- _vol = value;
+ SaveSystem.CurrentSave.Settings.audioVolume = value;
}
}
diff --git a/ShiftOS.WinForms/Tools/ControlManager.cs b/ShiftOS.WinForms/Tools/ControlManager.cs
index 456e46d..78d3534 100644
--- a/ShiftOS.WinForms/Tools/ControlManager.cs
+++ b/ShiftOS.WinForms/Tools/ControlManager.cs
@@ -180,7 +180,14 @@ namespace ShiftOS.WinForms.Tools
ctrl.Font = SkinEngine.LoadedSkin.Header3Font;
}
- ctrl.Text = Localization.Parse(ctrl.Text);
+ try
+ {
+ ctrl.Text = Localization.Parse(ctrl.Text);
+ }
+ catch
+ {
+
+ }
ctrl.KeyDown += (o, a) =>
{
if (a.Control && a.KeyCode == Keys.T)
diff --git a/ShiftOS.WinForms/packages.config b/ShiftOS.WinForms/packages.config
index 51393a5..b591ab5 100644
--- a/ShiftOS.WinForms/packages.config
+++ b/ShiftOS.WinForms/packages.config
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
+ <package id="CommonMark.NET" version="0.15.0" targetFramework="net451" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net452" />
<package id="Vlc.DotNet.Core.Interops" version="2.1.130" targetFramework="net451" />
</packages> \ No newline at end of file
diff --git a/ShiftOS_TheReturn.sln b/ShiftOS_TheReturn.sln
index b868ebf..78a3822 100644
--- a/ShiftOS_TheReturn.sln
+++ b/ShiftOS_TheReturn.sln
@@ -13,6 +13,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShiftOS.WinForms", "ShiftOS
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShiftOS.MFSProfiler", "ShiftOS.MFSProfiler\ShiftOS.MFSProfiler.csproj", "{AF587F3F-CA85-4183-BEEB-ACF527B1FFF3}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShiftOS.Modding.VirtualMachine", "ShiftOS.Modding.VirtualMachine\ShiftOS.Modding.VirtualMachine.csproj", "{FF0B1831-AC9F-4093-9747-DDAE4467516A}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -39,6 +41,10 @@ Global
{AF587F3F-CA85-4183-BEEB-ACF527B1FFF3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AF587F3F-CA85-4183-BEEB-ACF527B1FFF3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AF587F3F-CA85-4183-BEEB-ACF527B1FFF3}.Release|Any CPU.Build.0 = Release|Any CPU
+ {FF0B1831-AC9F-4093-9747-DDAE4467516A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {FF0B1831-AC9F-4093-9747-DDAE4467516A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {FF0B1831-AC9F-4093-9747-DDAE4467516A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {FF0B1831-AC9F-4093-9747-DDAE4467516A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/ShiftOS_TheReturn/AudioManager.cs b/ShiftOS_TheReturn/AudioManager.cs
index 4f90d76..d03da4c 100644
--- a/ShiftOS_TheReturn/AudioManager.cs
+++ b/ShiftOS_TheReturn/AudioManager.cs
@@ -29,6 +29,10 @@ namespace ShiftOS.Engine
};
var t = new Thread(() =>
{
+ SaveSystem.GameReady += () =>
+ {
+ _out.Volume = _provider.Volume;
+ };
Random rnd = new Random();
while(_running == true)
{
diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs
index 7678bca..4934221 100644
--- a/ShiftOS_TheReturn/SaveSystem.cs
+++ b/ShiftOS_TheReturn/SaveSystem.cs
@@ -101,15 +101,16 @@ namespace ShiftOS.Engine
if (defaultConf.ConnectToMud == true)
{
- try
+ bool guidReceived = false;
+ ServerManager.GUIDReceived += (str) =>
{
- bool guidReceived = false;
- ServerManager.GUIDReceived += (str) =>
- {
- guidReceived = true;
- Console.WriteLine("{CONNECTION_SUCCESSFUL}");
- };
+ guidReceived = true;
+ Console.WriteLine("{CONNECTION_SUCCESSFUL}");
+ };
+ try
+ {
+
ServerManager.Initiate("secondary4162.cloudapp.net", 13370);
while(guidReceived == false)
{
@@ -121,6 +122,10 @@ namespace ShiftOS.Engine
Console.WriteLine("{ERROR}: " + ex.Message);
Thread.Sleep(3000);
ServerManager.StartLANServer();
+ while (guidReceived == false)
+ {
+
+ }
}
}
else
diff --git a/ShiftOS_TheReturn/Scripting.cs b/ShiftOS_TheReturn/Scripting.cs
index 4d5c1a7..1bb48d5 100644
--- a/ShiftOS_TheReturn/Scripting.cs
+++ b/ShiftOS_TheReturn/Scripting.cs
@@ -34,6 +34,7 @@ using System.Dynamic;
using Newtonsoft.Json;
using System.Windows.Forms;
using System.Threading;
+using System.Net;
namespace ShiftOS.Engine.Scripting
{
@@ -125,6 +126,16 @@ namespace ShiftOS.Engine.Scripting
t.IsBackground = true;
t.Start();
});
+ Lua.includeScript = new Action<string>((file) =>
+ {
+ if (!Utils.FileExists(file))
+ throw new ArgumentException("File does not exist.");
+
+ if (!file.EndsWith(".lua"))
+ throw new ArgumentException("File is not a lua file.");
+
+ Lua(Utils.ReadAllText(file));
+ });
}
@@ -142,12 +153,31 @@ namespace ShiftOS.Engine.Scripting
public void Execute(string lua)
{
+ try
+ {
Console.WriteLine("");
Lua(lua);
Console.WriteLine($"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ");
+ }
+ catch (Exception e)
+ {
+ Infobox.Show("Script error", $@"Script threw {e.GetType().Name}:
+
+{e.Message}");
+ }
}
}
+ [Exposed("net")]
+ public class NetFunctions
+ {
+ public string get(string url)
+ {
+ return new WebClient().DownloadString(url);
+ }
+
+ }
+
[Exposed("console")]
public class ConsoleFunctions
{
@@ -175,7 +205,18 @@ namespace ShiftOS.Engine.Scripting
return TerminalBackend.RunClient(cmd, args);
}
-
+ public void addCodepoints(int cp)
+ {
+ if (cp > 100 || cp <= 0)
+ {
+ throw new Exception("Value 'cp' must be at or below 100, and above 0.");
+ }
+ else
+ {
+ SaveSystem.CurrentSave.Codepoints += cp;
+ SaveSystem.SaveGame();
+ }
+ }
}