private void AddButton_Click(object sender, RoutedEventArgs e) { if (!CheckIsEmpty()) { string authName = authmoduleNameTextbox.Text; string authData = authDataTextbox.Text; AuthenticationNode node = new AuthenticationNode() { AuthType = authenticationType, Name = authName }; switch (authenticationType) { case AuthenticationType.NIDE8: node.Property.Add("nide8ID", authData); break; case AuthenticationType.AUTHLIB_INJECTOR: node.Property.Add("authserver", authData); break; case AuthenticationType.CUSTOM_SERVER: node.Property.Add("authserver", authData); break; default: node.Property.Add("authserver", authData); break; } ((SettingWindow)Window.GetWindow(this)).AddAuthModule(authName, node); } }
public void build_the_object_def_successfully() { var def = new AuthenticationNode(typeof(BasicAuthentication)) .As <IContainerModel>().ToObjectDef(); def.Type.ShouldEqual(typeof(BasicAuthentication)); }
public void build_the_object_def_successfully() { var def = new AuthenticationNode(typeof (BasicAuthentication)) .As<IContainerModel>().ToObjectDef(); def.Type.ShouldEqual(typeof (BasicAuthentication)); }
//启动游戏按钮点击 private void launchButton_Click(object sender, RoutedEventArgs e) { //获取启动版本 MineRealmsLauncherCore.Modules.Version launchVersion = null; if (launchVersionCombobox.SelectedItem != null) { launchVersion = (MineRealmsLauncherCore.Modules.Version)launchVersionCombobox.SelectedItem; } //获取验证方式 AuthenticationNode authNode = null; string authNodeName = null; if (authTypeCombobox.SelectedItem != null) { KeyValuePair <string, AuthenticationNode> node = (KeyValuePair <string, AuthenticationNode>)authTypeCombobox.SelectedItem; authNode = node.Value; authNodeName = node.Key; } //获取用户信息 string userName = userComboBox.Text; string selectedUserUUID = (string)userComboBox.SelectedValue; bool isNewUser = string.IsNullOrWhiteSpace(selectedUserUUID); UserNode userNode = null; if (!string.IsNullOrWhiteSpace(userName)) { if (!isNewUser) { userNode = ((KeyValuePair <string, UserNode>)userComboBox.SelectedItem).Value; } else { userNode = new UserNode() { AuthModule = authNodeName, UserName = userName }; } } else { userNode = null; } this.Launch?.Invoke(this, new LaunchEventArgs() { AuthNode = authNode, UserNode = userNode, LaunchVersion = launchVersion, IsNewUser = isNewUser }); }
public async void AddAuthModule(string name, AuthenticationNode authmodule) { if (App.Config.MainConfig.User.AuthenticationDic.Any(x => x.Key == name)) { await this.ShowMessageAsync("添加的验证模型名称已存在", "您可以尝试更换可用的验证模型名称"); return; } var item = new KeyValuePair <string, AuthenticationNode>(name, authmodule); App.Config.MainConfig.User.AuthenticationDic.Add(name, authmodule); await this.ShowMessageAsync("添加成功", "记得点击应用按钮保存噢"); authModuleCombobox.SelectedItem = item; }