Skip to content

Commit 5146b44

Browse files
committed
hotfix2
1 parent 77500c1 commit 5146b44

1 file changed

Lines changed: 17 additions & 16 deletions

File tree

src/Uploader/Program.cs

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -76,31 +76,32 @@ static int Main(string host, string name, string password)
7676
md5List.ToList()
7777
.ForEach(_ =>
7878
{
79-
scpClient.Upload(_.OpenRead(), $"/var/www/html/files/{_.Name}");
80-
Log.Information("向远程服务器写入文件:{0}", $"/var/www/html/files/{_.Name}");
79+
var fileName = CapitalizeGroup(_.Name); // md5文件名,应当已修正
80+
scpClient.Upload(_.OpenRead(), $"/var/www/html/files/{fileName}");
81+
Log.Information("向远程服务器写入文件:{0}", $"/var/www/html/files/{fileName}");
8182
});
8283

8384
Log.Information("资源包传递完毕");
8485
return 0;
8586
}
8687

87-
public static string RegulateFileName(this string fileName)
88-
{
89-
// 历史遗留问题:全部单词都要大小写
90-
return CapitalizeGroup(fileName.Replace("Package", "Modpack") // 历史遗留问题:文件名
91-
.Replace('.', '-') // 历史遗留问题:版本号需要输杠
92-
.Replace("-1-12-2", "") // 历史遗留问题:1.12.2文件没有版本号
93-
.Split('-'));
88+
public static string RegulateFileName(this string fileName) =>
89+
90+
CapitalizeGroup( // 历史遗留问题:全部单词都要大小写
91+
fileName.Replace("Package", "Modpack") // 历史遗留问题:文件名
92+
.Replace('.', '-') // 历史遗留问题:版本号需要输杠
93+
.Replace("-1-12-2", "") // 历史遗留问题:1.12.2文件没有版本号
94+
);
9495

95-
// 将一组字符串的各项大小写,用'-'连接
96-
string CapitalizeGroup(string[] texts) => string.Join('-', texts.Select(_ => Capitalize(_)));
96+
// 将一组字符串的各项大小写,用'-'连接
97+
static string CapitalizeGroup(string text) => string.Join('-',
98+
text.Split('-')
99+
.Select(_ => Capitalize(_)));
97100

98101
// 将一段文本的首字母大写,其余不动
99-
string Capitalize(string text) => string.Join("",
100-
text[0..0].ToUpper(),
101-
text[1..]);
102-
}
103-
102+
static string Capitalize(string text) => string.Join("",
103+
text[0..0].ToUpper(),
104+
text[1..]);
104105

105106
/// <summary>
106107
/// 计算给定流中全体内容的MD5值。

0 commit comments

Comments
 (0)