Added error handling for both IBN and providers

This commit is contained in:
LukePulverenti Luke Pulverenti luke pulverenti
2012-08-28 08:39:23 -04:00
parent 42a2835633
commit 97bc7ec378
3 changed files with 33 additions and 15 deletions

View File

@@ -121,6 +121,22 @@ namespace MediaBrowser.Controller.IO
[DllImport("kernel32")]
private static extern bool FindClose(IntPtr hFindFile);
private const char SpaceChar = ' ';
private static char[] InvalidFileNameChars = Path.GetInvalidFileNameChars();
/// <summary>
/// Takes a filename and removes invalid characters
/// </summary>
public static string GetValidFilename(string filename)
{
foreach (char c in InvalidFileNameChars)
{
filename = filename.Replace(c, SpaceChar);
}
return filename;
}
}
[StructLayout(LayoutKind.Sequential)]