示例#1
0
        internal static void LoadNewPassivePlugins()
        {
            ScriptEngine Engine = GetScriptEngine();

            LoadNewPassivePlugins(Engine);
            IronUI.BuildPluginTree();
        }
示例#2
0
        internal static void LoadNewSessionPlugins()
        {
            ScriptEngine Engine = GetScriptEngine();

            LoadNewSessionPlugins(Engine);
            //IronUI.UpdateSessionPluginsInASTab();
            IronUI.BuildPluginTree();
        }
示例#3
0
        internal static void LoadNewFormatPlugins()
        {
            ScriptEngine Engine = GetScriptEngine();

            LoadNewFormatPlugins(Engine);
            IronUI.UpdateAllFormatPluginRows();
            IronUI.BuildPluginTree();
        }
示例#4
0
        internal static void LoadAllActivePlugins()
        {
            ScriptEngine Engine = GetScriptEngine();

            LoadAllActivePlugins(Engine);
            IronUI.UpdateAllActivePluginRows();
            IronUI.BuildPluginTree();
        }
示例#5
0
 internal static void LoadAllNewPlugins()
 {
     LoadNewPassivePlugins();
     LoadNewActivePlugins();
     LoadNewFormatPlugins();
     LoadNewSessionPlugins();
     IronUI.UpdateAllFormatPluginRows();
     IronUI.UpdateAllActivePluginRows();
     //IronUI.UpdateSessionPluginsInASTab();
     IronUI.BuildPluginTree();
 }
示例#6
0
        internal static void LoadAllPlugins()
        {
            ScriptEngine Engine = GetScriptEngine();

            LoadAllPassivePlugins(Engine);
            LoadAllActivePlugins(Engine);
            LoadAllFormatPlugins(Engine);
            LoadAllSessionPlugins(Engine);
            IronUI.UpdateAllFormatPluginRows();
            IronUI.UpdateAllActivePluginRows();
            //IronUI.UpdateSessionPluginsInASTab();
            IronUI.BuildPluginTree();
        }
示例#7
0
        internal static void ReloadPlugin(PluginType Type, string Name, string PluginFileName)
        {
            string FileName = "";

            switch (Type)
            {
            case PluginType.Passive:
                FileName = Config.RootDir + "\\plugins\\passive\\" + PluginFileName;
                lock (PassivePlugin.Collection)
                {
                    PassivePlugin.Remove(Name);
                    LoadPlugin(FileName);
                }
                break;

            case PluginType.Active:
                FileName = Config.RootDir + "\\plugins\\active\\" + PluginFileName;
                lock (ActivePlugin.Collection)
                {
                    ActivePlugin.Remove(Name);
                    LoadPlugin(FileName);
                }
                break;

            case PluginType.Format:
                FileName = Config.RootDir + "\\plugins\\format\\" + PluginFileName;
                lock (FormatPlugin.Collection)
                {
                    FormatPlugin.Remove(Name);
                    LoadPlugin(FileName);
                    IronUI.UpdateAllFormatPluginRows();
                }
                break;

            case PluginType.Session:
                FileName = Config.RootDir + "\\plugins\\session\\" + PluginFileName;
                lock (SessionPlugin.Collection)
                {
                    SessionPlugin.Remove(Name);
                    LoadPlugin(FileName);
                }
                break;
            }
            IronUI.UpdateAllFormatPluginRows();
            IronUI.UpdateAllActivePluginRows();
            IronUI.BuildPluginTree();
        }
示例#8
0
        internal static Module LoadModule(Module M)
        {
            try
            {
                string FullName = string.Format("{0}\\modules\\{1}\\{2}", Config.RootDir, M.Name, M.FileName);
                if (M.FileName.EndsWith(".dll"))
                {
                    Assembly MA        = System.Reflection.Assembly.LoadFile(FullName);
                    Module   NewModule = (Module)Activator.CreateInstance(MA.GetTypes()[0]);
                    Module.Add(NewModule.GetInstance());
                }
                else
                {
                    Engine = PluginEngine.GetScriptEngine();

                    if (M.FileName.EndsWith(".py"))
                    {
                        Engine.Runtime.TryGetEngine("py", out Engine);
                    }
                    else
                    {
                        Engine.Runtime.TryGetEngine("rb", out Engine);
                    }
                    List <string> ModulePaths = new List <string>();
                    foreach (Module ModuleFromXml in ModuleListFromXml)
                    {
                        ModulePaths.Add(string.Format("{0}\\modules\\{1}\\", Config.RootDir, ModuleFromXml.Name));
                    }
                    Engine.SetSearchPaths(ModulePaths);
                    if (M.FileName.Length == 0)
                    {
                        throw new Exception("Module is missing script files");
                    }
                    ScriptSource        ModuleSource  = Engine.CreateScriptSourceFromFile(FullName);
                    ScriptErrorReporter CompileErrors = new ScriptErrorReporter();
                    string       ErrorMessage         = "";
                    CompiledCode CompiledModule       = ModuleSource.Compile(CompileErrors);
                    ErrorMessage = CompileErrors.GetErrors();
                    if (M.FileName.EndsWith(".py"))
                    {
                        string IndentError = PluginEditor.CheckPythonIndentation(ModuleSource.GetCode())[1];
                        if (IndentError.Length > 0)
                        {
                            ErrorMessage = string.Format("{0}\r\n{1}", IndentError, ErrorMessage);
                        }
                    }
                    if (ErrorMessage.Length == 0)
                    {
                        ModuleSource.ExecuteProgram();
                    }
                    else
                    {
                        throw new Exception(string.Format("Syntax error in module file:{0}\r\n{1}", M.FileName, ErrorMessage));
                    }
                }
            }
            catch (Exception Exp)
            {
                ModuleStartPromptForm PF = GetPromptWindow(M);
                if (PF != null)
                {
                    PF.ShowError("Error Loading Module.");
                }
                IronException.Report(string.Format("Error Loading Module - {0}", M.Name), Exp);
                return(null);
            }
            IronUI.BuildPluginTree();
            ModuleStartPromptForm UsedPF = RemovePromptWindowFromList(M);

            if (UsedPF != null)
            {
                try
                {
                    if (!UsedPF.IsClosed)
                    {
                        UsedPF.CloseForm();
                    }
                }
                catch { }
            }
            return(Get(M.Name));
        }