private void WikiFindMatch(Dictionary <string, List <string> > dicNameList)
        {
            foreach (var kvp in dicNameList)
            {
                string content;
                using (var client = new WebClient())
                {
                    client.Encoding = Encoding.GetEncoding("EUC-JP");
                    content         = client.DownloadString(kvp.Key);
                }

                //最後一行li沒有換行
                var   listExpress = "(?<list>(<li class=\"pcmt\">.*</li>))";
                Regex regex       = new Regex(listExpress);
                //li用
                var liExpress = "<input.*>.*(?<matchid>([a-zA-Z0-9]){8}).*.*--.*<span class=\"comment_date\">(?<date>.*)<span";
                var liRegex   = new Regex(liExpress);

                var matches = regex.Matches(content);
                foreach (Match match in matches)
                {
                    var listGroup = match.Groups["list"];
                    foreach (Capture capture in listGroup.Captures)
                    {
                        foreach (var item in kvp.Value)
                        {
                            if (capture.Value.Contains(item))
                            {
                                foreach (Match liMatch in liRegex.Matches(capture.Value))
                                {
                                    //把曜日處理掉
                                    var   matchDtString = liMatch.Groups["date"].Value;
                                    Regex regDay        = new Regex(@"\(\w\)");
                                    matchDtString = regDay.Replace(matchDtString, string.Empty);
                                    var matchId = liMatch.Groups["matchid"].Value;

                                    DateTime matchDt = DateTime.MinValue;
                                    if (!string.IsNullOrWhiteSpace(matchId))
                                    {
                                        if (DateTime.TryParse(matchDtString, out matchDt))
                                        {
                                            if (matchDt.CompareTo(_lastMatchTime) > 0)
                                            {
                                                OnBattleFound?.Invoke(matchId, item, string.Empty);
                                                _lastMatchTime = matchDt;
                                            }
                                        }
                                        else
                                        {
                                            WriteLog($" date convert error. {matchDtString}");
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        private void ExecuteTwitterFinder(List <MultiBattleDefine> selectedBattles)
        {
            ExceptionHandler.SwallowWebExceptions = false;
            try
            {
                string consumerKey       = ConfigurationManager.AppSettings["ConsumerKey"];
                string consumerSecret    = ConfigurationManager.AppSettings["ConsumerSecret"];
                string accessToken       = ConfigurationManager.AppSettings["AccessToken"];
                string accessTokenSecret = ConfigurationManager.AppSettings["AccessTokenSecret"];

                Auth.SetUserCredentials(consumerKey, consumerSecret, accessToken, accessTokenSecret);

                TweetinviEvents.QueryBeforeExecute += (sender, args) =>
                {
                    //Console.WriteLine(args.QueryURL);
                };

                _twitterStream = Stream.CreateFilteredStream();

                //加入等級Filter
                selectedBattles.Select(s => s.Level).Distinct().ForEach(e =>
                {
                    _twitterStream.AddTrack("Lv" + e);
                });
                //加入名字Filter 降低通知頻率(中間名字有符號的會捉不到,放棄)
                //selectedBattles.ForEach(e =>
                //{
                //    _twitterStream.AddTrack("Lv" + e.BattleLevel + " " + e.Value);
                //});
                _twitterStream.AddTweetLanguageFilter(LanguageFilter.Japanese);


                //組合name的pattern
                string namePatternString = $"(?<name>{string.Join("|", selectedBattles.Select(s => $"Lv{s.Level}\\s*{s.Value}"))})";
                Regex  pattern           = new Regex(@"参戦ID:(?<matchid>([a-zA-Z0-9]){8})\s*" + namePatternString);

                //取得ID和名字
                //Regex pattern = new Regex(@"参戦ID:(?<matchid>([a-zA-Z0-9]){8})\s*Lv\d{2,3}\s(?<name>\w*)");

                _twitterStream.MatchingTweetReceived += (sender, args) =>
                {
                    var tweet = args.Tweet;
                    var match = pattern.Match(tweet.FullText);
                    if (match.Success)
                    {
                        OnBattleFound?.Invoke(match.Groups["matchid"].ToString(), match.Groups["name"].ToString(), string.Empty);
                    }
                    //else
                    //{
                    //    WriteLog("Not matched");
                    //}
                };
                _twitterStream.StartStreamMatchingAnyCondition();

                //var SStatus = _twitterStream.StreamState;

                if (_twitterStream.StreamState == StreamState.Stop)
                {
                    WriteLog(" stopped!");
                }
            }
            catch (TwitterException ex)
            {
                WriteLog(ex.ToString());
            }
            finally
            {
                if (null != _twitterStream && _twitterStream.StreamState != StreamState.Stop)
                {
                    _twitterStream.StopStream();
                    WriteLog(" Auto stopped!");
                }
            }
        }