コード例 #1
0
ファイル: Decompiler.cs プロジェクト: feelworld/reko
        public void RunScriptOnProgramImage(Program program, Script_v2 script)
        {
            if (script == null || !script.Enabled)
            {
                return;
            }
            IScriptInterpreter interpreter;

            try
            {
                //$TODO: should be in the config file, yeah.
                var type = Type.GetType("Reko.ImageLoaders.OdbgScript.OllyLang,Reko.ImageLoaders.OdbgScript");
                interpreter = (IScriptInterpreter)Activator.CreateInstance(type);
            }
            catch (Exception ex)
            {
                eventListener.Error(new NullCodeLocation(""), ex, string.Format("Unable to load script interpreter {0}."));
                return;
            }

            try
            {
                interpreter.LoadFromString(script.Script, null);
                interpreter.Run();
            } catch (Exception ex)
            {
                eventListener.Error(new NullCodeLocation(""), ex, string.Format("An error occurred while running the script."));
            }
        }
コード例 #2
0
ファイル: Decompiler.cs プロジェクト: nemerle/reko
        public void RunScriptOnProgramImage(Program program, Script_v2 script)
        {
            if (script == null || !script.Enabled)
                return;
            IScriptInterpreter interpreter;
            try
            {
                //$TODO: should be in the config file, yeah.
                var type = Type.GetType("Reko.ImageLoaders.OdbgScript.OllyLang,Reko.ImageLoaders.OdbgScript");
                interpreter = (IScriptInterpreter) Activator.CreateInstance(type);
            }
            catch (Exception ex)
            {
                eventListener.Error(new NullCodeLocation(""), ex, string.Format("Unable to load script interpreter {0}."));
                return;
            }

            try
            {
                interpreter.LoadFromString(script.Script, null);
                interpreter.Run();
            } catch (Exception ex)
            {
                eventListener.Error(new NullCodeLocation(""), ex, string.Format("An error occurred while running the script."));
            }
        }