Welcome to mirror list, hosted at ThFree Co, Russian Federation.

PythonExecutionManager.cs « PythonBinding « extras - github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 59926754c98f580d5e895f8e718b67c1f9d3977b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using System;
using System.IO;
using System.Diagnostics;
using System.Collections;
using System.Reflection;
using System.Xml;
using System.CodeDom.Compiler;
using Gtk;

using MonoDevelop.Projects;
 
using MonoDevelop.Core;
using MonoDevelop.Core;

namespace PythonBinding
{
	public class PythonExecutionManager
	{
		public void Execute (string filename, bool debug)
		{
			ProcessStartInfo psi = new ProcessStartInfo ("IronPythonConsole", filename);
			psi.WorkingDirectory = Path.GetDirectoryName (filename);
			psi.UseShellExecute = false;
		}
		
		public void Execute(IProject project, bool debug)
		{
			//PythonCompilerParameters parameters = (PythonCompilerParameters) project.ActiveConfiguration;
			//FileUtilityService fileUtilityService = (FileUtilityService) ServiceManager.GetService (typeof (FileUtilityService));
	
			string files = "";

			foreach (ProjectFile finfo in project.ProjectFiles) {
				if (finfo.Subtype != Subtype.Directory) {
					switch (finfo.BuildAction) {
						case BuildAction.Compile:
							files += String.Format ("{0} ", finfo.Name);
							break;
					}
				}
			}
			Console.WriteLine (files);

			string fullCommand = String.Format ("-e \"IronPythonConsole {0};read -p 'press any key to continue...' -n1\"", files);
			ProcessStartInfo psi = new ProcessStartInfo ("xterm", fullCommand);
			//psi.WorkingDirectory = Path.GetDirectoryName (exe);
			psi.UseShellExecute  = false;
			Process p = Process.Start (psi);
			p.WaitForExit ();
		}
	}
}