private void RunCustomCommands(string weiboId, string command) { var splitCommand = command.Split(' ')[0]; NotifyIcon.Text = @"检查自定义命令..."; DebugPrintHelper("当前状态:检查自定义命令..."); try { _repo = new CommandRepository(Global.ConnectionString); var cmd = _repo.FindOne(splitCommand.ToLower()); if(cmd != null && !string.IsNullOrEmpty(cmd.File)) { SendComment(weiboId, string.Format("#PC遥控器#正在为您执行您的自定义命令: {0}。", command)); var optionsCommand = command.Remove(0, splitCommand.Length); while (optionsCommand.StartsWith(" ")) { optionsCommand = optionsCommand.Remove(0, 1); } DebugPrintHelper(string.Format("当前执行的自定义命令为: \"{0} {1}\"", cmd.File, optionsCommand)); Process.Start(cmd.File, optionsCommand); SendComment(weiboId, "#PC遥控器#执行自定义命令完成。"); } } catch (Exception ex) { DebugPrintHelper(ex.Message); SendComment(weiboId, "执行自定义命令出错。请过一会重试。"); } }