コード例 #1
0
ファイル: HeymanTalk.cs プロジェクト: ErwinCat/heyman
 private string FillArgs(HeymanCommand command,string message)
 {
     return command.Arguments.
         Replace("$MESSAGE", message).
         Replace("$USER_ID", _user.Id).
         Replace("$USER_NAME", _user.Name);
 }
コード例 #2
0
 private string FillArgs(HeymanCommand command, string message)
 {
     return(command.Arguments.
            Replace("$MESSAGE", message).
            Replace("$USER_ID", _user.Id).
            Replace("$USER_NAME", _user.Name));
 }
コード例 #3
0
ファイル: XmppHeyman.cs プロジェクト: ErwinCat/heyman
        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());
        }
コード例 #4
0
ファイル: HeymanTalk.cs プロジェクト: ErwinCat/heyman
        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;
        }
コード例 #5
0
        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;
        }
コード例 #6
0
ファイル: HeymanBase.cs プロジェクト: ErwinCat/heyman
 protected HeymanBase(HeymanCommand[] commands)
 {
     if (commands == null) throw new ArgumentNullException("commands");
     _commands = commands;
 }
コード例 #7
0
ファイル: HeymanBase.cs プロジェクト: ErwinCat/heyman
 protected abstract void PrintHelp(string user, string unknownMessgae, HeymanCommand[] avalableComamnds);