Fixing indents !

This commit is contained in:
Đạt Nhân Trương
2022-08-02 23:14:17 +07:00
parent 4496e0854f
commit d9a86d6d75
32 changed files with 691 additions and 703 deletions

View File

@@ -28,7 +28,7 @@ public enum WZFiles {
}
public Path getFile() {
return Paths.get(DIRECTORY).resolve(fileName);
return Paths.get(DIRECTORY).resolve(fileName);
}
public String getFilePath() {
@@ -36,8 +36,7 @@ public enum WZFiles {
}
private static String getWzDirectory() {
// Either provide a custom directory path through the "wz-path" property when launching the .jar,
// or don't provide one to use the default "wz" directory
// Either provide a custom directory path through the "wz-path" property when launching the .jar, or don't provide one to use the default "wz" directory
String propertyPath = System.getProperty("wz-path");
if (propertyPath != null && new File(propertyPath).isDirectory()) {
return propertyPath;

View File

@@ -80,7 +80,8 @@ public class XMLDomMapleData implements Data {
boolean foundChild = false;
for (int i = 0; i < childNodes.getLength(); i++) {
Node childNode = childNodes.item(i);
if (childNode.getNodeType() == Node.ELEMENT_NODE && childNode.getAttributes().getNamedItem("name").getNodeValue().equals(s)) {
if (childNode.getNodeType() == Node.ELEMENT_NODE
&& childNode.getAttributes().getNamedItem("name").getNodeValue().equals(s)) {
myNode = childNode;
foundChild = true;
break;
@@ -104,12 +105,12 @@ public class XMLDomMapleData implements Data {
for (int i = 0; i < childNodes.getLength(); i++) {
Node childNode = childNodes.item(i);
if (childNode.getNodeType() == Node.ELEMENT_NODE) {
XMLDomMapleData child = new XMLDomMapleData(childNode);
XMLDomMapleData child = new XMLDomMapleData(childNode);
child.imageDataDir = imageDataDir.resolve(getName().trim());
ret.add(child);
}
}
return ret;
}

View File

@@ -38,50 +38,50 @@ import org.slf4j.LoggerFactory;
public class XMLWZFile implements DataProvider {
private static final Logger log = LoggerFactory.getLogger(DataProvider.class);
private final Path root;
private final WZDirectoryEntry rootForNavigation;
private final WZDirectoryEntry rootForNavigation;
public XMLWZFile(Path fileIn) {
root = fileIn;
rootForNavigation = new WZDirectoryEntry(fileIn.getFileName().toString(), 0, 0, null);
fillMapleDataEntitys(root, rootForNavigation);
}
public XMLWZFile(Path fileIn) {
root = fileIn;
rootForNavigation = new WZDirectoryEntry(fileIn.getFileName().toString(), 0, 0, null);
fillMapleDataEntitys(root, rootForNavigation);
}
private void fillMapleDataEntitys(Path lroot, WZDirectoryEntry wzdir) {
private void fillMapleDataEntitys(Path lroot, WZDirectoryEntry wzdir) {
try (DirectoryStream<Path> stream = Files.newDirectoryStream(lroot)) {
for (Path path : stream) {
String fileName = path.getFileName().toString();
if (Files.isDirectory(path) && !fileName.endsWith(".img")) {
WZDirectoryEntry newDir = new WZDirectoryEntry(fileName, 0, 0, wzdir);
wzdir.addDirectory(newDir);
fillMapleDataEntitys(path, newDir);
} else if (fileName.endsWith(".xml")) {
wzdir.addFile(new WZFileEntry(fileName.substring(0, fileName.length() - 4), 0, 0, wzdir));
}
}
} catch (IOException e) {
log.warn("Can not open file/directory at " + lroot);
}
}
try (DirectoryStream<Path> stream = Files.newDirectoryStream(lroot)) {
for (Path path : stream) {
String fileName = path.getFileName().toString();
if (Files.isDirectory(path) && !fileName.endsWith(".img")) {
WZDirectoryEntry newDir = new WZDirectoryEntry(fileName, 0, 0, wzdir);
wzdir.addDirectory(newDir);
fillMapleDataEntitys(path, newDir);
} else if (fileName.endsWith(".xml")) {
wzdir.addFile(new WZFileEntry(fileName.substring(0, fileName.length() - 4), 0, 0, wzdir));
}
}
} catch (IOException e) {
log.warn("Can not open file/directory at " + lroot);
}
}
@Override
public synchronized Data getData(String path) {
Path dataFile = root.resolve(path + ".xml");
Path imageDataDir = root.resolve(path);
if (!Files.exists(dataFile)) {
return null;// bitches
}
final XMLDomMapleData domMapleData;
try (FileInputStream fis = new FileInputStream(dataFile.toString())) {
domMapleData = new XMLDomMapleData(fis, imageDataDir.getParent());
} catch (FileNotFoundException e) {
throw new RuntimeException("Datafile " + path + " does not exist in " + root.toAbsolutePath());
} catch (IOException e) {
throw new RuntimeException(e);
}
@Override
public synchronized Data getData(String path) {
Path dataFile = root.resolve(path + ".xml");
Path imageDataDir = root.resolve(path);
if (!Files.exists(dataFile)) {
return null;// bitches
}
final XMLDomMapleData domMapleData;
try (FileInputStream fis = new FileInputStream(dataFile.toString())) {
domMapleData = new XMLDomMapleData(fis, imageDataDir.getParent());
} catch (FileNotFoundException e) {
throw new RuntimeException("Datafile " + path + " does not exist in " + root.toAbsolutePath());
} catch (IOException e) {
throw new RuntimeException(e);
}
return domMapleData;
}
return domMapleData;
}
@Override
public DataDirectoryEntry getRoot() {