Changeset 339
- Timestamp:
- 10/20/07 19:20:19 (15 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
Apple Wireless Keyboard Helper/trunk/Misuzilla.Applications.AppleWirelessKeyboardHelper/Program.cs
r331 r339 9 9 using System.IO; 10 10 using System.Text; 11 using Microsoft.Scripting.Hosting; 12 using System.Collections.Generic; 11 13 12 14 namespace Misuzilla.Applications.AppleWirelessKeyboardHelper … … 16 18 private static NotifyIcon _notifyIcon; 17 19 private const String ApplicationName = "Apple Wireless Keyboard Helper"; 20 private static IScriptModule _module; 18 21 19 22 public static Int32 BalloonTipTimeout = 1500; … … 88 91 private static void Call(String funcName, EventArgs e) 89 92 { 90 if (!Script.VariableExists(funcName)) 93 Object funcObj; 94 if (!_module.TryLookupVariable(funcName, out funcObj)) 91 95 return; 92 96 93 FastCallable f = Script.GetVariable(funcName)as FastCallable;97 FastCallable f = funcObj as FastCallable; 94 98 if (f == null) 95 99 return; … … 104 108 } 105 109 110 111 106 112 /// <summary> 107 113 /// … … 113 119 Unload = null; 114 120 Load = null; 115 Script.ClearVariables();116 121 117 122 #pragma warning disable 0618 … … 120 125 #pragma warning restore 0618 121 126 127 IScriptEnvironment scriptEnv = ScriptEnvironment.GetEnvironment(); 128 List<ICompiledCode> compiledCodes = new List<ICompiledCode>(); 129 _module = scriptEnv.CreateModule("ScriptModule"); 130 122 131 Boolean hasScripts = false; 123 132 if (Directory.Exists("Scripts")) … … 128 137 try 129 138 { 139 IScriptEngine engine = scriptEnv.GetLanguageProviderByFileExtension(Path.GetExtension(path)).GetEngine(); 140 engine.ExecuteFileContent(path, _module); 130 141 hasScripts = true; 131 Script.ExecuteFileContent(path);132 142 } 133 143 catch (SyntaxErrorException se) … … 145 155 if (!hasScripts) 146 156 { 147 Script.Execute("py", Resources.Strings.DefaultPythonScript); 148 } 149 157 Script.GetEngine("py").Execute(Resources.Strings.DefaultPythonScript, _module); 158 } 159 160 // ��s 161 _module.Execute(); 162 150 163 OnLoad(EventArgs.Empty); 151 164
