示例#1
0
        public MatchingThread Resolve(ChannelInfo channelInfo)
        {
            ushort networkId = channelInfo.NetworkId, serviceId = channelInfo.ServiceId;

            if (networkId == 0)
            {
                //録画ファイルなどではネットワークIDが分からないのでサービスIDだけで検索
                //BSとCSの間ではサービスIDが重複する可能性があるがほとんどないので割り切る
                foreach (ChannelEntry channel in channelDatabase.GetByServiceId(serviceId))
                {
                    MatchingThread ret = boardDatabase.GetMatchingThreadForChannel(channel);
                    if (ret != null)
                    {
                        return(ret);
                    }
                }
                return(null);
            }
            else
            {
                ChannelEntry channel = channelDatabase.GetByNetworkIdAndServiceId(networkId, serviceId);//channels.txtの登録チャンネルに解決
                if (channel == null)
                {
                    return(null);
                }
                return(boardDatabase.GetMatchingThreadForChannel(channel));
            }
        }
示例#2
0
        public MatchingThread Resolve(ChannelInfo channelInfo, bool ignoreMainThreadTitleKeywords)
        {
            MatchingThread getMatchingThread(ChannelEntry channel)
            {
                if (!ignoreMainThreadTitleKeywords)
                {
                    return(this.boardDatabase.GetMatchingThread(channel));
                }
                else
                {
                    ThreadMappingRuleEntry ruleEntry = this.boardDatabase.GetMatchingThreadMappingRuleEntry(channel);
                    if (ruleEntry == null)
                    {
                        return(null);
                    }
                    BoardEntry boardEntry = this.boardDatabase.GetBoardEntryById(ruleEntry.BoardId);
                    if (boardEntry == null)
                    {
                        return(null);
                    }
                    return(new MatchingThread(boardEntry.Title, boardEntry.Uri, ruleEntry.ThreadTitleKeywords));
                }
            }

            ushort networkId = channelInfo.NetworkId, serviceId = channelInfo.ServiceId;

            if (networkId == 0)
            {
                //録画ファイルなどではネットワークIDが分からないのでサービスIDだけで検索
                //BSとCSの間ではサービスIDが重複する可能性があるがほとんどないので割り切る
                foreach (ChannelEntry channel in channelDatabase.GetByServiceId(serviceId))
                {
                    MatchingThread ret = getMatchingThread(channel);
                    if (ret != null)
                    {
                        return(ret);
                    }
                }
                return(null);
            }
            else
            {
                ChannelEntry channel = channelDatabase.GetByNetworkIdAndServiceId(networkId, serviceId);//channels.txtの登録チャンネルに解決
                if (channel == null)
                {
                    return(null);
                }
                return(getMatchingThread(channel));
            }
        }
示例#3
0
        private static IEnumerable <MatchingThread> GetMatchingThreads(AnalysisResult olderDump, AnalysisResult newerDump)
        {
            Log.Verbose("Determine matching threads");

            var matchingThreads = new List <MatchingThread>();

            foreach (var threadFromOlder in olderDump.Threads)
            {
                var threadFromNewer = newerDump.Threads.FirstOrDefault(t => t.OsThreadId == threadFromOlder.OsThreadId);
                if (threadFromNewer == null)
                {
                    continue;
                }

                var matchingFrames   = new List <StackFrameInfo>();
                var isFullTraceMatch = threadFromOlder.StackFrameInfos.Any();
                foreach (var frameInfo in threadFromOlder.StackFrameInfos)
                {
                    var matchingFrame = threadFromNewer.StackFrameInfos.FirstOrDefault(info =>
                                                                                       info.InstructionPointer == frameInfo.InstructionPointer);

                    if (matchingFrame == null)
                    {
                        isFullTraceMatch = false;
                        continue;
                    }

                    matchingFrames.Add(matchingFrame);
                }

                var matchingThread = new MatchingThread
                {
                    ThreadFromOlder  = threadFromOlder,
                    ThreadFromNewer  = threadFromNewer,
                    MatchingFrames   = matchingFrames,
                    IsFullTraceMatch = isFullTraceMatch
                };
                matchingThreads.Add(matchingThread);
            }

            return(matchingThreads);
        }