Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
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));
        }
Exemplo n.º 3
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);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 获取图片高度
        /// </summary>
        /// <param name="image"></param>
        /// <returns></returns>
        public static int GetPictureHeight(string image)
        {
            string fileName = Tools.Reg_get(image, "\\[CQ:image,file=(?<name>.*?)\\]", "name") + ".cqimg";//获取文件名
            string filePath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase + @"data\image\" + fileName;

            if (File.Exists(filePath))
            {
                IniObject iObject = IniObject.Load(filePath, Encoding.Default);
                return(iObject["image"]["height"].ToInt32());
            }
            return(0);//没这个文件
        }
Exemplo n.º 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();
            }
        }
Exemplo n.º 6
0
        void ReadConfig()
        {
            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);
            sign1        = INIhelper.IniRead("Answer", "Sign1", "大姐你回来了,天气这么好一起多逛逛吧", path);
            sign2        = INIhelper.IniRead("Answer", "Sign2", "<@>这是你今天清扫甲板的报酬,拿好(<#>水晶)", path);
            querydiamond = INIhelper.IniRead("Answer", "QueryDiamond", "<@>你手头还有<#>水晶", path);
            IniObject iObject = IniObject.Load(path, Encoding.Default);         // 从指定的文件中读取 Ini 配置项, 参数1: 文件路径, 参数2: 编码格式 [默认: ANSI]
            IniValue  value1  = iObject["Answer"]["Help"];

            help   = value1.ToString();
            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));
        }
Exemplo n.º 7
0
        private void Initialize()
        {
            string cPath = Path.Combine(Common.AppDirectory, type + ".ini");

            if (File.Exists(cPath))
            {
                using (FileStream myStream = new FileStream(GetSrcImagePath(), FileMode.Open))
                    srcImage = Image.FromStream(myStream);

                graphics = Graphics.FromImage(srcImage);

                IniObject iObject = IniObject.Load(cPath);

                IniSection fontconfig = iObject["font"];
                string     fontname   = fontconfig["fontname"].ToString();
                float      fontsize   = fontconfig["fontsize"].ToSingle();
                font = new Font(fontname, fontsize);

                int color = Convert.ToInt32(fontconfig["rgb"].ToString(), 16);
                brush = new SolidBrush(Color.FromArgb(color));

                IniSection positionconfig = iObject["position"];
                float      x = positionconfig["x"].ToSingle();
                float      y = positionconfig["y"].ToSingle();
                position = new PointF(x, y);

                string alignment = positionconfig["alignment"].ToString();
                format.LineAlignment = StringAlignment.Near;
                format.Alignment     = GetAlignment(alignment);

                string repeating = positionconfig["repeating"].ToString();
                mode = GetPicRepeatingType(repeating);
            }
            else
            {
                throw new Exception(type + "的配置文件不存在!");
            }
        }