Exemplo n.º 1
0
 internal static void IsValidFileName(string s, string parameterName, string message)
 {
     Debug.Assert(!string.IsNullOrEmpty(parameterName));
     if (!FileInfoExt.IsValidFileName(s))
     {
         throw new ArgumentException(parameterName, message);
     }
 }
Exemplo n.º 2
0
 internal static void IsValidFileName(string s, string parameterName)
 {
     Debug.Assert(!string.IsNullOrEmpty(parameterName));
     if (!FileInfoExt.IsValidFileName(s))
     {
         var illegalCahrs = FileInfoExt.InvalidFileNameChars.Where(c => s.IndexOf(c) != -1).ToArray();
         var illegals     = string.Join(", ", illegalCahrs.Select(x => string.Format("'{0}'", x)));
         var message      = string.Format(@"{0} is not a valid filename. Contains: {{{1}}}", s, illegals);
         IsValidFileName(s, parameterName, message);
     }
 }