Ejemplo n.º 1
0
        internal static PsRequest New(Object requestObject, PowerShellProviderBase provider, string methodName)
        {
            if (requestObject is IAsyncAction)
            {
                ((IAsyncAction)(requestObject)).OnCancel += provider.CancelRequest;
                ((IAsyncAction)(requestObject)).OnAbort  += provider.CancelRequest;
            }
            var req = requestObject.As <PsRequest>();

            req.CommandInfo = provider.GetMethod(methodName);
            if (req.CommandInfo == null)
            {
                req.Debug("METHOD_NOT_IMPLEMENTED", methodName);
            }
            req._provider = provider;

            if (req.Options == null)
            {
                req.Debug("req.Options is null");
            }
            else
            {
                req.Debug("Calling New() : MethodName = '{0}'", methodName);

                foreach (string key in req.Options.Keys)
                {
                    req.Debug(String.Format(CultureInfo.CurrentCulture, "{0}: {1}", key, req.Options[key]));
                }
            }

            return(req);
        }
Ejemplo n.º 2
0
        internal static PsRequest New(Object requestObject, PowerShellProviderBase provider, string methodName) {
            if (requestObject is IAsyncAction) {
                ((IAsyncAction)(requestObject)).OnCancel += provider.CancelRequest;
                ((IAsyncAction)(requestObject)).OnAbort += provider.CancelRequest;
            }
            var req = requestObject.As<PsRequest>();

            req.CommandInfo = provider.GetMethod(methodName);
            if (req.CommandInfo == null) {
                req.Debug("METHOD_NOT_IMPLEMENTED", methodName);
            }
            req._provider = provider;

            if (req.Options == null) {
                req.Debug("req.Options is null");
                
            } else {

                req.Debug("Calling New() : MethodName = '{0}'", methodName);

                foreach(string key in req.Options.Keys)
                {
                    req.Debug(String.Format(CultureInfo.CurrentCulture, "{0}: {1}", key, req.Options[key]));                   
                }
            }
                      
            return req;
        }