예제 #1
0
        protected override bool CanLaunch(IArgumentHintResolver hintResolver)
        {
            string resolvedArgument = hintResolver.Resolve(this.Arguments, _allowMultiValueFields, " ");

            if (resolvedArgument == null)
            {
                return(false);
            }
            return(true);
        }
예제 #2
0
 private bool TryCanLaunch(IArgumentHintResolver hintResolver)
 {
     try
     {
         return(this.CanLaunch(hintResolver));
     }
     finally
     {
         hintResolver.Dispose();
     }
 }
예제 #3
0
파일: ExternalBase.cs 프로젝트: nhannd/Xian
		private bool TryCanLaunch(IArgumentHintResolver hintResolver)
		{
			try
			{
				return this.CanLaunch(hintResolver);
			}
			finally
			{
				hintResolver.Dispose();
			}
		}
예제 #4
0
 private bool TryPerformLaunch(IArgumentHintResolver hintResolver)
 {
     try
     {
         return(this.PerformLaunch(hintResolver));
     }
     catch (Exception ex)
     {
         // if the sub class doesn't handle the exception, throw it
         if (!HandleLaunchException(ex))
         {
             throw;
         }
         return(false);
     }
     finally
     {
         hintResolver.Dispose();
     }
 }
예제 #5
0
        protected override bool PerformLaunch(IArgumentHintResolver hintResolver)
        {
            string multiValueSeparator = _multiValueFieldSeparator;

            if (string.IsNullOrEmpty(multiValueSeparator))
            {
                multiValueSeparator = " ";
            }

            var command          = ExpandEnvironmentVariables(_command);
            var workingDirectory = ExpandEnvironmentVariables(_workingDirectory);
            var arguments        = ExpandEnvironmentVariables(_arguments);

            command          = hintResolver.Resolve(command, _allowMultiValueFields, multiValueSeparator);
            workingDirectory = hintResolver.Resolve(workingDirectory, _allowMultiValueFields, multiValueSeparator);
            arguments        = hintResolver.Resolve(arguments, _allowMultiValueFields, multiValueSeparator);

            ProcessStartInfo nfo;

            if (string.IsNullOrEmpty(arguments))
            {
                nfo = new ProcessStartInfo(command);
            }
            else
            {
                nfo = new ProcessStartInfo(command, arguments);
            }
            if (Directory.Exists(workingDirectory))
            {
                nfo.WorkingDirectory = workingDirectory;
            }

            switch (base.WindowStyle)
            {
            case WindowStyle.Minimized:
                nfo.WindowStyle = ProcessWindowStyle.Minimized;
                break;

            case WindowStyle.Maximized:
                nfo.WindowStyle = ProcessWindowStyle.Maximized;
                break;

            case WindowStyle.Hidden:
                nfo.WindowStyle = ProcessWindowStyle.Hidden;
                break;

            case WindowStyle.Normal:
            default:
                nfo.WindowStyle = ProcessWindowStyle.Normal;
                break;
            }

            if (!string.IsNullOrEmpty(this._username))
            {
                nfo.UserName = this._username;
                nfo.Domain   = this._domain;
                nfo.Password = this._password;
            }
            nfo.UseShellExecute = false;

            Process process = new Process();

            process.StartInfo = nfo;

            Platform.Log(LogLevel.Debug, "Command Line Execute: {2}> {0} {1}", nfo.FileName, nfo.Arguments, nfo.WorkingDirectory);

            bool result = process.Start();

            if (_waitForExit)
            {
                process.WaitForExit();
                process.Dispose();
            }

            return(result);
        }
예제 #6
0
 protected override bool CanLaunch(IArgumentHintResolver hintResolver)
 {
     throw new NotSupportedException();
 }
예제 #7
0
 protected abstract bool PerformLaunch(IArgumentHintResolver hintResolver);
예제 #8
0
 protected abstract bool CanLaunch(IArgumentHintResolver hintResolver);
예제 #9
0
		protected abstract bool PerformLaunch(IArgumentHintResolver hintResolver);
예제 #10
0
		protected abstract bool CanLaunch(IArgumentHintResolver hintResolver);
예제 #11
0
		private bool TryPerformLaunch(IArgumentHintResolver hintResolver)
		{
			try
			{
				return this.PerformLaunch(hintResolver);
			}
			catch (Exception ex)
			{
				// if the sub class doesn't handle the exception, throw it
				if (!HandleLaunchException(ex))
					throw;
				return false;
			}
			finally
			{
				hintResolver.Dispose();
			}
		}