mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-11 16:07:39 +00:00
66 lines
1.2 KiB
Java
66 lines
1.2 KiB
Java
package shadersmodcore.client;
|
|
|
|
import java.io.File;
|
|
import java.io.InputStream;
|
|
import java.util.zip.ZipEntry;
|
|
import java.util.zip.ZipFile;
|
|
|
|
public class ShaderPackZip implements IShaderPack {
|
|
|
|
protected File packFile;
|
|
protected ZipFile packZipFile;
|
|
|
|
public ShaderPackZip(String name, File file)
|
|
{
|
|
packFile = file;
|
|
packZipFile = null;
|
|
}
|
|
|
|
@Override
|
|
public void close()
|
|
{
|
|
if(packZipFile != null)
|
|
{
|
|
try
|
|
{
|
|
packZipFile.close();
|
|
}
|
|
catch (Exception excp)
|
|
{
|
|
}
|
|
packZipFile = null;
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public InputStream getResourceAsStream(String resName)
|
|
{
|
|
if (packZipFile == null)
|
|
{
|
|
try
|
|
{
|
|
packZipFile = new ZipFile(packFile);
|
|
}
|
|
catch (Exception excp)
|
|
{
|
|
}
|
|
}
|
|
if (packZipFile != null)
|
|
{
|
|
try
|
|
{
|
|
ZipEntry entry = packZipFile.getEntry(resName.substring(1));
|
|
if (entry != null)
|
|
{
|
|
return packZipFile.getInputStream(entry);
|
|
}
|
|
}
|
|
catch (Exception excp)
|
|
{
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
}
|