Ejemplo n.º 1
0
 public static IEnumerable <string> GenerateFileNames(string directory, string primaryFileName, string extension)
 {
     Verify.IsNeitherNullNorEmpty(directory, "directory");
     Verify.IsNeitherNullNorEmpty(primaryFileName, "primaryFileName");
     primaryFileName = Utility.MakeValidFileName(primaryFileName);
     for (int i = 0; i <= 50; i++)
     {
         if (i == 0)
         {
             yield return(string.Concat(Path.Combine(directory, primaryFileName), extension));
         }
         else if (40 < i)
         {
             object[] objArray = new object[] { Path.Combine(directory, primaryFileName), " (", Utility._randomNumberGenerator.Next(41, 9999), ")", extension };
             yield return(string.Concat(objArray));
         }
         else
         {
             string[] strArrays = new string[] { Path.Combine(directory, primaryFileName), " (", i.ToString((IFormatProvider)null), ")", extension };
             yield return(string.Concat(strArrays));
         }
     }
 }