/// <summary>
        ///
        /// </summary>
        /// <param name="func"></param>
        /// <param name="p"></param>
        /// <param name="s"></param>
        protected override void CommandWrapper(ICommandFunc func, CommunicateProtocol p, SocketState s)
        {
            try
            {
                func.profile = this.GetProfile(Settings.Default);
                SocketState state = func.Execute(p, s, listener);

                if (this.window != null)
                {
                    this.window.MessageCallBackMethod(state.OutPutMsg, null);
                }
            }
            catch (Exception Ex)
            {
                Logger.Write(LogType.Error, Ex.Message, Ex);

                if (this.window != null)
                {
                    this.window.MessageCallBackMethod(Ex.ToString(), null);
                }
            }
            finally
            {
                listener.ContinueAsyncReceive(s);
                GC.WaitForFullGCComplete();
                GC.Collect();
            }
        }
Exemple #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="func"></param>
        /// <param name="p"></param>
        /// <param name="s"></param>
        protected override void CommandWrapper(ICommandFunc func, CommunicateProtocol p, SocketState s)
        {
            try
            {
                func.profile = this.GetProfile(Settings.Default);
                SocketState state = func.Execute(p, s, client);

                OnSocketEventRaised(this, new EventArgCollection.SocketEventArgs()
                {
                    Msg = state.OutPutMsg
                });
            }
            catch (Exception Ex)
            {
                OnErrorRaised(this, new EventArgCollection.SocketErrorEventArgs()
                {
                    Exp = Ex
                });
            }
            finally
            {
                client.ContinueAsyncReceive(s);
                GC.WaitForFullGCComplete();
                GC.Collect();
            }
        }
 public TResult Execute <TResult>(ICommandFunc <TResult> command, CommandAction commandAction)
 {
     try
     {
         Logger.WriteLine($"Executing Command: {command?.GetType().FullName}");
         return(command.Execute(commandAction));
     }
     catch (TestExecutionException ex)
     {
         if (!HandleException(ex))
         {
             throw;
         }
         else
         {
             return(default);
 public TResult Execute <TResult>(ICommandFunc <TResult> command)
 {
     return(Execute(command, DefaultCommandAction));
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="func"></param>
 /// <param name="p"></param>
 /// <param name="s"></param>
 protected abstract void CommandWrapper(ICommandFunc func, CommunicateProtocol p, SocketState s);