aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.WinForms/FakeSetupScreen.cs
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-01-22 19:03:59 -0500
committerMichael <[email protected]>2017-01-22 19:04:04 -0500
commit5b01c364e65616a41332f76e445a9dbd8e64a53f (patch)
treec793a556fc3f2dff03184f0719c4d866aa7b875b /ShiftOS.WinForms/FakeSetupScreen.cs
parent28a8eb7a6a62f3de9515d22dc1bb066585e64655 (diff)
downloadshiftos_thereturn-5b01c364e65616a41332f76e445a9dbd8e64a53f.tar.gz
shiftos_thereturn-5b01c364e65616a41332f76e445a9dbd8e64a53f.tar.bz2
shiftos_thereturn-5b01c364e65616a41332f76e445a9dbd8e64a53f.zip
Implement save migration from client to server
Diffstat (limited to 'ShiftOS.WinForms/FakeSetupScreen.cs')
-rw-r--r--ShiftOS.WinForms/FakeSetupScreen.cs62
1 files changed, 61 insertions, 1 deletions
diff --git a/ShiftOS.WinForms/FakeSetupScreen.cs b/ShiftOS.WinForms/FakeSetupScreen.cs
index b223cb2..cc38d9b 100644
--- a/ShiftOS.WinForms/FakeSetupScreen.cs
+++ b/ShiftOS.WinForms/FakeSetupScreen.cs
@@ -18,10 +18,11 @@ namespace ShiftOS.WinForms
public Action<bool> MUDUserFound = null;
- public FakeSetupScreen(Oobe _oobe)
+ public FakeSetupScreen(Oobe _oobe, int page = 0)
{
oobe = _oobe;
InitializeComponent();
+ currentPage = page;
SetupUI();
ServerManager.MessageReceived += (msg) =>
{
@@ -133,9 +134,68 @@ So make sure your password is secure enough that it can't be guessed, but easy f
CanClose = true;
this.Close();
break;
+ case 7:
+ btnnext.Show();
+ btnback.Hide();
+ pgrereg.BringToFront();
+ TextType("You have two choices - either you can migrate your local user file to this multi-user domain, or you can restart with 0 Codepoints, no upgrades, and still keep your files.");
+ break;
+ case 8:
+ btnnext.Hide();
+ ServerMessageReceived rc = null;
+
+ rc = (msg) =>
+ {
+ if(msg.Name == "mud_found")
+ {
+ TextType("That username and password already exists in this multi-user domain. Please choose another.");
+ currentPage = 7;
+ }
+ else if(msg.Name == "mud_notfound")
+ {
+ currentPage = 9;
+ SetupUI();
+ }
+ ServerManager.MessageReceived -= rc;
+ };
+
+ if (string.IsNullOrEmpty(txtruname.Text))
+ {
+ TextType("You must provide a username.");
+ currentPage = 7;
+ }
+
+ if (string.IsNullOrEmpty(txtrpass.Text))
+ {
+ TextType("You must provide a password.");
+ currentPage = 7;
+ }
+
+ if (string.IsNullOrEmpty(txtrsys.Text))
+ {
+ TextType("You must provide a system hostname.");
+ currentPage = 7;
+ }
+
+ if (currentPage == 7)
+ return;
+
+ ServerManager.MessageReceived += rc;
+ ServerManager.SendMessage("mud_checkuserexists", $@"{{
+ username: ""{txtruname.Text}"",
+ password: ""{txtrpass.Text}""
+}}");
+ break;
+ case 9:
+ UserReregistered?.Invoke(txtruname.Text, txtrpass.Text, txtrsys.Text);
+ this.CanClose = true;
+ this.Close();
+ break;
}
}
+ public event Action<string, string, string> UserReregistered;
+
public void StartWipingInBackground(long arbitraryAmountOfBytes)
{
pgformatprogress.Maximum = (int)arbitraryAmountOfBytes;