Skip to content

Commit 437598f

Browse files
committed
Merge branch 'develop'
2 parents 579e3d7 + 86461ce commit 437598f

File tree

20 files changed

+717
-2
lines changed

20 files changed

+717
-2
lines changed

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Official website
4+
url: https://www.zzhow.com/MagicEncodingEN
5+
about: Please read the official documentation before submitting an issue, and if that doesn't solve your problem, then ask an issue.
6+
- name: 官方网站
7+
url: https://www.zzhow.com/MagicEncoding
8+
about: 请在提交问题之前先阅读官方文档,如果还不能解决问题,则再提问题。
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
name: Bug Report | Bug反馈
3+
about: Create a "Bug Report" | 创建一个"Bug反馈"
4+
title: ''
5+
labels: ["bug"]
6+
assignees: ''
7+
---
8+
9+
<!-- 请填写以下这些问题。 | Please fill in these questions. -->
10+
11+
### Bug description | bug 描述
12+
13+
### Desired outcome | 期望的结果
14+
15+
### MagicCalculator version | MagicCalculator 版本
16+
17+
### Operating system version | 操作系统版本
18+
19+
### Screenshot | 截图
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
name: Desired functionality | 期望的功能
3+
about: Tell us what features you would like | 告诉我们您期望的功能
4+
title: ''
5+
labels: ["enhancement"]
6+
assignees: ''
7+
---
8+
9+
<!-- 请在您提交期望的功能之前,回答以下这些问题。 | Please answer these questions before you submit the desired feature. -->
10+
11+
### Scenes to be used | 使用场景
12+
13+
### Functional Description | 功能描述
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
name: Question Exchange | 问题交流
3+
about: Create a "Question Exchange" | 创建一个“问题交流”
4+
title: ''
5+
labels: ["question"]
6+
assignees: ''
7+
---
8+
9+
<!-- 请填写以下这些问题。 | Please fill in these questions. -->
10+
11+
### Question description | 问题描述
12+
13+
### Desired outcome | 期望的结果
14+
15+
### MagicCalculator version | MagicCalculator 版本
16+
17+
### Operating system version | 操作系统版本
18+
19+
### Screenshot | 截图

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
/.idea
3+
.DS_Store
4+
/target

README.md

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,49 @@
1-
# MagicEncoding
2-
MagicEncoding.Developing with JavaFX.
1+
# [JavaFX 项目]神奇编码_**MagicEncoding**(中文说明)
2+
3+
[**English**](README_EN.md)
4+
5+
---
6+
7+
Website:
8+
9+
[[JavaFX 项目]神奇编码_MagicEncoding | ZZHow](https://www.zzhow.com/MagicEncoding)
10+
11+
Source Code:
12+
13+
https://github.com/ZZHow1024/MagicEncoding
14+
15+
Releases:
16+
17+
https://github.com/ZZHow1024/MagicEncoding/releases
18+
19+
---
20+
21+
## 使用说明
22+
23+
- 确定您使用的操作系统。
24+
- Linux:
25+
- 选择 .deb安装包 / .rpm安装包。
26+
- macOS:
27+
- 确定您使用的 Mac 的芯片(Apple Silicon / Intel)。
28+
- 选择 .dmg磁盘镜像 / .pkg安装包。
29+
- Windows:
30+
- 选择 .zip压缩包 / .exe安装包 / .msi安装包。
31+
- 下载对应的文件。
32+
- Linux 和 macOS 需要执行安装操作后再运行,Windows 可直接运行 .zip 压缩包中的 .exe 可执行程序或选择 .exe 安装包与 .msi 安装包执行安装操作。
33+
34+
---
35+
36+
## 功能介绍
37+
38+
- MagicEncoding1.0.0
39+
- "GBK" 与 "UTF-8" 之间的编码转换。
40+
- 根据路径查找文件。
41+
- 支持根据文件后缀名筛选文件。
42+
43+
---
44+
45+
## **效果图**
46+
47+
![MagicEncoding1.0.0](https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F4b165318-6383-451c-8845-110b786c9f0a%2F94657332-79a5-4e54-b697-8979784a6da3%2FMagicEncoding1.0.0.png?table=block&id=c8dd391f-0e31-455c-8dc3-2b154b44605f&t=c8dd391f-0e31-455c-8dc3-2b154b44605f&width=529&cache=v2)
48+
49+
MagicEncoding1.0.0

README_EN.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# [JavaFX Project]**MagicEncoding**(English)
2+
3+
[**中文说明**](README.md)
4+
5+
---
6+
7+
Website:
8+
9+
[[JavaFX Project]MagicEncoding_EN | ZZHow](https://www.zzhow.com/MagicEncodingEN)
10+
11+
Source Code:
12+
13+
https://github.com/ZZHow1024/MagicEncoding
14+
15+
Releases:
16+
17+
https://github.com/ZZHow1024/MagicEncoding/releases
18+
19+
---
20+
21+
## **Instructions for use**
22+
23+
- Determine the operating system you are using.
24+
- Linux:
25+
- Select .deb installation package/ .rpm installation package.
26+
- macOS:
27+
- Determine the chipset of your Mac (Apple Silicon / Intel).
28+
- Select .dmg disk image/ .pkg installation package.
29+
- Windows:
30+
- Select .zip package/.exe installation package/.msi installation package.
31+
- Download the corresponding file.
32+
- Linux and macOS users need to perform the installation operation before running. Windows users can directly run the .exe executable program in the .zip compressed package or select the .exe installation package and .msi installation package to perform the installation operation.
33+
34+
---
35+
36+
## Function Introduction
37+
38+
- MagicEncoding1.0.0
39+
- Encoding conversion between "GBK" and "UTF-8”.
40+
- Find files by path.
41+
- Support filtering files based on file extensions.
42+
43+
---
44+
45+
## **Renderings**
46+
47+
![MagicEncoding1.0.0](https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F4b165318-6383-451c-8845-110b786c9f0a%2Fa91b3a7d-672f-4ea2-b167-4657fef038dc%2FMagicEncoding1.0.0.png?table=block&id=ed5e4ef9-7816-4961-9740-d423c5681168&t=ed5e4ef9-7816-4961-9740-d423c5681168&width=1504&cache=v2)
48+
49+
MagicEncoding1.0.0

pom.xml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>com.zzhow</groupId>
8+
<artifactId>MagicEncoding</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
<name>MagicEncoding</name>
11+
12+
<properties>
13+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
14+
<junit.version>5.10.0</junit.version>
15+
</properties>
16+
17+
<dependencies>
18+
<dependency>
19+
<groupId>org.openjfx</groupId>
20+
<artifactId>javafx-controls</artifactId>
21+
<version>21</version>
22+
</dependency>
23+
<dependency>
24+
<groupId>org.openjfx</groupId>
25+
<artifactId>javafx-fxml</artifactId>
26+
<version>21</version>
27+
</dependency>
28+
29+
<dependency>
30+
<groupId>org.junit.jupiter</groupId>
31+
<artifactId>junit-jupiter-api</artifactId>
32+
<version>${junit.version}</version>
33+
<scope>test</scope>
34+
</dependency>
35+
<dependency>
36+
<groupId>org.junit.jupiter</groupId>
37+
<artifactId>junit-jupiter-engine</artifactId>
38+
<version>${junit.version}</version>
39+
<scope>test</scope>
40+
</dependency>
41+
</dependencies>
42+
43+
<build>
44+
<plugins>
45+
<plugin>
46+
<groupId>org.apache.maven.plugins</groupId>
47+
<artifactId>maven-compiler-plugin</artifactId>
48+
<version>3.11.0</version>
49+
<configuration>
50+
<source>21</source>
51+
<target>21</target>
52+
</configuration>
53+
</plugin>
54+
<plugin>
55+
<groupId>org.openjfx</groupId>
56+
<artifactId>javafx-maven-plugin</artifactId>
57+
<version>0.0.8</version>
58+
<executions>
59+
<execution>
60+
<!-- Default configuration for running with: mvn clean javafx:run -->
61+
<id>default-cli</id>
62+
<configuration>
63+
<mainClass>com.zzhow.magicencoding/com.zzhow.magicencoding.ui.Application</mainClass>
64+
<launcher>app</launcher>
65+
<jlinkZipName>app</jlinkZipName>
66+
<jlinkImageName>app</jlinkImageName>
67+
<noManPages>true</noManPages>
68+
<stripDebug>true</stripDebug>
69+
<noHeaderFiles>true</noHeaderFiles>
70+
</configuration>
71+
</execution>
72+
</executions>
73+
</plugin>
74+
</plugins>
75+
</build>
76+
</project>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.zzhow.magicencoding;
2+
3+
import com.zzhow.magicencoding.ui.Application;
4+
5+
/**
6+
* @author ZZHow
7+
* @date 2024/9/3
8+
*/
9+
public class MainClass {
10+
public static void main(String[] args) {
11+
Application.main(args);
12+
}
13+
}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
package com.zzhow.magicencoding.controller;
2+
3+
import com.zzhow.magicencoding.service.FileService;
4+
import com.zzhow.magicencoding.service.impl.FileServiceImpl;
5+
import com.zzhow.magicencoding.ui.About;
6+
import com.zzhow.magicencoding.utils.MessageBox;
7+
import javafx.fxml.FXML;
8+
import javafx.scene.control.ChoiceBox;
9+
import javafx.scene.control.ListView;
10+
import javafx.scene.control.TextField;
11+
12+
public class MainController {
13+
14+
// 文件服务类
15+
private final FileService fileService = FileServiceImpl.getInstance();
16+
17+
@FXML
18+
private ChoiceBox<String> originChoiceBox;
19+
@FXML
20+
private ChoiceBox<String> targetChoiceBox;
21+
@FXML
22+
private TextField pathTextField;
23+
@FXML
24+
private TextField endWithTextField;
25+
@FXML
26+
private ListView<String> filesListView;
27+
28+
public void initialize() {
29+
originChoiceBox.getItems().addAll("GBK", "UTF-8");
30+
originChoiceBox.setValue("GBK");
31+
targetChoiceBox.getItems().addAll("UTF-8", "GBK");
32+
targetChoiceBox.setValue("UTF-8");
33+
}
34+
35+
public void clearFilesPath() {
36+
fileService.clearTargetFileList();
37+
filesListView.setItems(null);
38+
}
39+
40+
@FXML
41+
private void onReset() {
42+
this.clearFilesPath();
43+
pathTextField.setText("");
44+
endWithTextField.setText("");
45+
}
46+
47+
@FXML
48+
private void onFindFiles() {
49+
this.clearFilesPath();
50+
String absolutePath = pathTextField.getText();
51+
String endWith = endWithTextField.getText();
52+
53+
filesListView.setItems(fileService.findFiles(absolutePath, endWith));
54+
}
55+
56+
@FXML
57+
private void onTransform() {
58+
String absolutePath = pathTextField.getText();
59+
String originCharset = originChoiceBox.getValue();
60+
String targetCharset = targetChoiceBox.getValue();
61+
62+
if (fileService.transform(absolutePath, originCharset, targetCharset)) {
63+
MessageBox.success("执行成功", "已将" + fileService.getTargetFileList().size()
64+
+ "个文件从 \"" + originCharset + "\" 转为 \"" + targetCharset + "\"");
65+
} else {
66+
MessageBox.error("执行失败", "请重试");
67+
}
68+
}
69+
70+
@FXML
71+
private void onAbout() {
72+
About.open();
73+
}
74+
75+
}

0 commit comments

Comments
 (0)