Exemple #1
0
        private void btnAddRssSubscription_Click(object sender, EventArgs e)
        {
            pnlRssSubscriptionList.Controls.Remove(btnAddRssSubscription);
            CtrlRssItem ctrlRssItem = new CtrlRssItem();

            ctrlRssItem.Width        = RssItemCtrlWidth;
            ctrlRssItem.RemoveClick += (_, _) => pnlRssSubscriptionList.Controls.Remove(ctrlRssItem);
            pnlRssSubscriptionList.Controls.Add(ctrlRssItem);
            pnlRssSubscriptionList.Controls.Add(btnAddRssSubscription);
            pnlRssSubscriptionList.ScrollControlIntoView(btnAddRssSubscription);
        }
Exemple #2
0
        protected override void OnShown(EventArgs e)
        {
            base.OnShown(e);

            if (pnlHPictureCheckBoxes.Left < 519)  //狗屎设计器整天有Bug自动移动位置
            {
                pnlHPictureCheckBoxes.Left = 519;
            }

            cboLogLevel.SelectedIndex = BotInfo.LogLevel;

            #region -- 通用设置 --

            txbBotName.Text = BotInfo.BotName;

            foreach (var item in BotInfo.AdminQQ)
            {
                lstAdmins.Items.Add(item.ToString());
            }

            foreach (long item in BotInfo.BannedGroup)
            {
                lstBannedGroup.Items.Add(item.ToString());
            }

            foreach (var item in BotInfo.BannedUser)
            {
                lstBannedUser.Items.Add(item.ToString());
            }

            chkDebugMode.Checked = BotInfo.DebugMode;
            foreach (var item in BotInfo.DebugGroups)
            {
                lstDebugGroups.Items.Add(item.ToString());
            }
            chkOnlyReplyDebugGroup.Checked     = BotInfo.OnlyReplyDebugGroup;
            chkDebugReplyAdminOnly.Checked     = BotInfo.DebugReplyAdminOnly;
            chkHttpRequestByWebBrowser.Checked = BotInfo.HttpRequestByWebBrowser;
            chkCheckPornEnabled.Checked        = BotInfo.CheckPornEnabled; //是否启用腾讯云鉴黄
            txbCheckPornLimitCount.Text        = BotInfo.CheckPornLimitCount.ToString();

            #region -- 腾讯云相关设置 --
            txbTencentCloudAPPID.Text     = BotInfo.TencentCloudAPPID;
            txbTencentCloudRegion.Text    = BotInfo.TencentCloudRegion;
            txbTencentCloudSecretId.Text  = BotInfo.TencentCloudSecretId;
            txbTencentCloudSecretKey.Text = BotInfo.TencentCloudSecretKey;
            txbTencentCloudBucket.Text    = BotInfo.TencentCloudBucket;
            #endregion -- 腾讯云相关设置 --

            #endregion -- 通用设置 --

            #region -- 搜图设置 --
            chkSearchPictureEnabled.Checked                 = BotInfo.SearchEnabled; //是否启用搜图功能
            chkPmAutoSearch.Checked                         = BotInfo.PmAutoSearch;
            txbTraceMoeSendThreshold.Text                   = BotInfo.TraceMoeSendThreshold.ToString();
            chkSearchSauceNAOEnabled.Checked                = BotInfo.SearchEnabledSauceNao; //SauceNao Api-Key
            chkSearchSauceNAOSortByDesc.Checked             = BotInfo.SearchSauceNAOSortByDesc;
            chkSearchSauceNAOSendPixivOriginPicture.Checked = BotInfo.SearchSauceNAOSendPixivOriginPicture;
            txbSearchSauceNAOApiKey.Text                    = string.Join("\r\n", BotInfo.SauceNAOApiKey);
            chkSearchASCII2DEnabled.Checked                 = BotInfo.SearchEnabledASCII2D;  //是否启用ASCII2D搜图
            chkSearchTraceMoeEnabled.Checked                = BotInfo.SearchEnabledTraceMoe; //是否启用TraceMoe搜番
            cboSearchShowAscii2dCount.SelectedIndex         = BotInfo.SearchShowAscii2dCount - 1;
            txbSearchModeOnCmd.Text                         = BotInfo.SearchModeOnCmd;
            txbSearchModeOffCmd.Text                        = BotInfo.SearchModeOffCmd;
            txbSearchModeTimeOutReply.Text                  = BotInfo.SearchModeTimeOutReply;
            txbSearchModeOnReply.Text                       = BotInfo.SearchModeOnReply;
            txbSearchModeAlreadyOnReply.Text                = BotInfo.SearchModeAlreadyOnReply;
            txbSearchingReply.Text                  = BotInfo.SearchingReply;
            txbSearchModeOffReply.Text              = BotInfo.SearchModeOffReply;
            txbSearchModeAlreadyOffReply.Text       = BotInfo.SearchModeAlreadyOffReply;
            txbSearchNoResultReply.Text             = BotInfo.SearchNoResultReply;
            txbSearchErrorReply.Text                = BotInfo.SearchErrorReply;
            txbSearchSauceNAOLowSimilarity.Text     = BotInfo.SearchSauceNAOLowSimilarity.ToString();
            txbSearchSauceNAOHighSimilarity.Text    = BotInfo.SearchSauceNAOHighSimilarity.ToString();
            txbSearchLowSimilarityReply.Text        = BotInfo.SearchLowSimilarityReply;
            txbSearchDownloadThuImageFailReply.Text = BotInfo.SearchDownloadThuImageFailReply;

            chkSearchCheckPornEnabled.Checked   = BotInfo.SearchCheckPornEnabled; //是否在搜图启用鉴黄
            txbSearchCheckPornIllegalReply.Text = BotInfo.SearchCheckPornIllegalReply;
            txbSearchCheckPornErrorReply.Text   = BotInfo.SearchCheckPornErrorReply;

            chkOriginPictureEnabled.Checked          = BotInfo.OriginPictureEnabled;
            chkOriginPictureCheckPornEnabled.Checked = BotInfo.OriginPictureCheckPornEnabled; //是否在下载原图启用鉴黄
            switch (BotInfo.OriginPictureCheckPornEvent)                                      //鉴黄不通过的行为
            {
            case 0:
                rdoOriginPictureCheckPornSendByForward.Checked = true;
                break;

            case 1:
                rdoOriginPictureCheckPornDoNothing.Checked = true;
                break;

            case 2:
                rdoOriginPictureCheckPornReply.Checked = true;
                break;
            }
            txbOriginPictureCheckPornIllegalReply.Text = BotInfo.OriginPictureCheckPornIllegalReply;
            txbOriginPictureCheckPornErrorReply.Text   = BotInfo.OriginPictureCheckPornErrorReply;
            chkASCII2DRequestByWebBrowser.Checked      = BotInfo.ASCII2DRequestByWebBrowser;
            chkSauceNaoRequestByWebBrowser.Checked     = BotInfo.SauceNaoRequestByWebBrowser;
            chkSearchSendByForward.Checked             = BotInfo.SearchSendByForward;
            txbSearchCheckPornOutOfLimitReply.Text     = BotInfo.SearchCheckPornOutOfLimitReply;

            #endregion -- 搜图设置 --

            #region -- 翻译设置 --

            chkTranslateEnabled.Checked      = BotInfo.TranslateEnabled;
            cboTranslateEngine.SelectedIndex = (int)BotInfo.TranslateEngineType;
            txbTranslateToChinese.Text       = BotInfo.TranslateToChineseCMD;
            txbTranslateTo.Text        = BotInfo.TranslateToCMD;
            txbTranslateFromToCMD.Text = BotInfo.TranslateFromToCMD;

            foreach (long item in BotInfo.AutoTranslateGroupMemoriesQQ)
            {
                lstAutoTranslateGroupMemoriesQQ.Items.Add(item.ToString());
            }

            #endregion -- 翻译设置 --

            #region -- 色图设置 --

            foreach (var hSource in BotInfo.EnabledHPictureSource)
            {
                if (hSource == PictureSource.Lolicon)
                {
                    chkHPictureEnabledLoliconSource.Checked = true;
                }
                if (hSource == PictureSource.GreenOnions)
                {
                    chkHPictureEnabledGreenOnionsSource.Checked = true;
                }
            }
            foreach (var beautySource in BotInfo.EnabledBeautyPictureSource)
            {
                if (beautySource == PictureSource.ELF)
                {
                    chkEnabledELFBeautyPicture.Checked = true;
                }
                if (beautySource == PictureSource.GreenOnions)
                {
                    chkEnabledGreenOnionsBeautyPicture.Checked = true;
                }
            }
            txbHPictureOnceMessageMaxImageCount.Text = BotInfo.HPictureOnceMessageMaxImageCount.ToString();
            chkHPictureEnabled.Checked     = BotInfo.HPictureEnabled;
            txbHPictureApiKey.Text         = BotInfo.HPictureApiKey;
            txbHPictureCmd.Text            = BotInfo.HPictureCmd;
            chkRevokeBeautyPicture.Checked = BotInfo.RevokeBeautyPicture;
            if (BotInfo.HPictureUserCmd != null)
            {
                foreach (var item in BotInfo.HPictureUserCmd)
                {
                    lstHPictureUserCmd.Items.Add(item);
                }
            }
            if (BotInfo.HPictureWhiteGroup != null)
            {
                foreach (var item in BotInfo.HPictureWhiteGroup)
                {
                    lstHPictureWhiteGroup.Items.Add(item.ToString());
                }
            }
            chkHPictureWhiteOnly.Checked    = BotInfo.HPictureWhiteOnly;
            chkHPictureAllowR18.Checked     = BotInfo.HPictureAllowR18;
            chkHPictureR18WhiteOnly.Checked = BotInfo.HPictureR18WhiteOnly;
            chkHPictureAllowPM.Checked      = BotInfo.HPictureAllowPM;
            chkHPictureSize1200.Checked     = BotInfo.HPictureSize1200;
            txbHPictureLimit.Text           = BotInfo.HPictureLimit.ToString();
            chkHPicturePMNoLimit.Checked    = BotInfo.HPicturePMNoLimit;
            chkHPictureAdminNoLimit.Checked = BotInfo.HPictureAdminNoLimit;
            chkHPictureWhiteNoLimit.Checked = BotInfo.HPictureWhiteNoLimit;
            txbHPictureCD.Text              = BotInfo.HPictureCD.ToString();
            txbHPictureRevoke.Text          = BotInfo.HPictureRevoke.ToString();
            txbHPictureWhiteCD.Text         = BotInfo.HPictureWhiteCD.ToString();
            txbHPictureWhiteRevoke.Text     = BotInfo.HPictureWhiteRevoke.ToString();
            txbHPicturePMCD.Text            = BotInfo.HPicturePMCD.ToString();
            txbHPicturePMRevoke.Text        = BotInfo.HPicturePMRevoke.ToString();
            txbHPictureCDUnreadyReply.Text  = BotInfo.HPictureCDUnreadyReply;
            txbHPictureOutOfLimitReply.Text = BotInfo.HPictureOutOfLimitReply;
            txbHPictureErrorReplyReply.Text = BotInfo.HPictureErrorReply;
            txbHPictureNoResultReply.Text   = BotInfo.HPictureNoResultReply;
            txbDownloadFailReply.Text       = BotInfo.HPictureDownloadFailReply;
            if (BotInfo.HPictureLimitType == LimitType.Count)
            {
                rodHPictureLimitCount.Checked = true;
            }
            else
            {
                rdoHPictureLimitFrequency.Checked = true;
            }
            chkHPictureSendUrl.Checked       = BotInfo.HPictureSendUrl;
            chkHPictureSendTags.Checked      = BotInfo.HPictureSendTags;
            chkHPictureSendByForward.Checked = BotInfo.HPictureSendByForward;

            #endregion -- 色图设置 --

            #region -- 复读设置 --
            chkRandomRepeat.Checked                  = BotInfo.RandomRepeatEnabled;
            txbRandomRepeatProbability.Text          = BotInfo.RandomRepeatProbability.ToString();
            chkSuccessiveRepeat.Checked              = BotInfo.SuccessiveRepeatEnabled;
            txbSuccessiveRepeatCount.Text            = BotInfo.SuccessiveRepeatCount.ToString();
            chkRewindGif.Checked                     = BotInfo.RewindGifEnabled;
            txbRewindGifProbability.Text             = BotInfo.RewindGifProbability.ToString();
            chkHorizontalMirrorImage.Checked         = BotInfo.HorizontalMirrorImageEnabled;
            txbHorizontalMirrorImageProbability.Text = BotInfo.HorizontalMirrorImageProbability.ToString();
            chkVerticalMirrorImage.Checked           = BotInfo.VerticalMirrorImageEnabled;
            chkReplaceMeToYou.Checked                = BotInfo.ReplaceMeToYou;
            txbVerticalMirrorImageProbability.Text   = BotInfo.VerticalMirrorImageProbability.ToString();
            #endregion -- 复读设置 --

            #region -- 进/退群消息设置 --
            chkSendMemberJoinedMessage.Checked        = BotInfo.SendMemberJoinedMessage;
            chkSendMemberPositiveLeaveMessage.Checked = BotInfo.SendMemberPositiveLeaveMessage;
            chkSendMemberBeKickedMessage.Checked      = BotInfo.SendMemberBeKickedMessage;
            txbMemberJoinedMessage.Text        = BotInfo.MemberJoinedMessage;
            txbMemberPositiveLeaveMessage.Text = BotInfo.MemberPositiveLeaveMessage;
            txbMemberBeKickedMessage.Text      = BotInfo.MemberBeKickedMessage;
            #endregion  -- 进/退群消息设置 --

            #region -- 伪造消息 --

            chkEnabledForgeMessage.Checked = BotInfo.ForgeMessageEnabled;
            txbForgeMessageCmdBegin.Text   = BotInfo.ForgeMessageCmdBegin;
            txbForgeMessageCmdNewLine.Text = BotInfo.ForgeMessageCmdNewLine;
            chkForgeMessageAppendBotMessageEnabled.Checked = BotInfo.ForgeMessageAppendBotMessageEnabled;
            chkForgeMessageAdminOnly.Checked       = BotInfo.ForgeMessageAdminOnly;
            chkForgeMessageAdminDontAppend.Checked = BotInfo.ForgeMessageAdminDontAppend;
            txbForgeMessageAppendMessage.Text      = BotInfo.ForgeMessageAppendMessage;
            chkRefuseForgeAdmin.Checked            = BotInfo.RefuseForgeAdmin;
            txbRefuseForgeAdminReply.Text          = BotInfo.RefuseForgeAdminReply;
            chkRefuseForgeBot.Checked   = BotInfo.RefuseForgeBot;
            txbRefuseForgeBotReply.Text = BotInfo.RefuseForgeBotReply;

            #endregion -- 伪造消息 --

            #region -- RSS --
            chkRssEnabled.Checked = BotInfo.RssEnabled;
            if (BotInfo.RssSubscription != null)
            {
                pnlRssSubscriptionList.Controls.Remove(btnAddRssSubscription);
                foreach (RssSubscriptionItem item in BotInfo.RssSubscription)
                {
                    CtrlRssItem ctrlRssItem = new CtrlRssItem();
                    ctrlRssItem.Width = RssItemCtrlWidth;
                    ctrlRssItem.RssSubscriptionUrl = item.Url;
                    ctrlRssItem.RssRemark          = item.Remark;
                    ctrlRssItem.RssForwardGroups   = item.ForwardGroups;
                    ctrlRssItem.RssForwardQQs      = item.ForwardQQs;
                    ctrlRssItem.RssTranslate       = item.Translate;
                    ctrlRssItem.RssTranslateFromTo = item.TranslateFromTo;
                    ctrlRssItem.RssTranslateFrom   = item.TranslateFrom;
                    ctrlRssItem.RssTranslateTo     = item.TranslateTo;
                    ctrlRssItem.RssSendByForward   = item.SendByForward;
                    ctrlRssItem.RssAtAll           = item.AtAll;
                    ctrlRssItem.RemoveClick       += (_, _) => pnlRssSubscriptionList.Controls.Remove(ctrlRssItem);
                    pnlRssSubscriptionList.Controls.Add(ctrlRssItem);
                }
                pnlRssSubscriptionList.Controls.Add(btnAddRssSubscription);
            }
            txbReadRssInterval.Text = BotInfo.ReadRssInterval.ToString();
            #endregion  -- RSS --

            #region -- 井字棋 --
            chkTicTacToeEnabled.Checked        = BotInfo.TicTacToeEnabled;
            txbStartTicTacToeCmd.Text          = BotInfo.StartTicTacToeCmd;
            txbTicTacToeStartedReply.Text      = BotInfo.TicTacToeStartedReply;
            txbTicTacToeAlreadyStartReply.Text = BotInfo.TicTacToeAlreadyStartReply;
            txbStopTicTacToeCmd.Text           = BotInfo.StopTicTacToeCmd;
            txbTicTacToeStoppedReply.Text      = BotInfo.TicTacToeStoppedReply;
            txbTicTacToeAlreadStopReply.Text   = BotInfo.TicTacToeAlreadStopReply;
            txbTicTacToeTimeoutReply.Text      = BotInfo.TicTacToeTimeoutReply;
            txbTicTacToePlayerWinReply.Text    = BotInfo.TicTacToePlayerWinReply;
            txbTicTacToeBotWinReply.Text       = BotInfo.TicTacToeBotWinReply;
            txbTicTacToeDrawReply.Text         = BotInfo.TicTacToeDrawReply;
            txbTicTacToeNoMoveReply.Text       = BotInfo.TicTacToeNoMoveReply;
            txbTicTacToeIllegalMoveReply.Text  = BotInfo.TicTacToeIllegalMoveReply;
            txbTicTacToeMoveFailReply.Text     = BotInfo.TicTacToeMoveFailReply;
            foreach (CheckBox moveMode in pnlTicTacToeMoveMode.Controls.OfType <CheckBox>())
            {
                moveMode.Checked = (BotInfo.TicTacToeMoveMode & Convert.ToInt32(moveMode.Tag)) != 0;
            }
            #endregion -- 井字棋 --
        }