Ejemplo n.º 1
0
        //-------------------------------------------------------------
        // 概要:スレッド一覧解析
        // 詳細:subject.txtからスレッド一覧情報を作成する
        //-------------------------------------------------------------
        protected override List<ThreadInfo> AnalyzeSubjectText(string[] lines)
        {
            Logger.Instance.DebugFormat("AnalyzeSubjectText(lines:{0})", lines);

            List<ThreadInfo> threadList = new List<ThreadInfo>();

            foreach (string line in lines)
            {
                // 行末はスルー
                if (String.IsNullOrEmpty(line))
                    continue;

                Regex regex = new Regex(@"(?<threadNo>[0-9]+)\.dat<>(?<threadTitle>.+)\((?<resCount>[0-9]+)\)");
                Match match = regex.Match(line);

                // 正規表現がヒットしなければスルー
                if (match.Success == false) { continue; }

                // データ抽出
                string threadNo = match.Groups["threadNo"].Value;
                string resCount = match.Groups["resCount"].Value;
                double days = BbsUtil.GetThreadSince(threadNo);
                ThreadInfo threadInfo = new ThreadInfo(BbsInfo)
                {
                    ThreadNo = threadNo,
                    ThreadTitle = match.Groups["threadTitle"].Value.Trim(),
                    ResCount = int.Parse(resCount),
                    ThreadSpeed = BbsUtil.GetThreadSpeed(days, resCount),
                    ThreadSince = days
                };
                threadList.Add(threadInfo);
            }
            // 1002レス以上のスレッドがあれば最大レス数を10000として扱う
            BbsInfo.ThreadStop = threadList.Any(x => x.ResCount >= 1002) ? 10000 : 1000;

            return threadList;
        }
Ejemplo n.º 2
0
        //-------------------------------------------------------------
        // 概要:スレッド一覧解析
        // 詳細:subject.txtからスレッド一覧情報を作成する
        //-------------------------------------------------------------
        protected override List<ThreadInfo> AnalyzeSubjectText(string[] lines)
        {
            Logger.Instance.DebugFormat("AnalyzeSubjectText(lines:{0})", lines);

            List<ThreadInfo> threadList = new List<ThreadInfo>();

            foreach (string line in lines)
            {
                // 行末はスルー
                if (String.IsNullOrEmpty(line))
                    continue;

                Regex regex = new Regex(@"(?<threadNo>[0-9]+)\.cgi,(?<threadTitle>.+)\((?<resCount>[0-9]+)\)");
                Match match = regex.Match(line);

                // 正規表現がヒットしなければスルー
                if (match.Success == false) { continue; }

                // データ抽出
                string threadNo = match.Groups["threadNo"].Value;
                string resCount = match.Groups["resCount"].Value;
                double days = BbsUtil.GetThreadSince(threadNo);
                ThreadInfo threadInfo = new ThreadInfo
                {
                    ThreadNo = threadNo,
                    ThreadTitle = match.Groups["threadTitle"].Value.Trim(),
                    ResCount = int.Parse(resCount),
                    ThreadSpeed = BbsUtil.GetThreadSpeed(days, resCount),
                    ThreadSince = days
                };
                threadList.Add(threadInfo);
            }

            // 末尾を削除(不要なデータ)
            if (threadList.Count > 0)
            {
                threadList.RemoveAt(threadList.Count - 1);
            }

            return threadList;
        }