mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-03 16:34:20 +00:00
show resources in order
This commit is contained in:
@@ -49,9 +49,14 @@ import java.io.PrintStream;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@@ -73,7 +78,7 @@ public class CheckResources {
|
||||
stream.println("Resource file not found: " + resourcePath);
|
||||
return;
|
||||
}
|
||||
Properties prop = new Properties();
|
||||
Properties prop = new LinkedProperties();
|
||||
prop.load(is);
|
||||
properties.put(clazz, prop);
|
||||
}
|
||||
@@ -86,7 +91,7 @@ public class CheckResources {
|
||||
boolean firstMissing = true;
|
||||
for (Class clazz : classes) {
|
||||
Properties prop = properties.get(clazz);
|
||||
Properties prop2 = new Properties();
|
||||
Properties prop2 = new LinkedProperties();
|
||||
String resourcePath = getResourcePath(clazz, lang);
|
||||
InputStream is = CheckResources.class.getResourceAsStream(resourcePath);
|
||||
if (is == null) {
|
||||
@@ -99,6 +104,7 @@ public class CheckResources {
|
||||
Logger.getLogger(CheckResources.class.getName()).log(Level.SEVERE, "Cannot load resource:" + clazz.getSimpleName() + " " + lang, ex);
|
||||
}
|
||||
|
||||
boolean firstMissing2 = true;
|
||||
for (Object key : prop.keySet()) {
|
||||
String keyStr = (String) key;
|
||||
String value = prop2.getProperty(keyStr);
|
||||
@@ -109,7 +115,12 @@ public class CheckResources {
|
||||
firstMissing = false;
|
||||
}
|
||||
|
||||
stream.println(clazz.getSimpleName() + ", property: " + key + "=" + prop.getProperty(keyStr));
|
||||
if (firstMissing2) {
|
||||
stream.println(clazz.getSimpleName());
|
||||
firstMissing2 = false;
|
||||
}
|
||||
|
||||
stream.println(key + " = " + prop.getProperty(keyStr));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -135,25 +146,31 @@ public class CheckResources {
|
||||
URL latestUrl = new URL(rootUrl + (revision2 == null ? "master" : revision2) + resPath);
|
||||
URL prevUrl = new URL(rootUrl + revision + resPath);
|
||||
|
||||
Properties latestProp = new Properties();
|
||||
Properties latestProp = new LinkedProperties();
|
||||
try {
|
||||
uc = latestUrl.openConnection();
|
||||
latestProp.load(new BufferedReader(new InputStreamReader(uc.getInputStream())));
|
||||
} catch (IOException ex) {
|
||||
}
|
||||
|
||||
Properties prevProp = new Properties();
|
||||
Properties prevProp = new LinkedProperties();
|
||||
try {
|
||||
uc = prevUrl.openConnection();
|
||||
prevProp.load(new BufferedReader(new InputStreamReader(uc.getInputStream())));
|
||||
} catch (IOException ex) {
|
||||
}
|
||||
|
||||
boolean firstMissing2 = true;
|
||||
for (Object key : latestProp.keySet()) {
|
||||
String keyStr = (String) key;
|
||||
String value = prevProp.getProperty(keyStr);
|
||||
if (value == null) {
|
||||
stream.println(clazz.getSimpleName() + ", property: " + key + "=" + latestProp.getProperty(keyStr));
|
||||
if (firstMissing2) {
|
||||
stream.println(clazz.getSimpleName());
|
||||
firstMissing2 = false;
|
||||
}
|
||||
|
||||
stream.println(key + " = " + latestProp.getProperty(keyStr));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +178,12 @@ public class CheckResources {
|
||||
String keyStr = (String) key;
|
||||
String value = latestProp.getProperty(keyStr);
|
||||
if (value == null) {
|
||||
stream.println(clazz.getSimpleName() + ", property: " + key + " was removed");
|
||||
if (firstMissing2) {
|
||||
stream.println(clazz.getSimpleName());
|
||||
firstMissing2 = false;
|
||||
}
|
||||
|
||||
stream.println(key + " was removed. Last value: " + prevProp.getProperty(keyStr));
|
||||
}
|
||||
}
|
||||
} catch (MalformedURLException ex) {
|
||||
@@ -214,4 +236,32 @@ public class CheckResources {
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
private static class LinkedProperties extends Properties {
|
||||
|
||||
private final HashSet<Object> keys = new LinkedHashSet<>();
|
||||
|
||||
public LinkedProperties() {
|
||||
}
|
||||
|
||||
public Iterable<Object> orderedKeys() {
|
||||
return Collections.list(keys());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration<Object> keys() {
|
||||
return Collections.enumeration(keys);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Object> keySet() {
|
||||
return keys;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object put(Object key, Object value) {
|
||||
keys.add(key);
|
||||
return super.put(key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ config.group.name.limit = Limits
|
||||
config.group.description.limit = Decompilation limits for obfuscated code, etc.
|
||||
|
||||
config.group.name.ui = Interface
|
||||
config.group.description.ui = User intercace configuration
|
||||
config.group.description.ui = User interface configuration
|
||||
|
||||
config.group.name.debug = Debug
|
||||
config.group.description.debug = Debugging settings
|
||||
@@ -292,7 +292,7 @@ config.name.tagTreeShowEmptyFolders = Show empty folders
|
||||
config.description.tagTreeShowEmptyFolders = Show empty folders in tag tree.
|
||||
|
||||
config.name.autoLoadEmbeddedSwfs = Auto load embedded SWFs
|
||||
config.description.autoLoadEmbeddedSwfs = Automaticaly load the embedded SWFs from DefineBinaryData tags.
|
||||
config.description.autoLoadEmbeddedSwfs = Automatically load the embedded SWFs from DefineBinaryData tags.
|
||||
|
||||
config.name.overrideTextExportFileName = Override text export filename
|
||||
config.description.overrideTextExportFileName = You can customize the filename of the exported text. Use {filename} placeholder to use the filename of current SWF.
|
||||
@@ -319,9 +319,9 @@ config.name.updateProxyAddress = Http Proxy address for checking updates
|
||||
config.description.updateProxyAddress = Http Proxy address for checking updates. Format: example.com:8080
|
||||
|
||||
config.name.editorMode = Editor Mode
|
||||
config.description.editorMode = Make text areas edittable automatically when you select a Text or Script node
|
||||
config.description.editorMode = Make text areas editable automatically when you select a Text or Script node
|
||||
|
||||
config.name.autoSaveTagModifications = Auto save tag modificatios
|
||||
config.name.autoSaveTagModifications = Auto save tag modifications
|
||||
config.description.autoSaveTagModifications = Save the changes when you select a new tag in the tree
|
||||
|
||||
config.name.saveSessionOnExit = Save session on exit
|
||||
|
||||
Reference in New Issue
Block a user