Exemplo n.º 1
0
 public static string RandomFastString(int length)
 {
     if (length == 1)
     {
         return("r");
     }
     return("r" + RandomText.Generate(length - 1));
 }
Exemplo n.º 2
0
        /// <summary>
        /// Generate a clean random string for things like image verification.
        /// Doesn't generates vowels and visually confusing numbers / characters to help keep things simple.
        /// </summary>
        /// <param name="length"></param>
        /// <returns>String</returns>
        public static string RandomEasyReadString(int length)
        {
            if (length == 1)
            {
                return("r");
            }
            const RegexOptions options = RegexOptions.IgnoreCase | RegexOptions.Compiled;
            string             result  = "r" + RandomText.Generate(length - 1);

            result = Regex.Replace(result, @"[AEIFL1]", "t", options);
            result = Regex.Replace(result, @"[OU0L6J]", "x", options);
            return(result);
        }
Exemplo n.º 3
0
 public static DirectoryInfo EnsureTempSubDirectory(this DirectoryInfo dir)
 {
     return(dir.EnsureSubDirectory(RandomText.RandomFastString(10)));
 }