Beispiel #1
0
            public override string Convert(string source, EncodeType encode, bool check)
            {
                int    i, count;
                string result = "";
                string cod;

                count = source.Length;
                if (check)
                {
                    for (i = 0; i < count; i++)
                    {
                        if (encode.Check(source[i]))
                        {
                            cod     = encode.Encode.GetString(Encoding.Default.GetBytes(new char[] { source[i] }));
                            result += cod;
                        }
                        else
                        {
                            result += source[i];
                        }
                    }
                }
                else
                {
                    for (i = 0; i < count; i++)
                    {
                        cod     = encode.Encode.GetString(Encoding.Default.GetBytes(new char[] { source[i] }));
                        result += cod;
                    }
                }
                return(result);
            }
Beispiel #2
0
            public override string Convert(string source, EncodeType encode, bool check)
            {
                int    i, count;
                string result = "";
                string cod;
                var    ps = source.Split('"');

                count = ps.Length;
                if (check)
                {
                    for (i = 0; i < count - 1; i++)
                    {
                        if (encode.Check(ps[i]))
                        {
                            cod   = encode.Encode.GetString(Encoding.Default.GetBytes(ps[i]));
                            ps[i] = cod;
                        }
                        result += ps[i] + "\"";
                    }
                    if (encode.Check(ps[i]))
                    {
                        cod   = encode.Encode.GetString(Encoding.Default.GetBytes(ps[i]));
                        ps[i] = cod;
                    }
                    result += ps[i];
                }
                else
                {
                    for (i = 0; i < count - 1; i++)
                    {
                        cod     = encode.Encode.GetString(Encoding.Default.GetBytes(ps[i]));
                        ps[i]   = cod;
                        result += ps[i] + "\"";
                    }
                    cod     = encode.Encode.GetString(Encoding.Default.GetBytes(ps[i]));
                    ps[i]   = cod;
                    result += ps[i];
                }
                return(result);
            }
Beispiel #3
0
            public override string Convert(string source, EncodeType encode, bool check)
            {
                string result = "";

                if (check)
                {
                    if (encode.Check(source))
                    {
                        result = encode.Encode.GetString(Encoding.Default.GetBytes(source));
                    }
                    else
                    {
                        result = source;
                    }
                }
                else
                {
                    result = encode.Encode.GetString(Encoding.Default.GetBytes(source));
                }
                return(result);
            }