Ejemplo n.º 1
0
 public static string GenerateZalgo(string content, ZalgoIntensity intensity, IncludeChars includeChars)
 => new StringBuilder().Apply(sb => content.Where(c => !IsZalgoChar(c)).ForEach(c =>
Ejemplo n.º 2
0
    public static string generateString(string str, ZalgoIntensity intensity, bool up, bool mid, bool down)
    {
        string ret    = "";
        int    strLen = str.Length;

        char[] s = str.ToCharArray();
        m_zalgoUpLen   = (uint)Char.zalgoUp.Length;
        m_zalgoDownLen = (uint)Char.zalgoDown.Length;
        m_zalgoMidLen  = (uint)Char.zalgoMid.Length;

        for (int i = 0; i < strLen; i++)
        {
            if (isZalgoChar(s[i]))
            {
                continue;
            }

            uint numUp   = 0;
            uint numMid  = 0;
            uint numDown = 0;

            ret += s[i];

            if (s[i] == '\r' || s[i] == '\n')
            {
                continue;
            }
            switch (intensity)
            {
            case ZalgoIntensity.MINI:
                numUp   = randomNumber(8);
                numMid  = randomNumber(2);
                numDown = randomNumber(8);
                break;

            case ZalgoIntensity.NORMAL:
                numUp   = randomNumber(16) / 2 + 1;
                numMid  = randomNumber(6) / 2;
                numDown = randomNumber(16) / 2 + 1;
                break;

            case ZalgoIntensity.MAXI:
                numUp   = randomNumber(64) / 4 + 3;
                numMid  = randomNumber(16) / 4 + 1;
                numDown = randomNumber(64) / 4 + 3;
                break;
            }

            if (up)
            {
                for (int j = 0; j < numUp; j++)
                {
                    ret += getZalgoChar(Char.zalgoUp, m_zalgoUpLen);
                }
            }
            if (mid)
            {
                for (int j = 0; j < numMid; j++)
                {
                    ret += getZalgoChar(Char.zalgoMid, m_zalgoMidLen);
                }
            }
            if (down)
            {
                for (int j = 0; j < numDown; j++)
                {
                    ret += getZalgoChar(Char.zalgoDown, m_zalgoDownLen);
                }
            }
        }

        return(ret);
    }