Beispiel #1
0
        /// <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);
        }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of <see cref="VirtualizedProcess"/>,
 /// using the <see cref="ProcessSynchronizer"/> specified.
 /// </summary>
 /// <param name="startInfo">
 /// The <see cref="VirtualProcessStartInfo"/> containing the information used to start the process with.
 /// </param>
 /// <param name="processSynchronizer">
 /// The <see cref="IProcessSynchronizer"/> to use for data synchronization with the <see cref="VirtualizedProcess"/>.
 /// </param>
 protected VirtualizedProcess(VirtualProcessStartInfo startInfo, IProcessSynchronizer processSynchronizer)
 {
     _exitEventSyncRoot = new object();
     _startInfo         = startInfo;
     _connection        = new ConnectionManager(processSynchronizer);
     _gacManager        = new GacManager(startInfo.Files.Executable.FileName,
                                         HostCore.Configuration.Application.LibsToShare);
 }
Beispiel #3
0
 /// <summary>
 /// Initializes a new instance of <see cref="VirtualizedProcess"/>,
 /// using a default <see cref="ProcessSynchronizer"/> based on the specified <see cref="VirtualProcessStartInfo"/>.
 /// </summary>
 /// <param name="startInfo">
 /// The <see cref="VirtualProcessStartInfo"/> containing the information used to start the process with.
 /// </param>
 protected VirtualizedProcess(VirtualProcessStartInfo startInfo)
     : this(startInfo, new ProcessSynchronizer(startInfo.Files.RootDirectory, startInfo.FileSystemRuleCollection,
                                               startInfo.Files.RegistryDatabase, startInfo.RegistryRuleCollection))
 {
 }
 /// <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;
 }
 /// <summary>
 /// Initializes a new instance of <see cref="VirtualizedProcess"/>,
 /// using the <see cref="ProcessSynchronizer"/> specified.
 /// </summary>
 /// <param name="startInfo">
 /// The <see cref="VirtualProcessStartInfo"/> containing the information used to start the process with.
 /// </param>
 /// <param name="processSynchronizer">
 /// The <see cref="IProcessSynchronizer"/> to use for data synchronization with the <see cref="VirtualizedProcess"/>.
 /// </param>
 protected VirtualizedProcess(VirtualProcessStartInfo startInfo, IProcessSynchronizer processSynchronizer)
 {
   _exitEventSyncRoot = new object();
   _startInfo = startInfo;
   _connection = new ConnectionManager(processSynchronizer);
   _gacManager = new GacManager(startInfo.Files.Executable.FileName,
                                HostCore.Configuration.Application.LibsToShare);
 }
 /// <summary>
 /// Initializes a new instance of <see cref="VirtualizedProcess"/>,
 /// using a default <see cref="ProcessSynchronizer"/> based on the specified <see cref="VirtualProcessStartInfo"/>.
 /// </summary>
 /// <param name="startInfo">
 /// The <see cref="VirtualProcessStartInfo"/> containing the information used to start the process with.
 /// </param>
 protected VirtualizedProcess(VirtualProcessStartInfo startInfo)
   : this(startInfo, new ProcessSynchronizer(startInfo.Files.RootDirectory, startInfo.FileSystemRuleCollection,
                                             startInfo.Files.RegistryDatabase, startInfo.RegistryRuleCollection))
 {
 }