public override bool CanDebugCommand (ExecutionCommand command)
		{
			NativeExecutionCommand cmd = command as NativeExecutionCommand;
			if (cmd == null)
				return false;
			
			string file = FindFile (cmd.Command);
			if (!File.Exists (file)) {
				// The provided file is not guaranteed to exist. If it doesn't
				// we assume we can execute it because otherwise the run command
				// in the IDE will be disabled, and that's not good because that
				// command will build the project if the exec doesn't yet exist.
				return true;
			}
			
			file = Path.GetFullPath (file);
			DateTime currentTime = File.GetLastWriteTime (file);
				
			FileData data;
			if (fileCheckCache.TryGetValue (file, out data)) {
				if (data.LastCheck == currentTime)
					return data.IsExe;
			}
			data.LastCheck = currentTime;
			try {
				data.IsExe = IsExecutable (file);
			} catch {
				data.IsExe = false;
			}
			fileCheckCache [file] = data;
			return data.IsExe;
		}
		public DebuggerStartInfo CreateDebuggerStartInfo (ExecutionCommand c)
		{
			var cmd = (DotNetExecutionCommand) c;
			var runtime = (MonoTargetRuntime)cmd.TargetRuntime;
			var dsi = new SoftDebuggerStartInfo (runtime.Prefix, runtime.EnvironmentVariables) {
				Command = cmd.Command,
				Arguments = cmd.Arguments,
				WorkingDirectory = cmd.WorkingDirectory,
			};
			
			string error;
			dsi.UserAssemblyNames = GetAssemblyNames (cmd.UserAssemblyPaths, out error);
			dsi.LogMessage = error;
			
			foreach (KeyValuePair<string,string> var in cmd.EnvironmentVariables)
				dsi.EnvironmentVariables [var.Key] = var.Value;
			
			var varsCopy = new Dictionary<string, string> (cmd.EnvironmentVariables);
			dsi.ExternalConsoleLauncher = delegate (System.Diagnostics.ProcessStartInfo info) {
				IProcessAsyncOperation oper;
				oper = Runtime.ProcessService.StartConsoleProcess (info.FileName, info.Arguments, info.WorkingDirectory,
					varsCopy, ExternalConsoleFactory.Instance.CreateConsole (dsi.CloseExternalConsoleOnExit), null);
				return new ProcessAdapter (oper, Path.GetFileName (info.FileName));
			};

			return dsi;
		}
		public IProcessAsyncOperation Execute (
			ExecutionCommand command,
			IConsole console)
		{
			var cmd = (TizenExecutionCommand) command;
			var config = cmd.Config;
			var sdkInfo = TizenSdkInfo.GetSdkInfo ();
			if (sdkInfo == null)
				return Finish (false);

			var project = config.ParentItem as Project;
			var tpkPath = FindTpkPath (project);
			if (tpkPath == null)
				return Finish (false);

			var sdkBuild = new TizenSdkBuild (config, sdkInfo);
			if (!sdkBuild.DoNativeInstall (tpkPath, console))
				return Finish (false);

			var tpkId = ExtractTpkId (tpkPath);
			if (tpkId == null)
				return Finish (false);

			var success = sdkBuild.DoNativeRun (tpkId, console);
			return Finish (success);
		}
		public bool CanExecute (ExecutionCommand command)
		{
			var cmd = command as MonoDroidExecutionCommand;
			if (cmd == null)
				return false;
			return true;
		}
		public DebuggerStartInfo CreateDebuggerStartInfo (ExecutionCommand command)
		{
			DotNetExecutionCommand cmd = command as DotNetExecutionCommand;
			if (cmd != null) {
				DebuggerStartInfo startInfo = new DebuggerStartInfo ();
				startInfo.Command = cmd.Command;
				startInfo.Arguments = cmd.Arguments;
				startInfo.WorkingDirectory = cmd.WorkingDirectory;
				if (cmd.EnvironmentVariables.Count > 0) {
					foreach (KeyValuePair<string, string> val in cmd.EnvironmentVariables)
						startInfo.EnvironmentVariables[val.Key] = val.Value;
				}
				return startInfo;
			}
			AspNetExecutionCommand acmd = command as AspNetExecutionCommand;
			if (acmd != null) {
				DebuggerStartInfo startInfo = new DebuggerStartInfo ();
				string xspName = (acmd.ClrVersion == ClrVersion.Net_1_1) ? "xsp" : "xsp2";
				string xspPath = acmd.TargetRuntime.GetToolPath (acmd.TargetFramework, xspName);
				if (!File.Exists (xspPath))
					throw new UserException (string.Format ("The \"{0}\" web server cannot be started. Please ensure that it is installed.", xspName), null);

				startInfo.Command = xspPath;
				startInfo.Arguments = acmd.XspParameters.GetXspParameters () + " --nonstop";
				startInfo.WorkingDirectory = acmd.BaseDirectory;

				// Set DEVPATH when running on Windows (notice that this has no effect unless
				// <developmentMode developerInstallation="true" /> is set in xsp2.exe.config

				startInfo.EnvironmentVariables["DEVPATH"] = Path.GetDirectoryName (xspPath);
				return startInfo;
			}
			throw new NotSupportedException ();
		}
		public IProcessAsyncOperation Execute (ExecutionCommand command, IConsole console)
		{
			DotNetExecutionCommand cmd = (DotNetExecutionCommand) command;
			if (cmd.TargetRuntime == null)
				cmd.TargetRuntime = Runtime.SystemAssemblyService.DefaultRuntime;
			return cmd.TargetRuntime.GetExecutionHandler ().Execute (cmd, console);
		}
		public DebuggerStartInfo CreateDebuggerStartInfo (ExecutionCommand command)
		{
			var cmd = (AspNetExecutionCommand) command;
			
			var runtime = (MonoTargetRuntime)cmd.TargetRuntime;
			var startInfo = new SoftDebuggerStartInfo (runtime.Prefix, runtime.EnvironmentVariables) {
				WorkingDirectory = cmd.BaseDirectory,
				Arguments = cmd.XspParameters.GetXspParameters ().Trim (),
			};
			
			var xspName = AspNetExecutionHandler.GetXspName (cmd);
			
			FilePath fxDir = GetFxDir (runtime, cmd.ClrVersion);
			FilePath xspPath = fxDir.Combine (xspName).ChangeExtension (".exe");
			
			//no idea why xsp is sometimes relocated to a "winhack" dir on Windows
			if (MonoDevelop.Core.PropertyService.IsWindows && !File.Exists (xspPath)) {
				var winhack = fxDir.Combine ("winhack");
				if (Directory.Exists (winhack))
					xspPath = winhack.Combine (xspName).ChangeExtension (".exe");
			}
			
			if (!File.Exists (xspPath))
				throw new UserException (GettextCatalog.GetString (
					"The \"{0}\" web server cannot be started. Please ensure that it is installed.", xspName), null);
			
			startInfo.Command = xspPath;
			
			string error;
			startInfo.UserAssemblyNames = SoftDebuggerEngine.GetAssemblyNames (cmd.UserAssemblyPaths, out error);
			startInfo.LogMessage = error;
			
			return startInfo;
		}
		public IProcessAsyncOperation Execute (ExecutionCommand command, IConsole console)
		{
			if (!CanExecute (command))
			    return null;
			DebugExecutionHandler h = new DebugExecutionHandler (null);
			return h.Execute (command, console);
		}
		public DebuggerStartInfo CreateDebuggerStartInfo (ExecutionCommand command)
		{
			var cmd = (AspNetExecutionCommand) command;
			
			var runtime = (MonoTargetRuntime)cmd.TargetRuntime;
			var startInfo = new SoftDebuggerStartInfo (runtime.Prefix, runtime.EnvironmentVariables) {
				WorkingDirectory = cmd.BaseDirectory,
				Arguments = cmd.XspParameters.GetXspParameters ().Trim (),
			};
			
			FilePath prefix = runtime.Prefix;
			if (MonoDevelop.Core.PropertyService.IsWindows) {
				startInfo.Command = (cmd.ClrVersion == ClrVersion.Net_1_1)
					? prefix.Combine ("lib", "mono", "1.0", "winhack", "xsp.exe")
					: prefix.Combine ("lib", "mono", "2.0", "winhack", "xsp2.exe");
			}
			else {
				startInfo.Command = (cmd.ClrVersion == ClrVersion.Net_1_1)
					? prefix.Combine ("lib", "mono", "1.0", "xsp.exe")
					: prefix.Combine ("lib", "mono", "2.0", "xsp2.exe");
			}
			
			string error;
			startInfo.UserAssemblyNames = SoftDebuggerEngine.GetAssemblyNames (cmd.UserAssemblyPaths, out error);
			startInfo.LogMessage = error;
			
			return startInfo;
		}
		public DebuggerStartInfo CreateDebuggerStartInfo (ExecutionCommand command)
		{
			AspNetExecutionCommand cmd = (AspNetExecutionCommand) command;
			MonoDebuggerStartInfo startInfo = MonoDebuggerSessionFactory.CreateDebuggerStartInfo (cmd.TargetRuntime);
			
			string xspPath = Path.Combine (startInfo.MonoPrefix, "lib" + Path.DirectorySeparatorChar + "mono" + Path.DirectorySeparatorChar);
			
			if (cmd.ClrVersion == ClrVersion.Net_1_1)
				xspPath += Path.Combine ("1.0","xsp.exe");
			else
				xspPath += Path.Combine ("2.0","xsp2.exe");
			
			startInfo.IsXsp = true;
			startInfo.UserCodeOnly = true;
			startInfo.Command = xspPath;
			startInfo.WorkingDirectory = cmd.BaseDirectory;
			startInfo.Arguments = cmd.XspParameters.GetXspParameters ().Trim ();
			
			string binDir = Path.Combine (cmd.BaseDirectory, "bin");
			startInfo.UserModules = new List<string> ();
			foreach (string file in Directory.GetFiles (binDir)) {
				if (file.EndsWith (".dll") || file.EndsWith (".exe"))
					startInfo.UserModules.Add (file);
			}
			
			return startInfo;
		}
		public DebuggerStartInfo CreateDebuggerStartInfo (ExecutionCommand command)
		{
			var cmd = (MoonlightExecutionCommand) command;
			var msi = new MoonlightDebuggerStartInfo (cmd.AppName, cmd.Url);
			SoftDebuggerEngine.SetUserAssemblyNames (msi, cmd.UserAssemblyPaths);
			return msi;
		}
		public IProcessAsyncOperation Execute (ExecutionCommand command, IConsole console)
		{
			var cmd = (MonoDroidExecutionCommand) command;
			int runningProcessId = -1;

			var launchOp = new ChainedAsyncOperationSequence (
				new ChainedAsyncOperation<AdbGetProcessIdOperation> () {
					Create = () => new AdbGetProcessIdOperation (cmd.Device, cmd.PackageName),
					Completed = (op) => {
						if (op.Success)
							runningProcessId = op.ProcessId;
					}
				},
				new ChainedAsyncOperation () {
					Skip = () => runningProcessId <= 0 ? "" : null,
					Create = () => new AdbShellOperation (cmd.Device, "kill " + runningProcessId)
				},
				new ChainedAsyncOperation () {
					Create = () => MonoDroidFramework.Toolbox.StartActivity (cmd.Device, cmd.Activity)
				}
			);
			launchOp.Start ();

			return new MonoDroidProcess (cmd.Device, cmd.Activity, cmd.PackageName, 
				console.Out.Write, console.Error.Write, launchOp);
		}
		public override DebuggerStartInfo CreateDebuggerStartInfo (ExecutionCommand c)
		{
			var cmd = (DotNetExecutionCommand) c;
			var runtime = (MonoTargetRuntime)cmd.TargetRuntime;
			var dsi = new SoftDebuggerStartInfo (runtime.Prefix, runtime.EnvironmentVariables) {
				Command = cmd.Command,
				Arguments = cmd.Arguments,
				WorkingDirectory = cmd.WorkingDirectory,
			};
			
			SetUserAssemblyNames (dsi, cmd.UserAssemblyPaths);
			
			foreach (KeyValuePair<string,string> var in cmd.EnvironmentVariables)
				dsi.EnvironmentVariables [var.Key] = var.Value;
			
			var varsCopy = new Dictionary<string, string> (cmd.EnvironmentVariables);
			var startArgs = (SoftDebuggerLaunchArgs) dsi.StartArgs;
			startArgs.ExternalConsoleLauncher = delegate (System.Diagnostics.ProcessStartInfo info) {
				ProcessAsyncOperation oper;
				oper = Runtime.ProcessService.StartConsoleProcess (info.FileName, info.Arguments, info.WorkingDirectory,
					ExternalConsoleFactory.Instance.CreateConsole (dsi.CloseExternalConsoleOnExit), varsCopy);
				return new ProcessAdapter (oper, Path.GetFileName (info.FileName));
			};
			startArgs.MonoExecutableFileName = runtime.MonoRuntimeInfo.Force64or32bit.HasValue ? runtime.MonoRuntimeInfo.Force64or32bit.Value ? "mono64" : "mono32" : "mono";
			return dsi;
		}
 public DebuggerStartInfo CreateDebuggerStartInfo(ExecutionCommand command)
 {
     var cmd = (MonobjcExecutionCommand) command;
     var startInfo = new MonobjcDebuggerStartInfo(IPAddress.Loopback, 46789, cmd);
     startInfo.SetUserAssemblies(cmd.UserAssemblyPaths);
     return startInfo;
 }
		public IProcessAsyncOperation Execute (ExecutionCommand command, IConsole console)
		{
			var cmd = (AspNetExecutionCommand) command;
			var xspPath = GetXspPath (cmd);
			
			//if it's a script, use a native execution handler
			if (xspPath.Extension != ".exe") {
				//set mono debug mode if project's in debug mode
				var envVars = cmd.TargetRuntime.GetToolsExecutionEnvironment (cmd.TargetFramework).Variables; 
				if (cmd.DebugMode) {
					envVars = new Dictionary<string, string> (envVars);
					envVars ["MONO_OPTIONS"] = "--debug";
				}
				
				var ncmd = new NativeExecutionCommand (
					xspPath, cmd.XspParameters.GetXspParameters () + " --nonstop",
					cmd.BaseDirectory, envVars);
				
				return Runtime.ProcessService.GetDefaultExecutionHandler (ncmd).Execute (ncmd, console);
			}

			// Set DEVPATH when running on Windows (notice that this has no effect unless
			// <developmentMode developerInstallation="true" /> is set in xsp2.exe.config

			var evars = cmd.TargetRuntime.GetToolsExecutionEnvironment (cmd.TargetFramework).Variables;
			if (cmd.TargetRuntime is MsNetTargetRuntime)
				evars["DEVPATH"] = Path.GetDirectoryName (xspPath);
			
			var netCmd = new DotNetExecutionCommand (
				xspPath, cmd.XspParameters.GetXspParameters () + " --nonstop",
				cmd.BaseDirectory, evars);
			netCmd.DebugMode = cmd.DebugMode;
			
			return cmd.TargetRuntime.GetExecutionHandler ().Execute (netCmd, console);
		}
		public IProcessAsyncOperation Execute (ExecutionCommand command, IConsole console)
		{
			var cmd = (MonoDroidExecutionCommand) command;
			var launchOp = MonoDroidFramework.Toolbox.StartActivity (cmd.Device, cmd.Activity);

			return new MonoDroidProcess (cmd.Device, cmd.Activity, cmd.PackageName, 
				console.Out.Write, console.Error.Write, launchOp, false);
		}
		public DebuggerStartInfo CreateDebuggerStartInfo (ExecutionCommand command)
		{
			var cmd = (MonoMacExecutionCommand) command;
			
			var startInfo = new MonoMacDebuggerStartInfo (cmd);
			SoftDebuggerEngine.SetUserAssemblyNames (startInfo, cmd.UserAssemblyPaths);
			return startInfo;
		}
        public override bool CanDebugCommand(ExecutionCommand cmd)
	    {
	        var processCmd = cmd as ProcessExecutionCommand;
	        if (processCmd == null)
	            return false;

            return processCmd.Command.StartsWith("XenkoDebug");
		}
		public bool CanDebugCommand (ExecutionCommand command)
		{
			if (PropertyService.IsMac || PropertyService.IsWindows)
				return false;
			
			var cmd = command as MoonlightExecutionCommand;
			return cmd != null && cmd.Url.StartsWith ("file://");
		}
		public ExecutionCommand GetTargetCommand ()
		{
			if (cmd != null)
				return cmd;
			SpyHandler sh = new SpyHandler ();
			runCheckDelegate (sh);
			return cmd = sh.Command;
		}
Beispiel #21
0
		public IProcessAsyncOperation Execute (ExecutionCommand command, IConsole console)
		{
			//FIXME: use open -W -n Foo.app, or the launch script?
			var cmd = (MonoMacExecutionCommand) command;
			return Runtime.ProcessService.StartConsoleProcess (cmd.LaunchScript, "",
			    //"open", string.Format ( "-W -n \"{0}\"", cmd.AppPath), 
				cmd.AppPath.ParentDirectory, console, null); 
		}
	    public DebuggerStartInfo CreateDebuggerStartInfo(ExecutionCommand cmd)
	    {
	        var dsi =
	            cmd.CommandString.EndsWith("Client")
	                ? new SoftDebuggerStartInfo(new SoftDebuggerConnectArgs("TestApp", IPAddress.Loopback, 13332))
	                : new SoftDebuggerStartInfo(new SoftDebuggerListenArgs("TestApp", IPAddress.Any, 13332));
			return dsi;
		}
		internal IProcessAsyncOperation InternalExecute (CommandExecutionContext ctx, IExecutionMode mode, ExecutionCommand command, IConsole console)
		{
			CustomExecutionMode cmode = ExecutionModeCommandService.ShowParamtersDialog (ctx, mode, null);
			if (cmode == null)
				return new CancelledProcessAsyncOperation ();
			
			return cmode.Execute (command, console, false, false);
		}
Beispiel #24
0
		public DebuggerStartInfo CreateDebuggerStartInfo (ExecutionCommand command)
		{
			var cmd = (MonoMacExecutionCommand) command;
			
			var startInfo = new MonoMacDebuggerStartInfo (cmd);
			startInfo.SetUserAssemblies (cmd.UserAssemblyPaths);
			return startInfo;
		}
		public bool CanDebugCommand (ExecutionCommand cmd)
		{
			var netCmd = cmd as DotNetExecutionCommand;
			if (netCmd == null)
				return false;

			return CanDebugRuntime (netCmd.TargetRuntime);
		}
		public DebuggerStartInfo CreateDebuggerStartInfo (ExecutionCommand command)
		{
			var cmd = (MonoDroidExecutionCommand) command;
			
			//var startInfo = new MonoDroidDebuggerStartInfo (MonoDroidSettings.GetDebuggerHostIP (false), cmd);
			var startInfo = new MonoDroidDebuggerStartInfo (IPAddress.Loopback, cmd);
			SoftDebuggerEngine.SetUserAssemblyNames (startInfo, cmd.UserAssemblyPaths);
			return startInfo;
		}
		public bool CanExecute (ExecutionCommand command)
		{
			var cmd = command as IPhoneExecutionCommand;
			if (cmd == null)
				return false;
			if (SimulatorTarget != null && (!cmd.Simulator || !SimulatorTarget.Supports (cmd.MinimumOSVersion, cmd.SupportedDevices)))
				return false;
			return true;
		}
		public void Customize (ExecutionCommand cmd, object data)
		{
			DotNetExecutionCommand command = (DotNetExecutionCommand) cmd;
			MonoExecutionParameters config = (MonoExecutionParameters) data;
			
			string opts;
			config.GenerateOptions (command.EnvironmentVariables, out opts);
			command.RuntimeArguments = opts;
		}
        /// <summary>
        ///   Creates the debugger start info.
        /// </summary>
        /// <param name = "command">The command.</param>
        /// <returns></returns>
        public DebuggerStartInfo CreateDebuggerStartInfo(ExecutionCommand command)
        {
            MonobjcExecutionCommand executionCommand = (MonobjcExecutionCommand)command;

            MonobjcDebuggerStartInfo startInfo = new MonobjcDebuggerStartInfo (executionCommand);
            SoftDebuggerEngine.SetUserAssemblyNames (startInfo, executionCommand.UserAssemblyPaths);

            return startInfo;
        }
		public DebuggerStartInfo CreateDebuggerStartInfo (ExecutionCommand command)
		{
			var cmd = command as CryEngineExecutionCommand;
			if (null == cmd){ return null; }
			var msi = new CryEngineDebuggerStartInfo("CryEngine");
			// msi.SetUserAssemblies (null);
			msi.Arguments = string.Format ("-projectPath \"{0}\"", cmd.ProjectPath);
			return msi;
		}
 public bool CanExecute(ExecutionCommand command)
 {
     return(Runtime.ProcessService.GetDefaultExecutionHandler(command) != null);
 }
        public ProcessAsyncOperation Execute(ExecutionCommand command, OperationConsole console)
        {
            IExecutionHandler handler = Runtime.ProcessService.GetDefaultExecutionHandler(command);

            return(handler.Execute(command, console));
        }
 public ProcessAsyncOperation Execute(MonoDevelop.Core.Execution.ExecutionCommand command, MonoDevelop.Core.Execution.OperationConsole console)
 {
     throw new InvalidOperationException();
 }
 public virtual bool CanExecute(ExecutionCommand command)
 {
     return(command is NativeExecutionCommand);
 }
Beispiel #35
0
 public override bool CanExecute(ExecutionCommand command)
 {
     return(command is DotNetExecutionCommand);
 }