private static void HandleEvent(LoginEvent e, ISession session) { Logger.Write( session.Translation.GetTranslation(TranslationString.LoggingIn, e.AuthType, e.Username), LogLevel.Info, ConsoleColor.DarkYellow ); }
public void Login() { string accessToken = r_AppSettings.LastAccessToken; if (accessToken != null) { LoggedInUser = FacebookService.Connect(accessToken).LoggedInUser; } else { LoginForm loginForm = new LoginForm(); if (loginForm.ShowDialog() != DialogResult.OK) { Environment.Exit(0); } LoggedInUser = loginForm.LogInInfo.LoggedInUser; r_AppSettings.LastAccessToken = loginForm.LogInInfo.AccessToken; r_AppSettings.SaveToFile(); } if (LoginEvent != null) { LoginEvent.Invoke(); } NextPage(Factory.AppPages[0].GetType().Name.ToLower()); }
public void DoLogin(string eMail, string pwd) { mLoginInfo = new LoginInfo(); mLoginInfo.memberEmail = eMail; mLoginInfo.memberName = ""; mLoginInfo.memberPwd = pwd; mLoginEvent = new LoginEvent(new EventDelegate(this, "LoginComplete")); // UtilMgr.ShowLoading (true); PlayerPrefs.SetString(Constants.PrefEmail, eMail); PlayerPrefs.SetString(Constants.PrefPwd, pwd); if (Application.platform == RuntimePlatform.Android) { AndroidMgr.RegistGCM(new EventDelegate(this, "SetGCMId")); } else if (Application.platform == RuntimePlatform.IPhonePlayer) { } else if (Application.platform == RuntimePlatform.OSXEditor) { mLoginInfo.memUID = ""; NetMgr.DoLogin(mLoginInfo, mLoginEvent); } }
/// <summary> /// 登陆连接 /// </summary> /// <param name="host">主机</param> /// <param name="port">端口</param> /// <param name="userId">用户Id</param> /// <param name="userName">用户名</param> /// <param name="userPad">用户密码</param> public void Connect(string host, int port, int userId, string userName, string userPad) { this.host = host; this.port = port; this.userId = userId; if (LoginEvent != null) { Tuple <bool, string, string> tuple = LoginEvent?.Invoke(); if (!tuple.Item1) { return; } userName = tuple.Item2; userPad = tuple.Item3; } var options = new MqttClientOptions { ClientId = this.ClientId, ChannelOptions = new MqttClientTcpOptions() { Server = host, Port = port }, Credentials = new MqttClientCredentials() { Username = userId > 0 ? userId + "" : userName, Password = userId > 0 ? null : userPad, }, CleanSession = true, }; options.KeepAlivePeriod = TimeSpan.FromSeconds(this.keepAlivePeriod); //options.KeepAliveSendInterval = TimeSpan.FromSeconds(15); mqttClient.ConnectAsync(options); }
public static string GetActionText(LoginEvent evt) { var action = (MessageAction)evt.Action; if (!actions.ContainsKey(action)) { //log.Error(string.Format("There is no action text for \"{0}\" type of event", action)); return(string.Empty); } try { var actionText = actions[(MessageAction)evt.Action].GetActionText(); if (evt.Description == null || !evt.Description.Any()) { return(actionText); } var description = evt.Description .Select(t => t.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) .Select(split => string.Join(", ", split.Select(ToLimitedText))).ToArray(); return(string.Format(actionText, description)); } catch { //log.Error(string.Format("Error while building action text for \"{0}\" type of event", action)); return(string.Empty); } }
protected override void OnStartup(StartupEventArgs e) { //first thing to do AppDomain.CurrentDomain.UnhandledException += OnUnhandledException; //start dependency injection DependencyInjector.Init(new ApplicationModule()); //register for login event subscription = BusManager.Add((evnt) => { if (evnt is LoginEvent) { LoginEvent loginEvent = evnt as LoginEvent; if (loginEvent.isSuccess) { bounce = OnUserLogin; } } }); Exit += OnDestroy; //start file manager IFileManager fileManager = DependencyInjector.Get <IFileManager>(); if (!fileManager.IsNullOrEmpty()) { fileManager.start(); } base.OnStartup(e); }
public async void SetSboCookieContainer(WebBrowser webBrowser, int timeToWait, string userName) { //WaitSomeTime(10000); await Task.Delay(timeToWait); try { if (!webBrowser.Url.Host.Contains("www")) { if (webBrowser.Url.Query.IndexOf("loginname=") >= 0) { AccountStatus = eAccountStatus.Online; UrlHost = webBrowser.Url.Scheme + Uri.SchemeDelimiter + webBrowser.Url.Host; SboLoginName = GetLoginName(webBrowser.Url.Query.Split('&')); Host = webBrowser.Url.Host; UserName = userName; Uri hostUri = new Uri(UrlHost); CookieContainer = GetUriCookieContainer(hostUri); //System.Net.CookieContainer cookie = GetUriCookieContainer(hostUri); //CookieCollection cookieCollection = cookie.GetCookies(hostUri); //DataContainer.CookieContainer.Add(cookieCollection); } } } catch (Exception ex) { Logger.Error(ex); } finally { LoginEvent.Set(); } }
public async void SetIbetCookieContainer(WebBrowser webBrowser, int timeToWait) { //WaitSomeTime(10000); await Task.Delay(timeToWait); try { //SetCookieEvent.WaitOne(); if (!webBrowser.Url.Host.Contains("www")) { AccountStatus = eAccountStatus.Online; UrlHost = webBrowser.Url.Scheme + Uri.SchemeDelimiter + webBrowser.Url.Host; Uri hostUri = new Uri(UrlHost); Host = webBrowser.Url.Host; CookieContainer = GetUriCookieContainer(hostUri); //System.Net.CookieContainer cookie = GetUriCookieContainer(hostUri); //CookieCollection cookieCollection = cookie.GetCookies(hostUri); //DataContainer.CookieContainer.Add(cookieCollection); } } catch (Exception ex) { Logger.Error(ex); } finally { LoginEvent.Set(); if (ReLoginEvent != null) { ReLoginEvent.Set(); } //setCookieEvent.Set(); } }
private void Awake() { IP = string.Empty; if (Loading != null) { LoadingCache = Loading; } if (GetIpOnAwake) { StartCoroutine(GetIP()); // Do my coroutine here and don't forget. } _Descrip = Description; OnLogin += onLogin; //resolve it later StartCoroutine(FadeOut()); // Do my coroutine here for fading the GameObj. in the scene if (GameObject.Find(SavedUser) == null) { GameObject person = Instantiate(PlayerInfo, Vector3.zero, Quaternion.identity) as GameObject; person.name = person.name.Replace("(Clone)", ""); saveInfo = person.GetComponent <SaveInfo>(); } else { saveInfo = GameObject.Find("PlayerInfo").GetComponent <SaveInfo>(); } }
public async Task Login(LoginEvent login) { if (!await login.IsLikelyValid(_captcha)) { Response.StatusCode = 400; return; } var modulrID = await _query.UserExists(login.Email); if (modulrID == 0) { Response.StatusCode = 403; return; } var loginCookie = await _manager.Login(modulrID, login.Password); if (loginCookie == null) { Response.StatusCode = 403; return; } var user = await _query.ResolveUser(loginCookie); await this.LoginUser(user, loginCookie); }
void onLogin(GameObject target) { SetResolution(); Environment.Operation = 0; string username = NGUIText.StripSymbols(mUserName.value); string passwd = NGUIText.StripSymbols(mPasswd.value); if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(passwd)) { mMessage.text = "[ff0000]用户名或密码不可为空"; return; } Environment.SeverAddress = mServerList.value; Environment.ChatServerAddress = GameConfig.ChatServerAddress; LoginEvent e = new LoginEvent(LoginEvent.LOGIN_EVENT_LOGIN); e.TencentLogin = false; e.UserName = username; e.PassWord = passwd; EventSystem.Instance.PushEvent(e); PlayerPrefs.SetString("username", username); PlayerPrefs.SetString("passwd", passwd); PlayerPrefs.SetString("ip", Environment.SeverAddress); }
//create message to allow user to login public static async Task <Activity> LoginHandler(Activity message) { StateClient stateClient = message.GetStateClient(); BotData userData = await stateClient.BotState.GetUserDataAsync(message.ChannelId, message.From.Id); //check no login already in progress, if there is, cancel it string oldGUID = userData.GetProperty <string>("GUID"); LoginEvent loginEvent = await AzureManager.AzureManagerInstance.GetLoginEventByGUID(oldGUID); if (loginEvent != null) { await AzureManager.AzureManagerInstance.DeleteLoginEvent(loginEvent); } //setup new login event string GUID = Guid.NewGuid().ToString(); userData.SetProperty <string>("GUID", GUID); await stateClient.BotState.SetUserDataAsync(message.ChannelId, message.From.Id, userData); await StartAuth(GUID, message); //send login card Activity reply = message.CreateReply(); reply.Attachments = new List <Attachment> { LoginCard(GetFacebookLoginLink(message, GUID), "Facebook") }; return(reply); }
public LoginEventWrapper(LoginEvent loginEvent) { Id = loginEvent.Id; Date = (ApiDateTime)loginEvent.Date; User = loginEvent.UserName; Action = loginEvent.ActionText; }
public void GotUID() { LoginInfo loginInfo = new LoginInfo(); if (Application.platform == RuntimePlatform.IPhonePlayer) { loginInfo.DeviceID = IOSMgr.GetMsg(); } else { loginInfo.DeviceID = SystemInfo.deviceUniqueIdentifier; } if (Application.platform == RuntimePlatform.Android) { loginInfo.osType = 1; } else if (Application.platform == RuntimePlatform.IPhonePlayer) { loginInfo.osType = 2; } else if (Application.platform == RuntimePlatform.OSXEditor) { loginInfo.osType = 1; } mLoginEvent = new LoginEvent(new EventDelegate(this, "LoginComplete")); NetMgr.LoginGuest(loginInfo, mLoginEvent, UtilMgr.IsTestServer(), true); }
//check user in message is logged in static public async Task <bool> IsAuthorised(Activity message) { StateClient stateClient = message.GetStateClient(); BotData userData = await stateClient.BotState.GetUserDataAsync(message.ChannelId, message.From.Id); if (userData.GetProperty <bool>("Authorised") == true) { //check no-one else has logged into account (changing its currentGUID) Account account = await AzureManager.AzureManagerInstance.GetAccountByGUID(userData.GetProperty <string>("GUID")); if (account == null) { userData.SetProperty <bool>("Authorised", false); await stateClient.BotState.SetUserDataAsync(message.ChannelId, message.From.Id, userData); return(false); } return(true); } else { //check if login event has been created and confirmed LoginEvent loginEvent = await AzureManager.AzureManagerInstance.GetLoginEventByGUID(userData.GetProperty <string>("GUID")); if (loginEvent?.FacebookId != null) { await FinishLogin(message, loginEvent); return(true); } } return(false); }
public void SystemRunAfterSend(int nRet, int groupId, SGData sgData) { if (nRet == 0) { SGLoginData sgLoginDataSystemRun = (SGLoginData)sgDicRecvData.GetLoginData(groupId); sgLoginDataSystemRun.AddRunSystemEnvData(sgData); HsNetWork hs = null; if (m_DicNetWork.TryGetValue(groupId, out hs) == true) { sgDicRecvData.SetLoginData(hs, groupId, sgLoginDataSystemRun); /* * sgLoginDataSystemRun = (SGLoginData)sgDicRecvData.GetLoginData(groupId); * string strHszDefaultOption = sgLoginDataSystemRun.GetHszDefaultOption(); * int nHszOption = sgLoginDataSystemRun.GetHszDefaultDec(); * int nApproveTypeSFM = sgLoginDataSystemRun.GetApproveTypeSFM(); * string strInterLockEmail = sgLoginDataSystemRun.GetInterLockEmail(); */ hs = m_DicNetWork[groupId]; int hszOpt = sgLoginDataSystemRun.GetHszDefaultDec(); hs.SetHszDefault(hszOpt); } SendUrlList(groupId, sgLoginDataSystemRun.GetUserID()); LoginEvent LoginResult_Event = null; LoginResult_Event = sgPageEvent.GetLoginEvent(groupId); if (LoginResult_Event != null) { PageEventArgs e = new PageEventArgs(); e.result = 0; e.strMsg = ""; LoginResult_Event(groupId, e); } } }
protected void ReceiveLoginResult(PacketHeader header, Connection connection, int code) { if (LoginEvent != null) { LoginEvent.Invoke((LoginResponse)code, EventArgs.Empty); } }
public async Task <ErrorResponse> Login(LoginRequest request) { try { var response = await Client.PutAsJsonAsync("user/login", request); if (response.IsSuccessStatusCode) { var loginResponse = await response.Content.ReadAsAsync <LoginResponse>(); User = loginResponse.ToUser(); Client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", User.Token); Client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", User.Token); await LoginEvent?.Invoke(); return(null); } return(await response.Content.ReadAsAsync <ErrorResponse>()); } catch (Exception) { return(new ErrorResponse { Content = "Unable to connect to server." }); } }
static void LoginTest() { var @event = "login"; Console.WriteLine($"{nameof(LoginTest)} Start"); using (var ws = new WebSocket(URL)) { if (URL.StartsWith("wss", StringComparison.OrdinalIgnoreCase)) { ws.SslConfiguration.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult); } ws.OnMessage += (sender, e) => { BaseOutput baseOutput = JsonConvert.DeserializeObject <BaseOutput>(e.Data); if (baseOutput.Event == @event) { Console.WriteLine($"Result:{baseOutput.Result} Code:{baseOutput.ErrorCode}"); } }; LoginEvent baseEvent = new LoginEvent { Event = @event, parameters = new LoginInfo { ApiKey = ApiKey, Sign = Sign } }; var data = JsonConvert.SerializeObject(baseEvent); ws.Connect(); ws.Send(data); Console.ReadLine(); } Console.WriteLine($"{nameof(LoginTest)} End"); }
public static string GetActionText(LoginEvent evt) { var action = (MessageAction)evt.Action; if (!actions.ContainsKey(action)) { //log.Error(string.Format("There is no action text for \"{0}\" type of event", action)); return string.Empty; } try { var actionText = actions[(MessageAction)evt.Action].GetActionText(); if (evt.Description == null || !evt.Description.Any()) return actionText; var description = evt.Description .Select(t => t.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) .Select(split => string.Join(", ", split.Select(ToLimitedText))).ToList(); return string.Format(actionText, description.ToArray()); } catch { //log.Error(string.Format("Error while building action text for \"{0}\" type of event", action)); return string.Empty; } }
/// <summary> /// /// </summary> void Awake() { if (Loading != null) { LoadingCache = Loading; } if (GetIpOnAwake) { StartCoroutine(GetIP()); } if (!DetectBan) { this.GetComponent <bl_BanDetect>().enabled = false; } mDescrip = Description; OnLogin += onLogin; StartCoroutine(FadeOut()); if (GameObject.Find(bl_SaveInfo.SaveInfoName) == null) { GameObject p = Instantiate(PlayerInfo, Vector3.zero, Quaternion.identity) as GameObject; p.name = p.name.Replace("(Clone)", ""); m_SaveInfo = p.GetComponent <bl_SaveInfo>(); } else { m_SaveInfo = GameObject.Find(bl_SaveInfo.SaveInfoName).GetComponent <bl_SaveInfo>(); } }
public void GivenUser_WhenCreateLoginEvent_ThenTimeSet() { User user = new User(); LoginEvent actual = Target.CreateLoginEvent(user); Assert.IsTrue(DateTime.Now.WithinTimeSpanOf(TimeSpan.FromSeconds(1), actual.CreateTime)); }
public void Handle(LoginEvent message) { LoginWindow loginWindow = new LoginWindow(); loginWindow.Login += new EventHandler <LoginEventArgs>(this.LoginWindow_Login); loginWindow.Cancel += new EventHandler(LoginWindow_Cancel); loginWindow.ShowDialog(); }
public void GivenUser_WhenCreateLoginEvent_ThenReturnInstance() { User user = new User(); LoginEvent actual = Target.CreateLoginEvent(user); Assert.IsNotNull(actual); }
public void GivenItem_WhenRemove_ThenThrowException() { var item = new LoginEvent { Id = 1 }; Target.ExpectException <NotSupportedException>(() => Target.Remove(item)); }
public void OnBotEvent(LoginEvent ev) { Dispatcher.Invoke(() => { datacontext.Reset(); lblAccount.Content = currentSession.Translation.GetTranslation(NecroBot.Logic.Common.TranslationString.LoggingIn, ev.AuthType, ev.Username); }); }
private void MessageSorter(byte[] buffer, int start, int length, Socket clientSocket) { string content = Encoding.Default.GetString(buffer, 0, length); MessageDictionary messageD = new MessageDictionary(content); ShowMessage("从" + clientSocket.RemoteEndPoint.ToString() + "接收消息:" + content + "\n"); CommandType command = (CommandType)Enum.Parse(typeof(CommandType), messageD[MesKeyStr.CommandType]); switch (command) { case CommandType.Login: { LoginEvent?.Invoke(this, new LoginEventArgs() { UserID = messageD[MesKeyStr.UserID], PassWord = messageD[MesKeyStr.PassWord], ReceiveSocket = clientSocket }); break; } case CommandType.Logout: { LogoutEvent?.Invoke(this, new User(messageD[MesKeyStr.UserID], messageD[MesKeyStr.NickName])); break; } case CommandType.SignUp: { SignUpEvent?.Invoke(this, new SignUpEventArgs(clientSocket, messageD[MesKeyStr.NickName], messageD[MesKeyStr.PassWord])); break; } case CommandType.GroupMessage: { GroupMessageEvent?.Invoke(this, messageD); break; } case CommandType.PrivateMessage: { PrivateMessageEvent?.Invoke(this, messageD); break; } case CommandType.UserJoin: case CommandType.UserQuit: case CommandType.LoginResult: case CommandType.SignUpResult: case CommandType.ServerDisconnect: case CommandType.Remove: { ShowMessage("收到错误的消息类型!"); throw new Exception("收到错误的消息类型!"); } } }
private void OnMessage(object sender, MessageEventArgs eventArgs) { if (!eventArgs.IsText) { return; } var container = JsonConvert.DeserializeObject <Container>(eventArgs.Data); switch (container.Identifier) { case DispatchType.Login: if (((JObject)container.Payload).ToObject(typeof(LoginResponseContainer)) is LoginResponseContainer loginResponse) { var eventLog = new EventLogMessage() { IsSuccessfully = true, SenderName = _login, Text = "Login", Time = DateTime.Now, Type = DispatchType.Login }; if (loginResponse.Content.Result == ResponseType.Failure) { eventLog.IsSuccessfully = false; eventLog.Text = loginResponse.Content.Reason; } LoginEvent?.Invoke( this, new LoginEventArgs( _login, eventLog.IsSuccessfully, eventLog, loginResponse.General, loginResponse.OnlineList, loginResponse.OfflineList, loginResponse.EventLogMessageList)); } break; case DispatchType.Message: MessageReceived?.Invoke(this, MessageSorter.GetSortedMessage((JObject)container.Payload)); break; case DispatchType.Channel: UpdateChannel?.Invoke(this, MessageSorter.GetSortedChannel((JObject)container.Payload)); break; case DispatchType.EventLog: LogEvent?.Invoke(this, MessageSorter.GetSortedEventMessage((JObject)container.Payload)); break; default: throw new ArgumentOutOfRangeException(); } }
private void OnLogin(LoginEvent e) { _server.EventDispatcher.LoginEvent -= OnLogin; Console.WriteLine(e.Success + " msg " + e.Message + " obj " + e.Data.ToString()); ExtensionRequest req = new ExtensionRequest("player.move", new PsObject()); _server.Send(req); }
public void ConfirmMerge() { mMergeEvent = new LoginEvent(new EventDelegate(this, "CompleteMerge")); string pincode = mInput1.GetComponent <UIInput>().value.ToUpper(); pincode += mInput2.GetComponent <UIInput>().value.ToUpper(); pincode += mInput3.GetComponent <UIInput>().value.ToUpper(); NetMgr.MergeMembership(pincode, mMergeEvent); }
private void Controller_OnLoginStatus(LoginEvent e) { m_InLogin = false; if (e.Success) { /** Save the username **/ GlobalSettings.Default.LastUser = LoginDialog.Username; GlobalSettings.Default.Save(); /** Go to the select a sim page, make sure we do this in the UIThread **/ GameFacade.Controller.ShowPersonSelection(); } else { if (e.VersionOK) { //EventQueue is static, so shouldn't need to be locked. if (EventSink.EventQueue[0].ECode == EventCodes.BAD_USERNAME || EventSink.EventQueue[0].ECode == EventCodes.BAD_PASSWORD) { UIAlertOptions Options = new UIAlertOptions(); Options.Message = GameFacade.Strings.GetString("210", "26 110"); Options.Title = GameFacade.Strings.GetString("210", "21"); UI.Framework.UIScreen.ShowAlert(Options, true); //Doing this instead of EventQueue.Clear() ensures we won't accidentally remove any //events that may have been added to the end. EventSink.EventQueue.Remove(EventSink.EventQueue[0]); } else if (EventSink.EventQueue[0].ECode == EventCodes.AUTHENTICATION_FAILURE) { //Restart authentication procedure. NetworkFacade.Controller.InitialConnect(LoginDialog.Username.ToUpper(), LoginDialog.Password.ToUpper()); //Doing this instead of EventQueue.Clear() ensures we won't accidentally remove any //events that may have been added to the end. EventSink.EventQueue.Remove(EventSink.EventQueue[0]); } /** Reset **/ LoginProgress.ProgressCaption = GameFacade.Strings.GetString("210", "4"); LoginProgress.Progress = 0; m_InLogin = false; } else { UIAlertOptions Options = new UIAlertOptions(); Options.Message = "Your client was not up to date!"; Options.Title = "Invalid version"; UI.Framework.UIScreen.ShowAlert(Options, true); /** Reset **/ LoginProgress.ProgressCaption = GameFacade.Strings.GetString("210", "4"); LoginProgress.Progress = 0; m_InLogin = false; } } }
public void doGrab() { if (!MainData.instance.user.login()) { LoginEvent.tryToLogin(); return; } ConfirmUtil.confirm("确定抢单?", confirmGrab); }
/// <summary> /// /// </summary> void Awake() { mDescrip = Description; OnLogin += onLogin; StartCoroutine(FadeOut()); if (GameObject.Find("PlayerInfo") == null) { GameObject p = Instantiate(PlayerInfo, Vector3.zero, Quaternion.identity) as GameObject; p.name = p.name.Replace("(Clone)", ""); } }
/// <summary> /// /// </summary> void Awake() { if (Loading != null) { LoadingCache = Loading; } if (GetIpOnAwake) { StartCoroutine(GetIP()); } if (!DetectBan) { this.GetComponent<bl_BanDetect>().enabled = false;} mDescrip = Description; OnLogin += onLogin; StartCoroutine(FadeOut()); if (GameObject.Find(bl_SaveInfo.SaveInfoName) == null) { GameObject p = Instantiate(PlayerInfo, Vector3.zero, Quaternion.identity) as GameObject; p.name = p.name.Replace("(Clone)", ""); m_SaveInfo = p.GetComponent<bl_SaveInfo>(); } else { m_SaveInfo = GameObject.Find(bl_SaveInfo.SaveInfoName).GetComponent<bl_SaveInfo>(); } }
private static LoginEvent ToLoginEvent(object[] row) { try { var evt = new LoginEvent { Id = Convert.ToInt32(row[0]), IP = Convert.ToString(row[1]), Login = Convert.ToString(row[2]), Browser = Convert.ToString(row[3]), Mobile = Convert.ToBoolean(row[4]), Platform = Convert.ToString(row[5]), Date = TenantUtil.DateTimeFromUtc(Convert.ToDateTime(row[6])), TenantId = Convert.ToInt32(row[7]), UserId = Guid.Parse(Convert.ToString(row[8])), Page = Convert.ToString(row[9]), Action = Convert.ToInt32(row[10]) }; if (row[11] != null) { evt.Description = JsonConvert.DeserializeObject<IList<string>>(Convert.ToString(row[11]), new JsonSerializerSettings { DateTimeZoneHandling = DateTimeZoneHandling.Utc }); } evt.UserName = (row[12] != null && row[13] != null) ? UserFormatter.GetUserName(Convert.ToString(row[12]), Convert.ToString(row[13])) : evt.Login ?? AuditReportResource.UnknownAccount; evt.ActionText = AuditActionMapper.GetActionText(evt); return evt; } catch(Exception) { //log.Error("Error while forming event from db: " + ex); return null; } }
// got a response for trying to log in private void OnLogin(LoginEvent e) { _server.EventDispatcher.LoginEvent -= OnLogin; // if able to login start listening for regular responses if (e.Success) _server.EventDispatcher.ExtensionEvent += OnResponse; // just pass the info through if (LoginEvent != null) LoginEvent(new Dictionary<string, object>() { { "success", e.Success }, { "message", e.Message }, { "data", e.Data } }); }
/// <summary> /// /// </summary> void OnDisable() { OnLogin -= onLogin; }
public static string GetActionText(LoginEvent evt) { var action = (MessageAction)evt.Action; if (!actions.ContainsKey(action)) throw new ArgumentException(string.Format("There is no action text for \"{0}\" type of event", action)); var text = actions[(MessageAction)evt.Action].ActionText; return evt.Ids == null || !evt.Ids.Any() ? text : string.Format(text, evt.Ids.Select(GetLimitedText).ToArray()); }
private static void OnSCPlayerInfoHandler(LoginEvent e) { Logger.LogWarning("OnSCPlayerInfoHandler get called back, with event-" + e.Message); if (ServiceManager.IsDebugAccount == 1) { ServiceManager.SetDebugAccount(ServiceManager.DebugUserName, ServiceManager.DebugPassword); } }