aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.WinForms
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-04-30 18:50:54 -0400
committerMichael <[email protected]>2017-04-30 18:50:54 -0400
commit354b65cc54c6fdd4c004c5895bfd5fedf06abf7f (patch)
tree39e05425ee3893a8077abbef93f53eb2f63edb52 /ShiftOS.WinForms
parentcdfba45faaa9202c69bdfe1a2f9e92140e0ecdae (diff)
downloadshiftos_thereturn-354b65cc54c6fdd4c004c5895bfd5fedf06abf7f.tar.gz
shiftos_thereturn-354b65cc54c6fdd4c004c5895bfd5fedf06abf7f.tar.bz2
shiftos_thereturn-354b65cc54c6fdd4c004c5895bfd5fedf06abf7f.zip
A better linking system.
Diffstat (limited to 'ShiftOS.WinForms')
-rw-r--r--ShiftOS.WinForms/Oobe.cs68
-rw-r--r--ShiftOS.WinForms/ShiftOS.WinForms.csproj9
-rw-r--r--ShiftOS.WinForms/UniteSignupDialog.Designer.cs186
-rw-r--r--ShiftOS.WinForms/UniteSignupDialog.cs43
-rw-r--r--ShiftOS.WinForms/UniteSignupDialog.resx131
5 files changed, 421 insertions, 16 deletions
diff --git a/ShiftOS.WinForms/Oobe.cs b/ShiftOS.WinForms/Oobe.cs
index 6339588..35efca4 100644
--- a/ShiftOS.WinForms/Oobe.cs
+++ b/ShiftOS.WinForms/Oobe.cs
@@ -259,45 +259,81 @@ You must join the digital society, rise up the ranks, and save us.
});
AppearanceManager.SetupDialog(loginDialog);
}
+ else
+ {
+ var signupDialog = new UniteSignupDialog((token) =>
+ {
+
+ });
+ AppearanceManager.SetupDialog(signupDialog);
+ }
});
});
}
public void LinkSaveFile(string token)
{
- Infobox.PromptText("Enter username", "Please enter the username you used for your save file before these changes.", (cuname) =>
+ if (Utils.FileExists(Paths.GetPath("user.dat")))
{
- Infobox.PromptText("Enter password", "Now, please enter the corresponding password.", (cpass) =>
+ try
{
- ServerMessageReceived nsmr = null;
- nsmr = (nmsg) =>
+ var details = JsonConvert.DeserializeObject<ClientSave>(Utils.ReadAllText(Paths.GetPath("user.dat")));
+ ServerMessageReceived smr = null;
+ bool msgreceived = false;
+ bool found = false;
+ smr = (msg) =>
{
- ServerManager.MessageReceived -= nsmr;
- if (nmsg.Name == "mud_savefile")
+ if (msg.Name == "mud_savefile")
{
- var save = JsonConvert.DeserializeObject<Save>(nmsg.Contents);
+ var save = JsonConvert.DeserializeObject<Save>(msg.Contents);
save.UniteAuthToken = token;
- Infobox.Show("That'll do it.", "Your save has been linked up! Next time you log into the ShiftOS site, your Codepoints should show on your profile. There's just a few more things we have to do.", () =>
+ Infobox.Show("Migration complete.", "We have migrated your old save file to the new system successfully. You can still log in using the old system on old builds of ShiftOS.", () =>
{
SaveSystem.CurrentSave = save;
SaveSystem.SaveGame();
+ found = true;
+ msgreceived = true;
});
}
else
{
- Infobox.Show("Uh oh.", "We couldn't find a save file with those values. Please try again", () =>
- {
- LinkSaveFile(token);
- });
+ found = false;
+ msgreceived = true;
}
+ ServerManager.MessageReceived -= smr;
};
- ServerManager.MessageReceived += nsmr;
+ ServerManager.MessageReceived += smr;
ServerManager.SendMessage("mud_login", JsonConvert.SerializeObject(new
{
- username = cuname,
- password = cpass
+ username = details.Username,
+ password = details.Password
}));
- }, true);
+ while (msgreceived == false)
+ Thread.Sleep(10);
+ if (found)
+ return;
+ }
+ catch
+ {
+
+ }
+ }
+
+ var client = new UniteClient("http://getshiftos.ml", token);
+ var sve = new Save();
+ sve.Username = client.GetEmail();
+ sve.Password = Guid.NewGuid().ToString();
+ sve.SystemName = client.GetSysName();
+ sve.UniteAuthToken = token;
+ sve.Codepoints = 0;
+ sve.Upgrades = new Dictionary<string, bool>();
+ sve.ID = Guid.NewGuid();
+ Infobox.Show("Welcome to ShiftOS.", "Welcome to ShiftOS, " + client.GetDisplayName() + ". We have created a save file for you. Now, go on and Shift It Your Way.", () =>
+ {
+ sve.StoryPosition = 8675309;
+ SaveSystem.CurrentSave = sve;
+ SaveSystem.SaveGame();
+
});
}
diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj
index 97ba8ef..1d4e91a 100644
--- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj
+++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj
@@ -373,6 +373,12 @@
<Compile Include="UniteLoginDialog.Designer.cs">
<DependentUpon>UniteLoginDialog.cs</DependentUpon>
</Compile>
+ <Compile Include="UniteSignupDialog.cs">
+ <SubType>UserControl</SubType>
+ </Compile>
+ <Compile Include="UniteSignupDialog.Designer.cs">
+ <DependentUpon>UniteSignupDialog.cs</DependentUpon>
+ </Compile>
<Compile Include="VisualBasicStuff.cs" />
<Compile Include="WFLanguageProvider.cs" />
<Compile Include="WidgetManager.cs" />
@@ -534,6 +540,9 @@
<EmbeddedResource Include="UniteLoginDialog.resx">
<DependentUpon>UniteLoginDialog.cs</DependentUpon>
</EmbeddedResource>
+ <EmbeddedResource Include="UniteSignupDialog.resx">
+ <DependentUpon>UniteSignupDialog.cs</DependentUpon>
+ </EmbeddedResource>
<EmbeddedResource Include="WindowBorder.resx">
<DependentUpon>WindowBorder.cs</DependentUpon>
</EmbeddedResource>
diff --git a/ShiftOS.WinForms/UniteSignupDialog.Designer.cs b/ShiftOS.WinForms/UniteSignupDialog.Designer.cs
new file mode 100644
index 0000000..752f5c0
--- /dev/null
+++ b/ShiftOS.WinForms/UniteSignupDialog.Designer.cs
@@ -0,0 +1,186 @@
+namespace ShiftOS.WinForms
+{
+ partial class UniteSignupDialog
+ {
+ /// <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(UniteSignupDialog));
+ this.btnlogin = new System.Windows.Forms.Button();
+ this.txtpassword = new System.Windows.Forms.TextBox();
+ this.txtusername = new System.Windows.Forms.TextBox();
+ this.label3 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
+ this.label1 = new System.Windows.Forms.Label();
+ this.txtconfirm = new System.Windows.Forms.TextBox();
+ this.label4 = new System.Windows.Forms.Label();
+ this.txtdisplay = new System.Windows.Forms.TextBox();
+ this.label5 = new System.Windows.Forms.Label();
+ this.label6 = new System.Windows.Forms.Label();
+ this.SuspendLayout();
+ //
+ // btnlogin
+ //
+ this.btnlogin.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.btnlogin.Location = new System.Drawing.Point(462, 407);
+ this.btnlogin.Name = "btnlogin";
+ this.btnlogin.Size = new System.Drawing.Size(75, 23);
+ this.btnlogin.TabIndex = 11;
+ this.btnlogin.Text = "Submit";
+ this.btnlogin.UseVisualStyleBackColor = true;
+ //
+ // txtpassword
+ //
+ this.txtpassword.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.txtpassword.Location = new System.Drawing.Point(113, 133);
+ this.txtpassword.Name = "txtpassword";
+ this.txtpassword.Size = new System.Drawing.Size(424, 20);
+ this.txtpassword.TabIndex = 10;
+ this.txtpassword.UseSystemPasswordChar = true;
+ //
+ // txtusername
+ //
+ this.txtusername.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.txtusername.Location = new System.Drawing.Point(113, 100);
+ this.txtusername.Name = "txtusername";
+ this.txtusername.Size = new System.Drawing.Size(424, 20);
+ this.txtusername.TabIndex = 9;
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Location = new System.Drawing.Point(17, 136);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(56, 13);
+ this.label3.TabIndex = 8;
+ this.label3.Text = "Password:";
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(17, 103);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(76, 13);
+ this.label2.TabIndex = 7;
+ this.label2.Text = "Email Address:";
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(17, 36);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(84, 13);
+ this.label1.TabIndex = 6;
+ this.label1.Tag = "header2";
+ this.label1.Text = "Login to ShiftOS";
+ //
+ // txtconfirm
+ //
+ this.txtconfirm.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.txtconfirm.Location = new System.Drawing.Point(113, 159);
+ this.txtconfirm.Name = "txtconfirm";
+ this.txtconfirm.Size = new System.Drawing.Size(424, 20);
+ this.txtconfirm.TabIndex = 13;
+ this.txtconfirm.UseSystemPasswordChar = true;
+ //
+ // label4
+ //
+ this.label4.AutoSize = true;
+ this.label4.Location = new System.Drawing.Point(17, 162);
+ this.label4.Name = "label4";
+ this.label4.Size = new System.Drawing.Size(45, 13);
+ this.label4.TabIndex = 12;
+ this.label4.Text = "Confirm:";
+ //
+ // txtdisplay
+ //
+ this.txtdisplay.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.txtdisplay.Location = new System.Drawing.Point(113, 197);
+ this.txtdisplay.Name = "txtdisplay";
+ this.txtdisplay.Size = new System.Drawing.Size(424, 20);
+ this.txtdisplay.TabIndex = 15;
+ //
+ // label5
+ //
+ this.label5.AutoSize = true;
+ this.label5.Location = new System.Drawing.Point(17, 200);
+ this.label5.Name = "label5";
+ this.label5.Size = new System.Drawing.Size(73, 13);
+ this.label5.TabIndex = 14;
+ this.label5.Text = "Display name:";
+ //
+ // label6
+ //
+ this.label6.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.label6.Location = new System.Drawing.Point(20, 251);
+ this.label6.Name = "label6";
+ this.label6.Size = new System.Drawing.Size(517, 153);
+ this.label6.TabIndex = 16;
+ this.label6.Text = resources.GetString("label6.Text");
+ //
+ // UniteSignupDialog
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.label6);
+ this.Controls.Add(this.txtdisplay);
+ this.Controls.Add(this.label5);
+ this.Controls.Add(this.txtconfirm);
+ this.Controls.Add(this.label4);
+ this.Controls.Add(this.btnlogin);
+ this.Controls.Add(this.txtpassword);
+ this.Controls.Add(this.txtusername);
+ this.Controls.Add(this.label3);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.label1);
+ this.Name = "UniteSignupDialog";
+ this.Size = new System.Drawing.Size(555, 447);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Button btnlogin;
+ private System.Windows.Forms.TextBox txtpassword;
+ private System.Windows.Forms.TextBox txtusername;
+ private System.Windows.Forms.Label label3;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.TextBox txtconfirm;
+ private System.Windows.Forms.Label label4;
+ private System.Windows.Forms.TextBox txtdisplay;
+ private System.Windows.Forms.Label label5;
+ private System.Windows.Forms.Label label6;
+ }
+}
diff --git a/ShiftOS.WinForms/UniteSignupDialog.cs b/ShiftOS.WinForms/UniteSignupDialog.cs
new file mode 100644
index 0000000..2f20d9f
--- /dev/null
+++ b/ShiftOS.WinForms/UniteSignupDialog.cs
@@ -0,0 +1,43 @@
+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
+{
+ public partial class UniteSignupDialog : UserControl, IShiftOSWindow
+ {
+ public UniteSignupDialog(Action<string> callback)
+ {
+ InitializeComponent();
+ Callback = callback;
+ }
+
+ private Action<string> Callback { get; set; }
+
+
+ public void OnLoad()
+ {
+ this.ParentForm.AcceptButton = btnlogin;
+ }
+
+ public void OnSkinLoad()
+ {
+ }
+
+ public bool OnUnload()
+ {
+ return true;
+ }
+
+ public void OnUpgrade()
+ {
+ }
+ }
+}
diff --git a/ShiftOS.WinForms/UniteSignupDialog.resx b/ShiftOS.WinForms/UniteSignupDialog.resx
new file mode 100644
index 0000000..5fecdcd
--- /dev/null
+++ b/ShiftOS.WinForms/UniteSignupDialog.resx
@@ -0,0 +1,131 @@
+<?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="label6.Text" xml:space="preserve">
+ <value>Your ShiftOS Account is your gateway to the world of ShiftOS.
+
+What does this account do for you?
+
+ - It holds all your Codepoints, Shiftorium Upgrades, and other in-game save details in a secure spot.
+ - It gives you access to the ShiftOS Forums, Wiki, Developer Blog and the bugtracker.
+ - It gives you your own personal profile that you can shift your own way - just like you can ShiftOS.
+
+You can customize more information for this account at http://getshiftos.ml/, but first, we must create it.</value>
+ </data>
+</root> \ No newline at end of file