1
0
mirror of https://github.com/chylex/Backup-Essentials.git synced 2025-08-21 21:54:00 +02:00
Files
Backup-Essentials/BackupEssentials/Utils/WindowsFileUtils.cs
2015-05-04 19:02:00 +02:00

18 lines
541 B
C#

using System.Text;
namespace BackupEssentials.Utils{
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();
}
}
}