public void LoadConfig() { if (!this.configFile.Exists) return; PluginsXmlDocument pluginsXmlDocument = new PluginsXmlDocument(); ((XmlDocument)pluginsXmlDocument).Load(this.configFile.FullName); IEnumerator enumerator = pluginsXmlDocument.Plugins.GetEnumerator(); try { while (enumerator.MoveNext()) { PluginXmlNode pluginXmlNode = (PluginXmlNode)enumerator.Current; PluginInfo plugin = new PluginInfo(pluginXmlNode.PluginType, pluginXmlNode.TypeName.Value, pluginXmlNode.AssemblyName.Value); plugin.Enabled = pluginXmlNode.Enabled; if (pluginXmlNode.X86.HasValue) plugin.x86 = pluginXmlNode.X86.Value; if (pluginXmlNode.X64.HasValue) plugin.x64 = pluginXmlNode.X64.Value; this.plugins.Add(plugin); } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) disposable.Dispose(); } }
public bool TryGet(ref PluginInfo plugin) { PluginInfo pluginInfo; if (!this.plugins.TryGetValue(this.GetPluginKey(plugin), out pluginInfo)) return false; plugin = pluginInfo; return true; }
public PluginOQViewItem(PluginInfo plugin) : base(new string[2]) { this.plugin = plugin; this.SubItems[0].Text = plugin.TypeName; this.SubItems[1].Text = plugin.AssemblyName; this.Checked = plugin.Enabled; this.UpdateIcon(); }
public void LoadPlugin(PluginInfo plugin) { try { object obj = plugin.Load(); if (plugin.PluginType != PluginType.UserProvider) return; FieldInfo field = typeof(UserProvider).GetField("provider", BindingFlags.Instance | BindingFlags.NonPublic); if (field == null) return; ProviderManager.Add((IProvider)field.GetValue(obj)); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); } }
public void LoadConfig() { if (!this.configFile.Exists) return; PluginsXmlDocument doc = new PluginsXmlDocument(); doc.Load(this.configFile.FullName); foreach (PluginXmlNode node in doc.Plugins) { PluginInfo plugin = new PluginInfo(node.PluginType, node.TypeName.Value, node.AssemblyName.Value); plugin.Enabled = node.Enabled; if (node.X86.HasValue) plugin.x86 = node.X86.Value; if (node.X64.HasValue) plugin.x64 = node.X64.Value; this.plugins.Add(plugin); } }
private string GetPluginKey(PluginInfo plugin) { return(string.Format("{0}, {1}", plugin.TypeName, plugin.AssemblyName)); }
public void Remove(PluginInfo plugin) { this.plugins.Remove(this.GetPluginKey(plugin)); }
public void Add(PluginInfo plugin) { this.plugins.Add(this.GetPluginKey(plugin), plugin); }
public bool Contains(PluginInfo plugin) { return(this.plugins.ContainsKey(this.GetPluginKey(plugin))); }
private string GetPluginKey(PluginInfo plugin) { return string.Format("{0}, {1}", plugin.TypeName, plugin.AssemblyName); }
public bool Contains(PluginInfo plugin) { return this.plugins.ContainsKey(this.GetPluginKey(plugin)); }
private bool Equals(PluginInfo plugin1, PluginInfo plugin2) { if (plugin1.TypeName == plugin2.TypeName) return plugin1.AssemblyName == plugin2.AssemblyName; else return false; }
private PluginInfo[] ExtractPlugins(string filename, PluginType pluginType) { List<PluginInfo> list = new List<PluginInfo>(); System.Type pluginBaseType = Global.PluginManager.GetPluginBaseType(pluginType); try { AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += new ResolveEventHandler(this.CurrentDomain_ReflectionOnlyAssemblyResolve); Assembly assembly = Assembly.ReflectionOnlyLoad(AssemblyName.GetAssemblyName(filename).FullName); foreach (System.Type type in assembly.GetTypes()) { if (type.BaseType != (System.Type) null && type.BaseType.GUID == pluginBaseType.GUID) { PluginInfo pluginInfo = new PluginInfo(pluginType, type.FullName, assembly.GetName().Name); list.Add(pluginInfo); } } } catch (Exception ex) { int num = (int) MessageBox.Show((IWin32Window) this, ((object) ex).ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); list.Clear(); } finally { AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve -= new ResolveEventHandler(this.CurrentDomain_ReflectionOnlyAssemblyResolve); } return list.ToArray(); }
private bool IsPluginInUse(PluginInfo plugin) { return this.IsPluginInUse(plugin.TypeName, plugin.AssemblyName); }