Exemple #1
0
 public void LoadPlugin(PluginObj plugin)
 {
     _plugin = plugin;
     name.Text += plugin.ConfigAdaptor.Name;
     Author.Text += plugin.ConfigAdaptor.Author;
     Version.Text += plugin.ConfigAdaptor.Version;
     Description.Text += plugin.ConfigAdaptor.Description;
     foreach (Command command in plugin.ConfigAdaptor.Commands)
         CommandList.Controls.Add(new Item_command(command));
 }
Exemple #2
0
 public void CheckCommand(PluginObj plugin, string commands_directory)
 {
     try
     {
         DirectoryInfo Dir = new DirectoryInfo(commands_directory);
         string JsonFileName;
         string SerializedCommands;
         foreach (var file in Dir.GetFiles("*.json"))
         {
             JsonFileName = file.Name.Substring(0, file.Name.IndexOf(".json"));
             if (HttpUtility.UrlDecode(JsonFileName) == plugin.ConfigAdaptor.Name)
             {
                 SerializedCommands = System.IO.File.ReadAllText(commands_directory + HttpUtility.UrlEncode(plugin.ConfigAdaptor.Name) + ".json");
                 Commands DeSerializedCommands = JsonConvert.DeserializeObject<Commands>(SerializedCommands);
                 plugin.ConfigAdaptor.SetCommands(DeSerializedCommands);
                 OnMessage(this, Environment.NewLine + "Loaded commands for " + plugin.ConfigAdaptor.Name + Environment.NewLine);
             }
         }
     }
     catch (Exception ex)
     {
         OnError(this, ex);
     }
 }
Exemple #3
0
 private void PluginManager_OnPluginLoaded(PluginObj plugin)
 {
     try
     {
        pluginmanager.CheckCommand(plugin, _commands_directory);
     }
     catch (Exception ex)
     {
         OnError(this, ex);
     }
 }
Exemple #4
0
 private void CPlugin1_OnSaveChanges(Commands commands, PluginObj plugin)
 {
     manager.PluginManager.SaveCommand(Commands_Directory.Text, commands, plugin.ConfigAdaptor.Name);
     MessageBox.Show("Saved Commands!");
 }
Exemple #5
0
        public void LoadPlugins()
        {
            try
            {
                DirectoryInfo Dir = new DirectoryInfo(PluginFolder);
                string PluginName;
                foreach (var file in Dir.GetFiles("*.dll"))
                {

                    PluginName = file.Name.Substring(0, file.Name.IndexOf(".dll"));
                    if (pluginvalidator.IsPLuginValid(PluginFolder, PluginName))
                    {
                        PluginObj p = new PluginObj();
                        p.OnError += P_OnError;
                        p.Load(PluginFolder, PluginName, pluginadapter);
                        plugins.Add(p);
                        OnPluginLoaded(p);
                    }
                }
            }
            catch (Exception ex)
            {
                OnError(this, ex);
            }
        }