public static string GenerateRandomString(int length, GenerationStyle style) { string allowedChars = ""; if (FlagWrapper <GenerationStyle> .IsSet(style, GenerationStyle.Numeric)) { allowedChars += "0123456789"; } if (FlagWrapper <GenerationStyle> .IsSet(style, GenerationStyle.WackyChars)) { allowedChars += "!@#$%^&*()_+-=[]{};':<>?~,."; } if (FlagWrapper <GenerationStyle> .IsSet(style, GenerationStyle.Alpha)) { string alphas = ""; if (FlagWrapper <GenerationStyle> .IsSet(style, GenerationStyle.LowerCase)) { alphas += "abcdefghijklmnopqrstuvwxyz"; } if (FlagWrapper <GenerationStyle> .IsSet(style, GenerationStyle.UpperCase)) { alphas += "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; } if (alphas.Length == 0) { alphas = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; } allowedChars += alphas; } if (FlagWrapper <GenerationStyle> .IsSet(style, GenerationStyle.HexString)) { //Can have uppercase hexstring I suppose if (FlagWrapper <GenerationStyle> .IsSet(style, GenerationStyle.UpperCase)) { allowedChars = "0123456789ABCDEF"; } else { allowedChars = "0123456789abcdef"; } } return(StringHelper.GenerateRandomString(length, allowedChars)); }
public static bool IsUnSet(T enumVal, T checkForEnumVal) { return(!FlagWrapper <T> .IsSet(enumVal, checkForEnumVal)); }
public bool IsSet(T checkForEnumVal) { return(FlagWrapper <T> .IsSet(this._value, checkForEnumVal)); }