예제 #1
0
 public static void ProcessSerQueue()
 {
     try
     {
         int num = 0;
         while (num < 200)
         {
             if (Connect.Count <= 0)
             {
                 return;
             }
             num++;
             SevConnClass class2 = (SevConnClass)Connect.Dequeue();
             try
             {
                 if (class2.UserId.IndexOf(' ', class2.UserId.Length - 1) != -1)
                 {
                     Form1.WriteLine(1, "用户非法登陆[" + class2.UserId + "]" + class2.UserIp);
                 }
                 else if (!smethod_4(class2.UserId))
                 {
                     playerS rs = smethod_3(class2.UserId);
                     if (rs != null)
                     {
                         rs.conn     = 0;
                         rs.UserIp   = class2.UserIp;
                         rs.ServerID = class2.ServerID;
                         rs.WorldID  = class2.WorldID;
                         class2.Server.Sendd(string.Concat(new object[] { "用户登陆|", class2.UserId, "|", class2.WorldID, "|不在线|", int_9 }));
                     }
                 }
                 else
                 {
                     smethod_9(class2.ServerID, class2.WorldID);
                 }
                 continue;
             }
             catch (Exception exception)
             {
                 Form1.WriteLine(1, "ProcessSerQueue()出错 " + exception.Message);
                 continue;
             }
         }
     }
     catch
     {
     }
 }
예제 #2
0
        public byte[] DataReceived(byte[] data, int length)
        {
            byte[] buffer;
            try
            {
                Dictionary <string, playerS> dictionary;
                string[] strArray2;
                int      num;
                bool     flag;
                string   str = Encoding.Default.GetString(data);
                Form1.WriteLine(3, "帐号验证收到:" + str);
                string[] strArray = str.Split(new char[] { '|' });
                switch (strArray[0])
                {
                case "复查用户登陆":
                    dictionary = new Dictionary <string, playerS>();
                    strArray2  = strArray[1].Split(new char[] { ',' });
                    if (strArray2.Length <= 1)
                    {
                        goto Label_04AD;
                    }
                    num = 0;
                    goto Label_045C;

                case "踢出玩家用户":
                    if (!World.smethod_4(strArray[1]))
                    {
                        goto Label_0475;
                    }
                    this.Sendd("踢出玩家成功 ID: " + strArray[1]);
                    goto Label_04AD;

                case "用户登陆":
                    if (strArray.Length == 5)
                    {
                        this.SevConn          = new SevConnClass();
                        this.SevConn.Server   = this;
                        this.SevConn.UserId   = strArray[1];
                        this.SevConn.UserIp   = strArray[2];
                        this.SevConn.ServerID = strArray[3];
                        this.SevConn.WorldID  = strArray[4];
                        World.Connect.Enqueue(this.SevConn);
                    }
                    goto Label_04AD;

                case "用户登出":
                    World.smethod_2(strArray[1]);
                    goto Label_04AD;

                case "更新服务器配置":
                    this.Int32_0 = int.Parse(strArray[2]);
                    goto Label_04AD;

                case "服务器连接登陆":
                    this.ServerId = strArray[1];
                    this.Int32_0  = int.Parse(strArray[2]);
                    World.smethod_6(this.ServerId);
                    Form1.WriteLine(3, "服务器连接成功 ID:" + strArray[1]);
                    goto Label_04AD;

                case "狮子吼":
                    if (World.queue_0.Count < World.int_1)
                    {
                        break;
                    }
                    goto Label_0499;

                case "更新服务器端口":
                {
                    string s    = strArray[1];
                    string str3 = strArray[2];
                    foreach (ServerClass class4 in World.ServerList)
                    {
                        foreach (ServerXlClass class5 in class4.ServerList)
                        {
                            if (class5.ServerZId == int.Parse(s))
                            {
                                class5.SERVER_PORT = str3;
                            }
                        }
                    }
                    Form1.WriteLine(3, "更新服务器端口 ID:" + strArray[1] + "   " + strArray[2]);
                    goto Label_04AD;
                }

                default:
                    goto Label_04AD;
                }
                GClass0 class2 = new GClass0
                {
                    FLD_INDEX    = int.Parse(strArray[1]),
                    UserName     = strArray[2],
                    TxtId        = World.int_0,
                    Txt          = strArray[3],
                    UserClientIP = strArray[4],
                    Int32_0      = int.Parse(strArray[5]),
                    Map          = int.Parse(strArray[6])
                };
                World.queue_0.Enqueue(class2);
                if (World.int_0 < 0x7f)
                {
                    goto Label_048B;
                }
                World.int_0 = 0;
                goto Label_04AD;
Label_03C3:
                if (num >= strArray2.Length)
                {
                    goto Label_0464;
                }
                try
                {
                    string[] strArray3 = strArray2[num].Split(new char[] { '-' });
                    playerS  rs        = new playerS
                    {
                        UserId = strArray3[0]
                    };
                    if (strArray3.Length >= 2)
                    {
                        rs.UserIp = strArray3[1];
                    }
                    rs.ServerID = this.ServerId;
                    rs.conn     = 0;
                    dictionary.Add(strArray3[0], rs);
                }
                catch
                {
                }
                num++;
Label_045C:
                flag = true;
                goto Label_03C3;
Label_0464:
                World.smethod_10(this.ServerId, dictionary);
                goto Label_04AD;
Label_0475:
                this.Sendd("踢出玩家失败 ID: " + strArray[1]);
                goto Label_04AD;
Label_048B:
                World.int_0++;
                goto Label_04AD;
Label_0499:
                this.Sendd("狮子吼|NO|" + strArray[1]);
Label_04AD:
                buffer = null;
            }
            catch (Exception exception)
            {
                Form1.WriteLine(1, "出错:" + exception.Message);
                Console.WriteLine(exception.Message);
                Console.WriteLine(exception.Source);
                Console.WriteLine(exception.StackTrace);
                buffer = null;
            }
            return(buffer);
        }
예제 #3
0
        public override byte[] DataReceived2(byte[] data, int length)
        {
            byte[] buffer2;
            try
            {
                bool   flag;
                byte[] dst = new byte[length];
                Buffer.BlockCopy(data, 0, dst, 0, length);
                string str = Encoding.Default.GetString(dst);
                Form1.WriteLine(3, "帐号验证收到:" + str);
                string[] strArray = str.Split(new char[] { '|' });
                string   str2     = strArray[0];
                if (str2 == null)
                {
                    goto Label_028E;
                }
                if (str2 != "复查用户登陆")
                {
                    goto Label_0166;
                }
                Dictionary <string, playerS> players = new Dictionary <string, playerS>();
                string[] strArray2 = strArray[1].Split(new char[] { ',' });
                if (strArray2.Length <= 1)
                {
                    goto Label_028E;
                }
                int index = 0;
                goto Label_0149;
Label_00B0:
                if (index >= strArray2.Length)
                {
                    goto Label_0151;
                }
                try
                {
                    string[] strArray3 = strArray2[index].Split(new char[] { '-' });
                    playerS  rs        = new playerS
                    {
                        UserId = strArray3[0]
                    };
                    if (strArray3.Length >= 2)
                    {
                        rs.UserIp = strArray3[1];
                    }
                    rs.ServerID = this.ServerId;
                    rs.conn     = 0;
                    players.Add(strArray3[0], rs);
                }
                catch
                {
                }
                index++;
Label_0149:
                flag = true;
                goto Label_00B0;
Label_0151:
                World.smethod_10(this.ServerId, players);
                goto Label_028E;
Label_0166:
                switch (str2)
                {
                case "用户登陆":
                    if (strArray.Length == 5)
                    {
                        this.SevConn          = new SevConnClass();
                        this.SevConn.Server   = this;
                        this.SevConn.UserId   = strArray[1];
                        this.SevConn.UserIp   = strArray[2];
                        this.SevConn.ServerID = strArray[3];
                        this.SevConn.WorldID  = strArray[4];
                        World.Connect.Enqueue(this.SevConn);
                    }
                    break;

                case "用户登出":
                    World.smethod_2(strArray[1]);
                    break;

                default:
                    switch (str2)
                    {
                    case "更新服务器配置":
                        this.Int32_0 = int.Parse(strArray[2]);
                        break;

                    case "服务器连接登陆":
                        this.ServerId = strArray[1];
                        this.Int32_0  = int.Parse(strArray[2]);
                        World.smethod_6(this.ServerId);
                        Form1.WriteLine(3, "服务器连接成功 ID:" + strArray[1]);
                        break;
                    }
                    break;
                }
Label_028E:
                buffer2 = null;
            }
            catch (Exception exception)
            {
                Form1.WriteLine(1, "出错:" + exception.Message);
                Console.WriteLine(exception.Message);
                Console.WriteLine(exception.Source);
                Console.WriteLine(exception.StackTrace);
                buffer2 = null;
            }
            return(buffer2);
        }