1
0
mirror of https://github.com/chylex/Backup-Essentials.git synced 2024-12-22 15:42:45 +01:00
Backup-Essentials/BackupEssentials/Utils/IO/WindowsFileUtils.cs

18 lines
544 B
C#

using System.Text;
namespace BackupEssentials.Utils.IO{
static class WindowsFileUtils{
private static readonly string InvalidChars = @"<>:/\|?*"+'"';
public static string ReplaceInvalidFileCharacters(string filename, char replacement){
StringBuilder build = new StringBuilder(filename);
for(int a = 0; a < build.Length; a++){
if (build[a] < 32 || InvalidChars.IndexOf(build[a]) != -1)build[a] = replacement;
}
return build.ToString();
}
}
}