Ejemplo n.º 1
0
        private static bool getTargetOk(AlartInfo alartItem, RssItem ri, string type)
        {
            //var targetAi = new List<AlartInfo>();
            //for (var i = 0; i < aiList.Count; i++) {
            //	var alartItem = (AlartInfo)aiList[i];

            var isNosetComId = alartItem.communityId == "" ||
                               alartItem.communityId == null;
            var isNosetHostName = alartItem.hostName == "" ||
                                  alartItem.hostName == null;
            var isNosetKeyword = (alartItem.isCustomKeyword && alartItem.cki == null) ||
                                 (!alartItem.isCustomKeyword && alartItem.keyword == "" || alartItem.keyword == null);

            if (isNosetComId && isNosetHostName && isNosetKeyword)
            {
                return(false);
            }

            var isComOk     = alartItem.communityId == ri.comId || (alartItem.communityId == "official" && type == "official");
            var isUserOk    = alartItem.hostName == ri.hostName;
            var isKeywordOk = ri.isMatchKeyword(alartItem);

            if ((string.IsNullOrEmpty(alartItem.communityId) !=
                 string.IsNullOrEmpty(alartItem.communityName)) ||
                (string.IsNullOrEmpty(alartItem.hostId) !=
                 string.IsNullOrEmpty(alartItem.hostName)))
            {
                return(false);
            }

            if (!isAlartMatch(alartItem, isComOk,
                              isUserOk, isKeywordOk, isNosetComId,
                              isNosetHostName, isNosetKeyword))
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 2
0
        private static void setFavoriteFromAiList(List <AlartInfo> targetAi, RssItem ri, HistoryInfo hi)
        {
            while (true)
            {
                try
                {
                    foreach (var ai in targetAi)
                    {
                        if (!string.IsNullOrEmpty(ai.communityId))
                        {
                            if (ai.communityId == hi.communityId ||
                                (ai.communityId == "official" && ri.type == "official"))
                            {
                                if (hi.favorite.IndexOf("コミュニティID") == -1)
                                {
                                    if (hi.favorite != "")
                                    {
                                        hi.favorite += ",";
                                    }
                                    hi.favorite += "コミュニティID";
                                }
                                //							if (memo != "") memo += ",";
                                //							memo += ai.memo;
                                hi.textColor = ai.textColor;
                                hi.backColor = ai.backColor;
                            }
                            else
                            {
                                hi.isInListCom = false;
                            }
                        }
                        if (!string.IsNullOrEmpty(ai.hostId))
                        {
                            if (ai.hostName == hi.userName)
                            {
                                if (hi.favorite.IndexOf("ユーザー名?") == -1)
                                {
                                    if (hi.favorite != "")
                                    {
                                        hi.favorite += ",";
                                    }
                                    hi.favorite += "ユーザー名?";
                                }
                                //							if (memo != "") memo += ",";
                                //							memo += ai.memo;
                                hi.textColor = ai.textColor;
                                hi.backColor = ai.backColor;
                            }
                            else
                            {
                                hi.isInListUser = false;
                            }
                        }

                        if (!string.IsNullOrEmpty(ai.Keyword) && ri.isMatchKeyword(ai))
                        {
                            if (hi.favorite.IndexOf("キーワート:") == -1)
                            {
                                if (hi.favorite != "")
                                {
                                    hi.favorite += ",";
                                }
                                hi.favorite += "キーワート:" + ai.Keyword;
                            }
                            //							if (memo != "") memo += ",";
                            //							memo += ai.memo;
                            hi.textColor = ai.textColor;
                            hi.backColor = ai.backColor;
                        }
                    }
                    break;
                }
                catch (Exception e)
                {
                    util.debugWriteLine(e.Message + e.Source + e.StackTrace + e.TargetSite);
                    Thread.Sleep(1000);
                }
            }
        }
Ejemplo n.º 3
0
        private string getFavorite(SortableBindingList <AlartInfo> aiList, RssItem ri, string _favorite)
        {
            try
            {
                foreach (var ai in aiList)
                {
                    if (!getTargetOk(ai, ri, type))
                    {
                        continue;
                    }


                    if ((!string.IsNullOrEmpty(comId) && (comId == ai.communityId)) ||
                        (type == "official" && ai.communityId == "official"))
                    {
                        if (_favorite.IndexOf("コミュニティID") == -1)
                        {
                            if (_favorite != "")
                            {
                                _favorite += ",";
                            }
                            _favorite += "コミュニティID";
                        }
                        if (memo != "")
                        {
                            memo += ",";
                        }
                        memo     += ai.memo;
                        textColor = ai.textColor;
                        backColor = ai.backColor;
                    }
                    if (!string.IsNullOrEmpty(hostName) && hostName == ai.hostName)
                    {
                        if (_favorite.IndexOf("ユーザー名?") == -1)
                        {
                            if (_favorite != "")
                            {
                                _favorite += ",";
                            }
                            _favorite += "ユーザー名?";
                        }
                        if (memo != "")
                        {
                            memo += ",";
                        }
                        memo     += ai.memo;
                        textColor = ai.textColor;
                        backColor = ai.backColor;
                    }
                    if (!string.IsNullOrEmpty(ai.Keyword) && ri.isMatchKeyword(ai))
                    {
                        if (_favorite.IndexOf("キーワート:") == -1)
                        {
                            if (_favorite != "")
                            {
                                _favorite += ",";
                            }
                            _favorite += "キーワート:" + ai.Keyword;
                        }
                        if (memo != "")
                        {
                            memo += ",";
                        }
                        memo     += ai.memo;
                        textColor = ai.textColor;
                        backColor = ai.backColor;
                    }
                }
            }
            catch (Exception e)
            {
                util.debugWriteLine(e.Message + e.Source + e.StackTrace + e.TargetSite);
            }
            return(_favorite);
        }