Esempio n. 1
0
        private static void DoThePython()
        {
            var engine = Python.CreateEngine();

            PythonContext        context = HostingHelpers.GetLanguageContext(engine) as PythonContext;
            ICollection <string> paths   = context.GetSearchPaths();

            paths.Add(@"C:\Program Files (x86)\IronPython 2.7\Lib");
            context.SetSearchPaths(paths);
            engine.ImportModule("xml");
            engine.Runtime.LoadAssembly(System.Reflection.Assembly.GetEntryAssembly());
            var scope = engine.CreateScope();

            engine.ExecuteFile(@"C:\Users\aheumann\Documents\vvd\CommonGraphDiffer.py", scope);
            var xmlToDS = scope.GetVariable <Func <string, dynamic> >("XMLToDS");
            var myDS    = xmlToDS(@"C:\Users\aheumann\Documents\vvd\foo.dsx");

            foreach (var change in myDS.Changes)
            {
                //Console.WriteLine(change.ToString());
            }
        }