Exemplo n.º 1
0
        /// <summary>
        /// Constructs the AppDomain for the given executable by using it's path for the base directory and configuraiton file.
        /// </summary>
        public AssemblyRunner(string executable)
        {
            _executable = ProcessRunner.FindFullPath(executable);
            AppDomainSetup setup = new AppDomainSetup();

            setup.ApplicationBase   = Path.GetDirectoryName(_executable);
            setup.ApplicationName   = Path.GetFileNameWithoutExtension(_executable);
            setup.ConfigurationFile = _executable + ".config";
            _workerDomain           = AppDomain.CreateDomain(setup.ApplicationName, AppDomain.CurrentDomain.Evidence, setup);
        }
Exemplo n.º 2
0
        private TempFile SetExePath(string script)
        {
            _executable = script.Trim();
            _executable = Environment.ExpandEnvironmentVariables(_executable);
            if (!Path.IsPathRooted(_executable))
            {
                if (File.Exists(_executable))
                {
                    _executable = Path.GetFullPath(_executable);
                }
                else
                {
                    _executable = ProcessRunner.FindFullPath(_executable);
                }
            }

            _fileExtension = Path.GetExtension(script.Trim());

            TempFile temp = new TempFile();

            temp.Delete();
            return(temp);
        }