Skip to content
This repository was archived by the owner on Mar 26, 2019. It is now read-only.

Commit 6d1e751

Browse files
committed
修复段号为0的问题
1 parent 5f2effd commit 6d1e751

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/main/java/me/ryan/controller/RootController.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,13 @@ public RootController(TextController textController, ScoresController scoresCont
3434
*
3535
* @param actionEvent xx
3636
*/
37-
public void setTextFromCupboard(ActionEvent actionEvent) {
38-
// 1. 从剪切版获取文章
37+
public void setQQTextFromCupboard(ActionEvent actionEvent) {
38+
// 1. 保存上一次的成绩,并初始化成绩
39+
scoresController.updateScores();
40+
scoreUpdator.reInit();
41+
42+
43+
// 2. 从剪切版获取文章
3944
Clipboard clipboard = Clipboard.getSystemClipboard();
4045
String text = clipboard.getString();
4146

@@ -44,7 +49,7 @@ public void setTextFromCupboard(ActionEvent actionEvent) {
4449
return;
4550
}
4651

47-
// 2. 分析文章
52+
// 3. 分析文章
4853
// 正则匹配
4954
Pattern pattern =
5055
Pattern.compile(".+" // 这个是 ”xxx群xxx赛文“ 之类的东西
@@ -59,21 +64,16 @@ public void setTextFromCupboard(ActionEvent actionEvent) {
5964
if (matcher.matches()) {
6065
// 如果匹配上了
6166

62-
// 3. 设置段号
67+
// 4. 设置段号
6368
scoreUpdator.setIdOfArticle(Integer.parseInt(matcher.group(2)));
64-
// 设置赛文内容
69+
// 5. 设置赛文内容
6570
text = matcher.group(1);
6671

6772
} else {
6873
logger.error("赛文格式不匹配,已加载全文");
6974
}
7075

71-
// 4. 保存上一次的成绩,并初始化成绩
72-
scoresController.updateScores();
73-
scoreUpdator.reInit();
74-
75-
76-
// 5. 显示文章
76+
// 6. 显示文章
7777
textController.setTextShow(text);
7878
}
7979

src/main/resources/view/RootView.fxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<items>
1717
<MenuItem mnemonicParsing="false" text="打开载文面板"/>
1818
<MenuItem mnemonicParsing="false" text="QQ剪切版载文"
19-
onAction="#setTextFromCupboard"/>
19+
onAction="#setQQTextFromCupboard"/>
2020
</items>
2121
</Menu>
2222
<Menu mnemonicParsing="false" text="模式">

0 commit comments

Comments
 (0)