本文整理汇总了Java中info.ata4.vpk.VPKEntry类的典型用法代码示例。如果您正苦于以下问题:Java VPKEntry类的具体用法?Java VPKEntry怎么用?Java VPKEntry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
VPKEntry类属于info.ata4.vpk包,在下文中一共展示了VPKEntry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getScriptReader
import info.ata4.vpk.VPKEntry; //导入依赖的package包/类
private BufferedReader getScriptReader(VPKEntry entry)
{
byte[] buf = new byte[entry.getDataSize()];
try
{
entry.getData().get(buf);
}
catch(IOException ex)
{
System.err.println("Unable to read VPKEntry " + entry.getName());
return null;
}
ByteArrayInputStream bis = new ByteArrayInputStream(buf);
BufferedReader br = new BufferedReader(new InputStreamReader(bis));
return br;
}
示例2: getVPKEntries
import info.ata4.vpk.VPKEntry; //导入依赖的package包/类
/**
* Attempts to get all VPKEntries at the provided paths. Lazily-loads the VPK Archive.
* Returns null if the VPKArchive fails to load, or no entries are found.
* @param _vpkPaths A list of fully-qualified internal VPK paths.
* @return a List of entries, or null if nothing is found, or the VPKArchive fails to load.
*/
public List<VPKEntry> getVPKEntries(List<String> _vpkPaths)
{
loadVPK();
if(!_vpkLoaded)
{
return null;
}
ArrayList<VPKEntry> entryList = new ArrayList<>();
for(String path : _vpkPaths)
{
entryList.add(_vpk.getEntry(path));
}
return entryList;
}
示例3: setUp
import info.ata4.vpk.VPKEntry; //导入依赖的package包/类
@Before
public void setUp()
{
mockPaths.add("/somepath/wherever");
VPKEntry mockVPKEntry = mock(VPKEntry.class);
when(mockVPKEntry.getName()).thenReturn("Somename");
when(mockVPKEntry.getType()).thenReturn("vsndevts");
when(mockVPKEntry.getPath()).thenReturn("/somepath/wherever/Somename.vsndevts");
List<VPKEntry> mockVPKList = new ArrayList<>();
mockVPKList.add(mockVPKEntry);
when(vpkFileService.getVPKEntriesInDirectory(anyString())).thenReturn(mockVPKList);
when(vpkFileService.getVPKEntry(anyString())).thenReturn(mockVPKEntry);
_testProfile = new Profile("Test Profile", "Test profile description", vpkFileService);
ArrayList<Category> categories = new ArrayList<>();
}
示例4: main
import info.ata4.vpk.VPKEntry; //导入依赖的package包/类
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
for (String arg : args) {
File file = new File(arg);
VPKArchive vpk = new VPKArchive();
System.out.println(file);
try {
vpk.load(file);
} catch (Exception ex) {
System.err.println("Can't open archive: " + ex.getMessage());
return;
}
for (VPKEntry entry : vpk.getEntries()) {
if (vpk.isMultiChunk()) {
System.out.printf("%s:%s\n", entry.getFile().getName(), entry.getPath());
} else {
System.out.println(entry.getPath());
}
}
}
}
示例5: writeScriptFileToDisk
import info.ata4.vpk.VPKEntry; //导入依赖的package包/类
protected void writeScriptFileToDisk(VPKEntry entryToWrite, boolean overwriteExisting)
{
File existsChecker = new File(Paths.get(installDir, entryToWrite.getPath()).toString());
boolean fileExistsLocally = existsChecker.exists();
if (fileExistsLocally && !overwriteExisting)
{
return;
}
File entryFile = new File(Paths.get(installDir, "/dota/").toFile(), entryToWrite.getPath());
File entryDir = entryFile.getParentFile();
if (entryDir != null && !entryDir.exists())
{
entryDir.mkdirs();
}
try (final FileChannel fc = FileUtils.openOutputStream(entryFile).getChannel())
{
fc.write(entryToWrite.getData());
}
catch (IOException ex)
{
JOptionPane.showMessageDialog(this, "Error: Unable to write script file to disk.\nDetails: " + ex.getMessage(), "Error writing script file", JOptionPane.ERROR_MESSAGE);
}
}
示例6: getItemScriptFile
import info.ata4.vpk.VPKEntry; //导入依赖的package包/类
private VPKEntry getItemScriptFile()
{
String internalScriptPath = "scripts/game_sounds_items.txt";
File vpkFile = new File(vpkPath);
VPKArchive vpk = new VPKArchive();
try
{
vpk.load(vpkFile);
}
catch (Exception ex)
{
JOptionPane.showMessageDialog(this,
"Error: Unable to open VPK file.\nDetails: " + ex.getMessage(),
"Error opening VPK", JOptionPane.ERROR_MESSAGE);
ex.printStackTrace();
return null;
}
VPKEntry entry = vpk.getEntry(internalScriptPath);
return entry;
}
示例7: getVoiceScriptFile
import info.ata4.vpk.VPKEntry; //导入依赖的package包/类
private VPKEntry getVoiceScriptFile(String voiceName)
{
voiceName = voiceName.toLowerCase();
String internalScriptPath = "scripts/voscripts/game_sounds_vo_" + voiceName + ".txt";
File vpkFile = new File(vpkPath);
VPKArchive vpk = new VPKArchive();
try
{
vpk.load(vpkFile);
}
catch (Exception ex)
{
JOptionPane.showMessageDialog(this,
"Error: Unable to open VPK file.\nDetails: " + ex.getMessage(),
"Error opening VPK", JOptionPane.ERROR_MESSAGE);
ex.printStackTrace();
return null;
}
VPKEntry entry = vpk.getEntry(internalScriptPath);
return entry;
}
示例8: getHeroScriptFile
import info.ata4.vpk.VPKEntry; //导入依赖的package包/类
private VPKEntry getHeroScriptFile(String heroName)
{
heroName = heroName.toLowerCase();
String internalScriptPath = "scripts/game_sounds_heroes/game_sounds_" + heroName + ".txt";
File vpkFile = new File(vpkPath);
VPKArchive vpk = new VPKArchive();
try
{
vpk.load(vpkFile);
}
catch (Exception ex)
{
JOptionPane.showMessageDialog(this,
"Error: Unable to open VPK file.\nDetails: " + ex.getMessage(),
"Error opening VPK", JOptionPane.ERROR_MESSAGE);
ex.printStackTrace();
return null;
}
VPKEntry entry = vpk.getEntry(internalScriptPath);
return entry;
}
示例9: getMusicScriptFile
import info.ata4.vpk.VPKEntry; //导入依赖的package包/类
private VPKEntry getMusicScriptFile(String fileName)
{
File vpkFile = new File(vpkPath);
VPKArchive vpk = new VPKArchive();
VPKEntry entryToReturn = null;
try
{
vpk.load(vpkFile);
}
catch (Exception ex)
{
System.err.println("Can't open VPK Archive. Details: " + ex.getMessage());
return entryToReturn;
}
String fn = fileName.replace("\\", "/"); //jVPKLib only uses forward slashes in paths.
return vpk.getEntry(fn);
}
示例10: buildHeroPortraits
import info.ata4.vpk.VPKEntry; //导入依赖的package包/类
private void buildHeroPortraits(VPKArchive vpk)
{
BufferedImage image = null;
for (VPKEntry entry : vpk.getEntriesForDir("resource/flash3/images/heroes/"))
{
if (entry.getType().equals("png") && !(entry.getPath().contains("selection")))
{
File imageFile = new File(entry.getPath());
try (FileChannel fc = FileUtils.openOutputStream(imageFile).getChannel())
{
fc.write(entry.getData());
image = ImageIO.read(imageFile);
portraitMap.put(entry.getName(), image);
}
catch (IOException ex)
{
System.err.println("Can't write " + entry.getPath() + ": " + ex.getMessage());
}
}
}
}
示例11: buildItemPortraits
import info.ata4.vpk.VPKEntry; //导入依赖的package包/类
private void buildItemPortraits(VPKArchive vpk)
{
BufferedImage image = null;
for (VPKEntry entry : vpk.getEntriesForDir("resource/flash3/images/items/"))
{
if (entry.getType().equals("png"))
{
File imageFile = new File(entry.getPath());
try (FileChannel fc = FileUtils.openOutputStream(imageFile).getChannel())
{
fc.write(entry.getData());
image = ImageIO.read(imageFile);
String item = entry.getName();
portraitMap.put(item, image);
}
catch (IOException ex)
{
System.err.println("Can't write " + entry.getPath() + ": " + ex.getMessage());
}
}
}
}
示例12: buildAnnouncerPortraits
import info.ata4.vpk.VPKEntry; //导入依赖的package包/类
private void buildAnnouncerPortraits(VPKArchive vpk)
{
BufferedImage image = null;
for(VPKEntry entry : vpk.getEntriesForDir("resource/flash3/images/econ/announcer/"))
{
if (entry.getName().contains("large"))
{
continue; //don't grab the huge images, we won't use them.
}
File imageFile = new File(entry.getPath());
try (FileChannel fc = FileUtils.openOutputStream(imageFile).getChannel())
{
fc.write(entry.getData());
image = ImageIO.read(imageFile);
String announcer = entry.getName();
portraitMap.put(announcer, image);
}
catch (IOException ex)
{
System.err.println("Can't write " + entry.getPath() + ": " + ex.getMessage());
}
}
}
示例13: Script
import info.ata4.vpk.VPKEntry; //导入依赖的package包/类
public Script(VPKEntry scriptFile, Category category)
{
_rawFileName = scriptFile.getName() + "." + scriptFile.getType();
_internalScriptName = StringParsing.getScriptNameFromFileName(_rawFileName);
friendlyScriptName.set(StringParsing.prettyFormatScriptName(_internalScriptName));
_parentCategoryName = category.getCategoryName();
_isCustom = false;
_vpkPath = scriptFile.getPath();
}
示例14: getVPKEntry
import info.ata4.vpk.VPKEntry; //导入依赖的package包/类
/**
* Attempts to the get the VPK entry at the provided path. Lazily-loads the
* VPK Archive. Returns null if the VPKArchive fails to load, or no entry is found.
* @param _vpkPath The internal VPK path to search.
* @return The entry in question, or null of nothing is found, or the VPKArchive fails to load.
*/
public VPKEntry getVPKEntry(String _vpkPath)
{
loadVPK();
if(!_vpkLoaded)
{
return null;
}
return _vpk.getEntry(_vpkPath);
}
示例15: getVPKEntriesInDirectory
import info.ata4.vpk.VPKEntry; //导入依赖的package包/类
/**
* Attempts to return all inside the provided internal directory. Lazily-loads
* the VPKArchive. Returns null if the VPKArchive fails to load, the
* directory doesn't exist, or contains nothing.
* @param _vpkDirectory The internal VPK directory to search.
* @return The list of found VPKEntries, or null if the VPKArchive fails to load, or if nothing is found.
*/
public List<VPKEntry> getVPKEntriesInDirectory(String _vpkDirectory)
{
loadVPK();
if(!_vpkLoaded)
{
return null;
}
return _vpk.getEntriesForDir(_vpkDirectory);
}