/// <summary> /// Initializes a new instance of <see cref="Packager"/>. /// </summary> /// <param name="applicationData">The data to base the packaging process on.</param> /// <param name="outputFolder">The location where the application must be packaged to.</param> public Packager(ApplicationData applicationData, string outputFolder) { var workingDirectory = new ApplicationFile(outputFolder); if (workingDirectory.Type != FileType.Directory) { throw new ArgumentException("The value specified for the outputFolder is invalid.", "outputFolder"); } _startInfo = new VirtualProcessStartInfo(applicationData, workingDirectory); _waitHandle = new AutoResetEvent(false); }
/// <summary> /// Starts a new <see cref="PackagingProcess"/> 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="PackagingProcess"/> component that is associated with the process resource. /// </returns> public new static PackagingProcess Start(VirtualProcessStartInfo startInfo) { if (startInfo.Files.RegistryDatabase.Type != FileType.Database) throw new ArgumentException("The destination file specified for the registry database is not valid.", "startInfo"); var synchronizer = new ProcessSynchronizer(startInfo.WorkingDirectory, startInfo.FileSystemRuleCollection, startInfo.Files.RegistryDatabase, startInfo.RegistryRuleCollection); var process = new PackagingProcess(startInfo, synchronizer); process.Start(); return process; }
/// <summary> /// Starts a new <see cref="PackagingProcess"/> 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="PackagingProcess"/> component that is associated with the process resource. /// </returns> public new static PackagingProcess Start(VirtualProcessStartInfo startInfo) { if (startInfo.Files.RegistryDatabase.Type != FileType.Database) { throw new ArgumentException("The destination file specified for the registry database is not valid.", "startInfo"); } var synchronizer = new ProcessSynchronizer(startInfo.WorkingDirectory, startInfo.FileSystemRuleCollection, startInfo.Files.RegistryDatabase, startInfo.RegistryRuleCollection); var process = new PackagingProcess(startInfo, synchronizer); process.Start(); return(process); }
/// <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> /// Initializes a new instance of <see cref="Packager"/>. /// </summary> /// <param name="applicationData">The data to base the packaging process on.</param> /// <param name="outputFolder">The location where the application must be packaged to.</param> public Packager(ApplicationData applicationData, string outputFolder) { var workingDirectory = new ApplicationFile(outputFolder); if (workingDirectory.Type != FileType.Directory) throw new ArgumentException("The value specified for the outputFolder is invalid.", "outputFolder"); _startInfo = new VirtualProcessStartInfo(applicationData, workingDirectory); _waitHandle = new AutoResetEvent(false); }
/// <summary> /// Initializes a new instance of <see cref="PackagingProcess"/>. /// </summary> /// <param name="startInfo"> /// The <see cref="VirtualProcessStartInfo"/> containing the information used to start the process with. /// </param> /// <param name="synchronizer"> /// The <see cref="ProcessSynchronizer"/> to use for data synchronization with the <see cref="VirtualizedProcess"/>. /// </param> private PackagingProcess(VirtualProcessStartInfo startInfo, IProcessSynchronizer synchronizer) : base(startInfo, synchronizer) { }
/// <summary> /// Initializes a new instance of <see cref="PackagingProcess"/>. /// </summary> /// <param name="startInfo"> /// The <see cref="VirtualProcessStartInfo"/> containing the information used to start the process with. /// </param> /// <param name="synchronizer"> /// The <see cref="ProcessSynchronizer"/> to use for data synchronization with the <see cref="VirtualizedProcess"/>. /// </param> private PackagingProcess(VirtualProcessStartInfo startInfo, IProcessSynchronizer synchronizer) : base(startInfo, synchronizer) { }