Exemple #1
0
        public static async Task <Dictionary <uint, CASCFile> > GetKnownFiles(bool includeUnverified = false)
        {
            var dict = new Dictionary <uint, CASCFile>();

            using (var connection = new MySqlConnection(SettingsManager.connectionString))
            {
                await connection.OpenAsync();

                using var cmd = connection.CreateCommand();
                if (!includeUnverified)
                {
                    cmd.CommandText = "SELECT id, filename, type from wow_rootfiles WHERE filename IS NOT NULL AND filename != '' AND verified = 1 ORDER BY id DESC";
                }
                else
                {
                    cmd.CommandText = "SELECT id, filename, type from wow_rootfiles WHERE filename IS NOT NULL AND filename != '' ORDER BY id DESC";
                }
                using var reader = await cmd.ExecuteReaderAsync();

                while (await reader.ReadAsync())
                {
                    var row = new CASCFile {
                        id = uint.Parse(reader["id"].ToString()), filename = reader["filename"].ToString(), type = reader["type"].ToString()
                    };
                    dict.Add(uint.Parse(reader["id"].ToString()), row);
                }
            }

            return(dict);
        }
Exemple #2
0
        public static async Task <Dictionary <uint, CASCFile> > GetAllFiles()
        {
            var dict = new Dictionary <uint, CASCFile>();

            using (var connection = new MySqlConnection(SettingsManager.connectionString))
            {
                await connection.OpenAsync();

                using var cmd    = connection.CreateCommand();
                cmd.CommandText  = "SELECT id, filename, type from wow_rootfiles ORDER BY id DESC";
                using var reader = await cmd.ExecuteReaderAsync();

                while (await reader.ReadAsync())
                {
                    var row = new CASCFile {
                        id = uint.Parse(reader["id"].ToString()), filename = reader["filename"].ToString(), type = reader["type"].ToString()
                    };
                    dict.Add(uint.Parse(reader["id"].ToString()), row);
                }
            }

            return(dict);
        }