@SuppressWarnings("unchecked")
    public static void extractZIP(LauncherAPI api, GameFile source, File file,
            File dest, int min, int max) throws Exception
    {
        final ZipFile zip = new ZipFile(file);
        
        Enumeration<ZipEntry> entries = (Enumeration<ZipEntry>) zip.entries();
        
        int total = 0;
        while (entries.hasMoreElements())
        {
            final ZipEntry entry = entries.nextElement();
            
            if (!entry.isDirectory())
            {
                total += entry.getSize();
            }
        }
        
        entries = (Enumeration<ZipEntry>) zip.entries();
        final int current = 0;
        
        while (entries.hasMoreElements())
        {
            final ZipEntry entry = entries.nextElement();
            
            if (entry.isDirectory())
            {
                final File dir = new File(dest, entry.getName());
                if (!dir.exists())
                {
                    dir.mkdirs();
                }
            }
            else
            {
                final File e = new File(dest, entry.getName());
                copyStream(api, source, zip.getInputStream(entry),
                        new FileOutputStream(e), current, total, min, max);
            }
        }
        
        zip.close();
    }