MCPcopy Create free account
hub / github.com/Card-Forge/forge / setLookUpFile

Method setLookUpFile

forge-core/src/main/java/forge/ImageKeys.java:342–381  ·  view source on GitHub ↗
(String filename, String fullborderFile)

Source from the content-addressed store, hash-verified

340 return false;
341 }
342 public static File setLookUpFile(String filename, String fullborderFile) {
343 if (!StaticData.instance().getSetLookup().isEmpty()) {
344 for (String setKey : StaticData.instance().getSetLookup().keySet()) {
345 if (filename.startsWith(setKey)) {
346 for (String setLookup : StaticData.instance().getSetLookup().get(setKey)) {
347 String lookupDirectory = CACHE_CARD_PICS_DIR + setLookup;
348 File f = new File(lookupDirectory);
349 if (f.exists() && f.isDirectory()) {
350 for (String ext : FILE_EXTENSIONS) {
351 if (ext.isEmpty())
352 continue;
353 File placeholder;
354 String fb1 = fullborderFile.replace(setKey+"/","")+ext;
355 placeholder = new File(lookupDirectory+"/"+fb1);
356 if (placeholder.exists()) {
357 return placeholder;
358 }
359 String fb2 = fullborderFile.replace(setKey+"/","").replaceAll("[0-9]*.fullborder", "1.fullborder")+ext;
360 placeholder = new File(lookupDirectory+"/"+fb2);
361 if (placeholder.exists()) {
362 return placeholder;
363 }
364 String f1 = filename.replace(setKey+"/","")+ext;
365 placeholder = new File(lookupDirectory+"/"+f1);
366 if (placeholder.exists()) {
367 return placeholder;
368 }
369 String f2 = filename.replace(setKey+"/","").replaceAll("[0-9]*.full", "1.full")+ext;
370 placeholder = new File(lookupDirectory+"/"+f2);
371 if (placeholder.exists()) {
372 return placeholder;
373 }
374 }
375 }
376 }
377 }
378 }
379 }
380 return null;
381 }
382 private static File findFile(String dir, String filename) {
383 if (dir.equals(CACHE_CARD_PICS_DIR)) {
384 for (String ext : FILE_EXTENSIONS) {

Callers 3

RewardActorMethod · 0.95
auditMethod · 0.95
getImageFileMethod · 0.95

Calls 7

instanceMethod · 0.95
getSetLookupMethod · 0.80
startsWithMethod · 0.80
isEmptyMethod · 0.65
getMethod · 0.65
replaceMethod · 0.45
replaceAllMethod · 0.45

Tested by

no test coverage detected