Пример #1
0
        private void PreRegisterPlugin(IPluginModule module)
        {
            var assembly = module.GetType().Assembly;

            MvvmService.D.Register(assembly);

            var types = assembly.GetTypes();

            foreach (var type in types)
            {
                foreach (var m in type.GetMethods())
                {
                    if (m.GetCustomAttribute <OnRegisterPlugin>() != null)
                    {
                        if (m.IsStatic)
                        {
                            //m.Invoke(null,null);
                            var action = (Action)Delegate.CreateDelegate(typeof(Action), m);
                            action();
                        }
                        else
                        {
                            throw new InvalidOperationException("OnRegisterPlugin should be static");
                        }
                    }
                }
            }
        }
Пример #2
0
        public ModuleDescriptor(Type type, IPluginModule instance)
        {
            Type     = type;
            Instance = instance;

            _dependencies = new List <IModuleDescriptor>();
        }
Пример #3
0
        public void Add([NotNull] IPluginModule module)
        {
            if (module == null)
            {
                throw new ArgumentNullException(nameof(module));
            }

            this._loadedPlugins.Add(module);
        }
Пример #4
0
        /// <summary>
        /// Event captured to remove all panels created by the module.
        /// </summary>
        void PluginModule_FormClosing(object sender, FormClosingEventArgs e)
        {
            IPluginModule module = sender as IPluginModule;

            if (module != null)
            {
                module.DestoryPanels();
            }
        }
Пример #5
0
        private static IEnumerable <PropertyInfo> GetKnownTypeProperties(IPluginModule module)
        {
            const BindingFlags bindings = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;

            return(module.GetType().GetProperties(bindings)
                   .Where(p =>
                          p.PropertyType.IsClosedGenericTypeOf(typeof(IEnumerable <>), typeof(IKnownPluginType)) &&
                          p.CanWrite));
        }
Пример #6
0
        private void LoadPlugin(IPluginModuleDescriptor plugin)
        {
            IPluginModule module = StudioContext.PluginManager.GetPluginModule(plugin.ID);

            if (module != null)
            {
                this.LoadPlugin(module, null);
            }
        }
Пример #7
0
        private static PropertyInfo[] GetDependentServiceProperties(IPluginModule module)
        {
            const BindingFlags bindings = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;

            return(module.GetType().GetProperties(bindings)
                   .Where(p =>
                          p.PropertyType.IsDerivedFrom(typeof(IPluginModuleService)) &&
                          p.CanWrite)
                   .ToArray());
        }
Пример #8
0
        // Automatically populates all properties on a plug-in module that are an enumeration of
        // a derived IPluginKnownType.  The plug-in known types specific by the module are returned
        // for use by the consumer.
        public IEnumerable <Type> SetPluginModuleKnownTypes(IPluginModule forModule, IEnumerable <PluginType> fromPluginTypes)
        {
            Check.NotNull(forModule, nameof(forModule), "module to discover known types not specified");
            Check.NotNull(fromPluginTypes, nameof(fromPluginTypes), "list of plug-in types not specified");

            IEnumerable <PropertyInfo> knownTypeProps = GetKnownTypeProperties(forModule);

            knownTypeProps.ForEach(ktp => SetKnownPropertyInstances(forModule, ktp, fromPluginTypes));
            return(knownTypeProps.Select(ktp => ktp.PropertyType.GenericTypeArguments.First()));
        }
Пример #9
0
 private void LogModuleDependencies(IPluginModule module, IEnumerable <PropertyInfo> moduleProps)
 {
     foreach (PropertyInfo moduleProp in moduleProps)
     {
         BootstrapLogger.Add(LogLevel.Trace,
                             "Module: {moduleName} Property: {propName}:  References Module: {refModuleName}",
                             module.GetType().FullName,
                             moduleProp.Name,
                             moduleProp.PropertyType.FullName);
     }
 }
Пример #10
0
        public void OpenPluginModule(string moduleID, params object[] args)
        {
            Logger.LogDebug(this, "[CLASS].OpenPluginModule('{0}', {1})", moduleID, args);

            IPluginModule module = StudioContext.PluginManager.GetPluginModule(moduleID);

            if (module != null)
            {
                this.LoadPlugin(module, args);
            }
        }
Пример #11
0
 public void RegisterChecker(Check check)
 {
     foreach (Type type in _pluginManager.ModulesLoaded)
     {
         if (check.ModuleName == type.Name)
         {
             var           x            = type.GetConstructors();
             IPluginModule pluginModule = (IPluginModule)Activator.CreateInstance(type, new ModuleConfiguration(check.ModuleConfiguration), _loggerfactory.CreateLogger(check.ModuleName));
             Checker       checker      = new Checker(pluginModule);
             _logger.LogInformation(pluginModule.Run().ToString());
         }
     }
 }
Пример #12
0
        private static void ValidateModule(IPluginModule pluginModule)
        {
            if (pluginModule == null)
            {
                throw new ArgumentNullException(nameof(pluginModule));
            }

            if (string.IsNullOrWhiteSpace(pluginModule.PluginId))
            {
                throw new ArgumentNullException(pluginModule.PluginId);
            }

            if (string.IsNullOrWhiteSpace(pluginModule.PluginType))
            {
                throw new ArgumentNullException(pluginModule.PluginType);
            }
        }
Пример #13
0
        private void SetKnownPropertyInstances(IPluginModule forModule, PropertyInfo KnownTypeProperty,
                                               IEnumerable <PluginType> fromPluginTypes)
        {
            var knownType           = KnownTypeProperty.PropertyType.GetGenericArguments().First();
            var discoveredInstances = fromPluginTypes.CreateInstancesDerivingFrom(knownType).ToList();

            // Create an array based on the known type and populate it from discovered instances.
            Array array = Array.CreateInstance(knownType, discoveredInstances.Count());

            for (var i = 0; i < discoveredInstances.Count(); i++)
            {
                array.SetValue(discoveredInstances.ElementAt(i), i);
            }

            // Set the corresponding property on the module.
            KnownTypeProperty.SetValue(forModule, array);
        }
Пример #14
0
        private void LoadPlugin(IPluginModule module, params object[] args)
        {
            Logger.LogDebug(this, "[CLASS].LoadPlugin([{0}], [args:{1}])", module, args);

            try
            {
                if (module is Form form)
                {
                    // Show the main form of the plugin module
                    form.MdiParent = this.ParentForm;
                    form.Tag       = module;
                    form.Show();

                    // Select the default ribbon page for the plugin module
                    if (module.StartupRibbonPage != null && module.StartupRibbonPage is RibbonPage)
                    {
                        this.RibbonControl.SelectedPage = module.StartupRibbonPage as RibbonPage;
                    }

                    // Initialize the module
                    module.Initialize(args);

                    // Merge status bar (not merged by default)
                    if (module.RibbonStatusBar != null)
                    {
                        this.RibbonControl.StatusBar.MergeStatusBar((RibbonStatusBar)module.RibbonStatusBar);
                    }
                }
                else
                {
                    MessageBox.Show("ERROR loading plugin module:" +
                                    Environment.NewLine + Environment.NewLine +
                                    "The specified class " + module.GetType().Name + " is not a plugin module implementation.",
                                    Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                Logger.LogError(this, ex);

                MessageBox.Show("ERROR loading plugin module:" +
                                Environment.NewLine + Environment.NewLine +
                                ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #15
0
        public static void RegisterIcons(this IPluginModule module)
        {
            var assembly = module.GetType().Assembly;
            var rm       = new ResourceManager(assembly.GetName().Name + ".g", assembly);

            try
            {
                var dict = new ResourceDictionary();
                var list = rm.GetResourceSet(CultureInfo.CurrentCulture, true, true);
                foreach (DictionaryEntry item in list)
                {
                    var s = item.Key.ToString();
                    if (!s.StartsWith("icons/"))
                    {
                        continue;
                    }

                    var uri = new Uri("/" + assembly.GetName().Name + ";component/" + s.Replace(".baml", ".xaml"), UriKind.RelativeOrAbsolute);
                    var obj = Application.LoadComponent(uri);

                    var key = s.Replace("icons/", "").Replace(".baml", "");

                    if (obj.GetType() == typeof(ResourceDictionary))
                    {
                        Application.Current.Resources.MergedDictionaries.Add(obj as ResourceDictionary);
                    }
                    else
                    {
                        dict.Add(key, obj);
                    }
                }
                Application.Current.Resources.MergedDictionaries.Add(dict);
            }
            finally
            {
                rm.ReleaseAllResources();
            }
        }
Пример #16
0
        public void RegisterPlugin(IPluginModule pluginModule)
        {
            ValidateModule(pluginModule);

            _modules[pluginModule.PluginType] = pluginModule;
        }
 public override void Initialize(ApplicationInitializationContext context, IPluginModule module)
 {
     (module as IOnApplicationInitialization)?.OnApplicationInitialization(context);
 }
 public override void Shutdown(ApplicationShutdownContext context, IPluginModule module)
 {
     (module as IOnApplicationShutdown)?.OnApplicationShutdown(context);
 }
Пример #19
0
 public virtual void Shutdown(ApplicationShutdownContext context, IPluginModule module)
 {
 }
Пример #20
0
        private static void Initialize()
        {
            using (ProfilingUtility.SampleBlock("Plugin Container Initialization"))
            {
                if (initialized || initializing)
                {
                    Debug.LogWarning("Attempting to re-initialize plugin container, ignoring.\n");
                    return;
                }

                if (!isAssetDatabaseReliable)
                {
                    Debug.LogWarning("Initializing plugin container while asset database is not initialized.\nLoading assets might fail!");
                }

                initializing = true;

                pluginTypesById = Codebase.GetTypeRegistrations <RegisterPluginAttribute>()
                                  .ToDictionary(r => r.id, r => r.type);

                pluginDependencies = new Dictionary <string, HashSet <string> >();

                foreach (var pluginId in pluginTypesById.Keys)
                {
                    pluginDependencies.Add(pluginId, new HashSet <string>());
                }

                foreach (var pluginDependencyRegistration in Codebase.GetAssemblyAttributes <RegisterPluginDependencyAttribute>())
                {
                    if (!pluginDependencies.TryGetValue(pluginDependencyRegistration.dependerId, out var dependencies))
                    {
                        dependencies = new HashSet <string>();
                        pluginDependencies.Add(pluginDependencyRegistration.dependerId, dependencies);
                    }

                    dependencies.Add(pluginDependencyRegistration.dependencyId);
                }

                var moduleTypeRegistrations = Codebase.GetTypeRegistrations <RegisterPluginModuleTypeAttribute>();

                pluginsById = new Dictionary <string, Plugin>();

                var allModules = new List <IPluginModule>();

                foreach (var pluginId in pluginTypesById.Keys.OrderByDependencies(pluginId => pluginDependencies[pluginId]))
                {
                    var pluginType = pluginTypesById[pluginId];

                    Plugin plugin;

                    try
                    {
                        using (ProfilingUtility.SampleBlock($"{pluginType.Name} (Instantiation)"))
                        {
                            plugin = (Plugin)pluginType.Instantiate();
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new TargetInvocationException($"Could not instantiate plugin '{pluginId}' ('{pluginType}').", ex);
                    }

                    var modules = new List <IPluginModule>();

                    foreach (var moduleTypeRegistration in moduleTypeRegistrations)
                    {
                        var moduleType = moduleTypeRegistration.type;
                        var required   = moduleTypeRegistration.required;

                        try
                        {
                            var moduleProperty = pluginType.GetProperties().FirstOrDefault(p => p.PropertyType.IsAssignableFrom(moduleType));

                            if (moduleProperty == null)
                            {
                                continue;
                            }

                            IPluginModule module = null;

                            var moduleOverrideType = Codebase.GetTypeRegistrations <MapToPluginAttribute>()
                                                     .FirstOrDefault(r => r.pluginId == pluginId &&
                                                                     moduleType.IsAssignableFrom(r.type) &&
                                                                     r.type.IsConcrete())?.type;

                            if (moduleOverrideType != null)
                            {
                                try
                                {
                                    using (ProfilingUtility.SampleBlock($"{moduleOverrideType.Name} (Instantiation)"))
                                    {
                                        module = (IPluginModule)InstantiateMappedType(moduleOverrideType, plugin);
                                    }
                                }
                                catch (Exception ex)
                                {
                                    throw new TargetInvocationException($"Failed to instantiate user-defined plugin module '{moduleOverrideType}' for '{pluginId}'.", ex);
                                }
                            }
                            else if (moduleType.IsConcrete())
                            {
                                try
                                {
                                    using (ProfilingUtility.SampleBlock($"{moduleType.Name} (Instantiation)"))
                                    {
                                        module = (IPluginModule)InstantiateMappedType(moduleType, plugin);
                                    }
                                }
                                catch (Exception ex)
                                {
                                    throw new TargetInvocationException($"Failed to instantiate built-in plugin module '{moduleType}' for '{pluginId}'.", ex);
                                }
                            }
                            else if (required)
                            {
                                throw new InvalidImplementationException($"Missing implementation of plugin module '{moduleType}' for '{pluginId}'.");
                            }

                            if (module != null)
                            {
                                moduleProperty.SetValue(plugin, module, null);

                                modules.Add(module);
                                allModules.Add(module);
                            }
                        }
                        catch (Exception ex)
                        {
                            Debug.LogException(ex);
                        }
                    }

                    pluginsById.Add(plugin.id, plugin);

                    foreach (var module in modules)
                    {
                        try
                        {
                            using (ProfilingUtility.SampleBlock($"{module.GetType().Name} (Initialization)"))
                            {
                                module.Initialize();
                            }
                        }
                        catch (Exception ex)
                        {
                            Debug.LogException(new Exception($"Failed to initialize plugin module '{plugin.id}.{module.GetType()}'.", ex));
                        }
                    }

                    if (plugin.manifest.versionMismatch)
                    {
                        anyVersionMismatch = true;
                    }
                }

                initializing = false;

                initialized = true;

                using (ProfilingUtility.SampleBlock($"Product Container Initialization"))
                {
                    ProductContainer.Initialize();
                }

                foreach (var module in allModules)
                {
                    try
                    {
                        using (ProfilingUtility.SampleBlock($"{module.GetType().Name} (Late Initialization)"))
                        {
                            module.LateInitialize();
                        }
                    }
                    catch (Exception ex)
                    {
                        Debug.LogException(new Exception($"Failed to late initialize plugin module '{module.plugin.id}.{module.GetType()}'.", ex));
                    }
                }

                var afterPluginTypes = Codebase.GetRegisteredTypes <InitializeAfterPluginsAttribute>();

                using (ProfilingUtility.SampleBlock($"BeforeInitializeAfterPlugins"))
                {
                    EditorApplicationUtility.BeforeInitializeAfterPlugins();
                }

                foreach (var afterPluginType in afterPluginTypes)
                {
                    using (ProfilingUtility.SampleBlock($"{afterPluginType.Name} (Static Initializer)"))
                    {
                        RuntimeHelpers.RunClassConstructor(afterPluginType.TypeHandle);
                    }
                }

                using (ProfilingUtility.SampleBlock($"AfterInitializeAfterPlugins"))
                {
                    EditorApplicationUtility.AfterInitializeAfterPlugins();
                }

                using (ProfilingUtility.SampleBlock($"Launch Setup Wizards"))
                {
                    // Automatically show setup wizards

                    if (!EditorApplication.isPlayingOrWillChangePlaymode)
                    {
                        var productsRequiringSetup    = ProductContainer.products.Where(product => product.requiresSetup).ToHashSet();
                        var productsHandlingAllSetups = productsRequiringSetup.ToHashSet();

                        // Do not show product setups if another product already
                        // includes all the same plugins or more. For example,
                        // if both Bolt and Ludiq require setup, but Bolt requires
                        // all of the Ludiq plugins, then only the Bolt setup wizard
                        // should be shown.
                        foreach (var product in productsRequiringSetup)
                        {
                            foreach (var otherProduct in productsRequiringSetup)
                            {
                                if (product == otherProduct)
                                {
                                    continue;
                                }

                                var productPlugins      = product.plugins.ResolveDependencies().ToHashSet();
                                var otherProductPlugins = otherProduct.plugins.ResolveDependencies().ToHashSet();

                                if (productPlugins.IsSubsetOf(otherProductPlugins))
                                {
                                    productsHandlingAllSetups.Remove(product);
                                }
                            }
                        }

                        foreach (var product in productsHandlingAllSetups)
                        {
                            // Delay call is used here to avoid showing multiple wizards during an import
                            EditorApplication.delayCall += () => SetupWizard.Show(product);
                        }
                    }
                }

                using (ProfilingUtility.SampleBlock($"Launch Update Wizard"))
                {
                    // Automatically show update wizard

                    if (!EditorApplication.isPlayingOrWillChangePlaymode && plugins.Any(plugin => plugin.manifest.versionMismatch))
                    {
                        // Delay call seems to be needed here to avoid arcane exceptions...
                        // Too lazy to debug why, it works that way.
                        EditorApplication.delayCall += UpdateWizard.Show;
                    }
                }

                using (ProfilingUtility.SampleBlock($"Delayed Calls"))
                {
                    lock (delayQueue)
                    {
                        while (delayQueue.Count > 0)
                        {
                            delayQueue.Dequeue().Invoke();
                        }
                    }
                }

                InternalEditorUtility.RepaintAllViews();

                ProfilingUtility.Clear();
                //ConsoleProfiler.Dump();
            }
        }
Пример #21
0
 public virtual void Initialize(ApplicationInitializationContext context, IPluginModule module)
 {
 }
Пример #22
0
        private static void Initialize()
        {
            EditorApplication.delayCall -= initializeCallbackFunction;

            using (ProfilingUtility.SampleBlock("Plugin Container Initialization"))
            {
                initializing = true;

                pluginTypesById = Codebase.ludiqEditorTypes
                                  .Where(t => typeof(Plugin).IsAssignableFrom(t) && t.IsConcrete())
                                  .ToDictionary(GetPluginID);

                pluginDependencies = new Dictionary <string, HashSet <string> >();

                foreach (var pluginTypeById in pluginTypesById)
                {
                    pluginDependencies.Add(pluginTypeById.Key, pluginTypeById.Value.GetAttributes <PluginDependencyAttribute>().Select(pda => pda.id).ToHashSet());
                }

                var moduleTypes = Codebase.ludiqEditorTypes
                                  .Where(t => typeof(IPluginModule).IsAssignableFrom(t) && t.HasAttribute <PluginModuleAttribute>(false))
                                  .OrderByDependencies(t => t.GetAttributes <PluginModuleDependencyAttribute>().Select(pmda => pmda.moduleType))
                                  .ToArray();

                pluginsById = new Dictionary <string, Plugin>();

                var allModules = new List <IPluginModule>();

                foreach (var pluginId in pluginTypesById.Keys.OrderByDependencies(pluginId => pluginDependencies[pluginId]))
                {
                    var pluginType = pluginTypesById[pluginId];

                    Plugin plugin;

                    try
                    {
                        using (ProfilingUtility.SampleBlock($"{pluginType.Name} (Instantiation)"))
                        {
                            plugin = (Plugin)pluginType.Instantiate();
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new TargetInvocationException($"Could not instantiate plugin '{pluginId}' ('{pluginType.CSharpName()}').", ex);
                    }

                    var modules = new List <IPluginModule>();

                    foreach (var moduleType in moduleTypes)
                    {
                        try
                        {
                            var required = moduleType.GetAttribute <PluginModuleAttribute>(false).required;

                            var moduleProperty = pluginType.GetProperties().FirstOrDefault(p => p.PropertyType.IsAssignableFrom(moduleType));

                            if (moduleProperty == null)
                            {
                                continue;
                            }

                            IPluginModule module = null;

                            var moduleOverrideType = Codebase.ludiqEditorTypes
                                                     .FirstOrDefault(t => moduleType.IsAssignableFrom(t) && t.IsConcrete() && t.HasAttribute <PluginAttribute>() && t.GetAttribute <PluginAttribute>().id == pluginId);

                            if (moduleOverrideType != null)
                            {
                                try
                                {
                                    using (ProfilingUtility.SampleBlock($"{moduleOverrideType.Name} (Instantiation)"))
                                    {
                                        module = (IPluginModule)InstantiateLinkedType(moduleOverrideType, plugin);
                                    }
                                }
                                catch (Exception ex)
                                {
                                    throw new TargetInvocationException($"Failed to instantiate user-defined plugin module '{moduleOverrideType.CSharpName()}' for '{pluginId}'.", ex);
                                }
                            }
                            else if (moduleType.IsConcrete())
                            {
                                try
                                {
                                    using (ProfilingUtility.SampleBlock($"{moduleType.Name} (Instantiation)"))
                                    {
                                        module = (IPluginModule)InstantiateLinkedType(moduleType, plugin);
                                    }
                                }
                                catch (Exception ex)
                                {
                                    throw new TargetInvocationException($"Failed to instantiate built-in plugin module '{moduleType.CSharpName()}' for '{pluginId}'.", ex);
                                }
                            }
                            else if (required)
                            {
                                throw new InvalidImplementationException($"Missing implementation of plugin module '{moduleType.CSharpName()}' for '{pluginId}'.");
                            }

                            if (module != null)
                            {
                                moduleProperty.SetValue(plugin, module, null);

                                modules.Add(module);
                                allModules.Add(module);
                            }
                        }
                        catch (Exception ex)
                        {
                            Debug.LogException(ex);
                        }
                    }

                    pluginsById.Add(plugin.id, plugin);

                    foreach (var module in modules)
                    {
                        try
                        {
                            using (ProfilingUtility.SampleBlock($"{module.GetType().Name} (Initialization)"))
                            {
                                module.Initialize();
                            }
                        }
                        catch (Exception ex)
                        {
                            Debug.LogException(new Exception($"Failed to initialize plugin module '{plugin.id}.{module.GetType().CSharpName()}'.", ex));
                        }
                    }

                    if (plugin.manifest.versionMismatch)
                    {
                        anyVersionMismatch = true;
                    }
                }

                foreach (var module in allModules)
                {
                    try
                    {
                        using (ProfilingUtility.SampleBlock($"{module.GetType().Name} (Late Initialization)"))
                        {
                            module.LateInitialize();
                        }
                    }
                    catch (Exception ex)
                    {
                        Debug.LogException(new Exception($"Failed to late initialize plugin module '{module.plugin.id}.{module.GetType().CSharpName()}'.", ex));
                    }
                }

                var afterPluginTypes = Codebase.ludiqEditorTypes
                                       .Where(t => t.HasAttribute <InitializeAfterPluginsAttribute>());

                using (ProfilingUtility.SampleBlock($"BeforeInitializeAfterPlugins"))
                {
                    EditorApplicationUtility.BeforeInitializeAfterPlugins();
                }

                foreach (var afterPluginType in afterPluginTypes)
                {
                    using (ProfilingUtility.SampleBlock($"{afterPluginType.Name} (Static Initializer)"))
                    {
                        RuntimeHelpers.RunClassConstructor(afterPluginType.TypeHandle);
                    }
                }

                using (ProfilingUtility.SampleBlock($"AfterInitializeAfterPlugins"))
                {
                    EditorApplicationUtility.AfterInitializeAfterPlugins();
                }

                using (ProfilingUtility.SampleBlock($"Delayed Calls"))
                {
                    lock (delayQueue)
                    {
                        while (delayQueue.Count > 0)
                        {
                            delayQueue.Dequeue().Invoke();
                        }
                    }
                }

                InternalEditorUtility.RepaintAllViews();

                ProfilingUtility.Clear();

                using (ProfilingUtility.SampleBlock($"Product Container Initialization"))
                {
                    ProductContainer.Initialize();
                }

                initializing = false;

                initialized = true;

                using (ProfilingUtility.SampleBlock($"Update Process"))
                {
                    // Automatically show update wizard

                    if (!EditorApplication.isPlayingOrWillChangePlaymode && plugins.Any(plugin => plugin.manifest.versionMismatch))
                    {
                        // Delay call seems to be needed here to avoid arcane exceptions...
                        // Too lazy to debug why, it works that way.
                        EditorApplication.delayCall += PerformUpdate;
                    }
                }
            }
        }
Пример #23
0
        public Plugintab(PluginServices.AvailablePlugin SelectedPlugin, string Realm, List <string> CdKeys, List <string> Accounts, string Proxy)
        {
            this.BConnect      = new Button();
            this.BConnectDelay = new System.Windows.Forms.Timer();
            this.BConnectAll   = new Button();
            this.BotList       = new ListBox();
            this.Closebutton   = new Button();
            this.Box           = new Panel();
            this.Optionz       = new List <ContextMenuStrip>();
            this.Connect       = new List <ToolStripButton>();
            this.ConnectAll    = new List <ToolStripButton>();
            this.LogBox        = new List <LogBox>();
            this.BotInstances  = new List <ConnectionManager>();
            this.RawcdKeys     = new List <string>();
            this.Generateform();
            this.Realm          = Realm.ToLower();
            this.SelectedPlugin = SelectedPlugin;
            string text = "";

            if (Operators.CompareString(Realm, "useast.battle.net", false) == 0)
            {
                text += "East";
            }
            else if (Operators.CompareString(Realm, "uswest.battle.net", false) == 0)
            {
                text += "West";
            }
            else if (Operators.CompareString(Realm, "asia.battle.net", false) == 0)
            {
                text += "Asia";
            }
            else if (Operators.CompareString(Realm, "europe.battle.net", false) == 0)
            {
                text += "Europe";
            }
            this.Text        = text;
            this.BackColor   = Color.FromArgb(43, 43, 43);
            this.BorderStyle = BorderStyle.FixedSingle;
            if (Operators.CompareString(Proxy, "", false) != 0)
            {
                this.Proxy         = new ProxyInfo();
                this.Proxy.Address = Proxy.Split(new char[]
                {
                    ':'
                })[0];
                this.Proxy.Port = Conversions.ToUShort(Proxy.Split(new char[]
                {
                    '/'
                })[0].Split(new char[]
                {
                    ':'
                })[1]);
                this.Proxy.Username = Proxy.Split(new char[]
                {
                    '/'
                })[1];
                this.Proxy.Password = Proxy.Split(new char[]
                {
                    '/'
                })[2];
            }
            this.RawcdKeys = CdKeys;
            this.GenerateBotInfos(CdKeys, Accounts);
            foreach (var connect in Plugintab.BotInfos)
            {
                ToolStripButton toolStripButton  = new ToolStripButton("Connect");
                ToolStripButton toolStripButton2 = new ToolStripButton("Connect All");
                this.Connect.Add(toolStripButton);
                this.ConnectAll.Add(toolStripButton2);
                ContextMenuStrip contextMenuStrip = new ContextMenuStrip();
                contextMenuStrip.TopLevel        = false;
                contextMenuStrip.Parent          = this;
                contextMenuStrip.BackColor       = Color.FromArgb(43, 43, 43);
                contextMenuStrip.ForeColor       = Color.Gray;
                contextMenuStrip.ShowImageMargin = false;
                contextMenuStrip.Items.Add(toolStripButton);
                contextMenuStrip.Items.Add(toolStripButton2);
                this.Optionz.Add(contextMenuStrip);
                LogBox logBox = new LogBox();
                logBox.Parent      = this;
                logBox.Visible     = false;
                logBox.BackColor   = Color.FromArgb(43, 43, 43);
                logBox.BorderStyle = BorderStyle.None;
                logBox.ReadOnly    = true;
                Control arg_30A_0 = logBox;
                Point   point     = new Point(1, 1);
                arg_30A_0.Location = point;
                Control arg_328_0 = logBox;
                point          = new Point(550, 262);
                arg_328_0.Size = (Size)point;
                this.LogBox.Add(logBox);
                MyProject.Forms.MainForm.Panel4.Controls.Add(logBox);
                IPluginModule pluginModule = (IPluginModule)PluginServices.CreateInstance(SelectedPlugin);
                this.BotInstances.Add((ConnectionManager)pluginModule);
                this.BotList.Items.Add(connect.BnetUserName);
            }
            this.BotList.SelectedIndex = 0;
        }
Пример #24
0
 public IEnumerable <Type> SetPluginModuleKnownTypes(IPluginModule forModule, IEnumerable <PluginType> fromPluginTypes)
 {
     return(_delegateResolver.SetPluginModuleKnownTypes(forModule, fromPluginTypes));
 }
Пример #25
0
 public Checker(IPluginModule module)
 {
 }