mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-12 00:17:54 +00:00
65 lines
1.2 KiB
Java
65 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;
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|