Exemplo n.º 1
0
 private void InvokeDisposeCallback()
 {
     if (this._cmdletDisposeEvent != null)
     {
         this._cmdletDisposeEvent();
         this._cmdletDisposeEvent = null;
     }
 }
Exemplo n.º 2
0
 protected void RegisterDisposeCallback(ADCmdletBase <P> .CmdletDispose disposeDelegate)
 {
     if (this._cmdletDisposeEvent != null)
     {
         ADCmdletBase <P> aDCmdletBase = this;
         aDCmdletBase._cmdletDisposeEvent += disposeDelegate;
         return;
     }
     else
     {
         this._cmdletDisposeEvent = disposeDelegate;
         return;
     }
 }
Exemplo n.º 3
0
        public static ADSessionInfo ConstructSessionFromIdentity <P, T>(ADCmdletBase <P> cmdletInstance, ADSessionInfo baseSessionInfo, bool ignoreNonDomainIdentity)
            where P : ADParameterSet, new()
            where T : ADEntity, new()
        {
            string str = null;
            string str1;
            string item = cmdletInstance._cmdletParameters["Server"] as string;
            object obj  = cmdletInstance._cmdletParameters["Identity"];

            if (item != null || obj == null)
            {
                return(baseSessionInfo);
            }
            else
            {
                if (((ADEntity)obj).Identity == null)
                {
                    str1 = null;
                }
                else
                {
                    str1 = ((ADEntity)obj).Identity.ToString();
                }
                string str2 = str1;
                string str3 = ADDomainUtil.DiscoverDCFromIdentity <T>(obj, out str);
                if (str3 != null)
                {
                    ADSessionInfo aDSessionInfo = baseSessionInfo.Copy();
                    aDSessionInfo.Server = str;
                    return(aDSessionInfo);
                }
                else
                {
                    if (!ignoreNonDomainIdentity)
                    {
                        ArgumentException argumentException = new ArgumentException();
                        argumentException.Data.Add("IdentityData", str2);
                        throw argumentException;
                    }
                    else
                    {
                        return(baseSessionInfo);
                    }
                }
            }
        }
Exemplo n.º 4
0
        public ADCmdletBase()
        {
            this._cmdletParameters       = Activator.CreateInstance <P>();
            this._connectedStore         = null;
            this._recordExceptionHandler = new ADRecordExceptionHandler();
            this._beginProcessPipeline   = new CmdletSubroutinePipeline();
            this._processRecordPipeline  = new CmdletSubroutinePipeline();
            this._endProcessPipeline     = new CmdletSubroutinePipeline();
            ADExceptionFilter aDExceptionFilter = new ADExceptionFilter();

            aDExceptionFilter.Add(this._recordExceptionHandler);
            aDExceptionFilter.Add(new ADPipelineExceptionHandler(this));
            aDExceptionFilter.Add(new ADSystemExceptionHandler());
            this._exceptionFilter = aDExceptionFilter;
            ADCmdletBase <P> aDCmdletBase = this;

            this.RegisterDisposeCallback(new ADCmdletBase <P> .CmdletDispose(aDCmdletBase.Dispose));
            this._cmdletSessionCache = new ADCmdletCache();
            this._warningBuffer      = new List <string>();
            this._errorBuffer        = new List <ErrorRecord>();
        }
Exemplo n.º 5
0
 public ExternalDelegates(ADCmdletBase <P> cmdletInstance)
 {
     this._cmdletInstance = cmdletInstance;
 }