Пример #1
0
        public void EqualsTest()
        {
            ClientVersion a = ClientVersion.v4_0_07a;

            ClientVersion b = ClientVersion.v5_0_7_0;
            ClientVersion B = ClientVersion.v5_0_7_0;

            Assert.IsFalse(a.Equals(b));
            Assert.IsFalse(b.Equals(a));

            Assert.IsTrue(b.Equals(B));
            Assert.IsTrue(B.Equals(b));
        }
Пример #2
0
        private static void LoadSettings()
        {
            if (!Configuration.IsMySQLEnabled)
            {
                return;
            }
            using (var con = new MySqlConnection(Configuration.ConnectionString))
            {
                using (MySqlCommand cmd = con.CreateCommand())
                {
                    con.Open();
                    cmd.CommandType = CommandType.Text;
                    cmd.CommandText = "SELECT * FROM `settings` WHERE `label` = 'CBot' LIMIT 1;";

                    using (MySqlDataReader reader = cmd.ExecuteReader())
                    {
                        reader.Read();
                        Settings settings = new Settings
                        {
                            MaxBots    = (int)reader["players"],
                            Region     = (string)reader["platform"],
                            Difficulty = (string)reader["difficulty"],
                            QueueType  = (int)reader["queue"], //Request
                            GamePath   = (string)reader["gamepath"]
                        };

                        Setting = settings;
                        if (Setting == null)
                        {
                            Status("No settings found!", "Console");
                            Environment.Exit(0);
                        }

                        ClientVersion = Controller.GetCurrentVersion(Setting.GamePath);
                        if (ClientVersion.Equals("0"))
                        {
                            Status("Unable to get client version! Check your game path!", "Console");
                            Environment.Exit(0);
                        }
                    }

                    con.Close();
                }
            }
        }