Reworked AssetRepository to link every Asset to a UUID

UUIDs are now being stored in the Replay File and loaded
This commit is contained in:
CrushedPixel
2015-07-07 20:14:40 +02:00
parent 40acb3f72d
commit 89cc6938f8
5 changed files with 97 additions and 25 deletions

View File

@@ -18,6 +18,7 @@ import java.io.*;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
public class ReplayFile extends ZipFile {
@@ -238,11 +239,17 @@ public class ReplayFile extends ZipFile {
try {
ZipArchiveEntry entry = entries.nextElement();
if(entry.getName().startsWith(ENTRY_ASSET_FOLDER)) {
String entryName = entry.getName();
if(entryName.startsWith(ENTRY_ASSET_FOLDER)) {
String name = entry.getName().substring(ENTRY_ASSET_FOLDER.length());
assetRepository.addAsset(name, getInputStream(entry));
String[] split = name.split("_");
UUID uuid = UUID.fromString(split[0]);
assetRepository.addAsset(name, getInputStream(entry), uuid);
}
} catch(IOException e) {
} catch(Exception e) {
e.printStackTrace();
}
}