Exemple #1
0
        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));
        }
Exemple #2
0
 public static bool IsUnSet(T enumVal, T checkForEnumVal)
 {
     return(!FlagWrapper <T> .IsSet(enumVal, checkForEnumVal));
 }
Exemple #3
0
 public void Set(T setEnumVal)
 {
     this._value = FlagWrapper <T> .Set(this._value, setEnumVal);
 }
Exemple #4
0
 public void UnSet(T unsetEnumVal)
 {
     this._value = FlagWrapper <T> .UnSet(this._value, unsetEnumVal);
 }
Exemple #5
0
 public bool IsUnSet(T checkForEnumVal)
 {
     return(FlagWrapper <T> .IsUnSet(this._value, checkForEnumVal));
 }