/// <summary> /// Starts a new <see cref="VirtualizedProcess"/> from the <see cref="VirtualProcessStartInfo"/> specified. /// </summary> /// <param name="startInfo"> /// The <see cref="VirtualProcessStartInfo"/> containing the information used to start the process with. /// </param> /// <returns> /// A new <see cref="VirtualizedProcess"/> component that is associated with the process resource. /// </returns> public static VirtualizedProcess Start(VirtualProcessStartInfo startInfo) { var process = new VirtualizedProcess(startInfo); process.Start(); return(process); }
/// <summary> /// Raised the <see cref="Exited"/> eventhandler. /// </summary> /// <param name="sender"></param> /// <param name="exitCode"></param> private void RaiseExitEvent(VirtualizedProcess sender, int exitCode) { lock (_exitEventSyncRoot) if (_exited != null) { _exited(sender, exitCode); } }
/// <summary> /// Raised the <see cref="Exited"/> eventhandler. /// </summary> /// <param name="sender"></param> /// <param name="exitCode"></param> private void RaiseExitEvent(VirtualizedProcess sender, int exitCode) { lock (_exitEventSyncRoot) if (_exited != null) _exited(sender, exitCode); }
/// <summary> /// Starts a process from the <see cref="ApplicationData"/> loaded from the filename specified. /// </summary> /// <exception cref="FileNotFoundException"> /// A <see cref="FileNotFoundException"/> is thrown if the <paramref name="applicationDataFile"/> can not be found. /// </exception> /// <exception cref="HostException"> /// A <see cref="HostException"/> is thrown if the process can't be started. /// </exception> /// <param name="applicationDataFile"> /// The file to load the <see cref="ApplicationData"/> from, /// representing the application to start. /// </param> public static void StartProcess(string applicationDataFile) { if (!File.Exists(applicationDataFile)) throw new FileNotFoundException("Unable to locate the virtual application's datafile.", applicationDataFile); var data = ApplicationData.Load(applicationDataFile); if (data == null) throw new HostException("\"" + applicationDataFile + "\"" + " could not be found or contains invalid data while trying" + " to start a new process based on this file."); var workingDirectory = new ApplicationFile(Path.GetDirectoryName(applicationDataFile)); var startInfo = new VirtualProcessStartInfo(data, workingDirectory); _process = VirtualizedProcess.Start(startInfo); }
/// <summary> /// Starts a new <see cref="VirtualizedProcess"/> from the <see cref="VirtualProcessStartInfo"/> specified. /// </summary> /// <param name="startInfo"> /// The <see cref="VirtualProcessStartInfo"/> containing the information used to start the process with. /// </param> /// <returns> /// A new <see cref="VirtualizedProcess"/> component that is associated with the process resource. /// </returns> public static VirtualizedProcess Start(VirtualProcessStartInfo startInfo) { var process = new VirtualizedProcess(startInfo); process.Start(); return process; }