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

Commit 324a545

Browse files
committed
修复windows\mac\linux下的换行符不同导致赛文加载失败的问题.
1 parent f846511 commit 324a545

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
一个跟打器,现在是刚刚可用的状态。
1+
2+
### 说明
3+
一个跟打器,现在是刚刚可用的状态。名字也还没取。。
24

35
演示:
46
![跟打演示](跟打演示.gif)
7+
8+
9+
### 项目结构
10+
不知道怎么描述,反正想到啥就说啥了。
11+

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ public class RootController {
1919

2020
private final ScoresController scoresController;
2121

22-
private final ScoreUpdater scoreUpdator;
22+
private final ScoreUpdater scoreUpdater;
2323

2424
@Autowired
25-
public RootController(TextController textController, ScoresController scoresController, ScoreUpdater scoreUpdator) {
25+
public RootController(TextController textController, ScoresController scoresController, ScoreUpdater scoreUpdater) {
2626
this.textController = textController;
2727
this.scoresController = scoresController;
28-
this.scoreUpdator = scoreUpdator;
28+
this.scoreUpdater = scoreUpdater;
2929
}
3030

3131
/**
@@ -37,7 +37,7 @@ public RootController(TextController textController, ScoresController scoresCont
3737
public void setQQTextFromCupboard(ActionEvent actionEvent) {
3838
// 1. 保存上一次的成绩,并初始化成绩
3939
scoresController.updateScores();
40-
scoreUpdator.reInit();
40+
scoreUpdater.reInit();
4141

4242

4343
// 2. 从剪切版获取文章
@@ -54,9 +54,9 @@ public void setQQTextFromCupboard(ActionEvent actionEvent) {
5454
Pattern pattern =
5555
Pattern.compile(".+" // 这个是 ”xxx群xxx赛文“ 之类的东西
5656
+ "第\\d+期-" // 第 xxx 期
57-
+ ".+制作\\n" // xx制作
57+
+ ".+制作(?:\\r\\n|\\n|\\r)" // xx制作
5858
+ "([\\s\\S]+)" // 赛文内容
59-
+ "\\n-{3,10}第(\\d+)段" // -----第xxx段
59+
+ "(?:\\r\\n|\\n|\\r)-{3,10}第(\\d+)段" // -----第xxx段
6060
+ "[\\s\\S]*" // 本文由xxx组成
6161
);
6262
Matcher matcher = pattern.matcher(text);
@@ -65,7 +65,7 @@ public void setQQTextFromCupboard(ActionEvent actionEvent) {
6565
// 如果匹配上了
6666

6767
// 4. 设置段号
68-
scoreUpdator.setIdOfArticle(Integer.parseInt(matcher.group(2)));
68+
scoreUpdater.setIdOfArticle(Integer.parseInt(matcher.group(2)));
6969
// 5. 设置赛文内容
7070
text = matcher.group(1);
7171

0 commit comments

Comments
 (0)