1
mirror of https://github.com/nilaoda/N_m3u8DL-CLI synced 2025-09-17 08:40:50 +02:00

Compare commits

..

1 Commits
2.4.2 ... 2.4.3

Author SHA1 Message Date
nilaoda
bc349b8977 文件名特殊字符处理 2019-12-16 22:16:54 +08:00
2 changed files with 17 additions and 3 deletions

View File

@@ -30,8 +30,8 @@ namespace N_m3u8DL_CLI
/*===============================================================================*/ /*===============================================================================*/
static string nowVer = "2.4.1"; static string nowVer = "2.4.2";
static string nowDate = "20191130"; static string nowDate = "20191216";
public static void WriteInit() public static void WriteInit()
{ {
Console.Clear(); Console.Clear();
@@ -77,6 +77,16 @@ namespace N_m3u8DL_CLI
} }
} }
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) // parseInt(s, radix)
public static int GetNum(string str, int numBase) public static int GetNum(string str, int numBase)
{ {

View File

@@ -203,6 +203,10 @@ namespace N_m3u8DL_CLI.NetCore
/// - 增加disableIntegrityCheck选项 /// - 增加disableIntegrityCheck选项
/// 2019年10月24日 /// 2019年10月24日
/// - 捕获Ctrl+C退出移动光标到正确位置 /// - 捕获Ctrl+C退出移动光标到正确位置
/// 2019年11月30日
/// - 完善芒果TV请求头的自动添加
/// 2019年12月16日
/// - 处理文件名特殊字符
/// </summary> /// </summary>
/// ///
@@ -392,7 +396,7 @@ namespace N_m3u8DL_CLI.NetCore
} }
if (arguments.Has("--saveName")) if (arguments.Has("--saveName"))
{ {
fileName = arguments.Get("--saveName").Next; fileName = Global.GetValidFileName(arguments.Get("--saveName").Next);
} }
if (arguments.Has("--useKeyFile")) if (arguments.Has("--useKeyFile"))
{ {