Exemplo n.º 1
0
        public CodeProviderCore(CodeProviderArguments args)
        {
            Automation    = args.Automation;
            TargetProcess = args.TargetProcess;

            RootElement = FindTargetApplicationRoot(args.TargetProcess.Id);

            // Initialize TreeWalker
            TreeWalker = Automation.TreeWalkerFactory.GetControlViewWalker();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets a provider by its name
        /// </summary>
        /// <param name="providerName">The name of the provider to find.</param>
        /// <returns></returns>
        public ICodeProvider CreateProvider(string providerName, CodeProviderArguments args)
        {
            Type providerType = null;

            if (_providers.TryGetValue(providerName, out providerType))
            {
                return((ICodeProvider)Activator.CreateInstance(providerType, args));
            }
            else
            {
                throw new ArgumentException($"Provider '{providerName}' not found.");
            }
        }