// ----------------------------------------------------------------------------------------
        /// <!-- CreateString -->
        /// <summary>
        ///      Creates a string to meet a particular set of restrictions
        /// </summary>
        /// <param name="cmd"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        protected override string CreateString(NodeCreationCommand cmd, string name)
        {
            string str = "";

            if (Regex.IsMatch(name, "amount", RegexOptions.IgnoreCase))
            {
                Pause();
            }


            // --------------------------------------------------------------------------
            //  Use the restrictions (new <--> now)
            // --------------------------------------------------------------------------
            RandomSource rs = RandomSource.New();
            Random       r  = rs.Random;

            if (cmd.Enumerations != null && cmd.Enumerations.Count > 0)
            {
                int e = r.Next(cmd.Enumerations.Count);
                str = cmd.Enumerations[e];
            }
            else
            {
                switch (cmd.MaxLength)
                {
                case -1:       // encapsulate
                    if (string.IsNullOrEmpty(cmd.RegexPattern))
                    {
                        bool found = false;       // encapsulate
                        if (!found && IsNumericField(name))
                        {
                            found = true;  str = new RegexGenerator("[0-9]").CreateString(r, rs.Skew(1, 49), cmd.WhiteSpace);
                        }
                        if (!found && IsDateTime(name))
                        {
                            found = true;  str = CreateDateTime(name);
                        }
                        if (!found)
                        {
                            str = CreatePrettyLabel(name);                // encapsulate
                        }
                    }
                    else
                    {
                        bool found = false;
                        if (IsNumericField(name))       // encapsulate
                        {
                            str   = new RegexGenerator(cmd.RegexPattern).CreateString(r, rs.Skew(7, 50), cmd.WhiteSpace);
                            found = true;
                        }
                        if (IsDigitField(name))       // encapsulate
                        {
                            str   = new RegexGenerator(cmd.RegexPattern).CreateString(r, 1, cmd.WhiteSpace);
                            found = true;
                        }
                        if (!found)
                        {
                            str = new RegexGenerator(cmd.RegexPattern).CreateString(r, cmd.WhiteSpace);
                        }
                    }
                    break;

                case 0: str = ""; break;

                default:
                    if (!string.IsNullOrEmpty(cmd.RegexPattern))
                    {
                        // ----------------------------------------------------------
                        //  convert a Regex pattern into a random string that it will match
                        // ----------------------------------------------------------
                        RegexGenerator genRegex = new RegexGenerator(cmd.RegexPattern);
                        str = genRegex.CreateString(r, cmd.WhiteSpace);
                        for (int i = 0; str.Length > cmd.MaxLength && i < 10; i++)
                        {
                            str = genRegex.CreateString(r, cmd.WhiteSpace);
                        }
                    }
                    else       // encapsulate
                    {
                        str = DbLabels.CreatePrettyLabel(r.Next(1, cmd.MaxLength + 1), LabelType.any);
                    }
                    break;
                }
            }

            return(str);
        }