예제 #1
0
        //public HistoryInfo(RssItem ri, SortableBindingList<AlartInfo> alartData, List<AlartInfo> targetAi)
        public HistoryInfo(RssItem ri, List <AlartInfo> targetAi = null)
        {
            this.dt            = DateTime.Parse(ri.pubDate);
            this.dtStr         = dt.ToString("yyyy/MM/dd HH:mm:ss");
            this.lvid          = ri.lvId;
            this.title         = util.removeTag(ri.title);
            this.userName      = ri.hostName == null ? "" : util.removeTag(ri.hostName);
            this.communityName = util.removeTag(ri.comName);
            this.userId        = ri.userId;
            this.communityId   = ri.comId;
            this.description   = util.removeTag(ri.description);
            this.type          = ri.type;
            //this.ri = ri;
            onAirMode         = ri.isMemberOnly ? 2 : 1;
            this.isMemberOnly = ri.isMemberOnly;
            this.isPayment    = ri.isPayment;

            if (targetAi != null)
            {
                setFavoriteFromAiList(targetAi, ri, this);
            }
            else
            {
                favorite = "Twitter";
            }
        }
예제 #2
0
        public void setPopupSize()
        {
            var thumbnailUrl = util.getJarPath()[0] + "/ImageCommunity/no thumb com.jpg";
            var ri           = new namaichi.info.RssItem("タイトル", "lv1000000",
                                                         DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"), "放送説明", "コミュニティ名",
                                                         "コミュニティID", "放送者名", thumbnailUrl, "true", "", false);

            popupSize = new Size[] { new PopupForm(ri, form.config, this, 0, null).Size,
                                     new SmallPopupForm(ri, form.config, this, 0, null).Size };
        }
예제 #3
0
        public LiveInfo(RssItem item,
                        //SortableBindingList<AlartInfo> alartData,
                        AlartInfo[] alartData,
                        config.config config,
                        AlartInfo[] userAlartData)
        {
            var ri = item;

            title        = ri.title;
            lvId         = ri.lvId;
            pubDateDt    = DateTime.Parse(ri.pubDate);
            description  = ri.description;
            thumbnail    = getThumbnail(ri.thumbnailUrl, config);
            thumbnailUrl = ri.thumbnailUrl;
            comName      = ri.comName;
            comId        = ri.comId;
            memberOnly   = ri.isMemberOnly ? "限定" : "";
            type         = ri.type;
            if (type == "user")
            {
                type = "community";
            }

            category = ri.category != null ? ri.category : new List <string>()
            {
                "一般(その他)"
            };

            hostName = ri.hostName;

            favorite = getFavorite(alartData, ri, favorite);
            favorite = getFavorite(userAlartData, ri, favorite);

            /*
             * var b = (byte[])new ImageConverter().ConvertTo(thumbnail, typeof(byte[]));
             * b = System.Text.Encoding.UTF8.GetBytes("あああああああああああああ");
             * byte[] outb;
             * using (var m = new MemoryStream()) {
             *      //m.Write(b, 0, b.Length);
             *      using (var d = new DeflateStream(m, CompressionMode.Compress, true)) {
             *              d.Write(b, 0, b.Length);
             *              d.Close();
             *              outb = m.ToArray();
             *      }
             *
             * }
             */
        }
예제 #4
0
        //public HistoryInfo(RssItem ri, SortableBindingList<AlartInfo> alartData, List<AlartInfo> targetAi)
        public HistoryInfo(RssItem ri, List <AlartInfo> targetAi)
        {
            this.dt            = DateTime.Parse(ri.pubDate);
            this.lvid          = ri.lvId;
            this.title         = util.removeTag(ri.title);
            this.userName      = ri.hostName == null ? "" : util.removeTag(ri.hostName);
            this.communityName = util.removeTag(ri.comName);
            this.userId        = ri.userId;
            this.communityId   = ri.comId;
            this.description   = util.removeTag(ri.description);
            //this.ri = ri;
            onAirMode = ri.isMemberOnly ? 2 : 1;


            setFavoriteFromAiList(targetAi, ri, this);
        }
예제 #5
0
        public void showTest(string poploc, int poptime,
                             bool isClickClose, bool isSmall,
                             bool isTopMost, bool isColor, double opacity)
        {
            var thumbnailUrl = util.getJarPath()[0] + "/ImageCommunity/no thumb com.jpg";
            var ri           = new namaichi.info.RssItem("タイトル", "lv1000000",
                                                         DateTime.Now.ToString(), "放送説明", "コミュニティ名",
                                                         "コミュニティID", "放送者名", thumbnailUrl, "true", "");

            popupSize = new Size[] { new PopupForm(ri, form.config, this, 0, null).Size,
                                     new SmallPopupForm(ri, form.config, this, 0, null).Size };

            var posI = 0;
            var pos  = getPos(isSmall, out posI, poploc,
                              true);

            form.DisplayPopup(ri, pos, isSmall, this, posI, null, true,
                              poploc, poptime, isClickClose,
                              isTopMost, isColor, opacity);
        }
예제 #6
0
 public RssItem getRssItem(string categoryName)
 {
     try {
         var thumb = getThumb();
         var pubDt = util.getUnixToDatetime(beginAt / 1000);
         var item  = new RssItem(title, id,
                                 pubDt.ToString("yyyy/MM/dd HH:mm:ss"), "", socialGroup.name, socialGroup.id,
                                 programProvider.name, thumb, isFollowerOnly, "", isPayProgram
                                 );
         item.setUserId(programProvider.id);
         item.category  = getCategoryName(categoryName);
         item.pubDateDt = pubDt;
         item.setTag(item.category.ToArray());
         item.type = providerType;
         return(item);
     } catch (Exception e) {
         util.debugWriteLine(e.Message + e.Source + e.StackTrace + e.TargetSite);
         return(null);
     }
 }
예제 #7
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);
        }
예제 #8
0
        public void showTest(string poploc, int poptime,
                             bool isClickClose, bool isSmall,
                             bool isTopMost, Color[] isColor, double opacity)
        {
            var thumbnailUrl = util.getJarPath()[0] + "/ImageCommunity/no thumb com.jpg";
            var ri           = new namaichi.info.RssItem("タイトル", "lv1000000",
                                                         DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"), "放送説明", "コミュニティ名",
                                                         "コミュニティID", "放送者名", thumbnailUrl, "true", "", false);

            try {
                popupSize = new Size[] { new PopupForm(ri, form.config, this, 0, null).Size,
                                         new SmallPopupForm(ri, form.config, this, 0, null).Size };

                var posI = 0;
                var pos  = getPos(isSmall, out posI, poploc,
                                  true);
                form.DisplayPopup(ri, pos, isSmall, this, posI, null, true,
                                  poploc, poptime, isClickClose,
                                  isTopMost, isColor, opacity);
            } catch (Exception e) {
                util.debugWriteLine(e.Message + e.Source + e.StackTrace + e.TargetSite);
            }
        }
예제 #9
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);
                }
            }
        }
예제 #10
0
        //byte[] deflateThumb = null;
        //Image testImg = null;

        public LiveInfo(List <KeyValuePair <string, string> > item, SortableBindingList <AlartInfo> alartData, config.config config, SortableBindingList <AlartInfo> userAlartData)
        {
            foreach (var l in item)
            {
                try
                {
                    if (l.Key == "title")
                    {
                        title = l.Value;
                    }
                    else if (l.Key == "guid")
                    {
                        lvId = l.Value;
                    }
                    else if (l.Key == "pubDate")
                    {
                        pubDateDt = DateTime.Parse(l.Value);
                    }
                    else if (l.Key == "description")
                    {
                        description = l.Value;
                    }
                    else if (l.Key == "category")
                    {
                        category.Add(l.Value);
                    }
                    else if (l.Key == "thumbnail")
                    {
                        thumbnail    = getThumbnail(l.Value, bool.Parse(config.get("liveListCacheIcon")));
                        thumbnailUrl = l.Value;
                    }
                    else if (l.Key == "community_name")
                    {
                        comName = l.Value;
                    }
                    else if (l.Key == "community_id")
                    {
                        comId = l.Value;
                    }
                    else if (l.Key == "member_only")
                    {
                        memberOnly = bool.Parse(l.Value) ? "限定" : "";
                    }
                    //else if (l.Key == "community_id") comId = l.Value;
                    else if (l.Key == "type")
                    {
                        type = l.Value;
                        if (type == "user")
                        {
                            type = "community";
                        }
                    }
                    else if (l.Key == "owner_name")
                    {
                        hostName = l.Value;
                    }
                    //else if (l.Key == "type") type = l.Value;
                    else
                    {
                        var pass = new string[] { "creator", "link",
                                                  "num_res", "view" };
                        if (Array.IndexOf(pass, l.Key) > -1)
                        {
                            continue;
                        }
                    }
                }
                catch (Exception e)
                {
                    util.debugWriteLine(e.Message + e.Source + e.StackTrace + e.TargetSite);
                }
            }
            var ri = new RssItem(title, lvId, "", description, comName, comId, hostName, thumbnailUrl, memberOnly, "");

            favorite = getFavorite(alartData, ri, favorite);
            favorite = getFavorite(userAlartData, ri, favorite);

            if (category == null)
            {
                util.debugWriteLine("not found category 11 " + lvId);
                category = new List <string>()
                {
                    "一般(その他)"
                };
            }

            //thumbnailUrl = getThumbnail(comId);



            //deflateThumb = b;
            //testImg = new Bitmap(thumbnail);
        }
예제 #11
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);
        }