예제 #1
0
        /// <summary>
        /// Execute void method.
        /// </summary>
        internal void ExecuteVoidMethod(PSHost clientHost)
        {
            // The clientHost can be null if the user creates a runspace object without providing
            // a host parameter.
            if (clientHost == null)
            {
                return;
            }

            RemoteRunspace remoteRunspaceToClose = null;

            if (this.IsSetShouldExitOrPopRunspace)
            {
                remoteRunspaceToClose = GetRemoteRunspaceToClose(clientHost);
            }

            try
            {
                object targetObject = this.SelectTargetObject(clientHost);
                MyMethodBase.Invoke(targetObject, Parameters);
            }
            finally
            {
                if (remoteRunspaceToClose != null)
                {
                    remoteRunspaceToClose.Close();
                }
            }
        }
예제 #2
0
        public static void LogsFailAndThrow(MyMethodBase method, string note)
        {
            Logs(Log.StatusX.Fail, method.Name, note);

            throw new Exception(note);
        }
예제 #3
0
    public static void LogsFailAndThrow(MyMethodBase method, string note)
    {
        Logs(Log.StatusX.Fail, method.Name, note);

        throw new Exception(note);
    }