Пример #1
0
 public IronPythonScript(string path) : base(path)
 {
     Runtime = new IronPythonRuntime(Name);
     Runtime.ExecuteFile(path);
     SupportedEvents = GetSupportedEvents();
     SupportedMenus  = GetSupportedMenus();
 }
Пример #2
0
        public IronPythonScript(string path) : base(path, ScriptLanguage.IronPython)
        {
            Runtime = new IronPythonRuntime();
            Runtime.ExecuteFile(path);

            var attributes = Runtime.GetVariable("__attributes");

            if (attributes != null)
            {
                Attributes = ((PythonDictionary)attributes).Cast <KeyValuePair <object, object> >().ToDictionary(a => a.Key.ToString(), b => b.Value.ToString());
            }

            var exports = Runtime.GetVariable("__exports");

            if (exports != null)
            {
                FunctionExports = new List <ScriptFunctionExport>();
                var funcs = (IEnumerable <object>)exports;
                foreach (PythonDictionary func in funcs)
                {
                    FunctionExports.Add(new ScriptFunctionExport(func["Name"].ToString(), func["Function"].ToString(), this));
                }
            }
        }
Пример #3
0
 public IronPythonScript(string path) : base(path)
 {
     Runtime = new IronPythonRuntime();
     Runtime.ExecuteFile(path);
 }