From 5b01c364e65616a41332f76e445a9dbd8e64a53f Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 22 Jan 2017 19:03:59 -0500 Subject: Implement save migration from client to server --- ShiftOS.WinForms/FakeSetupScreen.cs | 62 ++++++++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) (limited to 'ShiftOS.WinForms/FakeSetupScreen.cs') 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 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 UserReregistered; + public void StartWipingInBackground(long arbitraryAmountOfBytes) { pgformatprogress.Maximum = (int)arbitraryAmountOfBytes; -- cgit v1.2.3