internal string GetUserName()
 {
     if (this.Account == ServiceAccount.NetworkService)
     {
         return(@"NT AUTHORITY\NetworkService");
     }
     else if (this.Account == ServiceAccount.LocalSystem)
     {
         return("LocalSystem");
     }
     else if (this.Account == ServiceAccount.LocalService)
     {
         return(@"NT AUTHORITY\LocalService");
     }
     else
     {
         if (!UserName.IsNullOrWhiteSpace())
         {
             return(ChoEnvironment.ToDomainUserName(UserName));
         }
         else
         {
             ChoConsole.Write("Enter UserId: ");
             return(ChoEnvironment.ToDomainUserName(ChoConsole.ReadLine()));
         }
     }
 }
Example #2
0
 /// <summary>
 /// Reads the next line of characters from the standard input stream within the specified timeout period.
 /// </summary>
 /// <param name="timeoutInMilliSeconds">A System.TimeSpan that represents the number of milliseconds to wait, or a System.TimeSpan that represents -1 milliseconds to wait indefinitely.</param>
 /// <param name="defaultValue">A default value will be returned from this call when the timeout period elapsed while reading from console.</param>
 /// <param name="errMsg">A error message used to throw ChoTimeoutException when timeout happens while reading line from console and default value is not specified.</param>
 /// <returns>The next line of characters from the input stream, or null if no more lines</returns>
 public string ReadLine(int timeoutInMilliSeconds)
 {
     return(ChoConsole.ReadLine(timeoutInMilliSeconds));
 }
Example #3
0
 /// <summary>
 /// Reads the next line of characters from the standard input stream within the specified timeout period.
 /// </summary>
 /// <param name="timeoutInMilliSeconds">A System.TimeSpan that represents the number of milliseconds to wait, or a System.TimeSpan that represents -1 milliseconds to wait indefinitely.</param>
 /// <param name="defaultValue">A default value will be returned from this call when the timeout period elapsed while reading from console.</param>
 /// <param name="errMsg">A error message used to throw ChoTimeoutException when timeout happens while reading line from console and default value is not specified.</param>
 /// <returns>The next line of characters from the input stream, or null if no more lines</returns>
 public string ReadLine(int timeoutInMilliSeconds, string defaultValue, string errMsg)
 {
     return(ChoConsole.ReadLine(timeoutInMilliSeconds, defaultValue, errMsg));
 }
Example #4
0
 /// <summary>
 /// Reads the next line of characters from the standard input stream.
 /// </summary>
 public string ReadLine()
 {
     return(ChoConsole.ReadLine());
 }