internal string GetPassword() { if (this.Account == ServiceAccount.NetworkService) { return(String.Empty); } else if (this.Account == ServiceAccount.LocalSystem) { return(String.Empty); } else if (this.Account == ServiceAccount.LocalService) { return(String.Empty); } else { if (!UserName.IsNullOrWhiteSpace()) { return(Password); } else { ChoConsole.Write("Enter Password: "); return(ChoConsole.ReadPassword()); } } }
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())); } } }
private void SetStatusMsg(string statusMsg) { if (statusMsg != null && statusMsg.Length > _consolePercentageProgressorSettings.ProgressBarStatusMsgSize) { statusMsg = statusMsg.Substring(0, _consolePercentageProgressorSettings.ProgressBarStatusMsgSize); } ChoConsole.Write(statusMsg.PadRight(_consolePercentageProgressorSettings.ProgressBarStatusMsgSize), _statusMsgLocation, _consolePercentageProgressorSettings.ProgressBarStatusMsgForegroundColor, _consolePercentageProgressorSettings.ProgressBarStatusMsgBackgroundColor); }
public void Write(string msg) { if (HasPositionSpecified) { ChoConsole.Write(msg, _cursorLeft.Value, _cursorTop.Value, _foregroundColor, _backgroundColor); } else { ChoConsole.Write(msg, _foregroundColor, _backgroundColor); } }
public void StartFileCopy(string sourceDirectory = null, string destDirectory = null) { try { ChoAppSettings appSettings = new ChoAppSettings(); if (!SettingsFilePath.IsNullOrWhiteSpace()) { if (!File.Exists(SettingsFilePath)) { throw new ArgumentException("Can't find '{0}' settings file.".FormatString(SettingsFilePath)); } appSettings.LoadXml(File.ReadAllText(SettingsFilePath)); } ChoConsole.WriteLine(); ChoRoboCopyManager _roboCopyManager = new ChoRoboCopyManager(SettingsFilePath); _roboCopyManager.Status += (sender, e) => { ChoTrace.Write(e.Message); ChoConsole.Write(e.Message, ConsoleColor.Yellow); }; _roboCopyManager.AppStatus += (sender, e) => { ChoTrace.Write(e.Message); ChoConsole.Write(e.Message, ConsoleColor.Yellow); }; _roboCopyManager.Process(appSettings.RoboCopyFilePath, appSettings.GetCmdLineParams(), appSettings, true); } catch (ThreadAbortException) { Console.WriteLine("RoboCopy operation cancelled by user."); } catch (Exception ex) { Console.WriteLine("RoboCopy operation failed." + Environment.NewLine + ChoApplicationException.ToString(ex)); } }