示例#1
0
 public ServerSync(ServerProfile server, AccountProfile account, ShardProfile shard)
 {
     this.m_Server         = server;
     this.m_Account        = account;
     this.m_Shard          = shard;
     this.m_Buffer         = new byte[0x800];
     this.m_CryptoProvider = new LoginCrypto((uint)Network.ClientIP);
     Dns.BeginResolve(server.Address, new AsyncCallback(this.OnResolve), null);
 }
示例#2
0
 public ServerSync(ServerProfile server, AccountProfile account, ShardProfile shard)
 {
     this.m_Server = server;
     this.m_Account = account;
     this.m_Shard = shard;
     this.m_Buffer = new byte[0x800];
     this.m_CryptoProvider = new LoginCrypto((uint) Network.ClientIP);
     Dns.BeginResolve(server.Address, new AsyncCallback(this.OnResolve), null);
 }
示例#3
0
 public ShardSync(ServerProfile server, AccountProfile account, ShardProfile shard)
 {
     this.m_Server = server;
     this.m_Account = account;
     this.m_Shard = shard;
     this.m_Compressed = new byte[0x800];
     this.m_Buffer = new byte[0x800];
     this.m_CryptoProvider = new GameCrypto((uint) shard.Auth);
     this.Connect(new IPEndPoint(shard.Address, shard.Port));
 }
示例#4
0
 public ShardSync(ServerProfile server, AccountProfile account, ShardProfile shard)
 {
     this.m_Server         = server;
     this.m_Account        = account;
     this.m_Shard          = shard;
     this.m_Compressed     = new byte[0x800];
     this.m_Buffer         = new byte[0x800];
     this.m_CryptoProvider = new GameCrypto((uint)shard.Auth);
     this.Connect(new IPEndPoint(shard.Address, shard.Port));
 }
示例#5
0
 public void AddShard(ShardProfile shard)
 {
     ShardProfile[] shards = this.m_Shards;
     this.m_Shards = new ShardProfile[shards.Length + 1];
     for (int i = 0; i < shards.Length; i++)
     {
         this.m_Shards[i] = shards[i];
     }
     this.m_Shards[shards.Length] = shard;
 }
示例#6
0
        public int Compare(object x, object y)
        {
            ShardProfile shard    = null;
            ShardProfile profile2 = null;

            if (x is GShardMenu)
            {
                shard = ((GShardMenu)x).Shard;
            }
            else
            {
                shard = x as ShardProfile;
            }
            if (y is GShardMenu)
            {
                profile2 = ((GShardMenu)y).Shard;
            }
            else
            {
                profile2 = y as ShardProfile;
            }
            if (shard == null)
            {
                return(1);
            }
            if (profile2 == null)
            {
                return(-1);
            }
            TimeZone currentTimeZone = TimeZone.CurrentTimeZone;
            DateTime now             = DateTime.Now;
            int      hours           = currentTimeZone.GetUtcOffset(now).Hours;
            int      num2            = -shard.TimeZone;
            int      num3            = -profile2.TimeZone;
            int      num4            = Math.Abs((int)(hours - num2));
            int      num5            = Math.Abs((int)(hours - num3));
            int      num6            = num4 - num5;

            if (num6 == 0)
            {
                num6 = shard.Name.CompareTo(profile2.Name);
                if (num6 == 0)
                {
                    num6 = shard.Index - profile2.Index;
                }
            }
            return(num6);
        }
示例#7
0
        private static ServerProfile[] Load()
        {
            if (!File.Exists(Engine.FileManager.BasePath("Data/Profiles.xml")))
            {
                return(new ServerProfile[0]);
            }
            XmlDocument document = new XmlDocument();

            document.Load(Engine.FileManager.BasePath("Data/Profiles.xml"));
            ArrayList list = new ArrayList();

            foreach (XmlElement element in document.GetElementsByTagName("server"))
            {
                string        attribute = element.GetAttribute("title");
                string        address   = element.GetAttribute("address");
                string        s         = element.GetAttribute("port");
                ServerProfile server    = new ServerProfile(attribute, address, XmlConvert.ToInt32(s));
                foreach (XmlElement element2 in element.GetElementsByTagName("account"))
                {
                    string         title    = element2.GetAttribute("title");
                    string         username = element2.GetAttribute("username");
                    string         password = element2.GetAttribute("password");
                    AccountProfile account  = new AccountProfile(server, title, username, password);
                    foreach (XmlElement element3 in element2.GetElementsByTagName("shard"))
                    {
                        string       name     = element3.GetAttribute("name");
                        string       ipString = element3.GetAttribute("address");
                        string       str10    = element3.GetAttribute("port");
                        string       str11    = element3.GetAttribute("index");
                        string       str12    = element3.GetAttribute("timeZone");
                        string       str13    = element3.GetAttribute("percentFull");
                        string       str14    = element3.GetAttribute("auth");
                        ShardProfile shard    = new ShardProfile(account, IPAddress.Parse(ipString), XmlConvert.ToInt32(str10), XmlConvert.ToInt32(str11), XmlConvert.ToInt32(str12), XmlConvert.ToInt32(str13), XmlConvert.ToInt32(str14), name);
                        foreach (XmlElement element4 in element3.GetElementsByTagName("character"))
                        {
                            string str15 = element4.GetAttribute("index");
                            string str16 = element4.GetAttribute("name");
                            shard.AddCharacter(new CharacterProfile(shard, str16, XmlConvert.ToInt32(str15)));
                        }
                        account.AddShard(shard);
                    }
                    server.AddAccount(account);
                }
                list.Add(server);
            }
            return((ServerProfile[])list.ToArray(typeof(ServerProfile)));
        }
示例#8
0
 public bool Contains(ShardProfile shard)
 {
     return (Array.IndexOf(this.m_Shards, shard) >= 0);
 }
示例#9
0
 public void AddShard(ShardProfile shard)
 {
     ShardProfile[] shards = this.m_Shards;
     this.m_Shards = new ShardProfile[shards.Length + 1];
     for (int i = 0; i < shards.Length; i++)
     {
         this.m_Shards[i] = shards[i];
     }
     this.m_Shards[shards.Length] = shard;
 }
示例#10
0
 public GShardMenu(ShardProfile shard) : base(shard.Name)
 {
     this.m_Shard = shard;
 }
示例#11
0
 public void ShardList(PacketReader pvSrc)
 {
     pvSrc.ReadByte();
     int num = pvSrc.ReadInt16();
     if (num > 0)
     {
         int port = this.m_Server.Port;
         switch (port)
         {
             case 0x1e5f:
             case 0x1e60:
                 port = 0x1389;
                 break;
         }
         for (int i = 0; i < num; i++)
         {
             int index = pvSrc.ReadInt16();
             string name = pvSrc.ReadString(0x20);
             int percentFull = pvSrc.ReadByte();
             int timeZone = pvSrc.ReadSByte();
             IPAddress address = new IPAddress((long) pvSrc.ReadUInt32());
             if (this.m_Shard == null)
             {
                 ShardProfile profile = null;
                 for (int j = 0; (profile == null) && (j < this.m_Account.Shards.Length); j++)
                 {
                     if (this.m_Account.Shards[j].Name == name)
                     {
                         profile = this.m_Account.Shards[j];
                     }
                 }
                 if (profile == null)
                 {
                     this.m_Account.AddShard(profile = new ShardProfile(this.m_Account, address, port, index, timeZone, percentFull, 0xbadf00d, name));
                 }
                 else
                 {
                     profile.Index = index;
                     profile.Address = address;
                     profile.Port = port;
                     profile.TimeZone = timeZone;
                     profile.PercentFull = percentFull;
                 }
                 if (i == 0)
                 {
                     new Timer(new OnTick(this.Update_OnTick), 0, 1).Start(false);
                 }
             }
         }
         ShardProfile[] shards = this.m_Account.Shards;
         if (shards.Length > 0)
         {
             if (this.m_Shard == null)
             {
                 Array.Sort(shards, new ShardComparer());
                 this.m_Shard = shards[0];
             }
             this.Send(new PServerSelection(this.m_Shard.Index));
         }
     }
 }
示例#12
0
 private static ServerProfile[] Load()
 {
     if (!File.Exists(Engine.FileManager.BasePath("Data/Profiles.xml")))
     {
         return new ServerProfile[0];
     }
     XmlDocument document = new XmlDocument();
     document.Load(Engine.FileManager.BasePath("Data/Profiles.xml"));
     ArrayList list = new ArrayList();
     foreach (XmlElement element in document.GetElementsByTagName("server"))
     {
         string attribute = element.GetAttribute("title");
         string address = element.GetAttribute("address");
         string s = element.GetAttribute("port");
         ServerProfile server = new ServerProfile(attribute, address, XmlConvert.ToInt32(s));
         foreach (XmlElement element2 in element.GetElementsByTagName("account"))
         {
             string title = element2.GetAttribute("title");
             string username = element2.GetAttribute("username");
             string password = element2.GetAttribute("password");
             AccountProfile account = new AccountProfile(server, title, username, password);
             foreach (XmlElement element3 in element2.GetElementsByTagName("shard"))
             {
                 string name = element3.GetAttribute("name");
                 string ipString = element3.GetAttribute("address");
                 string str10 = element3.GetAttribute("port");
                 string str11 = element3.GetAttribute("index");
                 string str12 = element3.GetAttribute("timeZone");
                 string str13 = element3.GetAttribute("percentFull");
                 string str14 = element3.GetAttribute("auth");
                 ShardProfile shard = new ShardProfile(account, IPAddress.Parse(ipString), XmlConvert.ToInt32(str10), XmlConvert.ToInt32(str11), XmlConvert.ToInt32(str12), XmlConvert.ToInt32(str13), XmlConvert.ToInt32(str14), name);
                 foreach (XmlElement element4 in element3.GetElementsByTagName("character"))
                 {
                     string str15 = element4.GetAttribute("index");
                     string str16 = element4.GetAttribute("name");
                     shard.AddCharacter(new CharacterProfile(shard, str16, XmlConvert.ToInt32(str15)));
                 }
                 account.AddShard(shard);
             }
             server.AddAccount(account);
         }
         list.Add(server);
     }
     return (ServerProfile[]) list.ToArray(typeof(ServerProfile));
 }
示例#13
0
 public CharacterProfile(ShardProfile shard, string name, int index)
 {
     this.m_Shard = shard;
     this.m_Name  = name;
     this.m_Index = index;
 }
示例#14
0
 public bool Contains(ShardProfile shard)
 {
     return(Array.IndexOf(this.m_Shards, shard) >= 0);
 }
示例#15
0
 public CharacterProfile(ShardProfile shard, string name, int index)
 {
     this.m_Shard = shard;
     this.m_Name = name;
     this.m_Index = index;
 }
示例#16
0
 public GShardMenu(ShardProfile shard)
     : base(shard.Name)
 {
     this.m_Shard = shard;
 }
示例#17
0
        public void ShardList(PacketReader pvSrc)
        {
            pvSrc.ReadByte();
            int num = pvSrc.ReadInt16();

            if (num > 0)
            {
                int port = this.m_Server.Port;
                switch (port)
                {
                case 0x1e5f:
                case 0x1e60:
                    port = 0x1389;
                    break;
                }
                for (int i = 0; i < num; i++)
                {
                    int       index       = pvSrc.ReadInt16();
                    string    name        = pvSrc.ReadString(0x20);
                    int       percentFull = pvSrc.ReadByte();
                    int       timeZone    = pvSrc.ReadSByte();
                    IPAddress address     = new IPAddress((long)pvSrc.ReadUInt32());
                    if (this.m_Shard == null)
                    {
                        ShardProfile profile = null;
                        for (int j = 0; (profile == null) && (j < this.m_Account.Shards.Length); j++)
                        {
                            if (this.m_Account.Shards[j].Name == name)
                            {
                                profile = this.m_Account.Shards[j];
                            }
                        }
                        if (profile == null)
                        {
                            this.m_Account.AddShard(profile = new ShardProfile(this.m_Account, address, port, index, timeZone, percentFull, 0xbadf00d, name));
                        }
                        else
                        {
                            profile.Index       = index;
                            profile.Address     = address;
                            profile.Port        = port;
                            profile.TimeZone    = timeZone;
                            profile.PercentFull = percentFull;
                        }
                        if (i == 0)
                        {
                            new Timer(new OnTick(this.Update_OnTick), 0, 1).Start(false);
                        }
                    }
                }
                ShardProfile[] shards = this.m_Account.Shards;
                if (shards.Length > 0)
                {
                    if (this.m_Shard == null)
                    {
                        Array.Sort(shards, new ShardComparer());
                        this.m_Shard = shards[0];
                    }
                    this.Send(new PServerSelection(this.m_Shard.Index));
                }
            }
        }