Example #1
0
        public addForm(MainForm form, string id, AlartInfo editAi = null, bool isUserMode = false)
        {
            this.form       = form;
            this.editAi     = editAi;
            this.isUserMode = isUserMode;

            dataSource = isUserMode ? form.userAlartListDataSource : form.alartListDataSource;
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();
            if (editAi != null)
            {
                setEditModeDisplay(editAi);

                if (isUserMode)
                {
                    setUserModeForm();
                }
                return;
            }

            //
            // TODO: Add constructor code after the InitializeComponent() call.
            //
            setDefaultBehavior();

            if (id == null)
            {
                if (isUserMode)
                {
                    setUserModeForm();
                }
                return;
            }

            if (id.StartsWith("lv"))
            {
                hosoIdText.Text = id;
            }
            else if (id.StartsWith("c"))
            {
                if (bool.Parse(form.config.get("IsdragCom")))
                {
                    hosoIdText.Text = id;
                }
                communityId.Text = id;
            }
            else
            {
                userIdText.Text = id;
            }

            if (isUserMode)
            {
                //communityId.Text = communityNameText.Text = "";
                //keywordText.Text = "";
                setUserModeForm();
            }
        }
Example #2
0
        private void setMemberOnlyListInit(AlartInfo editAi)
        {
            var c = editAi.memberOnlyMode;

            if (editAi.memberOnlyMode == null)
            {
                editAi.memberOnlyMode = "True,True,True";
            }
            if (c.IndexOf(",") == -1)
            {
                if (c == "0")
                {
                    editAi.memberOnlyMode = "True,True,True";
                }
                else if (c == "1")
                {
                    editAi.memberOnlyMode = "True,False,False";
                }
                else if (c == "2")
                {
                    editAi.memberOnlyMode = "False,True,True";
                }
            }

            var types = editAi.memberOnlyMode.Split(',');

            memberOnlyCheckList.SetItemChecked(1, bool.Parse(types[0]));
            memberOnlyCheckList.SetItemChecked(2, bool.Parse(types[1]));
            memberOnlyCheckList.SetItemChecked(3, bool.Parse(types[2]));
            if (memberOnlyCheckList.CheckedIndices.Count == 3)
            {
                memberOnlyCheckList.SetItemChecked(0, true);
            }
            closeMemberOnlyList();
        }
Example #3
0
        private void bulkAddFromFollowCom(ToolMenuLock _lock, List <string[]> addList, int allNum, bool[] followMode)
        {
            var mainFollowList = new FollowChecker(form, form.check.container)
                                 .getFollowList(followMode);
            var behaviors = form.config.get("defaultBehavior").Split(',').Select <string, bool>(x => x == "1").ToArray();
            var textColor = ColorTranslator.FromHtml(form.config.get("defaultTextColor"));
            var backColor = ColorTranslator.FromHtml(form.config.get("defaultBackColor"));
            int got = 0, error = 0;

            for (var i = 0; i < addList.Count; i++)
            {
                var id = addList[i];
                if (bulkAddFromFollowComLock != _lock)
                {
                    util.showModelessMessageBox("参加コミュ一括登録が中断されました", "", form);
                    setToolMenuStatusBar();
                    return;
                }
                var isUser    = id[0].StartsWith("c");
                var comId     = isUser ? id[0] : "";
                var comName   = isUser ? id[1] : "";
                var comFollow = (!isUser && mainFollowList.Find((x) => id[0] == x[0]) != null) ?
                                "フォロー解除する" : "フォローする";
                if (comId == "")
                {
                    comFollow = "";
                }
                var userId     = isUser ? "" : id[0];
                var userName   = isUser ? "" : id[1];
                var userFollow = (isUser && mainFollowList.Find((x) => id[0] == x[0]) != null) ?
                                 "フォロー解除する" : "フォローする";
                if (userId == "")
                {
                    userFollow = "";
                }

                var now = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                var ai  = new AlartInfo(comId, userId,
                                        comName, userName, "", now, false, false,
                                        false, false, false, false, false,
                                        false, false, false, false, false,
                                        false, false, false, "",
                                        comFollow, userFollow, "", "");
                ai.setBehavior(behaviors);
                ai.textColor = textColor;
                ai.backColor = backColor;
                form.formAction(() =>
                                form.alartListDataSource.Add(ai)
                                );
                got++;
                _lock.end = i;
                setToolMenuStatusBar();
                //Thread.Sleep(2000);
            }
            util.showModelessMessageBox("新規登録:" + got + " 登録済み:" + (allNum - got) + " エラー:" + error, "参加コミュ登録完了", form);
            bulkAddFromFollowComLock = null;
            setToolMenuStatusBar();
            form.changedListContent();
        }
Example #4
0
        private string getMemberOnly()
        {
            var ret = "";

            for (var i = 1; i < memberOnlyCheckList.Items.Count; i++)
            {
                if (i != 1)
                {
                    ret += ",";
                }
                ret += memberOnlyCheckList.CheckedIndices.IndexOf(i) > -1;
            }
            return(Array.IndexOf(ret.Split(','), "True") == -1 ? null : ret);
        }
Example #5
0
        public void show(RssItem ri, AlartInfo ai)
        {
            if (popupSize == null)
            {
                setPopupSize();
            }

            var isSmall = bool.Parse(form.config.get("Issmallpopup"));
            var posI    = 0;
            var pos     = getPos(isSmall, out posI, form.config.get("poploc"),
                                 bool.Parse(form.config.get("Isfixpopup")));

            util.debugWriteLine("popupDisplay posI " + posI + " pos " + pos + " " + ri.lvId);
            //test
//			if (posList.Count > 10) return;
            form.DisplayPopup(ri, pos, isSmall, this, posI, ai);
        }
Example #6
0
 private void setNamarokuRead(AlartInfo ai, string namarokuRecRead)
 {
     if (namarokuRecRead == "appliA")
     {
         ai.appliA = true;
     }
     else if (namarokuRecRead == "appliB")
     {
         ai.appliB = true;
     }
     else if (namarokuRecRead == "appliC")
     {
         ai.appliC = true;
     }
     else if (namarokuRecRead == "appliD")
     {
         ai.appliD = true;
     }
     else if (namarokuRecRead == "appliE")
     {
         ai.appliE = true;
     }
     else if (namarokuRecRead == "appliF")
     {
         ai.appliF = true;
     }
     else if (namarokuRecRead == "appliG")
     {
         ai.appliG = true;
     }
     else if (namarokuRecRead == "appliH")
     {
         ai.appliH = true;
     }
     else if (namarokuRecRead == "appliI")
     {
         ai.appliI = true;
     }
     else if (namarokuRecRead == "appliJ")
     {
         ai.appliJ = true;
     }
 }
Example #7
0
        void setEditModeDisplay(AlartInfo editAi)
        {
            Text                          = "お気に入り編集";
            communityId.Text              = string.IsNullOrEmpty(editAi.communityId) ? "" : editAi.communityId;
            communityNameText.Text        = string.IsNullOrEmpty(editAi.communityName) ? "" : editAi.communityName;
            userIdText.Text               = string.IsNullOrEmpty(editAi.hostId) ? "" : editAi.hostId;
            userNameText.Text             = string.IsNullOrEmpty(editAi.hostName) ? "" : editAi.hostName;
            keywordText.Text              = string.IsNullOrEmpty(editAi.keyword) ? "" : editAi.keyword;
            memoText.Text                 = string.IsNullOrEmpty(editAi.memo) ? "" : editAi.memo;
            communityFollowChkBox.Checked = editAi.communityFollow == "フォロー解除する";
            userFollowChkBox.Checked      = editAi.hostFollow == "フォロー解除する";

            isPopupChkBox.Checked  = editAi.popup;
            isBaloonChkBox.Checked = editAi.baloon;
            isWebChkBox.Checked    = editAi.browser;
            isMailChkBox.Checked   = editAi.mail;
            isSoundChkBox.Checked  = editAi.sound;
            appliAChkBox.Checked   = editAi.appliA;
            appliBChkBox.Checked   = editAi.appliB;
            appliCChkBox.Checked   = editAi.appliC;
            appliDChkBox.Checked   = editAi.appliD;
            appliEChkBox.Checked   = editAi.appliE;
            appliFChkBox.Checked   = editAi.appliF;
            appliGChkBox.Checked   = editAi.appliG;
            appliHChkBox.Checked   = editAi.appliH;
            appliIChkBox.Checked   = editAi.appliI;
            appliJChkBox.Checked   = editAi.appliJ;
            textColorBtn.BackColor = sampleColorText.ForeColor =
                editAi.textColor;
            backColorBtn.BackColor = sampleColorText.BackColor =
                editAi.backColor;
            defaultSoundList.SelectedIndex = editAi.soundType;
            isDefaultSoundIdChkBox.Checked = editAi.isSoundId;
            setMemberOnlyListInit(editAi);
            //memberOnlyList.SelectedIndex = editAi.memberOnlyMode;

            Image comThumb = null, userThumb = null;

            if (!string.IsNullOrEmpty(editAi.communityId) && editAi.communityId != "official")
            {
                if (ThumbnailManager.isExist(editAi.communityId, out comThumb))
                {
                    comThumbBox.Image = comThumb;
                }
            }
            if (!string.IsNullOrEmpty(editAi.hostId))
            {
                if (ThumbnailManager.isExist(editAi.hostId, out userThumb))
                {
                    userThumbBox.Image = userThumb;
                }
            }
            isMustComChkBox.Checked     = editAi.isMustCom;
            isMustUserChkBox.Checked    = editAi.isMustUser;
            isMustKeywordChkBox.Checked = editAi.isMustKeyword;
            customKw = editAi.cki;
            if (customKw != null)
            {
                customKeywordBtn.Text = "カスタム設定(" + customKw[0].name + ")";
            }
            if (editAi.isCustomKeyword)
            {
                isCustomKeywordRadioBtn.Checked = true;
            }
            isAutoReserveChkBox.Checked = editAi.isAutoReserve;
        }
Example #8
0
        bool duplicationCheckOk(AlartInfo ai)
        {
            try {
                var count = form.getAlartListCount(isUserMode);
                for (var i = 0; i < count; i++)
                {
                    if (ai.communityId != null && ai.communityId != "" && dataSource[i].communityId ==
                        ai.communityId)
                    {
                        var m = (ai.communityId.StartsWith("co")) ? "コミュニティ" : (ai.communityId == "official" ? "official" : "チャンネル");

                        //var res = MessageBox.Show(m + "ID" + ai.communityId + "は既に登録されています。削除しますか?(はい=削除 いいえ=削除 キャンセル=フォームに戻る)", "確認", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);
                        form.setAlartListScrollIndex(i, isUserMode);
                        var res = MessageBox.Show(m + "ID:" + ai.communityId + "は既に登録されています。\n(" + dataSource[i].toString() + ")\n\n既に存在している行を削除しますか?\nはい=削除して登録 いいえ=既に存在する行を削除せず登録 キャンセル=登録しない", "確認", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);

                        if (res == DialogResult.Yes)
                        {
                            form.alartListRemove(dataSource[i], isUserMode);
                            i--;
                            count--;
                            //				        form.alartListAdd(ai);
                        }
                        else if (res == DialogResult.No)
                        {
                            //				        form.alartListAdd(ai);
                        }
                        else if (res == DialogResult.Cancel)
                        {
                            return(false);
                        }
                    }
                }
                count = form.getAlartListCount(isUserMode);
                for (var i = 0; i < count; i++)
                {
                    if (ai.hostId != null && ai.hostId != "" && dataSource[i].hostId ==
                        ai.hostId)
                    {
                        var m = "ユーザー";
                        //var res = MessageBox.Show(m + "ID" + ai.communityId + "は既に登録されています。削除しますか?(はい=削除して登録 いいえ=登録 キャンセル=フォームに戻る)", "確認", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);
                        form.setAlartListScrollIndex(i, isUserMode);
                        var res = MessageBox.Show(m + "ID:" + ai.hostId + "は既に登録されています。\n(" + dataSource[i].toString() + ")\n\n既に存在している行を削除しますか?\nはい=削除して登録 いいえ=既に存在する行を削除せず登録 キャンセル=登録しない", "確認", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);

                        if (res == DialogResult.Yes)
                        {
                            form.alartListRemove(dataSource[i], isUserMode);
                            i--;
                            count--;
                            //				        form.alartListAdd(ai);
                        }
                        else if (res == DialogResult.No)
                        {
                            //				        form.alartListAdd(ai);
                        }
                        else if (res == DialogResult.Cancel)
                        {
                            return(false);
                        }
                    }
                }
            } catch (Exception e) {
                util.debugWriteLine("duplicationcheckok " + e.Message + e.Source + e.StackTrace + e.TargetSite);
                return(false);
            }
            return(true);
        }
Example #9
0
        public addForm(MainForm form, string id, AlartInfo editAi = null, bool isUserMode = false)
        {
            this.form       = form;
            this.editAi     = editAi;
            this.isUserMode = isUserMode;

            dataSource = isUserMode ? form.userAlartListDataSource : form.alartListDataSource;
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            setMemberOnlyListCloseEventHandler(this);
            util.setFontSize(int.Parse(form.config.get("fontSize")), this, false);

            if (editAi != null)
            {
                setEditModeDisplay(editAi);

                if (isUserMode)
                {
                    setUserModeForm();
                }
                return;
            }

            for (var i = 0; i < memberOnlyCheckList.Items.Count; i++)
            {
                memberOnlyCheckList.SetItemChecked(i, true);
            }
            closeMemberOnlyList();

            //
            // TODO: Add constructor code after the InitializeComponent() call.
            //
            setDefaultBehavior();

            if (id == null)
            {
                if (isUserMode)
                {
                    setUserModeForm();
                }
                return;
            }

            if (id.StartsWith("lv"))
            {
                hosoIdText.Text = id;
            }
            else if (id.StartsWith("c"))
            {
                if (bool.Parse(form.config.get("IsdragCom")))
                {
                    hosoIdText.Text = id;
                }
                communityId.Text = id;
            }
            else
            {
                userIdText.Text = id;
            }

            if (isUserMode)
            {
                //communityId.Text = communityNameText.Text = "";
                //keywordText.Text = "";
                setUserModeForm();
            }
        }
Example #10
0
        void editOkBtnProcess()
        {
            var comId  = communityId.Text == "official" ? "official" : util.getRegGroup(communityId.Text, "((ch|co)*\\d+)");
            var userId = util.getRegGroup(userIdText.Text, "(\\d+)");

            communityNameText.Text = "";
            userNameText.Text      = "";
            if (comId != null)
            {
                GetCommunityInfoBtnClickProcess(true);
            }
            if (userId != null)
            {
                GetUserInfoBtnClickProcess(true);
            }
            var comFollow = string.IsNullOrEmpty(comId) || form.check.container == null ? "" :
                            (communityFollowChkBox.Checked) ? "フォロー解除する" : "フォローする";

            if (communityNameText.Text == "" || comId == "official")
            {
                comFollow = "";
            }
            var userFollow = string.IsNullOrEmpty(userId) || form.check.container == null ? "":
                             (userFollowChkBox.Checked) ? "フォロー解除する" : "フォローする";

            var isNoKeyword = (isSimpleKeywordRadioBtn.Checked && keywordText.Text == "") ||
                              (isCustomKeywordRadioBtn.Checked && customKw == null);

            if (communityNameText.Text == "" && userNameText.Text == "" && isNoKeyword)
            {
                MessageBox.Show("有効なコミュニティIDかユーザーIDかキーワードが入力されていないです");
                return;
            }

            if (customKw != null)
            {
                var isAllNot = true;
                foreach (var c in customKw)
                {
                    if (c.matchType != "含まない")
                    {
                        isAllNot = false;
                    }
                }
                if (communityNameText.Text == "" && userNameText.Text == "" && isAllNot)
                {
                    MessageBox.Show("「含まない」以外の行が必要です");
                    return;
                }
            }

            var memberOnly = getMemberOnly();

            if (memberOnly == null)
            {
                MessageBox.Show("通常放送、限定放送、有料放送のいずれかにチェックが必要です");
                return;
            }

            editAi.communityId     = comId;
            editAi.hostId          = userId;
            editAi.communityName   = communityNameText.Text;
            editAi.hostName        = userNameText.Text;
            editAi.communityFollow = comFollow;
            editAi.hostFollow      = userFollow;
            editAi.memo            = memoText.Text;
            editAi.keyword         = keywordText.Text;
            editAi.popup           = isPopupChkBox.Checked;
            editAi.baloon          = isBaloonChkBox.Checked;
            editAi.browser         = isWebChkBox.Checked;
            editAi.mail            = isMailChkBox.Checked;
            editAi.sound           = isSoundChkBox.Checked;
            editAi.appliA          = appliAChkBox.Checked;
            editAi.appliB          = appliBChkBox.Checked;
            editAi.appliC          = appliCChkBox.Checked;
            editAi.appliD          = appliDChkBox.Checked;
            editAi.appliE          = appliEChkBox.Checked;
            editAi.appliF          = appliFChkBox.Checked;
            editAi.appliG          = appliGChkBox.Checked;
            editAi.appliH          = appliHChkBox.Checked;
            editAi.appliI          = appliIChkBox.Checked;
            editAi.appliJ          = appliJChkBox.Checked;
            editAi.textColor       = textColorBtn.BackColor;
            editAi.backColor       = backColorBtn.BackColor;
            editAi.soundType       = defaultSoundList.SelectedIndex;
            editAi.isSoundId       = isDefaultSoundIdChkBox.Checked;
            editAi.isMustCom       = isMustComChkBox.Checked;
            editAi.isMustUser      = isMustUserChkBox.Checked;
            editAi.isMustKeyword   = isMustKeywordChkBox.Checked;
            editAi.cki             = customKw;
            editAi.isCustomKeyword = isCustomKeywordRadioBtn.Checked;
            editAi.memberOnlyMode  = memberOnly;
            editAi.isAutoReserve   = isAutoReserveChkBox.Checked;

            /*
             * var _ret = new AlartInfo(comId, userId,
             *              communityNameText.Text, userNameText.Text,
             *              "", editAi.addDate, isPopupChkBox.Checked,
             *              isBaloonChkBox.Checked, isWebChkBox.Checked,
             *              isMailChkBox.Checked, isSoundChkBox.Checked,
             *              appliAChkBox.Checked, appliBChkBox.Checked,
             *              appliCChkBox.Checked, appliDChkBox.Checked,
             *              appliEChkBox.Checked, appliFChkBox.Checked,
             *              appliGChkBox.Checked, appliHChkBox.Checked,
             *              appliIChkBox.Checked, appliJChkBox.Checked,
             *              memoText.Text, comFollow,
             *              userFollow, "", keywordText.Text);
             * ret = _ret;
             */
            ret = editAi;
            util.debugWriteLine("addform edit okbtn " + editAi.hostId + " " + editAi.communityId + " " + editAi.keyword);
            Close();
        }
Example #11
0
        void addOkBtnProcess()
        {
            var comId  = communityId.Text == "official" ? "official" : util.getRegGroup(communityId.Text, "((ch|co)*\\d+)");
            var userId = util.getRegGroup(userIdText.Text, "(\\d+)");

            communityNameText.Text = "";
            userNameText.Text      = "";
            if (comId != null)
            {
                GetCommunityInfoBtnClickProcess(true);
            }
            if (userId != null)
            {
                GetUserInfoBtnClickProcess(true);
            }
            var isNoKeyword = (isSimpleKeywordRadioBtn.Checked && keywordText.Text == "") ||
                              (isCustomKeywordRadioBtn.Checked && customKw == null);

            if (communityNameText.Text == "" && userNameText.Text == "" && isNoKeyword)
            {
                MessageBox.Show("有効なコミュニティIDかユーザーIDかキーワードが入力されていないです");
                return;
            }

            if (isCustomKeywordRadioBtn.Checked)
            {
                if (customKw == null)
                {
                    MessageBox.Show("カスタムキーワードが未設定です");
                    return;
                }
                var isAllNot = true;
                foreach (var c in customKw)
                {
                    if (c.matchType != "含まない")
                    {
                        isAllNot = false;
                    }
                }
                if (communityNameText.Text == "" && userNameText.Text == "" && isAllNot)
                {
                    MessageBox.Show("「含まない」以外の行が必要です");
                    return;
                }
            }


            var now       = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
            var addDate   = now;          //now.Substring(0, now.Length - 3);
            var comFollow = string.IsNullOrEmpty(comId) || form.check.container == null ? "" :
                            ((communityFollowChkBox.Checked) ? "フォロー解除する" : "フォローする");
            var userFollow = string.IsNullOrEmpty(userId) || form.check.container == null ? "" :
                             (userFollowChkBox.Checked) ? "フォロー解除する" : "フォローする";

            if (communityNameText.Text == "" || comId == "official")
            {
                comFollow = "";
            }
            if (userNameText.Text == "")
            {
                userFollow = "";
            }

            var memberOnly = getMemberOnly();

            if (memberOnly == null)
            {
                MessageBox.Show("通常放送、限定放送、有料放送のいずれかにチェックが必要です");
                return;
            }
            var _ret = new AlartInfo(comId, userId,
                                     communityNameText.Text, userNameText.Text,
                                     "", addDate, isPopupChkBox.Checked,
                                     isBaloonChkBox.Checked, isWebChkBox.Checked,
                                     isMailChkBox.Checked, isSoundChkBox.Checked,
                                     appliAChkBox.Checked, appliBChkBox.Checked,
                                     appliCChkBox.Checked, appliDChkBox.Checked,
                                     appliEChkBox.Checked, appliFChkBox.Checked,
                                     appliGChkBox.Checked, appliHChkBox.Checked,
                                     appliIChkBox.Checked, appliJChkBox.Checked,
                                     memoText.Text, comFollow,
                                     userFollow, "", keywordText.Text,
                                     textColorBtn.BackColor, backColorBtn.BackColor,
                                     defaultSoundList.SelectedIndex,
                                     isDefaultSoundIdChkBox.Checked, isMustComChkBox.Checked,
                                     isMustUserChkBox.Checked, isMustKeywordChkBox.Checked,
                                     customKw, isCustomKeywordRadioBtn.Checked, memberOnly,
                                     isAutoReserveChkBox.Checked, 0, "");

            if (inputLvidItem != null)
            {
                _ret.lastHosoDt   = inputLvidItem.pubDateDt;
                _ret.lastHostDate = inputLvidItem.pubDateDt.ToString("yyyy/MM/dd HH:mm:ss");
                _ret.lastLvid     = inputLvidItem.lvId;
                _ret.lastLvType   = inputLvidItem.type;
                _ret.lastLvTitle  = inputLvidItem.title;
                if (!isInputLvidItemClosed)
                {
                    _ret.recentColorMode = bool.Parse(form.config.get("IscheckRecent")) ? ((inputLvidItem.isMemberOnly) ? 2 : 1) : 0;
                }
            }
            if (!duplicationCheckOk(_ret))
            {
                return;
            }
            ret = _ret;
            util.debugWriteLine("addform add okbtn " + _ret.hostId + " " + _ret.communityId + " " + _ret.keyword);
            Close();
        }
Example #12
0
        public PopupForm(RssItem item, config.config config,
                         PopupDisplay pd, int showIndex, AlartInfo ai,
                         bool isTest       = false, string poploc = null, int poptime = 0,
                         bool isClickClose = true,
                         bool isTopMost    = true, bool isColor = true, double opacity = 0.9)
        {
            this.config    = config;
            this.ri        = item;
            this.pd        = pd;
            this.showIndex = showIndex;
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            //var dt = DateTime.Now;
            var dtStr = "";

            if (item.pubDate != null && item.pubDate != "")
            {
                var dt = DateTime.Parse(item.pubDate);
                dtStr = dt.ToString("yyyy/MM/dd(ddd) HH:mm") + "開始";
            }
            util.debugWriteLine(dtStr);

            //var t = "【弾幕歓迎】BOOWY関係リク枠!放送のしかた覚えてるかな?覚えてなかったらごめんlt;(_ _)gt;";
            var t = item.title;

            if (isOkStrWidth(t + " - "))
            {
                t += " - ";
            }
            if (isOkStrWidth(t + dtStr))
            {
                t += dtStr;
            }
            titleLabel.Text = util.removeTag(t);
            //titleLabel.Text = (item.isMemberOnly ? "(限定)" : "") + titleLabel.Text;

            hostNameLabel.Text      = util.removeTag(item.hostName);
            communityNameLabel.Text = util.removeTag(item.comName);
            descryptionLabel.Text   = util.removeTag(item.description);
            //var _Text = item.hostName + "/" + item.comName;
            if (ai != null && ai.keyword != null && ai.keyword != "")
            {
                Text = ai.keyword + "-" + Text;
            }
            if (ai != null && bool.Parse(config.get("IsColorPopup")))
            {
                BackColor = ai.backColor;
                ForeColor = ai.textColor;
            }
            //Text = Text;
            if (isTest && isColor)
            {
                BackColor = Color.FromArgb(255, 224, 255);
                ForeColor = Color.Black;
            }
            else if (ai != null && bool.Parse(config.get("IsColorPopup")))
            {
                BackColor = ai.backColor;
                ForeColor = ai.textColor;
            }

            var url = "https://live2.nicovideo.jp/watch/" + item.lvId;

            titleLabel.Links.Add(0, titleLabel.Text.Length, url);
            if (isTest)
            {
                this.isTopMostPara = isTopMost;
            }
            else
            {
                this.isTopMostPara = bool.Parse(config.get("IsTopMostPopup"));
            }

            Opacity = isTest ? (opacity / 100) : double.Parse(config.get("popupOpacity")) / 100;
            //
            // TODO: Add constructor code after the InitializeComponent() call.
            //
            this.isTestClosePopup = isClickClose;
            this.testPopTime      = poptime;
            this.isTest           = isTest;

            ContextMenuStrip = contextMenuStrip1;
            setAppliMenuVisible();

            if (item.isMemberOnly)
            {
                ShowIcon = true;
                var icon = new Icon(util.getJarPath()[0] + "/Icon/lock.ico");
                Icon = icon;
            }
        }
Example #13
0
        private DialogResult isDuplicateOk(AlartInfo ai, List <int> dupList, int _i, MainForm form, int allMode)
        {
            var ret = DialogResult.None;

            if (dupList.IndexOf(_i) == -1)
            {
                return(ret);
            }

            try
            {
                var count = form.getAlartListCount(isUserMode);
                for (var i = 0; i < count; i++)
                {
                    if (ai.communityId != null && ai.communityId != "" && ai.communityId != "official" && form.alartListDataSource[i].communityId ==
                        ai.communityId)
                    {
                        var m = (ai.communityId.StartsWith("co")) ? "コミュニティ" : "チャンネル";


                        form.setAlartListScrollIndex(i, isUserMode);
                        //var res = MessageBox.Show(m + "ID" + ai.communityId + "は既に登録されています。削除しますか?(はい=削除 いいえ=削除 キャンセル=フォームに戻る)", "確認", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);
                        DialogResult res;
                        if (allMode == 1)
                        {
                            res = DialogResult.Yes;
                        }
                        else if (allMode == 2)
                        {
                            res = DialogResult.No;
                        }
                        else
                        {
                            res = form.showMessageBox(m + "ID:" + ai.communityId + "は既に登録されています。\n(" + form.alartListDataSource[i].toString() + ")\n\n既に存在している行を削除しますか?\nはい=削除して登録 いいえ=既に存在する行を削除せず登録 キャンセル=登録しない(" + _i.ToString() + "/" + dupList.Count + ")", "確認", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);
                        }
                        ret = res;

                        if (res == DialogResult.Yes)
                        {
                            form.alartListRemove(form.alartListDataSource[i], isUserMode);
                            i--;
                            count--;
                            //				        form.alartListAdd(ai);
                        }
                        else if (res == DialogResult.No)
                        {
                            //				        form.alartListAdd(ai);
                        }
                        else if (res == DialogResult.Cancel)
                        {
                            return(ret);
                        }
                    }
                }
                count = form.getAlartListCount(isUserMode);
                for (var i = 0; i < count; i++)
                {
                    if (ai.hostId != null && ai.hostId != "" && form.alartListDataSource[i].hostId ==
                        ai.hostId)
                    {
                        form.setAlartListScrollIndex(i, isUserMode);
                        var m = "ユーザー";

                        //var res = MessageBox.Show(m + "ID" + ai.communityId + "は既に登録されています。削除しますか?(はい=削除 いいえ=削除 キャンセル=フォームに戻る)", "確認", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);
                        DialogResult res;
                        if (allMode == 1)
                        {
                            res = DialogResult.Yes;
                        }
                        else if (allMode == 2)
                        {
                            res = DialogResult.No;
                        }
                        else
                        {
                            //var res = MessageBox.Show(m + "ID" + ai.communityId + "は既に登録されています。削除しますか?(はい=削除して登録 いいえ=登録 キャンセル=フォームに戻る)", "確認", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);
                            res = form.showMessageBox(m + "ID:" + ai.hostId + "は既に登録されています。\n(" + form.alartListDataSource[i].toString() + ")\n\n既に存在している行を削除しますか?\nはい=削除して登録 いいえ=既に存在する行を削除せず登録 キャンセル=登録しない(" + _i.ToString() + "/" + dupList.Count + ")", "確認", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);
                        }
                        ret = res;

                        if (res == DialogResult.Yes)
                        {
                            form.alartListRemove(form.alartListDataSource[i], isUserMode);
                            i--;
                            count--;
                            //				        form.alartListAdd(ai);
                        }
                        else if (res == DialogResult.No)
                        {
                            //				        form.alartListAdd(ai);
                        }
                        else if (res == DialogResult.Cancel)
                        {
                            return(ret);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                util.debugWriteLine(e.Message + e.Source + e.StackTrace + e.TargetSite);
                return(ret);
            }
            return(ret);
        }
Example #14
0
        public void ReadNamarokuList(MainForm form, SortableBindingList <AlartInfo> dataSource, string fileName, bool isUpdateComHost, bool isDuplicateCheck)
        {
            string[] lines;

            try
            {
                if (!File.Exists(fileName))
                {
                    return;
                }
                using (var sr = new StreamReader(fileName, Encoding.UTF8))
                {
                    lines = sr.ReadToEnd().Replace("\r", "").Split('\n');
                    //sr.Close();
                }
            }
            catch (Exception ee)
            {
                util.debugWriteLine(ee.Message + ee.Source + ee.StackTrace + ee.TargetSite);
                return;
            }
            var itemLineNum = (lines[0] == "120") ? 29 : 36;

            if ((lines.Length - 3) % itemLineNum != 0)
            {
                form.showMessageBox("読み込めませんでした", "");
                return;
            }

            string namarokuRecRead = null;

            if (itemLineNum == 29)
            {
                var f = new NamarokuRecordCheckSettingForm();
                form.formAction(() => f.ShowDialog());
                if (f.recordCheck == null)
                {
                    return;
                }
                else
                {
                    namarokuRecRead = f.recordCheck;
                }
            }

            var readAiList = new List <AlartInfo>();

            for (var i = 1; i < lines.Length - 2; i += itemLineNum)
            {
                try
                {
                    var   isFollow = false;
                    var   comFollow = "";
                    var   userFollow = "";
                    Color textColor = Color.Black, backColor = Color.FromArgb(255, 224, 255);
                    if (lines[i + 10] != "" && lines[i + 11] != "")
                    {
                        try
                        {
                            textColor = ColorTranslator.FromHtml(lines[i + 10]);
                            backColor = ColorTranslator.FromHtml(lines[i + 11]);
                        }
                        catch (Exception e)
                        {
                            //						util.debugWriteLine(e.Message + e.Source + e.StackTrace + e.TargetSite);
                        }
                    }
                    int  defaultSound     = 0;
                    bool isDefaultSoundId = true;
                    if (itemLineNum != 29 && lines[i + 12] != "")
                    {
                        try
                        {
                            var b = lines[i + 12].Split(',');
                            defaultSound     = int.Parse(b[0]);
                            isDefaultSoundId = bool.Parse(b[1]);
                        }
                        catch (Exception e)
                        {
                            util.debugWriteLine(e.Message + e.Source + e.StackTrace + e.TargetSite);
                        }
                    }

                    /*
                     * bool isAnd = true;
                     * if (lines[i + 16] != "") {
                     *      try {
                     *              isAnd = lines[i + 16] == "true";
                     *      } catch (Exception e) {
                     *              util.debugWriteLine(e.Message + e.Source + e.StackTrace + e.TargetSite);
                     *      }
                     * }
                     */
                    bool isMustCom = true, isMustUser = true, isMustKeyword = true;
                    if (itemLineNum != 29 && lines[i + 14] != "")
                    {
                        try
                        {
                            var isMustArr = lines[i + 14].Split(',');
                            isMustCom     = bool.Parse(isMustArr[0]);
                            isMustUser    = bool.Parse(isMustArr[1]);
                            isMustKeyword = bool.Parse(isMustArr[2]);
                        }
                        catch (Exception e)
                        {
                            util.debugWriteLine(e.Message + e.Source + e.StackTrace + e.TargetSite);
                        }
                    }
                    List <CustomKeywordInfo> cki = null;
                    bool isCustomKeyword         = false;
                    if (itemLineNum != 29 && lines[i + 6] != "")
                    {
                        try
                        {
                            cki             = Newtonsoft.Json.JsonConvert.DeserializeObject <List <CustomKeywordInfo> >(lines[i + 6].Substring(1));
                            isCustomKeyword = lines[i + 6][0] == '1';
                        }
                        catch (Exception e)
                        {
                            util.debugWriteLine(e.Message + e.Source + e.StackTrace + e.TargetSite);
                            cki             = null;
                            isCustomKeyword = false;
                        }
                    }
                    if (isUpdateComHost)
                    {
                        /*
                         * if (lines[i + 1] != null && lines[i + 1] != "") {
                         *      var comName = util.getCommunityName(lines[i + 1], out isFollow, form.check.container);
                         *      if (comName != null)
                         *              comFollow = (isFollow) ? "フォロー解除する" : "フォローする";
                         *      else lines[i + 1] = "";
                         * } else lines[i + 4] = "";
                         */
                        /*
                         * if (lines[i + 2] != null && lines[i + 2] != "") {
                         *      var userName = util.getUserName(lines[i + 2], out isFollow, form.check.container);
                         *      if (userName != null)
                         *              userFollow = (isFollow) ? "フォロー解除する" : "フォローする";
                         *      else lines[i + 2] = "";
                         * } else lines[i + 5] = "";
                         */
                    }
                    //if (lines[i + 1] == "" && lines[i + 2] == "" && lines[i + 3] == "") continue;
                    AlartInfo ai;
                    var       comName = string.IsNullOrEmpty(lines[i + 4]) ? lines[i + 4] : WebUtility.HtmlDecode(lines[i + 4]);
                    if (itemLineNum == 29)
                    {
                        ai = new AlartInfo(lines[i + 1],
                                           lines[i + 2], comName, lines[i + 5],
                                           lines[i + 7], lines[i + 15],
                                           lines[i + 17] == "true",
                                           lines[i + 18] == "true",
                                           lines[i + 19] == "true",
                                           lines[i + 20] == "true",
                                           lines[i + 21] == "true",
                                           lines[i + 24] == "true",
                                           lines[i + 25] == "true",
                                           lines[i + 26] == "true",
                                           false,
                                           false,
                                           false,
                                           false,
                                           false,
                                           false,
                                           false,
                                           lines[i + 28],
                                           comFollow, userFollow, lines[i + 13],
                                           lines[i + 3], textColor,
                                           backColor, defaultSound, isDefaultSoundId,
                                           false, false, false, null, false);
                        if (lines[i + 23] == "true")
                        {
                            setNamarokuRead(ai, namarokuRecRead);
                        }
                    }
                    else
                    {
                        ai = new AlartInfo(lines[i + 1],
                                           lines[i + 2], comName, lines[i + 5],
                                           lines[i + 7], lines[i + 15],
                                           lines[i + 17] == "true",
                                           lines[i + 18] == "true",
                                           lines[i + 19] == "true",
                                           lines[i + 20] == "true",
                                           lines[i + 21] == "true",
                                           lines[i + 24] == "true",
                                           lines[i + 25] == "true",
                                           lines[i + 26] == "true",
                                           lines[i + 27] == "true",
                                           lines[i + 28] == "true",
                                           lines[i + 29] == "true",
                                           lines[i + 30] == "true",
                                           lines[i + 31] == "true",
                                           lines[i + 32] == "true",
                                           lines[i + 33] == "true",
                                           lines[i + 34],
                                           comFollow, userFollow, lines[i + 13],
                                           lines[i + 3], textColor,
                                           backColor, defaultSound, isDefaultSoundId,
                                           isMustCom, isMustUser, isMustKeyword, cki,
                                           isCustomKeyword);
                    }
                    //if ((ai.communityId == null || ai.communityId == "") &&
                    //    (ai.hostId == null || ai.hostId == "")) continue;
                    if (isUserMode && string.IsNullOrEmpty(ai.hostId))
                    {
                        continue;
                    }
                    if (isUserMode)
                    {
                        ai.communityId = ai.communityName = "";
                    }
                    readAiList.Add(ai);
                }
                catch (Exception e)
                {
                    form.addLogText(i + "行目から始まるお気に入りが読み込めませんでした");
                }
            }

            try
            {
                for (var j = 0; j < 100; j++)
                {
                    if (!form.IsDisposed && form.IsHandleCreated)
                    {
                        break;
                    }
                    Thread.Sleep(1000);
                }
                var dupliNumList = (isDuplicateCheck) ? getDuplicateNum(readAiList, form) : null;
                if (isDuplicateCheck && dupliNumList.Count > 0)
                {
                    form.showMessageBox(dupliNumList.Count.ToString() + "件の重複が見つかりました");
                }

                var addList          = new List <AlartInfo>();
                var isContinueCancel = 0;
                var isContinueYes    = 0;
                var isContinueNo     = 0;
                var allMode          = -1;       //-1-none 0-cancel 1-yes 2-no
                for (var i = 0; i < readAiList.Count; i++)
                {
                    var ai = readAiList[i];
                    if (isDuplicateCheck)
                    {
                        var dialogRet = isDuplicateOk(ai, dupliNumList, i, form, allMode);
                        if (dialogRet == DialogResult.Cancel)
                        {
                            isContinueCancel++;
                            isContinueYes = isContinueNo = 0;
                            if (isContinueCancel % 5 == 0 && allMode < 1)
                            {
                                var res = form.showMessageBox("全てキャンセルしますか?", "", MessageBoxButtons.YesNo);
                                if (res == DialogResult.Yes)
                                {
                                    break;
                                }
                            }
                            continue;                            //break;
                        }
                        else if (dialogRet == DialogResult.Yes)
                        {
                            isContinueYes++;
                            isContinueCancel = isContinueNo = 0;
                            if (isContinueYes % 5 == 0 && allMode < 1)
                            {
                                var res = form.showMessageBox("全て「はい」を選択しますか?", "", MessageBoxButtons.YesNo);
                                if (res == DialogResult.Yes)
                                {
                                    allMode = 1;
                                }
                            }
                        }
                        else if (dialogRet == DialogResult.No)
                        {
                            isContinueNo++;
                            isContinueCancel = isContinueYes = 0;
                            if (isContinueNo % 5 == 0 && allMode < 1)
                            {
                                var res = form.showMessageBox("全て「いいえ」を選択しますか?", "", MessageBoxButtons.YesNo);
                                if (res == DialogResult.Yes)
                                {
                                    allMode = 2;
                                }
                            }
                        }
                    }
                    addList.Add(ai);
                    //form.alartListAdd(ai);
                }
                foreach (var ai in addList)
                {
                    form.alartListAdd(ai, isUserMode);
                }
            }
            catch (Exception e)
            {
                util.debugWriteLine(e.Message + e.Source + e.StackTrace + e.TargetSite);
                form.addLogText("読み込んだリストを追加中にエラーが発生しました" + e.Message + e.Source + e.StackTrace + e.TargetSite);
            }
            if (form.check.container != null)
            {
                new FollowChecker(form, form.check.container).check();
            }

            form.recentLiveCheck();
        }
Example #15
0
        void addOkBtnProcess()
        {
            var comId  = communityId.Text == "official" ? "official" : util.getRegGroup(communityId.Text, "((ch|co)*\\d+)");
            var userId = util.getRegGroup(userIdText.Text, "(\\d+)");

            communityNameText.Text = "";
            userNameText.Text      = "";
            if (comId != null)
            {
                GetCommunityInfoBtnClickProcess(true);
            }
            if (userId != null)
            {
                GetUserInfoBtnClickProcess(true);
            }
            var isNoKeyword = (isSimpleKeywordRadioBtn.Checked && keywordText.Text == "") ||
                              (isCustomKeywordRadioBtn.Checked && customKw == null);

            if (communityNameText.Text == "" && userNameText.Text == "" && isNoKeyword)
            {
                MessageBox.Show("有効なコミュニティIDかユーザーIDかキーワードが入力されていないです");
                return;
            }

            if (isCustomKeywordRadioBtn.Checked)
            {
                if (customKw == null)
                {
                    MessageBox.Show("カスタムキーワードが未設定です");
                    return;
                }
                var isAllNot = true;
                foreach (var c in customKw)
                {
                    if (c.matchType != "含まない")
                    {
                        isAllNot = false;
                    }
                }
                if (communityNameText.Text == "" && userNameText.Text == "" && isAllNot)
                {
                    MessageBox.Show("「含まない」以外の行が必要です");
                    return;
                }
            }


            var now       = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
            var addDate   = now;          //now.Substring(0, now.Length - 3);
            var comFollow = string.IsNullOrEmpty(comId) ? "" :
                            ((communityFollowChkBox.Checked) ? "フォロー解除する" : "フォローする");
            var userFollow = string.IsNullOrEmpty(userId) ? "" :
                             (userFollowChkBox.Checked) ? "フォロー解除する" : "フォローする";

            if (communityNameText.Text == "" || comId == "official")
            {
                comFollow = "";
            }
            if (userNameText.Text == "")
            {
                userFollow = "";
            }
            var _ret = new AlartInfo(comId, userId,
                                     communityNameText.Text, userNameText.Text,
                                     "", addDate, isPopupChkBox.Checked,
                                     isBaloonChkBox.Checked, isWebChkBox.Checked,
                                     isMailChkBox.Checked, isSoundChkBox.Checked,
                                     appliAChkBox.Checked, appliBChkBox.Checked,
                                     appliCChkBox.Checked, appliDChkBox.Checked,
                                     appliEChkBox.Checked, appliFChkBox.Checked,
                                     appliGChkBox.Checked, appliHChkBox.Checked,
                                     appliIChkBox.Checked, appliJChkBox.Checked,
                                     memoText.Text, comFollow,
                                     userFollow, "", keywordText.Text,
                                     textColorBtn.BackColor, backColorBtn.BackColor,
                                     defaultSoundList.SelectedIndex,
                                     isDefaultSoundIdChkBox.Checked, isMustComChkBox.Checked,
                                     isMustUserChkBox.Checked, isMustKeywordChkBox.Checked,
                                     customKw, isCustomKeywordRadioBtn.Checked);

            if (!duplicationCheckOk(_ret))
            {
                return;
            }
            ret = _ret;
            util.debugWriteLine("addform add okbtn " + _ret.hostId + " " + _ret.communityId + " " + _ret.keyword);
            Close();
        }
Example #16
0
        public SmallPopupForm(RssItem item, config.config config,
                              PopupDisplay pd, int showIndex, AlartInfo ai,
                              bool isTest       = false, string poploc = null, int poptime = 0,
                              bool isClickClose = true,
                              bool isTopMost    = true, Color[] isColor = null, double opacity = 0.9)
        {
            this.config    = config;
            this.ri        = item;
            this.pd        = pd;
            this.showIndex = showIndex;

            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            //var dt = DateTime.Now;
            var dtStr = "";

            if (item.pubDate != null && item.pubDate != "")
            {
                var dt = DateTime.Parse(item.pubDate);
                dtStr = dt.ToString("yyyy/MM/dd(ddd) HH:mm") + "開始";
            }
//			util.debugWriteLine(dtStr);

            //var t = "haimasa_qm(歌ってみた)fw";
            var t = item.title;

            if (isOkStrWidth(t + " - "))
            {
                t += " - ";
            }
            if (isOkStrWidth(t + dtStr))
            {
                t += dtStr;
            }
            titleLabel.Text = util.removeTag(t);
            //titleLabel.Text = (item.isMemberOnly ? "(限定)" : "") + titleLabel.Text;

            hostNameLabel.Text      = util.removeTag(item.hostName);
            communityNameLabel.Text = util.removeTag(item.comName);
            descryptionLabel.Text   = util.removeTag(item.description);
            var _Text = util.removeTag(item.hostName + "/" + item.comName);

            if (ai != null && ai.keyword != null && ai.keyword != "")
            {
                _Text = ai.keyword + "-" + _Text;
            }
            Text = _Text;

            if (isTest && isColor != null)
            {
                BackColor            = isColor[0];     //Color.FromArgb(255,224,255);
                ForeColor            = isColor[1];     //Color.Black;
                titleLabel.LinkColor = ForeColor;
            }
            else if (ai != null && bool.Parse(config.get("IsColorPopup")))
            {
                BackColor            = ai.backColor;
                ForeColor            = ai.textColor;
                titleLabel.LinkColor = ForeColor;
            }
            var url = "https://live2.nicovideo.jp/watch/" + item.lvId;

            titleLabel.Links.Add(0, titleLabel.Text.Length, url);
            if (isTest)
            {
                this.isTopMostPara = isTopMost;
            }
            else
            {
                this.isTopMostPara = bool.Parse(config.get("IsTopMostPopup"));
            }

            Opacity = isTest ? (opacity / 100) : double.Parse(config.get("popupOpacity")) / 100;

            this.isTestClosePopup = isClickClose;
            this.testPopTime      = poptime;
            this.isTest           = isTest;
            //
            // TODO: Add constructor code after the InitializeComponent() call.
            //
            ContextMenuStrip = contextMenuStrip1;
            setAppliMenuVisible();

            if (item.isMemberOnly)
            {
                try {
                    ShowIcon = true;
                    var icon = new Icon(util.getJarPath()[0] + "/Icon/lock.ico");
                    Icon = util.changeIconColor(icon, ColorTranslator.FromHtml(config.get("onlyIconColor")));
                } catch (Exception e) {
                    util.debugWriteLine(e.Message + e.Source + e.StackTrace + e.TargetSite);
                }
            }
        }