Пример #1
0
        private static ProvisioningHandler[] GetProvisioningHandlersImpl(Task task)
        {
            if (ProvisioningLayer.Disabled)
            {
                return(null);
            }
            ProvisioningBroker provisioningBroker = ExchangePropertyContainer.GetProvisioningBroker(task.SessionState);

            if (provisioningBroker.InitializationException != null && !task.CurrentTaskContext.InvocationInfo.CommandName.StartsWith("Get-"))
            {
                string commandName;
                if ((commandName = task.CurrentTaskContext.InvocationInfo.CommandName) == null || (!(commandName == "Set-CmdletExtensionAgent") && !(commandName == "Remove-CmdletExtensionAgent") && !(commandName == "Disable-CmdletExtensionAgent")))
                {
                    ProvisioningBrokerException ex = new ProvisioningBrokerException(Strings.ProvisioningBrokerInitializationFailed(provisioningBroker.InitializationException.Message), provisioningBroker.InitializationException);
                    TaskLogger.LogError(ex);
                    throw ex;
                }
                task.WriteWarning(provisioningBroker.InitializationException.Message);
            }
            return(provisioningBroker.GetProvisioningHandlers(task));
        }
Пример #2
0
        // Token: 0x060011B3 RID: 4531 RVA: 0x000360F8 File Offset: 0x000342F8
        private void BuildHandlerLookupTable(CmdletExtensionAgent[] enabledAgents, out Exception ex)
        {
            ex = null;
            CmdletExtensionAgent cmdletExtensionAgent = null;

            try
            {
                for (int i = 0; i < enabledAgents.Length; i++)
                {
                    if (cmdletExtensionAgent != null && cmdletExtensionAgent.Priority == enabledAgents[i].Priority)
                    {
                        throw new ArgumentException(Strings.ClashingPriorities(cmdletExtensionAgent.Priority.ToString(), enabledAgents[i].Name, cmdletExtensionAgent.Name));
                    }
                    cmdletExtensionAgent = enabledAgents[i];
                    IProvisioningAgent classFactoryInstance = ProvisioningBroker.GetClassFactoryInstance(enabledAgents[i].Assembly, enabledAgents[i].ClassFactory, out ex);
                    if (ex != null)
                    {
                        break;
                    }
                    this.agentNameLookupTable.Add(classFactoryInstance, enabledAgents[i].Name);
                    IEnumerable <string> supportedCmdlets = classFactoryInstance.GetSupportedCmdlets();
                    foreach (string key in supportedCmdlets)
                    {
                        List <ProvisioningBroker.ClassFactoryBucket> list;
                        if (!this.lookupTable.TryGetValue(key, out list))
                        {
                            list = new List <ProvisioningBroker.ClassFactoryBucket>();
                            this.lookupTable.Add(key, list);
                        }
                        list.Add(new ProvisioningBroker.ClassFactoryBucket(classFactoryInstance, enabledAgents[i].Name, enabledAgents[i].Priority));
                    }
                }
            }
            catch (ConfigurationErrorsException ex2)
            {
                ex = ex2;
            }
            catch (ProvisioningException ex3)
            {
                ex = ex3;
            }
            catch (FileNotFoundException ex4)
            {
                ex = ex4;
            }
            catch (FileLoadException ex5)
            {
                ex = ex5;
            }
            catch (BadImageFormatException ex6)
            {
                ex = ex6;
            }
            catch (SecurityException ex7)
            {
                ex = ex7;
            }
            catch (UnauthorizedAccessException ex8)
            {
                ex = ex8;
            }
            catch (ArgumentException ex9)
            {
                ex = ex9;
            }
            catch (IOException ex10)
            {
                ex = ex10;
            }
            catch (MissingMethodException ex11)
            {
                ex = ex11;
            }
            catch (AmbiguousMatchException ex12)
            {
                ex = ex12;
            }
            catch (ReflectionTypeLoadException ex13)
            {
                ex = ex13;
            }
        }