private void Update() { if (Input.GetKey(KeyCode.Escape)) { InputInterceptor.EnableInput(); } if (Input.GetKeyDown(debugSequence[debugSequenceIndex].ToString())) { debugSequenceIndex++; if (debugSequenceIndex != debugSequence.Length) { return; } TwitchPlaySettings.data.TwitchPlaysDebugEnabled = !TwitchPlaySettings.data.TwitchPlaysDebugEnabled; TwitchPlaySettings.WriteDataToFile(); debugSequenceIndex = 0; UserAccess.AddUser("_TPDEBUG".ToLowerInvariant(), AccessLevel.Streamer | AccessLevel.SuperUser | AccessLevel.Admin | AccessLevel.Mod); UserAccess.WriteAccessList(); } else if (Input.anyKeyDown) { debugSequenceIndex = 0; } }
public void UserAddTest() { var con = DbHelper.GetDbConnection(); con.Open(); UserAccess.AddUser(con, "Test2", "Test2"); }
public ActionResult Register(UserAccess model) { //if (ModelState.IsValid) //{ // // Attempt to register the user // MembershipCreateStatus createStatus; // Membership.CreateUser(model.UserName, model.Password, model.Email, null, null, true, null, out createStatus); // if (createStatus == MembershipCreateStatus.Success) // { // FormsAuthentication.SetAuthCookie(model.UserName, false /* createPersistentCookie */); // return RedirectToAction("Index", "Home"); // } // else // { // ModelState.AddModelError("", ErrorCodeToString(createStatus)); // } //} //// If we got this far, something failed, redisplay form //return View(model); UserAccess user = new UserAccess(); user.UserID = model.UserID; user.UserName = model.UserName; user.Salt = DateTime.Now.Hour.ToString(CultureInfo.InvariantCulture); user.Password = model.Password; user.PasswordRetype = model.PasswordRetype; if (!string.Equals(user.Password, user.PasswordRetype)) { ModelState.AddModelError("Error", "Passwords mismatch."); return(View()); } // We need to create a second occurrence. UserAccess userRead = new UserAccess(); var userReadResponse = userRead.Read(model.UserID); if (userReadResponse.ReturnCode == 0001 && userReadResponse.ReasonCode == 0001) { userReadResponse = user.UpdateUser(); } if (userReadResponse.ReturnCode == 0001 && userReadResponse.ReasonCode == 0002) { userReadResponse = user.AddUser(); } if (userReadResponse.ReturnCode < 0001) { ModelState.AddModelError("Error", userReadResponse.Message); return(View()); } // all good return(View("CreateUserSuccess")); }
private void Update() { MainThreadQueue.ProcessQueue(); if (Input.GetKey(KeyCode.Escape)) { InputInterceptor.EnableInput(); TwitchGame.ModuleCameras?.DisableCameraWall(); } if (Input.GetKeyDown(DebugSequence[_debugSequenceIndex].ToString())) { _debugSequenceIndex++; if (_debugSequenceIndex != DebugSequence.Length) { return; } TwitchPlaySettings.data.TwitchPlaysDebugEnabled = !TwitchPlaySettings.data.TwitchPlaysDebugEnabled; TwitchPlaySettings.WriteDataToFile(); chatSimulator.SetActive(TwitchPlaySettings.data.TwitchPlaysDebugEnabled); _debugSequenceIndex = 0; UserAccess.AddUser("_TPDEBUG".ToLowerInvariant(), AccessLevel.Streamer | AccessLevel.SuperUser | AccessLevel.Admin | AccessLevel.Mod); UserAccess.WriteAccessList(); } else if (Input.anyKeyDown) { _debugSequenceIndex = 0; } }
public static void SetDebugUsername(bool force = false) { if (!UserAccess.HasAccess(TwitchPlaySettings.data.TwitchPlaysDebugUsername, AccessLevel.Streamer)) { foreach (string username in UserAccess.GetUsers().Where(kvp => kvp.Key.StartsWith("_")) .Select(kvp => kvp.Key).ToArray()) { UserAccess.RemoveUser(username, ~AccessLevel.User); } UserAccess.AddUser(TwitchPlaySettings.data.TwitchPlaysDebugUsername, AccessLevel.Streamer | AccessLevel.SuperUser | AccessLevel.Admin | AccessLevel.Mod); UserAccess.WriteAccessList(); } if (Instance == null) { return; } if (!Instance.UserNickName.StartsWith("_") && !force) { return; } Instance.UserNickName = TwitchPlaySettings.data.TwitchPlaysDebugUsername; Instance.ChannelName = TwitchPlaySettings.data.TwitchPlaysDebugUsername; Instance.CurrentColor = "#" + ColorUtility.ToHtmlStringRGB(TwitchPlaySettings.data.TwitchPlaysDebugUsernameColor); }
public void OnReceiveMsg(ReceiveMsgOrder receiveMsgOrder) { if (receiveMsgOrder.Sign == 1) //登陆成功 { //ID+账号+昵称+头像 string[] UserMsg = receiveMsgOrder.MsgContent.Split(MessageTypes.NSP.ToCharArray()); //此处不做窗口跳转处理,由PreViewModel.cs处理 //存储用户 _userModel = UserModel.CreateModel(UserMsg[1], UserMsg[2], UserMsg[3], this.PassWord, Check, DateTime.Now); if (_userAccess.IsAlreadyExists(_userModel)) { _userAccess.UpdateUser(_userModel); } else { _userAccess.AddUser(_userModel); } _userAccess.SortUser(); return; } StoryboardManager.StopStoryboard("Story_Login"); XWT.MessageBox.Show(receiveMsgOrder.MsgContent, "提示", MessageBoxButton.OK, MessageBoxImage.Information); //MsgEvent msgEvent = eventAggregator.GetEvent<MsgEvent>(); //if (subscriptionToken != null) // msgEvent.Unsubscribe(subscriptionToken); }
private void Start() { _gameInfo = GetComponent <KMGameInfo>(); _gameInfo.OnStateChange += OnStateChange; _modSettings = GetComponent <KMModSettings>(); ModSettingsJSON settings = JsonConvert.DeserializeObject <ModSettingsJSON>(_modSettings.Settings); if (settings == null) { DebugHelper.LogError("Failed to read connection settings from mod settings."); return; } DebugMode = (settings.debug == true); _ircConnection = new IRCConnection(settings.authToken, settings.userName, settings.channelName, settings.serverName, settings.serverPort); _ircConnection.Connect(); _coroutineCanceller = new CoroutineCanceller(); _coroutineQueue = GetComponent <CoroutineQueue>(); _coroutineQueue.coroutineCanceller = _coroutineCanceller; logUploader = GetComponent <LogUploader>(); logUploader.ircConnection = _ircConnection; urlHelper = GetComponent <UrlHelper>(); urlHelper.ChangeMode(settings.shortUrls == true); _leaderboard = new Leaderboard(); _leaderboard.LoadDataFromFile(); ModuleData.LoadDataFromFile(); ModuleData.WriteDataToFile(); TwitchPlaySettings.LoadDataFromFile(); UserAccess.AddUser(settings.userName, AccessLevel.Streamer | AccessLevel.SuperUser | AccessLevel.Admin | AccessLevel.Mod); UserAccess.AddUser(settings.channelName.Replace("#", ""), AccessLevel.Streamer | AccessLevel.SuperUser | AccessLevel.Admin | AccessLevel.Mod); UserAccess.WriteAccessList(); SetupResponder(bombMessageResponder); SetupResponder(postGameMessageResponder); SetupResponder(missionMessageResponder); SetupResponder(miscellaneousMessageResponder); bombMessageResponder.leaderboard = _leaderboard; postGameMessageResponder.leaderboard = _leaderboard; miscellaneousMessageResponder.leaderboard = _leaderboard; bombMessageResponder.parentService = this; }
public void AddUser() { try { var con = DbHelper.GetDbConnection(); con.Open(); UserAccess.AddUser(con, "Test2", "Test2"); Console.WriteLine("Success"); } catch (Exception ex) { Console.WriteLine(ex); } }
/// <summary> /// Legt einen neuen User in der Datenbank an /// </summary> /// <param name="name">User Name</param> /// <param name="password">User Password</param> /// <returns>Einen HttpStatusCode OK bei Erfolg InternalServerError bei Fehlschlag</returns> public HttpStatusCode Anlegen(string name, string password) { var con = DbHelper.GetDbConnection(); con.Open(); if (string.IsNullOrWhiteSpace(UserAccess.GetName(con, name))) { var HashnSalt = SaltHashHelper.CreateHash(password); UserAccess.AddUser(con, name, HashnSalt.Item1); UserAccess.AddSalt(con, UserAccess.GetIdByName(con, name), HashnSalt.Item2); return(HttpStatusCode.OK); } else { return(HttpStatusCode.InternalServerError); } }
public void UserAnlegen() { var con = DbHelper.GetDbConnection(); con.Open(); if (string.IsNullOrEmpty(UserAccess.GetName(con, "Test"))) { var SaltnHash = SaltHashHelper.CreateHash("Test"); UserAccess.AddUser(con, "Test", SaltnHash.Item1); var ID = UserAccess.GetIdByName(con, "Test"); UserAccess.AddSalt(con, ID, SaltnHash.Item2); } else { Console.Write("Error"); } con.Close(); }
public async Task <IActionResult> AddUser([FromBody] User user) { try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var userAccess = new UserAccess(this.ConnectionString); var newUser = await userAccess.AddUser(user); return(Ok(newUser)); } catch (Exception) { throw new Exception("something went wrong"); } }
public ActionResult Register(user user) { try { if (ModelState.IsValid) { UserAccess userAccess = new UserAccess(); userAccess.AddUser(user); return(View()); } else { return(View("Index")); } } catch (Exception e1) { TempData["Msg"] = "Create Failed : " + e1.Message; return(RedirectToAction("Index")); } }
/// <summary> /// Add role /// </summary> /// <param name="clientContract"></param> /// <returns></returns> public static ResponseStatus Save(UserAccess inUser) { ResponseStatus response = new ResponseStatus(); UserAccess user = new UserAccess(); user.UserID = inUser.UserID; user.UserName = inUser.UserName; user.Salt = inUser.Salt; user.Password = inUser.Password; // We need to create a second occurrence. UserAccess userRead = new UserAccess(); if (userRead.Read(inUser.UserID)) { response = user.UpdateUser(); } else { response = user.AddUser(); } return(response); }
public IActionResult AddUser(User user) { return(Ok(_userAccess.AddUser(user))); }
public HttpResponseMessage AddUser([FromBody] User objUser) { return(Request.CreateResponse(HttpStatusCode.OK, objUserAccess.AddUser(objUser))); }
public IActionResult AddNewUser(User user) { return(Ok(_storage.AddUser(user))); }