Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
keyescgm
jadx
提交
18070eb7
J
jadx
项目概览
keyescgm
/
jadx
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jadx
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
18070eb7
编写于
6月 20, 2022
作者:
S
Skylot
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(gui): allow to select file on mapping export
上级
84868917
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
71 addition
and
19 deletion
+71
-19
jadx-gui/libs/mapping-io-0.4.0-SNAPSHOT.jar
jadx-gui/libs/mapping-io-0.4.0-SNAPSHOT.jar
+0
-0
jadx-gui/src/main/java/jadx/gui/settings/JadxProject.java
jadx-gui/src/main/java/jadx/gui/settings/JadxProject.java
+13
-1
jadx-gui/src/main/java/jadx/gui/ui/MainWindow.java
jadx-gui/src/main/java/jadx/gui/ui/MainWindow.java
+23
-12
jadx-gui/src/main/java/jadx/gui/ui/dialog/FileDialog.java
jadx-gui/src/main/java/jadx/gui/ui/dialog/FileDialog.java
+35
-6
未找到文件。
jadx-gui/libs/mapping-io-0.4.0-SNAPSHOT.jar
浏览文件 @
18070eb7
无法预览此类型文件
jadx-gui/src/main/java/jadx/gui/settings/JadxProject.java
浏览文件 @
18070eb7
...
...
@@ -57,6 +57,18 @@ public class JadxProject {
this
.
mainWindow
=
mainWindow
;
}
public
@Nullable
Path
getWorkingDir
()
{
if
(
projectPath
!=
null
)
{
return
projectPath
.
toAbsolutePath
().
getParent
();
}
List
<
Path
>
files
=
data
.
getFiles
();
if
(!
files
.
isEmpty
())
{
Path
path
=
files
.
get
(
0
);
return
path
.
toAbsolutePath
().
getParent
();
}
return
null
;
}
@Nullable
public
Path
getProjectPath
()
{
return
projectPath
;
...
...
@@ -166,7 +178,7 @@ public class JadxProject {
Path
path
=
files
.
get
(
0
);
return
path
.
resolveSibling
(
path
.
getFileName
()
+
".cache"
);
}
throw
new
JadxRuntimeException
(
"
Can't get working
dir"
);
throw
new
JadxRuntimeException
(
"
Failed to build cache
dir"
);
}
public
boolean
isEnableLiveReload
()
{
...
...
jadx-gui/src/main/java/jadx/gui/ui/MainWindow.java
浏览文件 @
18070eb7
...
...
@@ -44,6 +44,7 @@ import javax.swing.Action;
import
javax.swing.Box
;
import
javax.swing.ImageIcon
;
import
javax.swing.JCheckBoxMenuItem
;
import
javax.swing.JFileChooser
;
import
javax.swing.JFrame
;
import
javax.swing.JMenu
;
import
javax.swing.JMenuBar
;
...
...
@@ -85,7 +86,6 @@ import jadx.api.JavaNode;
import
jadx.api.ResourceFile
;
import
jadx.api.plugins.utils.CommonFileUtils
;
import
jadx.core.Jadx
;
import
jadx.core.dex.nodes.RootNode
;
import
jadx.core.utils.ListUtils
;
import
jadx.core.utils.StringUtils
;
import
jadx.core.utils.files.FileUtils
;
...
...
@@ -362,17 +362,28 @@ public class MainWindow extends JFrame {
}
private
void
exportMappings
(
MappingFormat
mappingFormat
)
{
RootNode
rootNode
=
wrapper
.
getDecompiler
().
getRoot
();
Thread
exportThread
=
new
Thread
(()
->
{
new
MappingExporter
(
rootNode
).
exportMappings
(
Paths
.
get
(
project
.
getProjectPath
().
getParent
().
toString
(),
"mappings"
+
(
mappingFormat
.
hasSingleFile
()
?
"."
+
mappingFormat
.
fileExt
:
""
)),
project
.
getCodeData
(),
mappingFormat
);
});
backgroundExecutor
.
execute
(
NLS
.
str
(
"progress.export_mappings"
),
exportThread
);
update
();
FileDialog
fileDialog
=
new
FileDialog
(
this
,
FileDialog
.
OpenMode
.
CUSTOM_SAVE
);
fileDialog
.
setTitle
(
NLS
.
str
(
"file.export_mappings_as"
));
Path
workingDir
=
project
.
getWorkingDir
();
Path
baseDir
=
workingDir
!=
null
?
workingDir
:
settings
.
getLastSaveFilePath
();
if
(
mappingFormat
.
hasSingleFile
())
{
fileDialog
.
setSelectedFile
(
baseDir
.
resolve
(
"mappings."
+
mappingFormat
.
fileExt
));
fileDialog
.
setFileExtList
(
Collections
.
singletonList
(
mappingFormat
.
fileExt
));
fileDialog
.
setSelectionMode
(
JFileChooser
.
FILES_ONLY
);
}
else
{
fileDialog
.
setCurrentDir
(
baseDir
);
fileDialog
.
setSelectionMode
(
JFileChooser
.
DIRECTORIES_ONLY
);
}
List
<
Path
>
paths
=
fileDialog
.
show
();
if
(
paths
.
size
()
!=
1
)
{
return
;
}
Path
savePath
=
paths
.
get
(
0
);
LOG
.
info
(
"Export mappings to: {}"
,
savePath
.
toAbsolutePath
());
backgroundExecutor
.
execute
(
NLS
.
str
(
"progress.export_mappings"
),
()
->
new
MappingExporter
(
wrapper
.
getDecompiler
().
getRoot
())
.
exportMappings
(
savePath
,
project
.
getCodeData
(),
mappingFormat
),
s
->
update
());
}
void
open
(
List
<
Path
>
paths
)
{
...
...
jadx-gui/src/main/java/jadx/gui/ui/dialog/FileDialog.java
浏览文件 @
18070eb7
...
...
@@ -27,7 +27,12 @@ import jadx.gui.utils.NLS;
public
class
FileDialog
{
public
enum
OpenMode
{
OPEN
,
ADD
,
SAVE_PROJECT
,
EXPORT
OPEN
,
ADD
,
SAVE_PROJECT
,
EXPORT
,
CUSTOM_SAVE
,
CUSTOM_OPEN
}
private
final
MainWindow
mainWindow
;
...
...
@@ -44,6 +49,26 @@ public class FileDialog {
initForMode
(
mode
);
}
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
;
}
public
void
setFileExtList
(
List
<
String
>
fileExtList
)
{
this
.
fileExtList
=
fileExtList
;
}
public
void
setSelectionMode
(
int
selectionMode
)
{
this
.
selectionMode
=
selectionMode
;
}
public
void
setSelectedFile
(
Path
path
)
{
this
.
selectedFile
=
path
;
}
public
void
setCurrentDir
(
Path
currentDir
)
{
this
.
currentDir
=
currentDir
;
}
public
List
<
Path
>
show
()
{
FileChooser
fileChooser
=
buildFileChooser
();
int
ret
=
isOpen
?
fileChooser
.
showOpenDialog
(
mainWindow
)
:
fileChooser
.
showSaveDialog
(
mainWindow
);
...
...
@@ -66,10 +91,6 @@ public class FileDialog {
return
currentDir
;
}
public
void
setSelectedFile
(
Path
path
)
{
this
.
selectedFile
=
path
;
}
private
void
initForMode
(
OpenMode
mode
)
{
switch
(
mode
)
{
case
OPEN:
...
...
@@ -101,6 +122,14 @@ public class FileDialog {
currentDir
=
mainWindow
.
getSettings
().
getLastSaveFilePath
();
isOpen
=
false
;
break
;
case
CUSTOM_SAVE:
isOpen
=
false
;
break
;
case
CUSTOM_OPEN:
isOpen
=
true
;
break
;
}
}
...
...
@@ -110,7 +139,7 @@ public class FileDialog {
fileChooser
.
setFileSelectionMode
(
selectionMode
);
fileChooser
.
setMultiSelectionEnabled
(
isOpen
);
fileChooser
.
setAcceptAllFileFilterUsed
(
true
);
if
(
!
fileExtList
.
isEmpty
(
))
{
if
(
Utils
.
notEmpty
(
fileExtList
))
{
String
description
=
NLS
.
str
(
"file_dialog.supported_files"
)
+
": ("
+
Utils
.
listToString
(
fileExtList
)
+
')'
;
fileChooser
.
setFileFilter
(
new
FileNameExtensionFilter
(
description
,
fileExtList
.
toArray
(
new
String
[
0
])));
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录