diff --git a/N_m3u8DL-CLI/Global.cs b/N_m3u8DL-CLI/Global.cs index a2daed8..f399549 100644 --- a/N_m3u8DL-CLI/Global.cs +++ b/N_m3u8DL-CLI/Global.cs @@ -30,8 +30,8 @@ class Global /*===============================================================================*/ - static string nowVer = "2.4.1"; - static string nowDate = "20191130"; + static string nowVer = "2.4.2"; + static string nowDate = "20191216"; public static void WriteInit() { Console.Clear(); @@ -77,6 +77,16 @@ public static void CheckUpdate() } } + public static string GetValidFileName(string input, string re = ".") + { + string title = input; + foreach (char invalidChar in Path.GetInvalidFileNameChars()) + { + title = title.Replace(invalidChar.ToString(), re); + } + return title; + } + // parseInt(s, radix) public static int GetNum(string str, int numBase) { diff --git a/N_m3u8DL-CLI/Program.cs b/N_m3u8DL-CLI/Program.cs index 9125735..d21bad0 100644 --- a/N_m3u8DL-CLI/Program.cs +++ b/N_m3u8DL-CLI/Program.cs @@ -203,6 +203,10 @@ namespace N_m3u8DL_CLI.NetCore /// - 增加disableIntegrityCheck选项 /// 2019年10月24日 /// - 捕获Ctrl+C退出,移动光标到正确位置 + /// 2019年11月30日 + /// - 完善芒果TV请求头的自动添加 + /// 2019年12月16日 + /// - 处理文件名特殊字符 /// /// @@ -392,7 +396,7 @@ static void Main(string[] args) } if (arguments.Has("--saveName")) { - fileName = arguments.Get("--saveName").Next; + fileName = Global.GetValidFileName(arguments.Get("--saveName").Next); } if (arguments.Has("--useKeyFile")) {