Skip to content
This repository has been archived by the owner on Nov 19, 2023. It is now read-only.

Commit

Permalink
自动获取桌面路径,删除多国语言
Browse files Browse the repository at this point in the history
  • Loading branch information
chenpuhao committed Jun 6, 2023
1 parent 6fe4574 commit 223df87
Show file tree
Hide file tree
Showing 65 changed files with 18 additions and 3,955 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: CN.UI.Main

17 changes: 6 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@
![](https://img.shields.io/github/last-commit/chenpuhao/desktopaide)
![](https://img.shields.io/github/release-date/chenpuhao/desktopaide)

注意
==
从3.4.3版本起,DesktopAide更名为DesktopAide community且因高三的学业压力,目前只支持中文(其余语言安装包请耐心等待。。。。)

Starting from version 3.4.3, DesktopAide is renamed DesktopAide community. Due to the academic pressure of senior high school, only Chinese is currently supported (please wait patiently for installation packages of other languages...).

针对无网或弱网用户
==
请加入[QQ群](https://qm.qq.com/cgi-bin/qm/qr?k=f9bsc0Rw7_9i7cCWgKMcSNgrWohzmI5z&authKey=ScZtpf95RkpFWGgxsefyO2WzMPYNsBcxuoTWRfVaBl4A5HfbKNrruAw4K75ljQa7&noverify=0&personal_qrcode_source=0)获取下载安装包,也适用于出现Connection timed out错误的用户
Expand All @@ -41,10 +47,6 @@
==

[简体中文](src/main/java/CN/README-CN.md)
<br>
[English](src/main/java/EN/README-EN.md)
<br>
[русск(В настоящее время файлы README недоступны)](#)

注意
==
Expand All @@ -54,10 +56,3 @@ All content is machine translation, if there are errors, criticism and correctio
<br>
Весь контент является машинным переводом, если есть ошибки, критика и исправление приветствуются

翻译原则
==
该国访问主站的数目达到500
<br>
The number of visits to the main site in the country reached 500
<br>
Количество посещений главной площадки в стране достигло 500
2 changes: 1 addition & 1 deletion src/main/java/CN/Function/Update/CheckUpdate.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public String CheckUpdate() throws IOException {
downloadUsingStream("https://desktopaide.chenpuhao.me/update.txt",file.toString());
readAppointedLineNumber(file);
file.delete();
if(result.equals("3.4.1")){
if(result.equals("3.4.3")){
result = "true";
}
return result;
Expand Down
63 changes: 7 additions & 56 deletions src/main/java/CN/UI/FunctionPanel/CollationPanel.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package CN.UI.FunctionPanel;

import javax.swing.*;
import javax.swing.filechooser.FileSystemView;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
Expand Down Expand Up @@ -36,38 +37,17 @@ public CollationPanel() throws IOException {
//桌面路径
JPanel path = new JPanel();
path.setLayout(new GridLayout(4,1));
JLabel desktopPath = new JLabel("选择您的桌面路径:");
JLabel desktopPath = new JLabel();
FileSystemView view = FileSystemView.getFileSystemView();
File file = view.getHomeDirectory();
String getDesktopPath = file.getPath();
desktopPath.setText("您的桌面路径为"+getDesktopPath);
ButtonGroup pathButtonGroup = new ButtonGroup();
Map<String, String> map = System.getenv();
String userName = map.get("USERNAME");
JRadioButton desktop = new JRadioButton("C:\\Users\\" + userName + "\\Desktop");
JRadioButton oneDrive = new JRadioButton("C:\\Users\\" + userName + "\\OneDrive\\Desktop");
JRadioButton other = new JRadioButton("其他:");
pathButtonGroup.add(desktop);
pathButtonGroup.add(oneDrive);
pathButtonGroup.add(other);
JTextField otherTxt = new JTextField();
File folderPath = new File("C:\\Users\\" + userName + "\\.DesktopAide\\collation");
File filePath = new File(folderPath + "\\path.da");
if(filePath.exists()) {
readAppointedLineNumber(filePath);
if (data.equals("C:\\Users\\" + userName + "\\Desktop")) {
desktop.setSelected(true);
} else if (data.equals("C:\\Users\\" + userName + "\\OneDrive\\Desktop")) {
oneDrive.setSelected(true);
} else {
other.setSelected(true);
otherTxt.setText(data);
}
}
JPanel otherPanel = new JPanel();
otherPanel.setLayout(new BorderLayout());
otherPanel.add(other,BorderLayout.WEST);
otherPanel.add(otherTxt,BorderLayout.CENTER);
path.add(desktopPath);
path.add(desktop);
path.add(oneDrive);
path.add(otherPanel);
//配置后缀
JPanel methodPanel = new JPanel();
methodPanel.setLayout(new BorderLayout());
Expand All @@ -94,9 +74,6 @@ public CollationPanel() throws IOException {
methodSave.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (!desktop.isSelected() && !oneDrive.isSelected() && !other.isSelected()) {
JOptionPane.showMessageDialog(null,"选择一个桌面路径","错误",JOptionPane.ERROR_MESSAGE);
} else {
Map<String, String> map = System.getenv();
String userName = map.get("USERNAME");
File folderPath = new File("C:\\Users\\" + userName + "\\.DesktopAide\\collation");
Expand All @@ -111,39 +88,15 @@ public void mouseClicked(MouseEvent e) {
throw new RuntimeException(ex);
}
}
if (desktop.isSelected()) {
FileOutputStream fileOutputStream;
try {
fileOutputStream = new FileOutputStream(filePath);
fileOutputStream.write(desktop.getText().getBytes(StandardCharsets.UTF_8));
fileOutputStream.flush();
fileOutputStream.close();
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
if (oneDrive.isSelected()) {
FileOutputStream fileOutputStream;
try {
fileOutputStream = new FileOutputStream(filePath);
fileOutputStream.write(oneDrive.getText().getBytes(StandardCharsets.UTF_8));
fileOutputStream.write(getDesktopPath.getBytes(StandardCharsets.UTF_8));
fileOutputStream.flush();
fileOutputStream.close();
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
if (other.isSelected()) {
FileOutputStream fileOutputStream;
try {
fileOutputStream = new FileOutputStream(filePath);
fileOutputStream.write(otherTxt.getText().getBytes(StandardCharsets.UTF_8));
fileOutputStream.flush();
fileOutputStream.close();
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
filePath = new File(folderPath + "\\data.da");
if(!filePath.exists()){
try {
Expand All @@ -152,7 +105,6 @@ public void mouseClicked(MouseEvent e) {
throw new RuntimeException(ex);
}
}
FileOutputStream fileOutputStream;
try {
fileOutputStream = new FileOutputStream(filePath);
fileOutputStream.write(methodArea.getText().getBytes(StandardCharsets.UTF_8));
Expand All @@ -162,7 +114,6 @@ public void mouseClicked(MouseEvent e) {
throw new RuntimeException(ex);
}
JOptionPane.showMessageDialog(null,"保存成功!","成功!",JOptionPane.PLAIN_MESSAGE);
}
}
});
JButton methodClean = new JButton("清空");
Expand Down
86 changes: 0 additions & 86 deletions src/main/java/EN/Function/Collation/Collation.java

This file was deleted.

50 changes: 0 additions & 50 deletions src/main/java/EN/Function/Growth/Growth.java

This file was deleted.

23 changes: 0 additions & 23 deletions src/main/java/EN/Function/Puppet/Puppet.java

This file was deleted.

23 changes: 0 additions & 23 deletions src/main/java/EN/Function/Puppet/PuppetRun.java

This file was deleted.

Loading

0 comments on commit 223df87

Please sign in to comment.