1
0
mirror of synced 2024-11-27 17:00:50 +01:00

Change the way invalid chars are checked to be less restrictive between platforms

This commit is contained in:
KillzXGaming 2022-04-20 19:09:45 -04:00
parent db6fddc746
commit 196a7f5525

View File

@ -176,7 +176,12 @@ namespace Toolbox.Library.IO
//https://stackoverflow.com/questions/2230826/remove-invalid-disallowed-bad-characters-from-filename-or-directory-folder/12800424#12800424
public static string RemoveIllegaleFileNameCharacters(this string str)
{
return string.Join("_", str.Split(Path.GetInvalidFileNameChars()));
char[] _invalidFileNameChars = new char[41] { '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07',
'\x08', '\x09', '\x0A', '\x0B', '\x0C', '\x0D', '\x0E', '\x0F', '\x10', '\x11', '\x12',
'\x13', '\x14', '\x15', '\x16', '\x17', '\x18', '\x19', '\x1A', '\x1B', '\x1C', '\x1D',
'\x1E', '\x1F', '\x22', '\x3C', '\x3E', '\x7C', ':', '*', '?', '\\', '/' };
return string.Join("_", str.Split(_invalidFileNameChars));
}
public static string RemoveIllegaleFolderNameCharacters(this string str)