示例#1
0
 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();
     }
 }
示例#2
0
 public bool TryGet(ref PluginInfo plugin)
 {
     PluginInfo pluginInfo;
     if (!this.plugins.TryGetValue(this.GetPluginKey(plugin), out pluginInfo))
         return false;
     plugin = pluginInfo;
     return true;
 }
示例#3
0
		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();
		}
示例#4
0
 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);
     }
 }
示例#5
0
 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);
     }
 }
示例#6
0
 private string GetPluginKey(PluginInfo plugin)
 {
     return(string.Format("{0}, {1}", plugin.TypeName, plugin.AssemblyName));
 }
示例#7
0
 public void Remove(PluginInfo plugin)
 {
     this.plugins.Remove(this.GetPluginKey(plugin));
 }
示例#8
0
 public void Add(PluginInfo plugin)
 {
     this.plugins.Add(this.GetPluginKey(plugin), plugin);
 }
示例#9
0
 public bool Contains(PluginInfo plugin)
 {
     return(this.plugins.ContainsKey(this.GetPluginKey(plugin)));
 }
示例#10
0
 private string GetPluginKey(PluginInfo plugin)
 {
     return string.Format("{0}, {1}", plugin.TypeName, plugin.AssemblyName);
 }
示例#11
0
 public void Remove(PluginInfo plugin)
 {
     this.plugins.Remove(this.GetPluginKey(plugin));
 }
示例#12
0
 public bool Contains(PluginInfo plugin)
 {
     return this.plugins.ContainsKey(this.GetPluginKey(plugin));
 }
示例#13
0
 public void Add(PluginInfo plugin)
 {
     this.plugins.Add(this.GetPluginKey(plugin), plugin);
 }
示例#14
0
 private bool Equals(PluginInfo plugin1, PluginInfo plugin2)
 {
   if (plugin1.TypeName == plugin2.TypeName)
     return plugin1.AssemblyName == plugin2.AssemblyName;
   else
     return false;
 }
示例#15
0
 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();
 }
示例#16
0
 private bool IsPluginInUse(PluginInfo plugin)
 {
   return this.IsPluginInUse(plugin.TypeName, plugin.AssemblyName);
 }