示例#1
0
        /// <summary>
        /// 创建配置文件
        /// </summary>
        /// <returns></returns>
        public static bool CreateConfig(string rootpath)
        {
            try
            {
                IniObject iObject = new IniObject()
                {
                    new IniSection("admin")
                    {
                        { "qq", "363384882" }
                    },
                    new IniSection("Create")
                    {
                        { "DateT", DateTime.Now }
                    },
                    new IniSection("InOne")
                    {
                        { "YinZhiChen", "" }
                    }
                };

                iObject.Save(rootpath + "config.ini");
                return(true);
            }
            catch (Exception ex)
            {
                return(false);

                throw;
            }
        }
        private void AnswerDIY_Load(object sender, EventArgs e)
        {
            string path = $@"{CQSave.cq_menu.CQApi.AppDirectory}Config.ini";

            textBox_OrderKC1.Text          = INIhelper.IniRead("Order", "KC1", "#扩充单抽", path);
            textBox_OrderKC10.Text         = INIhelper.IniRead("Order", "KC10", "#扩充十连", path);
            textBox_OrderJZ1.Text          = INIhelper.IniRead("Order", "JZ1", "#精准单抽", path);
            textBox_OrderJZ10.Text         = INIhelper.IniRead("Order", "JZ10", "#精准十连", path);
            textBox_OrderRegiter.Text      = INIhelper.IniRead("Order", "Register", "#抽卡注册", path);
            textBox_OrderSign.Text         = INIhelper.IniRead("Order", "Sign", "#打扫甲板", path);
            textBox_OrderSignReset.Text    = INIhelper.IniRead("Order", "SignReset", "#甲板积灰", path);
            textBox_OrderQueryDiamond.Text = INIhelper.IniRead("Order", "QueryDiamond", "#我的水晶", path);
            textBox_OrderHelp.Text         = INIhelper.IniRead("Order", "Help", "#抽卡帮助", path);
            textBox_OrderGetPool.Text      = INIhelper.IniRead("Order", "GetPool", "#获取池子", path);

            textBox_AnsKC1.Text          = INIhelper.IniRead("Answer", "KC1", "少女祈祷中……", path);
            textBox_AnsKC10.Text         = INIhelper.IniRead("Answer", "KC10", "少女祈祷中……", path);
            textBox_AnsJZ1.Text          = INIhelper.IniRead("Answer", "JZ1", "少女祈祷中……", path);
            textBox_AnsJZ10.Text         = INIhelper.IniRead("Answer", "JZ10", "少女祈祷中……", path);
            textBox_AnsRegister.Text     = INIhelper.IniRead("Answer", "Register", "<@>欢迎上舰,这是你的初始资源(<#>)水晶", path);
            textBox_AnsMutiRegister.Text = INIhelper.IniRead("Answer", "MutiRegister", "重复注册是不行的哦", path);
            textBox_AnsSign1.Text        = INIhelper.IniRead("Answer", "Sign1", "大姐你回来了,天气这么好一起多逛逛吧", path);
            textBox_AnsSign2.Text        = INIhelper.IniRead("Answer", "Sign2", "<@>这是你今天清扫甲板的报酬,拿好(<#>水晶)", path);
            textBox_AnsMutiSign.Text     = INIhelper.IniRead("Answer", "MutiSign", "今天的甲板挺亮的,擦一遍就行了", path);
            textBox_AnsQueryDiamond.Text = INIhelper.IniRead("Answer", "QueryDiamond", "<@>你手头还有<#>水晶", path);
            textBox_AnsNoReg.Text        = INIhelper.IniRead("Answer", "NoReg", "<@>不是清洁工吧?来输入#抽卡注册 来上舰", path);
            textBox_AnsLowDiamond.Text   = INIhelper.IniRead("Answer", "LowDiamond", "<@>水晶不足,无法进行抽卡,你还剩余<#>水晶", path);
            IniObject iObject = IniObject.Load(path, Encoding.Unicode);     // 从指定的文件中读取 Ini 配置项, 参数1: 文件路径, 参数2: 编码格式 [默认: ANSI]

            try
            {
                IniValue value1 = iObject["Answer"]["Help"];
                textBox_AnsHelp.Text = value1.ToString();
            }
            catch
            {
                textBox_AnsHelp.Text = "";
            }
            if (textBox_AnsHelp.Text == "")
            {
                textBox_AnsHelp.Text = @"水银抽卡人 给你抽卡的自信(~ ̄▽ ̄)~ \n合成图片以及发送图片需要一些时间,请耐心等待\n单抽是没有保底的\n#抽卡注册\n#我的水晶\n#打扫甲板(签到)\n#甲板积灰(重置签到,管理员限定)\n#获取池子\n\n#精准单抽\n#扩充单抽\n#精准十连\n#扩充十连";
            }
            textBox_SignReset1.Text = INIhelper.IniRead("Answer", "Reset1", "贝贝龙来甲板找女王♂van,把甲板弄脏了,大家又得打扫一遍", path);
            textBox_SignReset2.Text = INIhelper.IniRead("Answer", "Reset2", "草履虫非要给鸭子做饭,厨房爆炸了,黑紫色的东西撒了一甲板,把甲板弄脏了,大家又得打扫一遍", path);
            textBox_SignReset3.Text = INIhelper.IniRead("Answer", "Reset3", "你和女武神们被从深渊扔了回来,来自深渊的炉灰把甲板弄脏了,大家又得打扫一遍", path);
            textBox_SignReset4.Text = INIhelper.IniRead("Answer", "Reset4", "由于神秘东方村庄的诅咒,你抽卡的泪水把甲板弄脏了,大家又得打扫一遍", path);
            textBox_SignReset5.Text = INIhelper.IniRead("Answer", "Reset5", "理律疯狂在甲板上逮虾户,把甲板弄脏了,大家又得打扫一遍", path);
            textBox_SignReset6.Text = INIhelper.IniRead("Answer", "Reset6", "希儿到处找不到鸭子,里人格暴走,把甲板弄脏了,大家又得打扫一遍", path);

            textBox_ResisterMin.Text = INIhelper.IniRead("GetDiamond", "RegisterMin", "0", path);
            textBox_RegisterMax.Text = INIhelper.IniRead("GetDiamond", "RegisterMax", "14000", path);
            textBox_SignMin.Text     = INIhelper.IniRead("GetDiamond", "SignMin", "0", path);
            textBox_SignMax.Text     = INIhelper.IniRead("GetDiamond", "SignMax", "14000", path);
        }
示例#3
0
        void ReadConfig(CQGroupMessageEventArgs e)
        {
            string path = $@"{cq.CQApi.AppDirectory}Config.ini";

            order_KC1          = INIhelper.IniRead("Order", "KC1", "#扩充单抽", path);
            order_KC10         = INIhelper.IniRead("Order", "KC10", "#扩充十连", path);
            order_JZ1          = INIhelper.IniRead("Order", "JZ1", "#精准单抽", path);
            order_JZ10         = INIhelper.IniRead("Order", "JZ10", "#精准十连", path);
            order_register     = INIhelper.IniRead("Order", "Register", "#抽卡注册", path);
            order_sign         = INIhelper.IniRead("Order", "Sign", "#打扫甲板", path);
            order_signreset    = INIhelper.IniRead("Order", "SignReset", "#甲板积灰", path);
            order_querydiamond = INIhelper.IniRead("Order", "QueryDiamond", "#我的水晶", path);
            order_help         = INIhelper.IniRead("Order", "Help", "#抽卡帮助", path);
            order_getpool      = INIhelper.IniRead("Order", "GetPool", "#获取池子", path);

            KC1          = INIhelper.IniRead("Answer", "KC1", "少女祈祷中……", path);
            KC10         = INIhelper.IniRead("Answer", "KC10", "少女祈祷中……", path);
            JZ1          = INIhelper.IniRead("Answer", "JZ1", "少女祈祷中……", path);
            JZ10         = INIhelper.IniRead("Answer", "JZ10", "少女祈祷中……", path);
            register     = INIhelper.IniRead("Answer", "Register", "<@>欢迎上舰,这是你的初始资源(<#>)水晶", path);
            mutiRegister = INIhelper.IniRead("Answer", "MutiRegister", "重复注册是不行的哦", path);
            sign1        = INIhelper.IniRead("Answer", "Sign1", "大姐你回来了,天气这么好一起多逛逛吧", path);
            sign2        = INIhelper.IniRead("Answer", "Sign2", "<@>这是你今天清扫甲板的报酬,拿好(<#>水晶)", path);
            mutiSign     = INIhelper.IniRead("Answer", "MutiSign", "今天的甲板挺亮的,擦一遍就行了", path);
            noReg        = INIhelper.IniRead("Answer", "NoReg", "<@>不是清洁工吧?来输入#抽卡注册 来上舰", path);
            lowDiamond   = INIhelper.IniRead("Answer", "LowDiamond", "<@>水晶不足,无法进行抽卡,你还剩余<#>水晶", path);
            queryDiamond = INIhelper.IniRead("Answer", "QueryDiamond", "<@>你手头还有<#>水晶", path);
            IniObject iObject = IniObject.Load(path, Encoding.Default);     // 从指定的文件中读取 Ini 配置项, 参数1: 文件路径, 参数2: 编码格式 [默认: ANSI]

            try
            {
                IniValue value1 = iObject["Answer"]["Help"];
                help = value1.ToString().Replace("\\", @"\");
            }
            catch
            {
                help = "";
            }
            if (help == "")
            {
                help = "水银抽卡人 给你抽卡的自信(~ ̄▽ ̄)~ \n合成图片以及发送图片需要一些时间,请耐心等待\n单抽是没有保底的\n#抽卡注册\n#我的水晶\n#打扫甲板(签到)\n#甲板积灰(重置签到,管理员限定)\n\n#精准单抽\n#扩充单抽\n#精准十连\n#扩充十连";
            }
            reset1 = INIhelper.IniRead("Answer", "Reset1", "贝贝龙来甲板找女王♂van,把甲板弄脏了,大家又得打扫一遍", path);
            reset2 = INIhelper.IniRead("Answer", "Reset2", "草履虫非要给鸭子做饭,厨房爆炸了,黑紫色的东西撒了一甲板,把甲板弄脏了,大家又得打扫一遍", path);
            reset3 = INIhelper.IniRead("Answer", "Reset3", "你和女武神们被从深渊扔了回来,来自深渊的炉灰把甲板弄脏了,大家又得打扫一遍", path);
            reset4 = INIhelper.IniRead("Answer", "Reset4", "由于神秘东方村庄的诅咒,你抽卡的泪水把甲板弄脏了,大家又得打扫一遍", path);
            reset5 = INIhelper.IniRead("Answer", "Reset5", "理律疯狂在甲板上逮虾户,把甲板弄脏了,大家又得打扫一遍", path);
            reset6 = INIhelper.IniRead("Answer", "Reset6", "希儿到处找不到鸭子,里人格暴走,把甲板弄脏了,大家又得打扫一遍", path);

            registermin = Convert.ToInt32(INIhelper.IniRead("GetDiamond", "RegisterMin", "0", path));
            registermax = Convert.ToInt32(INIhelper.IniRead("GetDiamond", "RegisterMax", "14000", path));
            signmin     = Convert.ToInt32(INIhelper.IniRead("GetDiamond", "SignMin", "0", path));
            signmax     = Convert.ToInt32(INIhelper.IniRead("GetDiamond", "SignMax", "14000", path));
        }
示例#4
0
        public void GroupMemberIncrease(object sender, CQGroupMemberIncreaseEventArgs e)
        {
            IniObject iniObject = IniObject.Load(e.CQApi.AppDirectory + "config.ini", Encoding.UTF8);

            if ("711498146,222600436".IndexOf(e.FromGroup.Id.ToString()) >= 0)
            {
                string str = iniObject["InOne"]["YinZhiChen"].ToString().Replace(" ", "\n");

                e.FromGroup.SendGroupMessage(CQApi.CQCode_At(e.BeingOperateQQ) + str);
            }
        }
示例#5
0
        private void buttonLoadIni_Click(object sender, EventArgs e)
        {
            var ofd = new OpenFileDialog()
            {
                InitialDirectory = Directory.GetCurrentDirectory(),
                Filter           = "Ini File(*.ini)|",
                Multiselect      = false,
            };


            if (ofd.ShowDialog() == DialogResult.OK)
            {
                IniObject = new IniObject(ofd.FileName);
                IniObject.Load();

                //richTextBoxIni.Text = IniObject.Data?.ToString();
            }
        }
示例#6
0
        private void buttonSaveIni_Click(object sender, EventArgs e)
        {
            var sfd = new SaveFileDialog()
            {
                InitialDirectory = Directory.GetCurrentDirectory(),
                Filter           = "Ini File(*.ini)|",
            };


            if (sfd.ShowDialog() == DialogResult.OK)
            {
                if (IniObject == null)
                {
                    IniObject = new IniObject();
                }

                //IniObject.Data = new IniDataParser().Parse(richTextBoxIni.Text);
                //IniObject.Save();
            }
        }