예제 #1
0
 private void FormSettings_Load(object sender, EventArgs e)
 {
     textBox1.Text = LinqXML.read(MyPlugin.confirm, "群号");
     textBox2.Text = LinqXML.read(MyPlugin.confirm, "admin");
     textBox4.Text = LinqXML.read(MyPlugin.confirm, "IP");
     textBox5.Text = LinqXML.read(MyPlugin.confirm, "Port");
 }
예제 #2
0
        /// <summary>
        /// 应用启动,完成插件线程、全局变量等自身运行所必须的初始化工作。
        /// </summary>
        public override void Startup()
        {
            //完成插件线程、全局变量等自身运行所必须的初始化工作。

            FormSettings frm = new FormSettings();
            //frm.ShowDialog();
            string check = LinqXML.read(confirm, "群号1");

            if (check == "")
            {
                MessageBox.Show("未设置群号,请设置"); frm.ShowDialog();
            }
            else
            {
                GroupSet1 = long.Parse(check);
            }
            ipaddress = LinqXML.read(confirm, "IP");
            if (ipaddress == "")
            {
                MessageBox.Show("未设置IP,请设置"); frm.ShowDialog();
            }
            else
            {
                ipaddress = LinqXML.read(confirm, "IP");
            }
            check = LinqXML.read(confirm, "Port");
            if (check == "")
            {
                MessageBox.Show("未设置端口,请设置"); frm.ShowDialog();
            }
            else
            {
                Port = int.Parse(LinqXML.read(confirm, "Port"));
            }
            CQ.SendGroupMessage(GroupSet1, "Minecraft_QQ已启动-作者yan_color");
            check = LinqXML.read(confirm, "群号2");
            if (check != "")
            {
                GroupSet2 = long.Parse(check);
                if (GroupSet2 != 0)
                {
                    CQ.SendGroupMessage(GroupSet2, "Minecraft_QQ已启动-作者yan_color");
                }
            }
            else
            {
                GroupSet2 = 0;
            }
            socket.start_socket();
        }
예제 #3
0
        private void button_Click(object sender, EventArgs e)
        {
            int tmp;

            LinqXML.write(MyPlugin.confirm, "IP", textBox4.Text);
            LinqXML.write(MyPlugin.confirm, "Port", textBox5.Text);
            if (!int.TryParse(textBox5.Text, out tmp))
            {
                MessageBox.Show("请正确输入数字");
                return;
            }
            MyPlugin.Port      = int.Parse(textBox5.Text);
            MyPlugin.ipaddress = textBox4.Text;
            button.Text        = "已设置";
        }
예제 #4
0
 /// <summary>
 /// Type=2 群消息。
 /// </summary>
 /// <param name="subType">子类型,目前固定为1。</param>
 /// <param name="sendTime">发送时间(时间戳)。</param>
 /// <param name="fromGroup">来源群号。</param>
 /// <param name="fromQQ">来源QQ。</param>
 /// <param name="fromAnonymous">来源匿名者。</param>
 /// <param name="msg">消息内容。</param>
 /// <param name="font">字体。</param>
 public override void GroupMessage(int subType, int sendTime, long fromGroup, long fromQQ, string fromAnonymous, string msg, int font)
 {
     // 处理群消息。
     if (fromGroup == GroupSet1)
     {
         string x = msg.Substring(0, 4);
         if (x == "服务器:" || x == "服务器:")
         {
             string reply = LinqXML.read(confirm, fromQQ.ToString());
             if (reply != "")
             {
                 text = reply + ':' + RemoveLeft(msg, 4);
                 text = "群消息" + text;
             }
             else
             {
                 CQ.SendGroupMessage(GroupSet1, "检测到你没有绑定服务器ID,发送“绑定:ID”来绑定,如:绑定:yan_color");
             }
         }
         if (msg.IndexOf("绑定:") == 0)
         {
             if (LinqXML.read(confirm, fromQQ.ToString()) == "")
             {
                 string a = msg.Replace("绑定:", "");
                 msg = a;
                 if (a == " " || a == "")
                 {
                     CQ.SendGroupMessage(GroupSet1, CQ.CQCode_At(fromQQ) + "绑定失败,禁止绑定为空");
                 }
                 else
                 {
                     var sb = new StringBuilder(a);
                     sb.Replace(":", string.Empty);
                     sb.Replace(" ", string.Empty);
                     LinqXML.write(confirm, fromQQ.ToString(), sb.ToString());
                     CQ.SendGroupMessage(GroupSet1, CQ.CQCode_At(fromQQ) + "绑定ID:" + msg.Replace("绑定", "") + "成功!");
                 }
             }
             else
             {
                 CQ.SendGroupMessage(GroupSet1, CQ.CQCode_At(fromQQ) + "你已经绑定过了,想换ID私聊服主去吧");
             }
         }
         if (msg == "在线人数")
         {
             CQ.SendGroupMessage(GroupSet1, "查询中");
             text = "在线人数:";
             g    = 1;
         }
         if (msg == "服务器状态")
         {
             CQ.SendGroupMessage(GroupSet1, "查询中,如果没有回复,则证明服务器未开启");
             text = "服务器状态";
             g    = 1;
         }
         if (msg.IndexOf("功能菜单") == 0)
         {
             CQ.SendGroupMessage(GroupSet1, "输入“绑定:ID”可以绑定你的游戏ID。\r\n输入“在线人数”可以查询服务器在线人数。\r\n输入“服务器状态”可以查询服务器是否在运行。\r\n输入“服务器:【内容】”可以向服务器里发送消息。");
         }
     }
     if (fromGroup == GroupSet2)
     {
         string x = msg.Substring(0, 4);
         if (x == "服务器:" || x == "服务器:")
         {
             string reply = LinqXML.read(confirm, fromQQ.ToString());
             if (reply != "")
             {
                 text = reply + ':' + RemoveLeft(msg, 4);
                 text = "群消息" + text;
             }
             else
             {
                 CQ.SendGroupMessage(GroupSet2, "检测到你没有绑定服务器ID,发送“绑定:ID”来绑定,如:绑定:yan_color");
             }
         }
         if (msg.IndexOf("绑定:") == 0)
         {
             if (LinqXML.read(confirm, fromQQ.ToString()) == "")
             {
                 string a = msg.Replace("绑定:", "");
                 msg = a;
                 if (a == " " || a == "")
                 {
                     CQ.SendGroupMessage(GroupSet2, CQ.CQCode_At(fromQQ) + "绑定失败,禁止绑定为空");
                 }
                 else
                 {
                     var sb = new StringBuilder(a);
                     sb.Replace(":", string.Empty);
                     sb.Replace(" ", string.Empty);
                     LinqXML.write(confirm, fromQQ.ToString(), sb.ToString());
                     CQ.SendGroupMessage(GroupSet2, CQ.CQCode_At(fromQQ) + "绑定ID:" + msg.Replace("绑定:", "") + "成功!");
                 }
             }
             else
             {
                 CQ.SendGroupMessage(GroupSet2, CQ.CQCode_At(fromQQ) + "你已经绑定过了,想换ID私聊服主去吧");
             }
         }
         if (msg == "在线人数")
         {
             CQ.SendGroupMessage(GroupSet2, "查询中");
             text = "在线人数:";
             g    = 2;
         }
         if (msg == "服务器状态")
         {
             CQ.SendGroupMessage(GroupSet2, "查询中,如果没有回复,则证明服务器未开启");
             text = "服务器状态";
             g    = 2;
         }
         if (msg.IndexOf("功能菜单") == 0)
         {
             CQ.SendGroupMessage(GroupSet2, "输入“绑定:ID”可以绑定你的游戏ID。\r\n输入“在线人数”可以查询服务器在线人数。\r\n输入“服务器状态”可以查询服务器是否在运行。\r\n输入“服务器:【内容】”可以向服务器里发送消息。");
         }
     }
 }
예제 #5
0
 private void button4_Click(object sender, EventArgs e)
 {
     LinqXML.write(MyPlugin.confirm, "群号2", textBox3.Text);
     MyPlugin.GroupSet2 = long.Parse(textBox3.Text);
     button4.Text       = "设置成功";
 }
예제 #6
0
 private void button2_Click(object sender, EventArgs e)
 {
     LinqXML.write(MyPlugin.confirm, "admin", textBox2.Text);
     button2.Text = "添加成功";
 }