Change the way invalid chars are checked to be less restrictive between platforms
This commit is contained in:
parent
db6fddc746
commit
196a7f5525
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user