using System.Text; using System.Text.RegularExpressions; /// /// Check if filename is valid on Win32 platforms (does not contain invalid characters) /// /// Name of the input file. /// /// true if input filename is valid otherwise, false. /// public bool IsFilenameValid(string inputFileName) { Match m = Regex.Match(inputFileName, @"[\\\/\:\*\?\" + Convert.ToChar(34) + @"\<\>\|]"); return !(m.Success); }