Exemplo n.º 1
0
        public static CorDebugProcess CreateProcessEx(IDebugPort2 pPort, string lpApplicationName, string lpCommandLine, System.IntPtr lpProcessAttributes, System.IntPtr lpThreadAttributes, int bInheritHandles, uint dwCreationFlags, System.IntPtr lpEnvironment, string lpCurrentDirectory, ref _STARTUPINFO lpStartupInfo, ref _PROCESS_INFORMATION lpProcessInformation, uint debuggingFlags)
        {
            DebugPort port = pPort as DebugPort;
            if (port == null)
                throw new Exception("IDebugPort2 object passed to Micro Framework package by Visual Studio is not a valid device port");

            CommandLineBuilder cb = new CommandLineBuilder(lpCommandLine);
            string[] args = cb.Arguments;
            string deployDeviceName = args[args.Length-1];

            //Extract deployDeviceName
            if (!deployDeviceName.StartsWith(CorDebugProcess.c_DeployDeviceName))
                throw new Exception(String.Format("\"{0}\" does not appear to be a valid Micro Framework device name", CorDebugProcess.c_DeployDeviceName));

            deployDeviceName = deployDeviceName.Substring(CorDebugProcess.c_DeployDeviceName.Length);
            cb.RemoveArguments(args.Length - 1, 1);

            lpCommandLine = cb.ToString();

            CorDebugProcess process = port.IsLocalPort
                ? new CorDebugProcess(port, null)
                : port.GetDeviceProcess(deployDeviceName, 60);

            if (process == null)
                throw new Exception("CorDebugProcess.CreateProcessEx() could not create or find the device process");

            process.StoreAssemblyPaths(args);
            process.InternalCreateProcess(port, lpApplicationName, lpCommandLine, lpProcessAttributes, lpThreadAttributes, bInheritHandles, dwCreationFlags, lpEnvironment, lpCurrentDirectory, ref lpStartupInfo, ref lpProcessInformation, debuggingFlags);

            return process;
        }
Exemplo n.º 2
0
		public static CorDebugProcess CreateProcess (DebugPort pPort, string lpCommandLine)
		{
			CommandLineBuilder cb = new CommandLineBuilder (lpCommandLine);
			string[] args = cb.Arguments;
			string deployDeviceName = args [args.Length - 1];

			//Extract deployDeviceName
			if (!deployDeviceName.StartsWith (CorDebugProcess.c_DeployDeviceName))
				throw new Exception (String.Format ("\"{0}\" does not appear to be a valid Micro Framework device name", deployDeviceName));

			deployDeviceName = deployDeviceName.Substring (CorDebugProcess.c_DeployDeviceName.Length);
			cb.RemoveArguments (args.Length - 1, 1);

			lpCommandLine = cb.ToString ();
			//CorDebugProcess process = port.GetDeviceProcess(deployDeviceName, 60);
			CorDebugProcess process = pPort.GetDeviceProcess (deployDeviceName, 60);
			if (process == null)
				throw new Exception ("CorDebugProcess.CreateProcessEx() could not create or find the device process");

			process.StoreAssemblyPaths (args);

			bool fDidDeploy = true;     //What if we did a launch but no deploy to a device...

			if (!fDidDeploy) {
				process.Engine.RebootDevice (Engine.RebootOption.RebootClrWaitForDebugger);
			}

			return process;
		}