提交 e6588c43 编写于 作者: S Skylot

fix(gui): correct font save with '-' in name (#1116)

上级 712389ab
......@@ -25,6 +25,7 @@ import com.beust.jcommander.Parameter;
import jadx.api.JadxArgs;
import jadx.cli.JadxCLIArgs;
import jadx.cli.LogHelper;
import jadx.core.utils.exceptions.JadxRuntimeException;
import jadx.gui.ui.MainWindow;
import jadx.gui.ui.codearea.EditorTheme;
import jadx.gui.utils.FontUtils;
......@@ -36,7 +37,7 @@ public class JadxSettings extends JadxCLIArgs {
private static final Path USER_HOME = Paths.get(System.getProperty("user.home"));
private static final int RECENT_PROJECTS_COUNT = 15;
private static final int CURRENT_SETTINGS_VERSION = 10;
private static final int CURRENT_SETTINGS_VERSION = 11;
private static final Font DEFAULT_FONT = new RSyntaxTextArea().getFont();
......@@ -485,6 +486,11 @@ public class JadxSettings extends JadxCLIArgs {
if (fromVersion == 10) {
srhResourceSkipSize = 3;
srhResourceFileExt = ".xml|.html|.js|.json|.txt";
fontStr = fontStr.replace('-', '/');
fromVersion++;
}
if (fromVersion != CURRENT_SETTINGS_VERSION) {
throw new JadxRuntimeException("Incorrect settings upgrade");
}
settingsVersion = CURRENT_SETTINGS_VERSION;
sync();
......
......@@ -24,7 +24,7 @@ public class FontUtils {
}
public static Font loadByStr(String fontDesc) {
String[] parts = fontDesc.split("-");
String[] parts = fontDesc.split("/");
if (parts.length != 3) {
throw new JadxRuntimeException("Unsupported font description format: " + fontDesc);
}
......@@ -42,8 +42,8 @@ public class FontUtils {
public static String convertToStr(Font font) {
return font.getFontName()
+ '-' + convertFontStyleToString(font.getStyle())
+ '-' + font.getSize();
+ '/' + convertFontStyleToString(font.getStyle())
+ '/' + font.getSize();
}
public static String convertFontStyleToString(int style) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册