private string FillArgs(HeymanCommand command,string message) { return command.Arguments. Replace("$MESSAGE", message). Replace("$USER_ID", _user.Id). Replace("$USER_NAME", _user.Name); }
private string FillArgs(HeymanCommand command, string message) { return(command.Arguments. Replace("$MESSAGE", message). Replace("$USER_ID", _user.Id). Replace("$USER_NAME", _user.Name)); }
protected override void PrintHelp(string user, string unknownMessgae, HeymanCommand[] avalableComamnds) { var sb = new StringBuilder(); sb.AppendLine(_localization.HelpHeader); foreach (var heymanCommand in avalableComamnds) { sb.AppendLine(string.Format("'{0}' : {1}", heymanCommand.Title, heymanCommand.Description)); } InternalSendMessage(user, sb.ToString()); }
public void Run(HeymanCommand command,string message) { _endLine = command.EndLine; _proc.StartInfo.FileName = command.FileName; _proc.StartInfo.UseShellExecute = false; _proc.StartInfo.CreateNoWindow = true; if (!string.IsNullOrWhiteSpace(command.UserName)) _proc.StartInfo.UserName = command.UserName; _proc.StartInfo.Arguments = FillArgs(command,message); _proc.StartInfo.RedirectStandardOutput = true; _proc.StartInfo.RedirectStandardInput = true; _proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; _proc.StartInfo.WorkingDirectory = !string.IsNullOrWhiteSpace(command.WorkingDirectory) ? command.WorkingDirectory : AppDomain.CurrentDomain.BaseDirectory; _proc.OutputDataReceived += OnOutputStreamRecived; _proc.Start(); _proc.BeginOutputReadLine(); _proc.StandardInput.AutoFlush = true; }
public void Run(HeymanCommand command, string message) { _endLine = command.EndLine; _proc.StartInfo.FileName = command.FileName; _proc.StartInfo.UseShellExecute = false; _proc.StartInfo.CreateNoWindow = true; if (!string.IsNullOrWhiteSpace(command.UserName)) { _proc.StartInfo.UserName = command.UserName; } _proc.StartInfo.Arguments = FillArgs(command, message); _proc.StartInfo.RedirectStandardOutput = true; _proc.StartInfo.RedirectStandardInput = true; _proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; _proc.StartInfo.WorkingDirectory = !string.IsNullOrWhiteSpace(command.WorkingDirectory) ? command.WorkingDirectory : AppDomain.CurrentDomain.BaseDirectory; _proc.OutputDataReceived += OnOutputStreamRecived; _proc.Start(); _proc.BeginOutputReadLine(); _proc.StandardInput.AutoFlush = true; }
protected HeymanBase(HeymanCommand[] commands) { if (commands == null) throw new ArgumentNullException("commands"); _commands = commands; }
protected abstract void PrintHelp(string user, string unknownMessgae, HeymanCommand[] avalableComamnds);