Search in sources :

Example 1 with Language

use of io.discloader.discloader.common.language.Language in project DiscLoader by R3alCl0ud.

the class ZipReader method readZip.

public static void readZip(File zip) {
    ZipFile zipFile = null;
    try {
        try {
            zipFile = new ZipFile(zip);
        } catch (ZipException e) {
            e.printStackTrace();
        }
        if (zipFile != null) {
            // read zip file
            for (ZipEntry e : readEntries(zipFile.entries())) {
                if (e.getName().endsWith(".lang")) {
                    // the entry is a language file
                    InputStream is = zipFile.getInputStream(e);
                    Language lang = new Language(is, getLocale(e.getName()));
                    LanguageRegistry.registerLanguage(lang);
                } else if (e.getName().endsWith(".png")) {
                    // the entry is an icon
                    InputStream is = zipFile.getInputStream(e);
                    is.close();
                // TextureRegistry.resourceHandler.addResource(is, e);
                }
            }
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Also used : ZipFile(java.util.zip.ZipFile) Language(io.discloader.discloader.common.language.Language) InputStream(java.io.InputStream) ZipEntry(java.util.zip.ZipEntry) ZipException(java.util.zip.ZipException) IOException(java.io.IOException)

Aggregations

Language (io.discloader.discloader.common.language.Language)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 ZipEntry (java.util.zip.ZipEntry)1 ZipException (java.util.zip.ZipException)1 ZipFile (java.util.zip.ZipFile)1