public void InsertNewAccount(string username, string password)
        {
            password = PasswordEncrypter.GetEncryptedPassword(password);

            MySqlCommand cmd = new MySqlCommand();

            cmd.Parameters.AddWithValue("@0", username);
            cmd.Parameters.AddWithValue("@1", password);

            Write("INSERT INTO account VALUES(@0, 'New User', @1, '', '', '')", cmd);
        }
        public bool AuthenticateAccount(string username, string password, out UserInfo userInfo)
        {
            bool returnValue = false;

            userInfo = null;

            MySqlCommand cmd = new MySqlCommand();

            cmd.Parameters.AddWithValue("@0", username);
            cmd.Parameters.AddWithValue("@1", password);

            string encryptedPassword = PasswordEncrypter.GetEncryptedPassword(password);

            MySqlDataReader reader = Read("SELECT * FROM account WHERE id=@0", cmd);

            while (reader.Read())
            {
                if (reader.GetString("password").Equals(encryptedPassword))
                {
                    // Only return userInfo if the password is correct.
                    userInfo = new UserInfo(reader.GetString("id"), reader.GetString("name"), reader.GetString("comment"), 1, reader.GetString("avatar"), false);

                    if (!Config.Properties.AVATAR_ENABLE)
                    {
                        userInfo.avatar = "";
                    }
                    else
                    {
                        Uri baseUri = new Uri(Config.Properties.AVATAR_IMAGE_URL);
                        Uri address = new Uri(baseUri, userInfo.avatar);

                        userInfo.avatar = address.ToString();
                    }

                    returnValue = true;
                }

                break;
            }

            reader.Close();
            return(returnValue);
        }