Esempio n. 1
0
        private MySqlCommand UpdateDictionaryCommand(MySqlConnection Connection, String ServerName)
        {
            MySqlCommand Cmd = Connection.CreateCommand();

            Cmd.Parameters.AddWithValue("@servername", ServerName);
            Cmd.Parameters.AddWithValue("@dictionary", BArrayManager.ToArray(Loadout.Instance.playerInvs));
            Cmd.CommandText = "Update loadout set dictionary = @dictionary where servername = @servername";
            return(Cmd);
        }
Esempio n. 2
0
        private MySqlCommand SaveDictionaryCommand(MySqlConnection Connection, String ServerName)
        {
            MySqlCommand Cmd = Connection.CreateCommand();

            Cmd.Parameters.AddWithValue("@servername", ServerName);
            Cmd.Parameters.AddWithValue("@dictionary", BArrayManager.ToArray(Loadout.Instance.playerInvs));
            Cmd.CommandText = "Insert into loadout " +
                              "(servername, dictionary) " +
                              "values " +
                              "(@servername, @dictionary);";
            return(Cmd);
        }
Esempio n. 3
0
 public void LoadDictionary(String ServerName)
 {
     using (MySqlConnection Connection = CreateConnection())
     {
         Connection.Open();
         using (MySqlCommand Cmd = Connection.CreateCommand())
         {
             Cmd.CommandText = "Select * from loadout where servername = " + ServerName + ";";
             object Result = Cmd.ExecuteNonQuery();
             using (MySqlDataReader Reader = Cmd.ExecuteReader())
             {
                 if (Reader.HasRows)
                 {
                     if (Reader.Read())
                     {
                         Loadout.Instance.playerInvs = (Dictionary <ulong, LoadoutList>)BArrayManager.ToObject((byte[])Reader.GetValue(1));
                     }
                 }
                 Reader.Close();
             }
         }
         Connection.Close();
     }
 }