所有平台均使用Windows上的特殊字符过滤规则

This commit is contained in:
nilaoda 2022-10-16 19:01:53 +08:00
parent 2299241d9d
commit fb81212da5
1 changed files with 3 additions and 1 deletions

View File

@ -53,10 +53,12 @@ namespace N_m3u8DL_RE.Util
};
}
private static char[] InvalidChars = "34,60,62,124,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,58,42,63,92,47"
.Split(',').Select(s => (char)int.Parse(s)).ToArray();
public static string GetValidFileName(string input, string re = ".", bool filterSlash = false)
{
string title = input;
foreach (char invalidChar in Path.GetInvalidFileNameChars())
foreach (char invalidChar in InvalidChars)
{
title = title.Replace(invalidChar.ToString(), re);
}