BF2Statistics.Database.GamespyDatabase.GamespyDatabase C# (CSharp) Method

GamespyDatabase() public method

Creates a new connection to the Gamespy Database
public GamespyDatabase ( ) : System
return System
        public GamespyDatabase()
            : base(Program.Config.GamespyDBEngine, Program.Config.GamespyDBConnectionString)
        {
            // Try and Reconnect
            try
            {
                Connect();

                // Try and get database version
                try
                {
                    // Correct the version string from older database installs
                    string ver = base.ExecuteScalar("SELECT dbver FROM _version LIMIT 1").ToString();
                    if (!ver.Contains(".")) ver += ".0";

                    // Set internals
                    Version = Version.Parse(ver);
                }
                catch
                {
                    // Table doesnt contain a _version table, then we arent installed
                    Version = new Version(0, 0);
                }
            }
            catch (Exception)
            {
                if (Connection != null)
                    Connection.Dispose();

                throw;
            }
        }