public override void OnCommandExecuting(CommandExecutingContext commandContext) { var session = commandContext.Session as MyAppSession; //If the session is not logged in, cancel the executing of the command if (!session.IsLoggedIn) commandContext.Cancel = true; }
public override void OnCommandExecuted(CommandExecutingContext commandContext) { var session = commandContext.Session; var startTime = session.Items.GetValue<DateTime>("StartTime"); var ts = DateTime.Now.Subtract(startTime); if (ts.TotalSeconds > 5 && session.Logger.IsInfoEnabled) { session.Logger.InfoFormat("A command '{0}' took {1} seconds!", commandContext.CurrentCommand.Name, ts.ToString()); } }
public override void OnCommandExecuting(CommandExecutingContext commandContext) { if (commandContext.Session is DeploySession) { var session = (commandContext.Session as DeploySession); if (!session.IsAdministrator) { ConsoleLogger.ErrorFormat("{0} session {1} not permission", DateTime.Now, session.SessionID); session.Send(CommandCodes.TRANSFERFILE_RESULT, Encoding.UTF8.GetBytes("permission deny")); } } }
public override void OnCommandExecuting(CommandExecutingContext commandContext) { if (commandContext.Session is DeploySession) { var session = (commandContext.Session as DeploySession); if (!session.Logged) { ConsoleLogger.ErrorFormat("{0} session {1} not authentication", DateTime.Now, session.SessionID); session.Close(SuperSocket.SocketBase.CloseReason.ServerClosing); } } }
/// <summary> /// 执行命令前调用 /// </summary> /// <param name="commandContext"></param> public override void OnCommandExecuted(CommandExecutingContext commandContext) { WeChatSession session = commandContext.Session as WeChatSession; if (session != null && !session.isLogin) { //判断当前命令是否为LOGIN if (!commandContext.RequestInfo.Key.Equals("CHECK")) { session.Send("not authorization"); //取消执行当前命令 commandContext.Cancel = true; } } }
public override void OnCommandExecuting(CommandExecutingContext commandContext) { commandContext.Session.Items["StartTime"] = DateTime.Now; }
/// <summary> /// Called when [command executed]. /// </summary> /// <param name="commandContext">The command context.</param> public abstract void OnCommandExecuted(CommandExecutingContext commandContext);
public override void OnCommandExecuting(CommandExecutingContext commandContext) { Interlocked.Increment(ref m_ExecutingCount); }
public override void OnCommandExecuted(CommandExecutingContext commandContext) { }
public override void OnCommandExecuted(CommandExecutingContext commandContext) { Interlocked.Increment(ref m_Total); }
/// <summary> /// 命令结束后调用 /// </summary> /// <param name="commandContext"></param> public override void OnCommandExecuting(CommandExecutingContext commandContext) { //throw new NotImplementedException(); }