private void Finish() { if (string.IsNullOrEmpty(MFPath)) { UtilHelper.ShowAlertDialog(new Model.AlertDialogInterfaceModel { Content = "未选择美服游戏路径" }); return; } if (!UserType) { if (string.IsNullOrEmpty(PickUsername) || PickUsername.Equals(pickUserPlaceholder)) { UtilHelper.ShowAlertDialog(new Model.AlertDialogInterfaceModel { Content = "请选择用户或新建用户" }); return; } } else { if (string.IsNullOrEmpty(NewUsername)) { UtilHelper.ShowAlertDialog(new Model.AlertDialogInterfaceModel { Content = "请输入新用户名" }); return; } if (AllUsernameList.IndexOf(NewUsername) != -1) { UtilHelper.ShowAlertDialog(new Model.AlertDialogInterfaceModel { Content = "用户名已存在,或者是系统保留用户名" }); return; } } if (string.IsNullOrEmpty(Password)) { UtilHelper.ShowAlertDialog(new Model.AlertDialogInterfaceModel { Content = "请输入密码" }); return; } if (!UserType) { if (UtilHelper.VerifySystemUser(PickUsername, Password)) { try { UtilHelper.CheckSystemUserFolderAndCreate(PickUsername, Password); } catch (Exception e) { UtilHelper.ShowAlertDialog(new Model.AlertDialogInterfaceModel { Content = "生成用户文件夹失败:\r\n" + e.Message }); return; } _ConfigManager.SaveMFUser(PickUsername, Password); } else { UtilHelper.ShowAlertDialog(new Model.AlertDialogInterfaceModel { Content = "密码不正确" }); return; } } else { try { UtilHelper.CreateSystemUser(NewUsername, Password); } catch (Exception e) { UtilHelper.ShowAlertDialog(new Model.AlertDialogInterfaceModel { Content = "创建新用户失败:\r\n" + e.Message }); return; } try { UtilHelper.CheckSystemUserFolderAndCreate(NewUsername, Password); } catch (Exception e) { UtilHelper.ShowAlertDialog(new Model.AlertDialogInterfaceModel { Content = "生成用户文件夹失败:\r\n" + e.Message }); return; } _ConfigManager.SaveMFUser(NewUsername, Password); } _ConfigManager.SaveGamePath(MFPath, "MF"); DialogCallback?.Invoke(true); ((ICommand)ControlCommands.Close).Execute(null); }