diff --git a/README.md b/README.md index 2f2098c..87f9062 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,12 @@ https://github.com/ZZHow1024/MagicEncoding/releases --- +## What is it? + +MagicEncoding is a cross-platform encoding processing tool that supports character set conversion of character files, encoding and decoding of character text (Unicode and URL) and Unix timestamps (conversion between timestamps and time and shortcut operations on time). + +--- + ## License This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details. @@ -26,6 +32,8 @@ This project is licensed under the GNU General Public License v3.0 - see the [LI ## **Instructions for use** +Download address: https://github.com/ZZHow1024/MagicEncoding/releases + - Determine the operating system you are using. - Linux: - Select .deb installation package/ .rpm installation package. @@ -39,13 +47,56 @@ This project is licensed under the GNU General Public License v3.0 - see the [LI - Start MagicEncoding. - You can select the language in the lower right corner of MagicEncoding's main interface. - Currently supports Chinese (Simplified / Traditional) and English. -- Drag the folder or file to obtain the path, enter the suffix name to be filtered (separate multiple suffix names with "&"), and click Find File. -- Select the original encoding and target encoding, and click "Start Conversion". +- You can select the function category (Character file / Character text / Unix timestamp) above MagicEncoding. + - Character file + - Drag the folder or file to get the path, fill in the suffix name to be filtered (multiple suffix names are separated by "&"), and click "Find files". + - Choose whether to overwrite the original file. + - Select the original encoding and the target encoding, and click "Start conversion". + - Character text + - Continue to select Unicode / URL. + - Unicode + - Fill in the text content to be encoded in the text box above, click "**↓**", and the encoded text will be displayed in the text box below. + - Fill in the text content to be decoded in the text box below, click "**↑**", and the decoded text will be displayed in the text box above. + - URL + - Fill in the text content to be encoded in the text box above, select the character set of the original text, click "**↓**", and the encoded text will be displayed in the text box below. + - Fill in the text content to be decoded in the text box below, select the character set of the original text, click "**↑**", and the decoded text will be displayed in the text box above. + - Unix timestamp + - Basic functions + - When entering this module, the current timestamp will be automatically obtained, but it will not be updated in real time. Click "Refresh" to re-obtain the current timestamp. + - Fill in the timestamp to be converted in the left text box, select the timestamp unit (seconds / milliseconds), click "-->", and the converted time will be displayed in the right text box. + - Fill in the time to be converted in the right text box, select the timestamp unit (seconds / milliseconds), click "<--", and the converted timestamp will be displayed in the left text box. + - Quick operations + - Fill in the timestamp or time. If you fill in both, the operation will be based on the time (the content in the right text box). + - Select the operation type (Move forward / Move backward). + - Fill in the year, month, day, hour, minute and second (only Arabic numerals are supported), click "Operate", and the timestamp and time after the operation will overwrite the original content. +- Click "Reset" to clear the filled content. + +--- + +## Supported file character sets + +- Supported file character sets for conversion: Big5, Big5-HKSCS, CESU-8, EUC-JP, EUC-KR, GB18030, GB2312, GBK, IBM-Thai, IBM00858, IBM01140, IBM01141, IBM01142, IBM01143, IBM01144, IBM01145, IBM01146, IBM01147, IBM01148, IBM01149, IBM037, IBM1026, IBM1047, IBM273, IBM277, IBM278, IBM280, IBM284, IBM285, IBM290, IBM297, IBM420, IBM424, IBM437, IBM500, IBM775, IBM850, IBM852, IBM855, IBM857, IBM860, IBM861, IBM862, IBM863, IBM864, IBM865, IBM866, IBM868, IBM869, IBM870, IBM871, IBM918, ISO-2022-CN, ISO-2022-JP, ISO-2022-JP-2, ISO-2022-KR, ISO-8859-1, ISO-8859-13, ISO-8859-15, ISO-8859-16, ISO-8859-2, ISO-8859-3, ISO-8859-4, ISO-8859-5, ISO-8859-6, ISO-8859-7, ISO-8859-8, ISO-8859-9, JIS_X0201, JIS_X0212-1990, KOI8-R, KOI8-U, Shift_JIS, TIS-620, US-ASCII, UTF-16, UTF-16BE, UTF-16LE, UTF-32, UTF-32BE, UTF-32LE, UTF-8, windows-1250, windows-1251, windows-1252, windows-1253, windows-1254, windows-1255, windows-1256, windows-1257, windows-1258, windows-31j, x-Big5-HKSCS-2001, x-Big5-Solaris, x-euc-jp-linux, x-EUC-TW, x-eucJP-Open, x-IBM1006, x-IBM1025, x-IBM1046, x-IBM1097, x-IBM1098, x-IBM1112, x-IBM1122, x-IBM1123, x-IBM1124, x-IBM1129, x-IBM1166, x-IBM1364, x-IBM1381, x-IBM1383, x-IBM29626C, x-IBM300, x-IBM33722, x-IBM737, x-IBM833, x-IBM834, x-IBM856, x-IBM874, x-IBM875, x-IBM921, x-IBM922, x-IBM930, x-IBM933, x-IBM935, x-IBM937, x-IBM939, x-IBM942, x-IBM942C, x-IBM943, x-IBM943C, x-IBM948, x-IBM949, x-IBM949C, x-IBM950, x-IBM964, x-IBM970, x-ISCII91, x-ISO-2022-CN-CNS, x-ISO-2022-CN-GB, x-iso-8859-11, x-JIS0208, x-JISAutoDetect, x-Johab, x-MacArabic, x-MacCentralEurope, x-MacCroatian, x-MacCyrillic, x-MacDingbat, x-MacGreek, x-MacHebrew, x-MacIceland, x-MacRoman, x-MacRomania, x-MacSymbol, x-MacThai, x-MacTurkish, x-MacUkraine, x-MS932_0213, x-MS950-HKSCS, x-MS950-HKSCS-XP, x-mswin-936, x-PCK, x-SJIS_0213, x-UTF-16LE-BOM, X-UTF-32BE-BOM, X-UTF-32LE-BOM, x-windows-50220, x-windows-50221, x-windows-874, x-windows-949, x-windows-950, x-windows-iso2022jp. +- Supports automatic identification of file character sets:[Encodings that can be detected](https://github.com/albfernandez/juniversalchardet?tab=readme-ov-file#encodings-that-can-be-detected). + +--- + +## Dependencies + +This project requires the following libraries: + +- [**juniversalchardet**](https://github.com/albfernandez/juniversalchardet): Used for character encoding detection. +- [**OpenJFX**](https://openjfx.io/): JavaFX library for building the graphical user interface. --- -## Function Introduction +## Functional introduction of each version +- MagicEncoding4.0.0 + - Unicode encoding and decoding of character text. + - URL encoding and decoding of character text. + - Unix timestamp. + - Supports conversion between timestamp and time + - Supports time shortcut operations - MagicEncoding3.0.0 - Automatic encoding recognition. - Single file conversion. @@ -63,7 +114,11 @@ This project is licensed under the GNU General Public License v3.0 - see the [LI --- -## **Renderings** +## Main interface of each version + +![MagicEncoding4.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%2Fbec5cc32-9058-45d2-baeb-3b24dfc55b96%2FMagicEncoding4.0.0_EN.png?table=block&id=100e64bd-e40f-8088-9b6a-ce06348c8739&t=100e64bd-e40f-8088-9b6a-ce06348c8739&width=1624&cache=v2) + +MagicEncoding4.0.0_EN ![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) diff --git a/README_ZH.md b/README_ZH.md index 174ce35..2495c7d 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -18,14 +18,22 @@ https://github.com/ZZHow1024/MagicEncoding/releases --- -## License +## 它是什么? -This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details. +MagicEncoding 是一款跨平台的编码处理工具,支持字符文件的字符集转换、字符文本的编解码(Unicode 与 URL)和 Unix 时间戳(时间戳与时间相互转换 和 时间的快捷操作)。 + +--- + +## 许可证 + +该项目根据 GNU 通用公共许可证 v3.0 获得许可 - 有关详细信息,请参阅 [LICENSE](LICENSE) 文件。 --- ## 使用说明 +下载地址:https://github.com/ZZHow1024/MagicEncoding/releases + - 确定您使用的操作系统。 - Linux: - 选择 .deb安装包 / .rpm安装包。 @@ -39,13 +47,56 @@ This project is licensed under the GNU General Public License v3.0 - see the [LI - 启动 MagicEncoding。 - 在 MagicEncoding 的主界面右下方可以选择语言。 - 当前支持中文(简体 / 繁体)与英文。 -- 拖拽文件夹或文件获取路径,填入需要筛选的后缀名(多种后缀名用“&”分隔),单击“查找文件”。 -- 选择原始编码与目标编码,单击“开始转换”。 +- 在 MagicEncoding 的上方可以选择功能分类(字符文件 / 字符文本 / Unix 时间戳)。 + - 字符文件 + - 拖拽文件夹或文件获取路径,填入需要筛选的后缀名(多种后缀名用“&”分隔),单击“查找文件”。 + - 选择是否覆盖原文件。 + - 选择原始编码与目标编码,单击“开始转换”。 + - 字符文本 + - 继续选择 Unicode / URL。 + - Unicode + - 将待编码的文本内容填入上方文本框中,单击“**↓**”,编码后的文本将显示在下方文本框中。 + - 将待解码的文本内容填入下方文本框中,单击“**↑**”,解码后的文本将显示在上方文本框中。 + - URL + - 将待编码的文本内容填入上方文本框中,选择原文本的字符集,单击“**↓**”,编码后的文本将显示在下方文本框中。 + - 将待解码的文本内容填入下方文本框中,选择原文本的字符集,单击“**↑**”,解码后的文本将显示在上方文本框中。 + - Unix时间戳 + - 基础功能 + - 当进入此模块时会自动获取当前的时间戳,但这不会实时更新,单击“刷新”可以重新获取当前的时间戳。 + - 将待转换的时间戳填入左方文本框中,选择时间戳的单位(秒 / 毫秒),单击“-->”,转换后的时间将显示在右方文本框中。 + - 将待转换的时间填入右方文本框中,选择时间戳的单位(秒 / 毫秒),单击“<--”,转换后的时间戳将显示在左方文本框中。 + - 快捷操作 + - 填写时间戳或时间,若同时填写将在时间(右方文本框中的内容)的基础上进行操作。 + - 选择操作类型(向前 / 向后)。 + - 分别填入年、月、日、时、分和秒(仅支持阿拉伯数字),单击“操作”,操作后的时间戳和时间将会覆盖原始内容。 +- 单击“重置”可清空填写的内容。 + +--- + +## 支持的文件字符集 + +- 支持转换的文件字符集:Big5,Big5-HKSCS,CESU-8,EUC-JP,EUC-KR,GB18030,GB2312,GBK,IBM-Thai,IBM00858,IBM01140,IBM01141,IBM01142,IBM01143,IBM01144,IBM01145,IBM01146,IBM01147,IBM01148,IBM01149,IBM037,IBM1026,IBM1047,IBM273,IBM277,IBM278,IBM280,IBM284,IBM285,IBM290,IBM297,IBM420,IBM424,IBM437,IBM500,IBM775,IBM850,IBM852,IBM855,IBM857,IBM860,IBM861,IBM862,IBM863,IBM864,IBM865,IBM866,IBM868,IBM869,IBM870,IBM871,IBM918,ISO-2022-CN,ISO-2022-JP,ISO-2022-JP-2,ISO-2022-KR,ISO-8859-1,ISO-8859-13,ISO-8859-15,ISO-8859-16,ISO-8859-2,ISO-8859-3,ISO-8859-4,ISO-8859-5,ISO-8859-6,ISO-8859-7,ISO-8859-8,ISO-8859-9,JIS_X0201,JIS_X0212-1990,KOI8-R,KOI8-U,Shift_JIS,TIS-620,US-ASCII,UTF-16,UTF-16BE,UTF-16LE,UTF-32,UTF-32BE,UTF-32LE,UTF-8,windows-1250,windows-1251,windows-1252,windows-1253,windows-1254,windows-1255,windows-1256,windows-1257,windows-1258,windows-31j,x-Big5-HKSCS-2001,x-Big5-Solaris,x-euc-jp-linux,x-EUC-TW,x-eucJP-Open,x-IBM1006,x-IBM1025,x-IBM1046,x-IBM1097,x-IBM1098,x-IBM1112,x-IBM1122,x-IBM1123,x-IBM1124,x-IBM1129,x-IBM1166,x-IBM1364,x-IBM1381,x-IBM1383,x-IBM29626C,x-IBM300,x-IBM33722,x-IBM737,x-IBM833,x-IBM834,x-IBM856,x-IBM874,x-IBM875,x-IBM921,x-IBM922,x-IBM930,x-IBM933,x-IBM935,x-IBM937,x-IBM939,x-IBM942,x-IBM942C,x-IBM943,x-IBM943C,x-IBM948,x-IBM949,x-IBM949C,x-IBM950,x-IBM964,x-IBM970,x-ISCII91,x-ISO-2022-CN-CNS,x-ISO-2022-CN-GB,x-iso-8859-11,x-JIS0208,x-JISAutoDetect,x-Johab,x-MacArabic,x-MacCentralEurope,x-MacCroatian,x-MacCyrillic,x-MacDingbat,x-MacGreek,x-MacHebrew,x-MacIceland,x-MacRoman,x-MacRomania,x-MacSymbol,x-MacThai,x-MacTurkish,x-MacUkraine,x-MS932_0213,x-MS950-HKSCS,x-MS950-HKSCS-XP,x-mswin-936,x-PCK,x-SJIS_0213,x-UTF-16LE-BOM,X-UTF-32BE-BOM,X-UTF-32LE-BOM,x-windows-50220,x-windows-50221,x-windows-874,x-windows-949,x-windows-950,x-windows-iso2022jp。 +- 支持自动识别的文件字符集:[Encodings that can be detected](https://github.com/albfernandez/juniversalchardet?tab=readme-ov-file#encodings-that-can-be-detected)。 + +--- + +## 依赖项 + +该项目需要以下库: + +- [**juniversalchardet**](https://github.com/albfernandez/juniversalchardet):用于字符编码检测。 +- [**OpenJFX**](https://openjfx.io/):用于构建图形用户界面的 JavaFX 库。 --- -## 功能介绍 +## 各版本功能介绍 +- MagicEncoding4.0.0 + - 字符文本的 Unicode 编解码。 + - 字符文本的 URL 编解码。 + - Unix 时间戳。 + - 时间戳与时间相互转换 + - 时间快捷操作 - MagicEncoding3.0.0 - 自动识别编码。 - 单文件转换。 @@ -63,7 +114,11 @@ This project is licensed under the GNU General Public License v3.0 - see the [LI --- -## **效果图** +## 各版本主界面 + +![MagicEncoding4.0.0_ZH](https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F4b165318-6383-451c-8845-110b786c9f0a%2Fb10a48cd-ee7f-49bd-a5c9-1a337b93b79a%2FMagicEncoding4.0.0_ZH.png?table=block&id=100e64bd-e40f-806d-8cd1-dd4538d217ba&t=100e64bd-e40f-806d-8cd1-dd4538d217ba&width=1624&cache=v2) + +MagicEncoding4.0.0_ZH ![MagicEncoding3.0.0_ZH](https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F4b165318-6383-451c-8845-110b786c9f0a%2F59e24efe-e112-48a3-8ca6-fa721270fca0%2FMagicEncoding3.0.0_ZH.png?table=block&id=63c5eb8e-9288-4418-a76b-627ee422a9c5&t=63c5eb8e-9288-4418-a76b-627ee422a9c5&width=1624&cache=v2) diff --git a/src/main/java/com/zzhow/magicencoding/controller/MainController.java b/src/main/java/com/zzhow/magicencoding/controller/MainController.java index 3df7194..191d27b 100644 --- a/src/main/java/com/zzhow/magicencoding/controller/MainController.java +++ b/src/main/java/com/zzhow/magicencoding/controller/MainController.java @@ -1,28 +1,45 @@ package com.zzhow.magicencoding.controller; +import com.zzhow.magicencoding.enums.TextEncodingType; +import com.zzhow.magicencoding.enums.TimeOperationType; import com.zzhow.magicencoding.service.FileService; +import com.zzhow.magicencoding.service.TextService; +import com.zzhow.magicencoding.service.TimeService; import com.zzhow.magicencoding.service.impl.FileServiceImpl; +import com.zzhow.magicencoding.service.impl.TextServiceImpl; +import com.zzhow.magicencoding.service.impl.TimeServiceImpl; 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.Button; import javafx.scene.control.Label; +import javafx.scene.control.TextArea; import javafx.scene.control.TextField; import javafx.scene.input.DragEvent; import javafx.scene.input.TransferMode; import java.io.*; import java.nio.charset.Charset; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; import java.util.List; -import java.util.Locale; -import java.util.ResourceBundle; -import java.util.SortedMap; +import java.util.concurrent.TimeUnit; public class MainController { // 文件服务类 private final FileService fileService = FileServiceImpl.getInstance(); + // 文本服务类 + private final TextService textService = TextServiceImpl.getInstance(); + // 时间服务类 + private final TimeService timeService = TimeServiceImpl.getInstance(); + // 字符编码索引 + private int textSelectedIndex = 0; + // 主页索引 + private int selectedIndex = 0; @FXML private Label Label1; @@ -60,6 +77,77 @@ public class MainController { private ListView filesListView; @FXML private CheckBox isOverwriteCheckBox; + @FXML + private TabPane textTabPane; + @FXML + private TextArea decodingText; + @FXML + private TextArea encodingText; + @FXML + private Label urlCharsetText; + @FXML + private ChoiceBox urlCharset; + @FXML + private TextField nowTimestampS; + @FXML + private TextField nowTimestampMs; + @FXML + private TabPane tabPane; + @FXML + private TextField timeTextField1; + @FXML + private TextField timeTextField2; + @FXML + private TextField timeTextField3; + @FXML + private TextField timeTextField4; + @FXML + private TextField timeTextField5; + @FXML + private TextField timeTextField6; + @FXML + private TextField timeTextField7; + @FXML + private TextField timeTextField8; + @FXML + private ChoiceBox secondTypeChoiceBox; + @FXML + private ChoiceBox timeOperationType; + @FXML + private Tab tab1; + @FXML + private Tab tab2; + @FXML + private Tab tab3; + @FXML + private Button textReset; + @FXML + private Label timeLabel1; + @FXML + private Label timeLabel2; + @FXML + private Label timeLabel3; + @FXML + private Label timeLabel4; + @FXML + private Label timeLabel5; + @FXML + private Label timeLabel6; + @FXML + private Label timeLabel7; + @FXML + private Label timeLabel8; + @FXML + private Label timeLabel9; + @FXML + private Button timeButton1; + @FXML + private Button timeButton2; + @FXML + private Button timeButton3; + @FXML + private TitledPane timeTitlePane; + public void clearFilesPath() { fileService.clearTargetFileList(); @@ -78,6 +166,14 @@ private void initialize() { targetChoiceBox.setValue("UTF-8"); languageSelector.getItems().addAll("简体中文", "繁體中文", "English"); + urlCharset.getItems().addAll("UTF-8", "GBK"); + urlCharset.setValue("UTF-8"); + + secondTypeChoiceBox.getItems().addAll("秒", "毫秒"); + secondTypeChoiceBox.setValue("秒"); + timeOperationType.getItems().addAll("向前", "向后"); + timeOperationType.setValue("向前"); + String language = Locale.getDefault().toLanguageTag(); if (language.contains("zh")) { @@ -87,7 +183,7 @@ else if (language.contains("Hant")) language = "zh_TW"; else if (language.contains("CN")) language = "zh_CN"; - else + else language = "zh_TW"; } else { language = "en_US"; @@ -104,6 +200,138 @@ else if (language.contains("CN")) switchLanguage(); } + @FXML + private void onTextTabPaneClicked() { + SingleSelectionModel selectionModel = textTabPane.getSelectionModel(); + + if (this.textSelectedIndex != selectionModel.getSelectedIndex()) { + if (this.textSelectedIndex == TextEncodingType.URL.getValue()) { + urlCharsetText.setVisible(false); + urlCharset.setVisible(false); + } + this.textSelectedIndex = selectionModel.getSelectedIndex(); + if (this.textSelectedIndex == TextEncodingType.URL.getValue()) { + urlCharsetText.setVisible(true); + urlCharset.setVisible(true); + } + selectionModel.select(this.textSelectedIndex); + decodingText.clear(); + encodingText.clear(); + encodingText.setPromptText(selectionModel.getSelectedItem().getText()); + } + } + + @FXML + private void onTabPaneClicked() { + SingleSelectionModel selectionModel = this.tabPane.getSelectionModel(); + + if (this.selectedIndex != selectionModel.getSelectedIndex()) { + this.selectedIndex = selectionModel.getSelectedIndex(); + if (selectionModel.getSelectedIndex() == 2) + this.onRefreshTimestamp(); + } + } + + @FXML + private void onRefreshTimestamp() { + this.nowTimestampS.setText(System.currentTimeMillis() / 1000 + ""); + this.nowTimestampMs.setText(System.currentTimeMillis() + ""); + } + + @FXML + private void onTimeReset() { + timeTextField1.clear(); + timeTextField2.clear(); + timeTextField3.clear(); + timeTextField4.clear(); + timeTextField5.clear(); + timeTextField6.clear(); + timeTextField7.clear(); + timeTextField8.clear(); + } + + @FXML + private void onTimestampToTime() { + String text = timeTextField1.getText(); + TimeUnit timeUnit = secondTypeChoiceBox.getSelectionModel().getSelectedIndex() == 0 ? TimeUnit.SECONDS : TimeUnit.MILLISECONDS; + if (text == null || text.isEmpty()) + return; + try { + long timestamp = Long.parseLong(text); + timeTextField2.setText(timeService.timestampToTime(timestamp, timeUnit)); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } + + @FXML + private void onTimeToTimestamp() { + String text = timeTextField2.getText(); + TimeUnit timeUnit = secondTypeChoiceBox.getSelectionModel().getSelectedIndex() == 0 ? TimeUnit.SECONDS : TimeUnit.MILLISECONDS; + if (text == null || text.isEmpty()) + return; + + try { + DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + LocalDateTime localDateTime = LocalDateTime.parse(timeTextField2.getText(), dateTimeFormatter); + timeTextField1.setText(timeService.timeToTimestamp(localDateTime, timeUnit)); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } + + @FXML + private void onTimeOperate() { + int selectedIndex = timeOperationType.getSelectionModel().getSelectedIndex(); + if (timeTextField2.getText().isEmpty()) + if (!timeTextField1.getText().isEmpty()) + this.onTimestampToTime(); + else { + ResourceBundle bundle = Application.bundle; + MessageBox.error(bundle.getString("error4_headerText"), bundle.getString("error4_contentText")); + return; + } + + String time = timeTextField2.getText(); + TimeOperationType type = TimeOperationType.valueOf(selectedIndex); + String year = timeTextField3.getText(); + String month = timeTextField4.getText(); + String day = timeTextField5.getText(); + String hour = timeTextField6.getText(); + String minute = timeTextField7.getText(); + String second = timeTextField8.getText(); + + String res = timeService.timeOperate(type, time, year, month, day, hour, minute, second); + timeTextField2.setText(res); + this.onTimeToTimestamp(); + } + + @FXML + private void onEncodeText() { + String originalText = decodingText.getText(); + String originalCharset = urlCharset.getValue(); + SingleSelectionModel selectionModel = textTabPane.getSelectionModel(); + TextEncodingType type = TextEncodingType.valueOf(selectionModel.getSelectedIndex()); + + encodingText.setText(textService.encodeText(originalText, originalCharset, type)); + } + + @FXML + private void onDecodeText() { + String text = encodingText.getText(); + String originalCharset = urlCharset.getValue(); + SingleSelectionModel selectionModel = textTabPane.getSelectionModel(); + TextEncodingType type = TextEncodingType.valueOf(selectionModel.getSelectedIndex()); + + decodingText.setText(textService.decodeText(text, originalCharset, type)); + } + + @FXML + private void onTextReset() { + decodingText.clear(); + encodingText.clear(); + } + @FXML private void handleDragOver(DragEvent event) { if (event.getGestureSource() != event.getTarget() // 是否从外部拖拽 @@ -182,14 +410,41 @@ private void switchLanguage() { Label1.setText(bundle.getString("Label1")); Label2.setText(bundle.getString("Label2")); Label3.setText(bundle.getString("Label3")); - Label4.setText(bundle.getString("Label4")); + Label4.setText(bundle.getString("charset")); Label5.setText(bundle.getString("Label5")); Label6.setText(bundle.getString("Label6")); Label7.setText(bundle.getString("Label7") + fileService.getTargetFileList().size()); - Button1.setText(bundle.getString("Button1")); + Button1.setText(bundle.getString("reset")); Button2.setText(bundle.getString("Button2")); Button3.setText(bundle.getString("Button3")); Button4.setText(bundle.getString("Button4")); isOverwriteCheckBox.setText(bundle.getString("isOverwriteCheckBox")); + tab1.setText(bundle.getString("tab1")); + tab2.setText(bundle.getString("tab2")); + tab3.setText(bundle.getString("tab3")); + urlCharsetText.setText(bundle.getString("charset")); + textReset.setText(bundle.getString("reset")); + decodingText.setPromptText(bundle.getString("text_content")); + timeLabel1.setText(bundle.getString("timeLabel1")); + timeLabel2.setText(bundle.getString("timeLabel2")); + timeLabel3.setText(bundle.getString("timeLabel3")); + timeLabel4.setText(bundle.getString("year")); + timeLabel5.setText(bundle.getString("month")); + timeLabel6.setText(bundle.getString("day")); + timeLabel7.setText(bundle.getString("hour")); + timeLabel8.setText(bundle.getString("minute")); + timeLabel9.setText(bundle.getString("second")); + timeButton1.setText(bundle.getString("refresh")); + timeButton2.setText(bundle.getString("reset")); + timeButton3.setText(bundle.getString("operate")); + timeTitlePane.setText(bundle.getString("shortcut_operations")); + int selectedIndex = secondTypeChoiceBox.getSelectionModel().getSelectedIndex(); + secondTypeChoiceBox.getItems().removeIf(item -> true); + secondTypeChoiceBox.getItems().addAll(bundle.getString("second"), bundle.getString("millisecond")); + secondTypeChoiceBox.getSelectionModel().select(selectedIndex); + selectedIndex = timeOperationType.getSelectionModel().getSelectedIndex(); + timeOperationType.getItems().removeIf(item -> true); + timeOperationType.getItems().addAll(bundle.getString("move_forward"), bundle.getString("move_backward")); + timeOperationType.getSelectionModel().select(selectedIndex); } } \ No newline at end of file diff --git a/src/main/java/com/zzhow/magicencoding/enums/TextEncodingType.java b/src/main/java/com/zzhow/magicencoding/enums/TextEncodingType.java new file mode 100644 index 0000000..0daef07 --- /dev/null +++ b/src/main/java/com/zzhow/magicencoding/enums/TextEncodingType.java @@ -0,0 +1,32 @@ +package com.zzhow.magicencoding.enums; + +/** + * @author ZZHow + * @date 2024/9/12 + */ +public enum TextEncodingType { + Unicode(0), URL(1); + + private final int value; + + private TextEncodingType(int value) { + this.value = value; + } + + public int getValue() { + return this.value; + } + + public static TextEncodingType valueOf(int value) { + switch (value) { + case 0 -> { + return Unicode; + } + case 1 -> { + return URL; + } + } + + return null; + } +} diff --git a/src/main/java/com/zzhow/magicencoding/enums/TimeOperationType.java b/src/main/java/com/zzhow/magicencoding/enums/TimeOperationType.java new file mode 100644 index 0000000..34b453c --- /dev/null +++ b/src/main/java/com/zzhow/magicencoding/enums/TimeOperationType.java @@ -0,0 +1,27 @@ +package com.zzhow.magicencoding.enums; + +/** + * @author ZZHow + * @date 2024/9/12 + */ +public enum TimeOperationType { + FORWARD(0), BACKWARD(1); + + private final int value; + + private TimeOperationType(int value) { + this.value = value; + } + + public int value() { + return this.value; + } + + public static TimeOperationType valueOf(int value) { + return switch (value) { + case 0 -> FORWARD; + case 1 -> BACKWARD; + default -> null; + }; + } +} diff --git a/src/main/java/com/zzhow/magicencoding/service/TextService.java b/src/main/java/com/zzhow/magicencoding/service/TextService.java new file mode 100644 index 0000000..ff077a8 --- /dev/null +++ b/src/main/java/com/zzhow/magicencoding/service/TextService.java @@ -0,0 +1,31 @@ +package com.zzhow.magicencoding.service; + +import com.zzhow.magicencoding.enums.TextEncodingType; + +/** + * @author ZZHow + * @date 2024/9/12 + */ +public interface TextService { + + /** + * 字符文本编码 + * + * @param original 原始字符串 + * @param originalCharset 原始字符集 + * @param type 编码类型 + * @return 编码后的字符串 + */ + String encodeText(String original, String originalCharset, TextEncodingType type); + + /** + * 字符文本解码 + * + * @param original 编码过的字符串 + * @param originalCharset 原始字符集 + * @param type 解码类型 + * @return 解码后的字符串 + */ + String decodeText(String original, String originalCharset, TextEncodingType type); + +} diff --git a/src/main/java/com/zzhow/magicencoding/service/TimeService.java b/src/main/java/com/zzhow/magicencoding/service/TimeService.java new file mode 100644 index 0000000..7d3f4ef --- /dev/null +++ b/src/main/java/com/zzhow/magicencoding/service/TimeService.java @@ -0,0 +1,44 @@ +package com.zzhow.magicencoding.service; + +import com.zzhow.magicencoding.enums.TimeOperationType; + +import java.time.LocalDateTime; +import java.util.concurrent.TimeUnit; + +/** + * @author ZZHow + * @date 2024/9/12 + */ +public interface TimeService { + + /** + * 时间戳转时间 + * + * @param timestamp 时间戳 + * @return 时间 + */ + public String timestampToTime(long timestamp, TimeUnit unit); + + /** + * 时间转时间戳 + * + * @param time 时间 + * @return 时间戳 + */ + public String timeToTimestamp(LocalDateTime time, TimeUnit unit); + + /** + * 时间操作 + * + * @param time 待操作的时间 + * @param year 年 + * @param month 月 + * @param day 日 + * @param hour 时 + * @param minute 分 + * @param second 秒 + * @return 操作后的时间 + */ + public String timeOperate(TimeOperationType type, String time, String year, String month, String day, String hour, String minute, String second); + +} diff --git a/src/main/java/com/zzhow/magicencoding/service/impl/TextServiceImpl.java b/src/main/java/com/zzhow/magicencoding/service/impl/TextServiceImpl.java new file mode 100644 index 0000000..8b694f4 --- /dev/null +++ b/src/main/java/com/zzhow/magicencoding/service/impl/TextServiceImpl.java @@ -0,0 +1,31 @@ +package com.zzhow.magicencoding.service.impl; + +import com.zzhow.magicencoding.enums.TextEncodingType; +import com.zzhow.magicencoding.service.TextService; +import com.zzhow.magicencoding.utils.MyTextUtil; + +/** + * @author ZZHow + * @date 2024/9/12 + */ +public class TextServiceImpl implements TextService { + private static final TextService textService = new TextServiceImpl(); + + private TextServiceImpl() { + + } + + public static TextService getInstance() { + return textService; + } + + @Override + public String encodeText(String original, String originalCharset, TextEncodingType type) { + return MyTextUtil.encode(original, originalCharset, type); + } + + @Override + public String decodeText(String original, String originalCharset, TextEncodingType type) { + return MyTextUtil.decode(original, originalCharset, type); + } +} diff --git a/src/main/java/com/zzhow/magicencoding/service/impl/TimeServiceImpl.java b/src/main/java/com/zzhow/magicencoding/service/impl/TimeServiceImpl.java new file mode 100644 index 0000000..53cafbd --- /dev/null +++ b/src/main/java/com/zzhow/magicencoding/service/impl/TimeServiceImpl.java @@ -0,0 +1,99 @@ +package com.zzhow.magicencoding.service.impl; + +import com.zzhow.magicencoding.enums.TimeOperationType; +import com.zzhow.magicencoding.service.TimeService; +import com.zzhow.magicencoding.utils.MyTimeUtil; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.concurrent.TimeUnit; + +/** + * @author ZZHow + * @date 2024/9/12 + */ +public class TimeServiceImpl implements TimeService { + private static final TimeService timeService = new TimeServiceImpl(); + + private TimeServiceImpl() { + + } + + public static TimeService getInstance() { + return timeService; + } + + @Override + public String timestampToTime(long timestamp, TimeUnit unit) { + DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + + if (unit == TimeUnit.MILLISECONDS) + timestamp /= 1000; + + return dateTimeFormatter.format(MyTimeUtil.timestampToLocalDateTime(timestamp)); + } + + @Override + public String timeToTimestamp(LocalDateTime time, TimeUnit unit) { + long timestamp = MyTimeUtil.localDateTimeToTimestamp(time); + + return String.valueOf(unit == TimeUnit.SECONDS ? timestamp / 1000 : timestamp); + } + + @Override + public String timeOperate(TimeOperationType type, String time, String year, String month, String day, String hour, String minute, String second) { + LocalDateTime localDateTime = null; + try { + localDateTime = LocalDateTime.parse(time, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + } catch (Exception e) { + System.out.println(e.getMessage()); + return null; + } + long yearLong = 0; + long monthLong = 0; + long dayLong = 0; + long hourLong = 0; + long minuteLong = 0; + long secondLong = 0; + + if (year != null && !year.isEmpty()) + try { + yearLong = Long.parseLong(year); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + if (month != null && !month.isEmpty()) + try { + monthLong = Long.parseLong(month); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + if (day != null && !day.isEmpty()) + try { + dayLong = Long.parseLong(day); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + if (hour != null && !hour.isEmpty()) + try { + hourLong = Long.parseLong(hour); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + if (minute != null && !minute.isEmpty()) + try { + minuteLong = Long.parseLong(minute); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + if (second != null && !second.isEmpty()) + try { + secondLong = Long.parseLong(second); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + LocalDateTime res = MyTimeUtil.timeOperate(type, localDateTime, yearLong, monthLong, dayLong, hourLong, minuteLong, secondLong); + + return res.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + } +} diff --git a/src/main/java/com/zzhow/magicencoding/ui/About.java b/src/main/java/com/zzhow/magicencoding/ui/About.java index b22b25c..f179b0d 100644 --- a/src/main/java/com/zzhow/magicencoding/ui/About.java +++ b/src/main/java/com/zzhow/magicencoding/ui/About.java @@ -17,7 +17,7 @@ public class About { public static void open() { Stage stage = new Stage(); - stage.setTitle("MagicEncoding 3.0.0 - About"); + stage.setTitle("MagicEncoding 4.0.0 - About"); Image icon = new Image(Objects.requireNonNull(MainClass.class.getResourceAsStream("/image/icon.png"))); stage.getIcons().add(icon); stage.setResizable(false); diff --git a/src/main/java/com/zzhow/magicencoding/ui/Application.java b/src/main/java/com/zzhow/magicencoding/ui/Application.java index 6eac8a2..6216de4 100644 --- a/src/main/java/com/zzhow/magicencoding/ui/Application.java +++ b/src/main/java/com/zzhow/magicencoding/ui/Application.java @@ -23,12 +23,15 @@ public static void setLanguage(String language) { @Override public void start(Stage stage) throws IOException { FXMLLoader fxmlLoader = new FXMLLoader(Application.class.getResource("main-view.fxml")); - Scene scene = new Scene(fxmlLoader.load(), 700, 535); + Scene scene = new Scene(fxmlLoader.load(), 780, 596); stage.setTitle("MagicEncoding"); stage.setScene(scene); Image icon = new Image(Objects.requireNonNull(MainClass.class.getResourceAsStream("/image/icon.png"))); stage.getIcons().add(icon); stage.setResizable(false); + stage.setOnHiding(windowEvent -> { + System.exit(0); + }); stage.show(); } diff --git a/src/main/java/com/zzhow/magicencoding/utils/MyTextUtil.java b/src/main/java/com/zzhow/magicencoding/utils/MyTextUtil.java new file mode 100644 index 0000000..b251ec0 --- /dev/null +++ b/src/main/java/com/zzhow/magicencoding/utils/MyTextUtil.java @@ -0,0 +1,68 @@ +package com.zzhow.magicencoding.utils; + +import com.zzhow.magicencoding.enums.TextEncodingType; + +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import java.net.URLEncoder; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * @author ZZHow + * @date 2024/9/12 + */ +public class MyTextUtil { + public static String encode(String original, String originalCharset, TextEncodingType type) { + switch (type) { + case Unicode -> { + // 将字符串中的每个字符转换为 Unicode 转义序列 + StringBuilder unicodeEncoded = new StringBuilder(); + for (char c : original.toCharArray()) { + unicodeEncoded.append(String.format("\\u%04x", (int) c)); + } + + return unicodeEncoded.toString(); + } + case URL -> { + // 使用 URLEncoder 类完成 URL 编码 + try { + return URLEncoder.encode(original, originalCharset); + } catch (UnsupportedEncodingException e) { + System.out.println(e.getMessage()); + } + } + } + + return null; + } + + public static String decode(String original, String originalCharset, TextEncodingType type) { + switch (type) { + case Unicode -> { + // 通过正则表达式,将字符串中的每个 Unicode 转义序列转为字符序列 + Pattern pattern = Pattern.compile("\\\\u([0-9a-fA-F]{4})"); + Matcher matcher = pattern.matcher(original); + + StringBuilder stringBuilder = new StringBuilder(); + while (matcher.find()) { + String s = String.valueOf((char) Integer.parseInt(matcher.group(1), 16)); + matcher.appendReplacement(stringBuilder, s); + } + matcher.appendTail(stringBuilder); + + return stringBuilder.toString(); + } + case URL -> { + // 使用 URLEncoder 类完成 URL 解码 + try { + return URLDecoder.decode(original, originalCharset); + } catch (UnsupportedEncodingException e) { + System.out.println(e.getMessage()); + } + } + } + + return null; + } +} diff --git a/src/main/java/com/zzhow/magicencoding/utils/MyTimeUtil.java b/src/main/java/com/zzhow/magicencoding/utils/MyTimeUtil.java new file mode 100644 index 0000000..9660489 --- /dev/null +++ b/src/main/java/com/zzhow/magicencoding/utils/MyTimeUtil.java @@ -0,0 +1,46 @@ +package com.zzhow.magicencoding.utils; + +import com.zzhow.magicencoding.enums.TimeOperationType; + +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.time.format.DateTimeFormatter; + +/** + * @author ZZHow + * @date 2024/9/12 + */ +public class MyTimeUtil { + + public static LocalDateTime timestampToLocalDateTime(long timestamp) { + Instant instant = Instant.ofEpochSecond(timestamp); + + return instant.atZone(ZoneId.systemDefault()).toLocalDateTime(); + } + + public static long localDateTimeToTimestamp(LocalDateTime localDateTime) { + return localDateTime.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli(); + } + + public static LocalDateTime timeOperate(TimeOperationType type, LocalDateTime localDateTime, long year, long month, long day, long hour, long minute, long second) { + if (type == TimeOperationType.BACKWARD) { + localDateTime = localDateTime.plusYears(year); + localDateTime = localDateTime.plusMonths(month); + localDateTime = localDateTime.plusDays(day); + localDateTime = localDateTime.plusHours(hour); + localDateTime = localDateTime.plusMinutes(minute); + localDateTime = localDateTime.plusSeconds(second); + } else { + localDateTime = localDateTime.minusYears(year); + localDateTime = localDateTime.minusMonths(month); + localDateTime = localDateTime.minusDays(day); + localDateTime = localDateTime.minusHours(hour); + localDateTime = localDateTime.minusMinutes(minute); + localDateTime = localDateTime.minusSeconds(second); + } + + return localDateTime; + } + +} diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index 7624d38..9271813 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -3,6 +3,7 @@ requires javafx.fxml; requires java.desktop; requires com.github.albfernandez.juniversalchardet; + requires java.sql; opens com.zzhow.magicencoding to javafx.fxml; diff --git a/src/main/resources/MessagesBundle_en_US.properties b/src/main/resources/MessagesBundle_en_US.properties index 7c259ac..4e385f5 100644 --- a/src/main/resources/MessagesBundle_en_US.properties +++ b/src/main/resources/MessagesBundle_en_US.properties @@ -1,11 +1,11 @@ Label1=Drag the folder or file to the gray area to get the path. Multiple suffixes can be separated by & Label2=Folder / File: Label3=Suffix: -Label4=Character set: +charset=Character set: Label5=\u2192 Label6=Hit files: Label7=Number of files: -Button1=Reset +reset=Reset Button2=Find files Button3=Start conversion Button4=About @@ -17,9 +17,30 @@ error2_headerText=There are currently no hit files error2_contentText=Please try again error3_headerText=Execution failed error3_contentText=Please try again +error4_headerText=Time is empty +error4_contentText=Please fill in the time or timestamp success=success success1_headerText=Execution Success success1_contentText=, number of files: -MagicEncoding=MagicEncoding 3.0.0 +MagicEncoding=MagicEncoding 4.0.0 features=Features: -features_content=1. Automatically identify encoding.\n2. Single file conversion.\n3. Support multiple languages.\n\t- Chinese (Simplified / Traditional)\n\t- English \ No newline at end of file +features_content=1. Unicode encoding and decoding of character text.\n2. URL encoding and decoding of character text.\n3. Unix timestamp.\n\t- Supports conversion between timestamp and time\n\t- Supports time shortcut operations +tab1=Character file +tab2=Character text +tab3=Unix timestamp +text_content=Text content +timeLabel1=Now (seconds): +timeLabel2=Now (milliseconds): +timeLabel3=Timestamp: +year=year(s) +month=month(s) +day=day(s) +hour=hour(s) +minute=minute(s) +second=second(s) +refresh=Refresh +operate=Operate +shortcut_operations=Shortcut operations +millisecond=millisecond(s) +move_forward=Move forward +move_backward=Move backward diff --git a/src/main/resources/MessagesBundle_zh_CN.properties b/src/main/resources/MessagesBundle_zh_CN.properties index 497c2b3..3db2ae0 100644 --- a/src/main/resources/MessagesBundle_zh_CN.properties +++ b/src/main/resources/MessagesBundle_zh_CN.properties @@ -1,11 +1,11 @@ Label1=\u5c06\u6587\u4ef6\u5939\u6216\u6587\u4ef6\u62d6\u62fd\u81f3\u7070\u8272\u533a\u57df\u4ee5\u83b7\u53d6\u8def\u5f84\uff0c\u591a\u4e2a\u540e\u7f00\u540d\u53ef\u7528\u0026\u5206\u9694 Label2=\u6587\u4ef6\u5939\u0020\u002f\u0020\u6587\u4ef6\uff1a Label3=\u540e\u7f00\u540d\uff1a -Label4=\u5b57\u7b26\u96c6\uff1a +charset=\u5b57\u7b26\u96c6\uff1a Label5=\u2192 Label6=\u547d\u4e2d\u7684\u6587\u4ef6\uff1a Label7=\u6587\u4ef6\u6570\u76ee\uff1a -Button1=\u91cd\u7f6e +reset=\u91cd\u7f6e Button2=\u67e5\u627e\u6587\u4ef6 Button3=\u5f00\u59cb\u8f6c\u6362 Button4=\u5173\u4e8e @@ -17,9 +17,30 @@ error2_headerText=\u5f53\u524d\u6ca1\u6709\u547d\u4e2d\u7684\u6587\u4ef6 error2_contentText=\u8bf7\u91cd\u8bd5 error3_headerText=\u6267\u884c\u5931\u8d25 error3_contentText=\u8bf7\u91cd\u8bd5 +error4_headerText=\u65f6\u95f4\u4e3a\u7a7a +error4_contentText=\u8bf7\u586b\u5199\u65f6\u95f4\u6216\u65f6\u95f4\u6233 success=\u6267\u884c\u6210\u529f success1_headerText=\u6267\u884c\u6210\u529f success1_contentText=\uff0c\u6587\u4ef6\u6570\u76ee\uff1a -MagicEncoding=\u795e\u5947\u7f16\u7801\u0020\u0033\u002e\u0030\u002e\u0030\u000d\u004d\u0061\u0067\u0069\u0063\u0045\u006e\u0063\u006f\u0064\u0069\u006e\u0067\u0020\u0033\u002e\u0030\u002e\u0030 +MagicEncoding=\u795e\u5947\u7f16\u7801\u0020\u0034\u002e\u0030\u002e\u0030\u000a\u004d\u0061\u0067\u0069\u0063\u0045\u006e\u0063\u006f\u0064\u0069\u006e\u0067\u0020\u0034\u002e\u0030\u002e\u0030 features=\u65b0\u7279\u6027\uff1a -features_content=\u0031\u002e\u0020\u81ea\u52a8\u8bc6\u522b\u7f16\u7801\u3002\u000d\u0032\u002e\u0020\u5355\u6587\u4ef6\u8f6c\u6362\u3002\u000d\u0033\u002e\u0020\u652f\u6301\u591a\u8bed\u8a00\u3002\u000d\u0020\u0020\u0020\u0020\u002d\u0020\u4e2d\u6587\uff08\u7b80\u4f53\u0020\u002f\u0020\u7e41\u4f53\uff09\u000d\u0020\u0020\u0020\u0020\u002d\u0020\u82f1\u6587 \ No newline at end of file +features_content=\u0031\u002e\u0020\u5b57\u7b26\u6587\u672c\u7684\u0020\u0055\u006e\u0069\u0063\u006f\u0064\u0065\u0020\u7f16\u89e3\u7801\u3002\u000a\u0032\u002e\u0020\u5b57\u7b26\u6587\u672c\u7684\u0020\u0055\u0052\u004c\u0020\u7f16\u89e3\u7801\u3002\u000a\u0033\u002e\u0020\u0055\u006e\u0069\u0078\u0020\u65f6\u95f4\u6233\u3002\u000a\u0009\u002d\u0020\u652f\u6301\u65f6\u95f4\u6233\u4e0e\u65f6\u95f4\u76f8\u4e92\u8f6c\u6362\u000a\u0009\u002d\u0020\u652f\u6301\u65f6\u95f4\u5feb\u6377\u64cd\u4f5c +tab1=\u5b57\u7b26\u6587\u4ef6 +tab2=\u5b57\u7b26\u6587\u672c +tab3=Unix\u65f6\u95f4\u6233 +text_content=\u6587\u672c\u5185\u5bb9 +timeLabel1=\u73b0\u5728\uff08\u79d2\uff09\uff1a +timeLabel2=\u73b0\u5728\uff08\u6beb\u79d2\uff09\uff1a +timeLabel3=\u65f6\u95f4\u6233\uff1a +year=\u5e74 +month=\u6708 +day=\u65e5 +hour=\u65f6 +minute=\u5206 +second=\u79d2 +refresh=\u5237\u65b0 +operate=\u64cd\u4f5c +shortcut_operations=\u5feb\u6377\u64cd\u4f5c +millisecond=\u6beb\u79d2 +move_forward=\u5411\u524d +move_backward=\u5411\u540e \ No newline at end of file diff --git a/src/main/resources/MessagesBundle_zh_TW.properties b/src/main/resources/MessagesBundle_zh_TW.properties index a739e07..65ff4da 100644 --- a/src/main/resources/MessagesBundle_zh_TW.properties +++ b/src/main/resources/MessagesBundle_zh_TW.properties @@ -1,11 +1,11 @@ Label1=\u5c07\u8cc7\u6599\u593e\u6216\u6a94\u6848\u62d6\u66f3\u81f3\u7070\u8272\u5340\u57df\u4ee5\u53d6\u5f97\u8def\u5f91\uff0c\u591a\u500b\u5f8c\u7db4\u540d\u53ef\u7528\u0026\u5206\u9694 Label2=\u8cc7\u6599\u593e\u0020\u002f\u0020\u6a94\u6848\uff1a Label3=\u5f8c\u7db4\u540d\uff1a -Label4=\u5b57\u5143\u96c6\uff1a +charset=\u5b57\u5143\u96c6\uff1a Label5=\u2192 Label6=\u547d\u4e2d\u7684\u6a94\u6848\uff1a Label7=\u6a94\u6848\u6578\u76ee\uff1a -Button1=\u91cd\u7f6e +reset=\u91cd\u7f6e Button2=\u67e5\u627e\u6a94\u6848 Button3=\u958b\u59cb\u8f49\u63db Button4=\u95dc\u65bc @@ -17,9 +17,30 @@ error2_headerText=\u76ee\u524d\u6c92\u6709\u547d\u4e2d\u7684\u6a94\u6848 error2_contentText=\u8acb\u91cd\u8a66 error3_headerText=\u57f7\u884c\u5931\u6557 error3_contentText=\u8acb\u91cd\u8a66 +error4_headerText=\u6642\u9593\u70ba\u7a7a +error4_contentText=\u8acb\u586b\u5beb\u6642\u9593\u6216\u6642\u9593\u6233 success=\u57f7\u884c\u6210\u529f success1_headerText=\u57f7\u884c\u6210\u529f success1_contentText=\uff0c\u6a94\u6848\u6578\u76ee\uff1a -MagicEncoding=\u795e\u5947\u7de8\u78bc\u0020\u0033\u002e\u0030\u002e\u0030\u000d\u004d\u0061\u0067\u0069\u0063\u0045\u006e\u0063\u006f\u0064\u0069\u006e\u0067\u0020\u0033\u002e\u0030\u002e\u0030 +MagicEncoding=\u795e\u5947\u7de8\u78bc\u0020\u0034\u002e\u0030\u002e\u0030\u000a\u004d\u0061\u0067\u0069\u0063\u0045\u006e\u0063\u006f\u0064\u0069\u006e\u0067\u0020\u0034\u002e\u0030\u002e\u0030 features=\u65b0\u7279\u6027\uff1a -features_content=\u0031\u002e\u0020\u81ea\u52d5\u8fa8\u8b58\u7de8\u78bc\u3002\u000d\u0032\u002e\u0020\u55ae\u4e00\u6a94\u6848\u8f49\u63db\u3002\u000d\u0033\u002e\u0020\u652f\u63f4\u591a\u8a9e\u8a00\u3002\u000d\u0020\u0020\u0020\u0020\u002d\u0020\u4e2d\u6587\uff08\u7c21\u9ad4\u0020\u002f\u0020\u7e41\u9ad4\uff09\u000d\u0020\u0020\u0020\u0020\u002d\u0020\u82f1\u6587 \ No newline at end of file +features_content=\u0031\u002e\u0020\u5b57\u5143\u6587\u5b57\u7684\u0020\u0055\u006e\u0069\u0063\u006f\u0064\u0065\u0020\u7de8\u89e3\u78bc\u3002\u000a\u0032\u002e\u0020\u5b57\u5143\u6587\u5b57\u7684\u0020\u0055\u0052\u004c\u0020\u7de8\u89e3\u78bc\u3002\u000a\u0033\u002e\u0020\u0055\u006e\u0069\u0078\u0020\u6642\u9593\u6233\u3002\u000a\u0009\u002d\u0020\u652f\u63f4\u6642\u9593\u6233\u8207\u6642\u9593\u76f8\u4e92\u8f49\u63db\u000a\u0009\u002d\u0020\u652f\u63f4\u6642\u9593\u5feb\u901f\u64cd\u4f5c +tab1=\u5b57\u5143\u6a94\u6848 +tab2=\u5b57\u5143\u6587\u5b57 +tab3=Unix\u6642\u9593\u6233 +text_content=\u6587\u5b57\u5167\u5bb9 +timeLabel1=\u73fe\u5728\uff08\u79d2\uff09\uff1a +timeLabel2=\u73fe\u5728\uff08\u6beb\u79d2\uff09\uff1a +timeLabel3=\u6642\u9593\u6233\uff1a +year=\u5e74 +month=\u6708 +day=\u65e5 +hour=\u6642 +minute=\u5206 +second=\u79d2 +refresh=\u91cd\u65b0\u6574\u7406 +operate=\u64cd\u4f5c +shortcut_operations=\u5feb\u901f\u64cd\u4f5c +millisecond=\u6beb\u79d2 +move_forward=\u5411\u524d +move_backward=\u5411\u5f8c diff --git a/src/main/resources/com/zzhow/magicencoding/ui/about-view.fxml b/src/main/resources/com/zzhow/magicencoding/ui/about-view.fxml index dca996e..9573712 100644 --- a/src/main/resources/com/zzhow/magicencoding/ui/about-view.fxml +++ b/src/main/resources/com/zzhow/magicencoding/ui/about-view.fxml @@ -6,32 +6,35 @@ - + - + - diff --git a/src/main/resources/com/zzhow/magicencoding/ui/main-view.fxml b/src/main/resources/com/zzhow/magicencoding/ui/main-view.fxml index c38b074..6f9f8e2 100644 --- a/src/main/resources/com/zzhow/magicencoding/ui/main-view.fxml +++ b/src/main/resources/com/zzhow/magicencoding/ui/main-view.fxml @@ -6,40 +6,191 @@ + + + + - + - + - + + + + + + + + +