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 Dec 26, 2022
1 parent 5538db5 commit d0844f9
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 13 deletions.
53 changes: 40 additions & 13 deletions src/main/java/en/Function/Collation.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ static void readAppointedLineNumber(File sourceFile, int lineNumber)
LineNumberReader reader = new LineNumberReader(in);
String s = "";
if (lineNumber <= 0 || lineNumber > getTotalLines(sourceFile)) {
JOptionPane.showMessageDialog (null, "Please select a desktop path", "An error has occurred", JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog (null, "请选择桌面路径", "出现了一个错误", JOptionPane.ERROR_MESSAGE);
}
int lines = 0;
while (s != null) {
Expand Down Expand Up @@ -53,17 +53,17 @@ public void run() {
throw new RuntimeException(e);
}
if (data.equals("false")) {
lineNumber = 1;
lineNumber = 1;
try {
readAppointedLineNumber(sourceFile, lineNumber);
} catch (IOException e) {
throw new RuntimeException(e);
}
File word = new File(data + "\\word");
File txt = new File(data + "\\txt");
File pdf = new File(data + "\\pdf");
File powerpoint = new File(data + "\\powerpoint");
File excel = new File(data + "\\excel");
File word = new File(data + "\\word文件");
File txt = new File(data + "\\txt文件");
File pdf = new File(data + "\\pdf文件");
File powerpoint = new File(data + "\\powerpoint文件");
File excel = new File(data + "\\excel文件");
if (!pdf.exists()) {//如果文件夹不存在
pdf.mkdir();//创建文件夹
}
Expand Down Expand Up @@ -93,13 +93,21 @@ public void run() {
String stxt = ".txt";
String spdf = ".pdf";
//调用查找XXX.后缀结尾的所有文件
name = "word";
findEndsWith(file, sword);
name = "powerpoint";
findEndsWith(file, sppt);
name = "powerpoint";
findEndsWith(file, ssppt);
name = "excel";
findEndsWith(file, sexcel);
name = "excel";
findEndsWith(file, ssexcel);
name = "word";
findEndsWith(file, ssword);
name = "txt";
findEndsWith(file, stxt);
name = "pdf";
findEndsWith(file, spdf);
}else{
lineNumber = 1;
Expand Down Expand Up @@ -128,12 +136,12 @@ public void run() {
name1 = line.substring(0,a);
result = line.substring(a+1);

File path = new File(data+"\\"+result);
if(!path.exists()){
path.mkdir();
}
findEndsWith(new File(data),"."+name1);
File path = new File(data+"\\"+result);
if(!path.exists()){
path.mkdir();
}
findEndsWith(new File(data),"."+name1);
}

try {
br.close();
Expand All @@ -159,9 +167,28 @@ public void findEndsWith(File file, String sword) {
//是文件,判断是否是以.后缀名结尾
if(i.getPath().endsWith(sword)) {
File doc;
int lineNumber = 3;
File sourceFile = new File("data/collation/collation.data");
try {
readAppointedLineNumber(sourceFile, lineNumber);
} catch (IOException e) {
throw new RuntimeException(e);
}
if (data.equals("false")) {
doc = new File(data + "\\" + name + "\\" + i.getName());
lineNumber = 1;
try {
readAppointedLineNumber(sourceFile, lineNumber);
} catch (IOException e) {
throw new RuntimeException(e);
}
doc = new File(data + "\\" + name + "文件\\" + i.getName());
}else{
lineNumber = 1;
try {
readAppointedLineNumber(sourceFile, lineNumber);
} catch (IOException e) {
throw new RuntimeException(e);
}
doc = new File(data + "\\" + result + "\\" + i.getName());
}
File docp = new File(i.getPath());
Expand Down
Binary file modified target/classes/cn/Function/Collation.class
Binary file not shown.

0 comments on commit d0844f9

Please sign in to comment.