public override void Show() { Console.WriteLine("Welcome in ShadeMSG now u can create a free account"); string nick = Input("Nick: "); Console.WriteLine("It will not be possible to change your password in the future"); string password = Input("Password: "******"Check nick lenght Min:" + minLenghtNick + " Max:" + maxLenghtNick); } if (!DataValidation.CheckLenght(password, minLenghtPassword, maxLenghtPassword)) { validationErrors.Add("Check password lenght Min:" + minLenghtPassword + " Max:" + maxLenghtPassword); } if (DataValidation.RegexCheck(nick, "[^A-Za-z0-9_.]")) { validationErrors.Add("Nick have illegal characters, use only letters and numbers."); } if (DataValidation.RegexCheck(password, "[^A-Za-z0-9_.]")) { validationErrors.Add("Password have illegal characters, use only letters and numbers."); } if (validationErrors.Count > 0) { foreach (string error in validationErrors) { Console.WriteLine(error, Color.Tomato); } return; } Packet reg_packet = new Packet() { name = "register", args = new Argument[] { new Argument("nick", nick), new Argument("password", password) } }; Console.WriteLine("Creating Account.."); client.Send(reg_packet); responseCatcher = new ResponseCatcher(reg_packet); responseCatcher.PacketCaught += ResponseCatcher_PacketCaught; while (!responseCatcher.packetWasCaught) { Thread.Sleep(100); } }
public override void Show() { Console.WriteLine("Login in to your account"); nick = Input("Nick: "); string password = Input("Password: "******"Check nick lenght Min:" + minLenghtNick + " Max:" + maxLenghtNick); } if (!DataValidation.CheckLenght(password, minLenghtPassword, maxLenghtPassword)) { validationErrors.Add("Check password lenght Min:" + minLenghtPassword + " Max:" + maxLenghtPassword); } if (DataValidation.RegexCheck(nick, "[^A-Za-z0-9_.]")) { validationErrors.Add("Nick have illegal characters, use only letters and numbers."); } if (DataValidation.RegexCheck(password, "[^A-Za-z0-9_.]")) { validationErrors.Add("Password have illegal characters, use only letters and numbers."); } if (validationErrors.Count > 0) { foreach (string error in validationErrors) { Console.WriteLine(error, Color.Tomato); } return; } Packet login_packet = new Packet() { name = "login", args = new Argument[] { new Argument("nick", nick), new Argument("password", password) } }; client.Send(login_packet); responseCatcher = new ResponseCatcher(login_packet); responseCatcher.PacketCaught += ResponseCatcher_PacketCaught; while (!responseCatcher.packetWasCaught) { } }