Correct AppPreferences class. Fix #139
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
94845c1411
commit
c1651e874b
8 changed files with 14 additions and 11 deletions
|
@ -32,7 +32,10 @@ public class AppPreferences {
|
|||
private AppPreferences(){
|
||||
this.preferences = Preferences.userRoot().node("NS-USBloader");
|
||||
String localeCode = preferences.get("locale", Locale.getDefault().toString());
|
||||
this.locale = new Locale(localeCode.substring(0, 2), localeCode.substring(3));
|
||||
if (localeCode.length() < 5)
|
||||
this.locale = new Locale("en", "EN");
|
||||
else
|
||||
this.locale = new Locale(localeCode.substring(0, 2), localeCode.substring(3));
|
||||
}
|
||||
|
||||
public String getTheme(){
|
||||
|
@ -147,6 +150,6 @@ public class AppPreferences {
|
|||
|
||||
public boolean getPatchesTabInvisible(){return preferences.getBoolean("patches_tab_visible", true); }
|
||||
public void setPatchesTabInvisible(boolean value){preferences.putBoolean("patches_tab_visible", value);}
|
||||
public String getPatchOffset(String type, int moduleNumber, int offsetId){ return preferences.get(String.format("%s_%02x_%02x", type, moduleNumber, offsetId), ""); }
|
||||
public void setPatchOffset(String fullTypeSpecifier, String offset){ preferences.put(fullTypeSpecifier, offset); }
|
||||
public String getPatchPattern(String type, int moduleNumber, int offsetId){ return preferences.get(String.format("%s_%02x_%02x", type, moduleNumber, offsetId), ""); }
|
||||
public void setPatchPattern(String fullTypeSpecifier, String offset){ preferences.put(fullTypeSpecifier, offset); }
|
||||
}
|
||||
|
|
|
@ -169,7 +169,7 @@ public class PatchesController implements Initializable {
|
|||
continue;
|
||||
if (! lineValues[1].matches("^(([0-9A-Fa-f]{2})|\\.)+?$"))
|
||||
continue;
|
||||
preferences.setPatchOffset(lineValues[0], lineValues[1]);
|
||||
preferences.setPatchPattern(lineValues[0], lineValues[1]);
|
||||
|
||||
System.out.println(pointer[0]+"_"+pointer[1]+"_"+pointer[2]+" = "+lineValues[1]);
|
||||
count++;
|
||||
|
|
|
@ -140,7 +140,7 @@ public class DriversInstall {
|
|||
return true;
|
||||
}
|
||||
catch (Exception e){
|
||||
runInstallerStatusLabel.setText("Error: "+e.toString());
|
||||
runInstallerStatusLabel.setText("Error: "+e);
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ import nsusbloader.Utilities.patches.SimplyFind;
|
|||
import java.util.List;
|
||||
|
||||
class HeuristicEs1 extends AHeuristic {
|
||||
private static final String PATTERN = AppPreferences.getInstance().getPatchOffset("ES", 1, 0);
|
||||
private static final String PATTERN = AppPreferences.getInstance().getPatchPattern("ES", 1, 0);
|
||||
|
||||
private final List<Integer> findings;
|
||||
private final byte[] where;
|
||||
|
|
|
@ -28,7 +28,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
class HeuristicEs2 extends AHeuristic {
|
||||
private static final String PATTERN = AppPreferences.getInstance().getPatchOffset("ES", 2, 0);
|
||||
private static final String PATTERN = AppPreferences.getInstance().getPatchPattern("ES", 2, 0);
|
||||
|
||||
private List<Integer> findings;
|
||||
private final byte[] where;
|
||||
|
|
|
@ -27,8 +27,8 @@ import nsusbloader.Utilities.patches.SimplyFind;
|
|||
import java.util.List;
|
||||
|
||||
class HeuristicEs3 extends AHeuristic {
|
||||
private static final String PATTERN0 = AppPreferences.getInstance().getPatchOffset("ES", 3, 0);
|
||||
private static final String PATTERN1 = AppPreferences.getInstance().getPatchOffset("ES", 3, 1);
|
||||
private static final String PATTERN0 = AppPreferences.getInstance().getPatchPattern("ES", 3, 0);
|
||||
private static final String PATTERN1 = AppPreferences.getInstance().getPatchPattern("ES", 3, 1);
|
||||
|
||||
private final List<Integer> findings;
|
||||
private final byte[] where;
|
||||
|
|
|
@ -28,7 +28,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
class HeuristicFs1 extends AHeuristic {
|
||||
private static final String PATTERN = AppPreferences.getInstance().getPatchOffset("FS", 1, 0); // TBZ
|
||||
private static final String PATTERN = AppPreferences.getInstance().getPatchPattern("FS", 1, 0); // TBZ
|
||||
|
||||
private final byte[] where;
|
||||
private final List<Integer> findings;
|
||||
|
|
|
@ -28,7 +28,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
class HeuristicFs2 extends AHeuristic {
|
||||
private static final String PATTERN = AppPreferences.getInstance().getPatchOffset("FS", 2, 0);
|
||||
private static final String PATTERN = AppPreferences.getInstance().getPatchPattern("FS", 2, 0);
|
||||
|
||||
private final byte[] where;
|
||||
private final List<Integer> findings;
|
||||
|
|
Loading…
Reference in a new issue