/// <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); }