Skip to content
This repository has been archived by the owner on Mar 18, 2019. It is now read-only.

Don't repeat class and version mismatch warnings #157

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public static void extract(Path file, Path outDir, Progress progress) throws IOE
}

String bundleName = outDir.getFileName().toString();
Path propsFile = outDir.getParent().resolve(bundleName + ".json");
Path propsFile = outDir.resolveSibling(bundleName + ".json");

writePropertiesFile(propsFile, assetBundle);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public class TypeTreeDatabase {

private final List<TypeTreeDatabaseEntry> entries = new ArrayList<>();
private final Map<Pair<UnityClass, UnityVersion>, TypeTreeDatabaseEntry> entryMap = new HashMap<>();
private final Set<Pair<UnityClass, UnityVersion>> warnedMatches = new HashSet<>();
private Path dbFile;

public TypeTreeDatabase() {
Expand Down Expand Up @@ -233,7 +234,8 @@ public Set<TypeNode> getNodeSet() {

public TypeTreeDatabaseEntry getEntry(UnityClass unityClass, UnityVersion unityVersion, boolean exact) {
// search for exact matches
TypeTreeDatabaseEntry entryA = entryMap.get(new ImmutablePair<>(unityClass, unityVersion));
Pair<UnityClass, UnityVersion> classAndVersion = new ImmutablePair<>(unityClass, unityVersion);
TypeTreeDatabaseEntry entryA = entryMap.get(classAndVersion);
if (entryA != null) {
return entryA;
}
Expand Down Expand Up @@ -273,17 +275,27 @@ public TypeTreeDatabaseEntry getEntry(UnityClass unityClass, UnityVersion unityV

// return less perfect match
if (entryB != null) {
L.log(Level.WARNING, "Unprecise match for class {0} (required: {1}, available: {2})", new Object[]{unityClass, unityVersion, versionB});
if (!warnedMatches.contains(classAndVersion)) {
L.log(Level.WARNING, "Unprecise match for class {0} (required: {1}, available: {2})", new Object[]{unityClass, unityVersion, versionB});
warnedMatches.add(classAndVersion);
}
return entryB;
}

// return field node from any revision as the very last resort
if (entryC != null) {
L.log(Level.WARNING, "Bad match for class {0} (required: {1}, available: {2})", new Object[]{unityClass, unityVersion, versionC});
if (!warnedMatches.contains(classAndVersion)) {
L.log(Level.WARNING, "Bad match for class {0} (required: {1}, available: {2})", new Object[]{unityClass, unityVersion, versionC});
warnedMatches.add(classAndVersion);
}
return entryC;
}

// no matches at all
if (!warnedMatches.contains(classAndVersion)) {
L.log(Level.WARNING, "No match for class {0} (required: {1})", new Object[]{unityClass, unityVersion});
warnedMatches.add(classAndVersion);
}
return null;
}

Expand Down