public Mcmod GetMcmod(String md5)
        {
            try
            {
                String sql =
                    "SELECT modname, modid, mcversion, modversion, md5, author FROM helpersolder.mods WHERE md5 LIKE @md5;";
                using (MySqlConnection connection = new MySqlConnection(_connectionStringGet))
                {
                    connection.Open();
                    using (MySqlCommand command = new MySqlCommand(sql, connection))
                    {
                        command.Parameters.AddWithValue("@md5", md5);
                        using (MySqlDataReader reader = command.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                if (reader["md5"].Equals(md5))
                                {
                                    List<String> a = reader["author"].ToString().Split(',').ToList();

                                    Mcmod mod = new Mcmod
                                    {
                                        Version = reader["modversion"].ToString(),
                                        Name = reader["modname"].ToString(),
                                        Modid = reader["modid"].ToString(),
                                        Mcversion = reader["mcversion"].ToString(),
                                        Authors = a,
                                        AuthorList = a

                                    };
                                    return mod;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
                Debug.WriteLine(e.StackTrace);
                if (e.InnerException != null)
                {
                    Debug.WriteLine(e.InnerException.Message);
                    Debug.WriteLine(e.InnerException.StackTrace);

                }
            }
            return null;
        }
예제 #2
0
        public Mcmod GetMcmod(String md5)
        {
            try
            {
                String sql =
                    "SELECT modname, modid, mcversion, modversion, md5, author FROM helpersolder.mods WHERE md5 LIKE @md5;";
                using (MySqlConnection connection = new MySqlConnection(_connectionStringGet))
                {
                    connection.Open();
                    using (MySqlCommand command = new MySqlCommand(sql, connection))
                    {
                        command.Parameters.AddWithValue("@md5", md5);
                        using (MySqlDataReader reader = command.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                if (reader["md5"].Equals(md5))
                                {
                                    List <String> a = reader["author"].ToString().Split(',').ToList();

                                    Mcmod mod = new Mcmod
                                    {
                                        Version    = reader["modversion"].ToString(),
                                        Name       = reader["modname"].ToString(),
                                        Modid      = reader["modid"].ToString(),
                                        Mcversion  = reader["mcversion"].ToString(),
                                        Authors    = a,
                                        AuthorList = a
                                    };
                                    return(mod);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
                Debug.WriteLine(e.StackTrace);
                if (e.InnerException != null)
                {
                    Debug.WriteLine(e.InnerException.Message);
                    Debug.WriteLine(e.InnerException.StackTrace);
                }
            }
            return(null);
        }