Skip to content

Commit

Permalink
MagicEncoding3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ZZHow1024 committed Sep 9, 2024
1 parent 2a9987a commit 5fff4f5
Show file tree
Hide file tree
Showing 18 changed files with 1,029 additions and 159 deletions.
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

54 changes: 26 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# [JavaFX 项目]神奇编码_**MagicEncoding**(中文说明)
# [JavaFX Project]**MagicEncoding**(English)

[**English**](README_EN.md)
[**中文说明**](README_ZH.md)

---

Website:

[[JavaFX 项目]神奇编码_MagicEncoding | ZZHow](https://www.zzhow.com/MagicEncoding)
[[JavaFX Project]MagicEncoding_EN | ZZHow](https://www.zzhow.com/MagicEncodingEN)

Source Code:

Expand All @@ -18,21 +18,9 @@ https://github.com/ZZHow1024/MagicEncoding/releases

---

## 使用说明

- 确定您使用的操作系统。
- Linux:
- 选择 .deb安装包 / .rpm安装包。
- macOS:
- 确定您使用的 Mac 的芯片(Apple Silicon / Intel)。
- 选择 .dmg磁盘镜像 / .pkg安装包。
- Windows:
- 选择 .zip压缩包 / .exe安装包 / .msi安装包。
- 下载对应的文件。
- Linux 和 macOS 需要执行安装操作后再运行,Windows 可直接运行 .zip 压缩包中的 .exe 可执行程序或选择 .exe 安装包与 .msi 安装包执行安装操作。
- 启动 MagicEncoding。
- 拖拽文件夹获取路径,填入需要筛选的后缀名(多种后缀名用“&”分隔),单击“查找文件”。
- 选择原始编码与目标编码,单击“开始转换”。
## License

This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details.

---

Expand All @@ -56,25 +44,35 @@ https://github.com/ZZHow1024/MagicEncoding/releases

---

## 功能介绍
## Function Introduction

- MagicEncoding3.0.0
- Automatic encoding recognition.
- Single file conversion.
- Support multiple languages.
- Chinese (Simplified/Traditional)
- English
- MagicEncoding2.0.0
- 拖拽文件夹获取路径。
- 查找多种后缀名。
- 支持覆盖原文件。
- Drag the folder to get the path.
- Search for multiple suffixes.
- Support overwriting original files.
- MagicEncoding1.0.0
- "GBK" "UTF-8" 之间的编码转换。
- 根据路径查找文件。
- 支持根据文件后缀名筛选文件。
- Encoding conversion between "GBK" and "UTF-8”.
- Find files by path.
- Support filtering files based on file extensions.

---

## **效果图**
## **Renderings**

![MagicEncoding3.0.0_EN](https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F4b165318-6383-451c-8845-110b786c9f0a%2Fa48f9fb0-5ca9-4b3e-aa65-5c0b9b8f53a4%2FMagicEncoding3.0.0_EN.png?table=block&id=e473a771-1ea7-42ab-9cc2-b124f8610072&t=e473a771-1ea7-42ab-9cc2-b124f8610072&width=1624&cache=v2)

MagicEncoding3.0.0_EN

![MagicEncoding2.0.0](https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F4b165318-6383-451c-8845-110b786c9f0a%2Fcea3d468-2198-4819-a5c3-cb4f3f287dfa%2FMagicEncoding2.0.0.png?table=block&id=34817b71-f9d4-42b9-91e9-a477ad85b262&t=34817b71-f9d4-42b9-91e9-a477ad85b262&width=1624&cache=v2)
![MagicEncoding2.0.0](https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F4b165318-6383-451c-8845-110b786c9f0a%2Fbf42de01-57d9-4f5d-bb7c-3490b0db7ee1%2FMagicEncoding2.0.0.png?table=block&id=7ce8da63-3633-47ff-848c-94492101089c&t=7ce8da63-3633-47ff-848c-94492101089c&width=1624&cache=v2)

MagicEncoding2.0.0

![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)
![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=1624&cache=v2)

MagicEncoding1.0.0
60 changes: 0 additions & 60 deletions README_EN.md

This file was deleted.

7 changes: 7 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
</properties>

<dependencies>
<!-- https://mvnrepository.com/artifact/com.github.albfernandez/juniversalchardet -->
<dependency>
<groupId>com.github.albfernandez</groupId>
<artifactId>juniversalchardet</artifactId>
<version>2.5.0</version>
</dependency>

<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.zzhow.magicencoding.controller;

import com.zzhow.magicencoding.ui.Application;
import javafx.fxml.FXML;
import javafx.scene.control.Label;

import java.util.ResourceBundle;

/**
* @author ZZHow
* @date 2024/9/8
*/
public class AboutController {

@FXML
private Label Label1;
@FXML
private Label Label2;
@FXML
private Label Label3;

@FXML
public void initialize() {
switchLanguage();
}

private void switchLanguage() {
ResourceBundle bundle = Application.bundle;

Label1.setText(bundle.getString("MagicEncoding"));
Label2.setText(bundle.getString("features"));
Label3.setText(bundle.getString("features_content"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@
import com.zzhow.magicencoding.service.FileService;
import com.zzhow.magicencoding.service.impl.FileServiceImpl;
import com.zzhow.magicencoding.ui.About;
import com.zzhow.magicencoding.ui.Application;
import com.zzhow.magicencoding.utils.MessageBox;
import javafx.fxml.FXML;
import javafx.scene.control.*;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.input.DragEvent;
import javafx.scene.input.TransferMode;

import java.io.File;
import java.io.*;
import java.nio.charset.Charset;
import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
Expand All @@ -20,19 +24,41 @@ public class MainController {
// 文件服务类
private final FileService fileService = FileServiceImpl.getInstance();

@FXML
private Label Label1;
@FXML
private Label Label2;
@FXML
private Label Label3;
@FXML
private Label Label4;
@FXML
private Label Label5;
@FXML
private Label Label6;
@FXML
private Label Label7;
@FXML
private Button Button1;
@FXML
private Button Button2;
@FXML
private Button Button3;
@FXML
private Button Button4;
@FXML
private ChoiceBox<String> originChoiceBox;
@FXML
private ChoiceBox<String> targetChoiceBox;
@FXML
private ChoiceBox<String> languageSelector;
@FXML
private TextField pathTextField;
@FXML
private TextField endWithTextField;
@FXML
private ListView<String> filesListView;
@FXML
private Label fileNumber;
@FXML
private CheckBox isOverwriteCheckBox;

public void clearFilesPath() {
Expand All @@ -42,9 +68,13 @@ public void clearFilesPath() {

@FXML
private void initialize() {
originChoiceBox.getItems().addAll("GBK", "UTF-8");
originChoiceBox.setValue("GBK");
targetChoiceBox.getItems().addAll("UTF-8", "GBK");
SortedMap<String, Charset> stringCharsetSortedMap = Charset.availableCharsets();
originChoiceBox.getItems().add("Auto");
for (String charset : stringCharsetSortedMap.keySet()) {
originChoiceBox.getItems().add(charset);
targetChoiceBox.getItems().add(charset);
}
originChoiceBox.setValue("Auto");
targetChoiceBox.setValue("UTF-8");
languageSelector.getItems().addAll("简体中文", "繁體中文", "English");

Expand Down Expand Up @@ -96,7 +126,7 @@ private void onReset() {
this.clearFilesPath();
pathTextField.setText("");
endWithTextField.setText("");
fileNumber.setText("文件数目:0");
Label7.setText(Application.bundle.getString("Label7") + "0");
}

@FXML
Expand All @@ -106,7 +136,8 @@ private void onFindFiles() {
String endWith = endWithTextField.getText();

filesListView.setItems(fileService.findFiles(absolutePath, endWith));
fileNumber.setText("文件数目:" + fileService.getTargetFileList().size());
Label7.setText(Application.bundle.getString("Label7")
+ fileService.getTargetFileList().size());
}

@FXML
Expand All @@ -117,10 +148,14 @@ private void onTransform() {
boolean isOverwrite = this.isOverwriteCheckBox.isSelected();

if (fileService.transform(absolutePath, originCharset, targetCharset, isOverwrite)) {
MessageBox.success("执行成功", "已将" + fileService.getTargetFileList().size()
+ "个文件从 \"" + originCharset + "\" 转为 \"" + targetCharset + "\"");
MessageBox.success(Application.bundle.getString("success1_headerText"),
"\"" + originCharset + "\"\"" + targetCharset + "\""
+ Application.bundle.getString("success1_contentText")
+ fileService.getTargetFileList().size());
this.onFindFiles();
} else {
MessageBox.error("执行失败", "请重试");
MessageBox.error(Application.bundle.getString("error3_headerText")
, Application.bundle.getString("error3_contentText"));
}
}

Expand Down
Loading

0 comments on commit 5fff4f5

Please sign in to comment.