Пример #1
0
    private string Stb(string wha)
    {
        if (wha.Equals("True", StringComparison.OrdinalIgnoreCase))
        {
            return("1");
        }
        if (wha.Equals("False", StringComparison.OrdinalIgnoreCase))
        {
            return("0");
        }
        string spliter;

        if (wha.Contains("=="))
        {
            spliter = "==";
            goto IL_013e;
        }
        if (wha.Contains("!="))
        {
            spliter = "!=";
            goto IL_013e;
        }
        if (wha.Contains("<"))
        {
            spliter = "<";
            goto IL_013e;
        }
        if (wha.Contains(">"))
        {
            spliter = ">";
            goto IL_013e;
        }
        if (wha.Contains("<="))
        {
            spliter = "<=";
            goto IL_013e;
        }
        if (wha.Contains(">="))
        {
            spliter = ">=";
            goto IL_013e;
        }
        if (wha.Contains("$contains$"))
        {
            spliter = "$contains$";
            goto IL_013e;
        }
        if (wha.Contains("$startswith$"))
        {
            spliter = "$startswith$";
            goto IL_013e;
        }
        if (wha.Contains("$endswith$"))
        {
            spliter = "$endswith$";
            goto IL_013e;
        }
        if (wha.Contains("$Contains$"))
        {
            spliter = "$Contains$";
            goto IL_013e;
        }
        if (wha.Contains("$StartsWith$"))
        {
            spliter = "$StartsWith$";
            goto IL_013e;
        }
        if (wha.Contains("$EndsWith$"))
        {
            spliter = "$EndsWith$";
            goto IL_013e;
        }
        return("0");

IL_013e:
        string what = wha.Replace(string.Format(" {0} ", spliter), string.Format("{0}", spliter));

        string[] kama = (from d in what.Trim().Split(new string[1]
        {
            spliter
        }, StringSplitOptions.RemoveEmptyEntries)
                         select new SystemCore(this.AV).Strad(d.Trim(), "+", false)).ToArray();
        if (spliter == "==")
        {
            if (kama[0].Equals(kama[1]))
            {
                return("1");
            }
            if (this.Dubexpress(kama[0].Trim()).Equals(this.Dubexpress(kama[1].Trim())))
            {
                return("1");
            }
            if (new SystemCore(this.AV).Strad(kama[0], "+", false).Equals(new SystemCore(this.AV).Strad(kama[1], "+", false)))
            {
                return("1");
            }
            if (this.Dubexpress(new SystemCore(this.AV).Numit(kama[0].Trim())) == this.Dubexpress(new SystemCore(this.AV).Numit(kama[1].Trim())))
            {
                return("1");
            }
            if (this.AV.ContainsKey(kama[0]) && this.AV.ContainsKey(kama[1]) && this.AV[kama[0]].Equals(this.AV[kama[1]]))
            {
                return("1");
            }
        }
        else if (spliter == "!=")
        {
            if (kama[0] != kama[1])
            {
                return("1");
            }
            if (this.Dubexpress(kama[0].Trim()) != this.Dubexpress(kama[1].Trim()))
            {
                return("1");
            }
            if (new SystemCore(this.AV).Strad(kama[0], "+", false) != new SystemCore(this.AV).Strad(kama[1], "+", false))
            {
                return("1");
            }
            if (this.Dubexpress(new SystemCore(this.AV).Numit(kama[0].Trim())) != this.Dubexpress(new SystemCore(this.AV).Numit(kama[1].Trim())))
            {
                return("1");
            }
            if (this.AV.ContainsKey(kama[0]) && this.AV.ContainsKey(kama[1]) && !this.AV[kama[0]].Equals(this.AV[kama[1]]))
            {
                return("1");
            }
        }
        else if (spliter == "<")
        {
            if (double.Parse(kama[0]) < double.Parse(kama[1]))
            {
                return("1");
            }
            if (double.Parse(this.Dubexpress(kama[0].Trim())) < double.Parse(this.Dubexpress(kama[1].Trim())))
            {
                return("1");
            }
            if (double.Parse(this.Dubexpress(new SystemCore(this.AV).Numit(kama[0].Trim()))) < double.Parse(this.Dubexpress(new SystemCore(this.AV).Numit(kama[1].Trim()))))
            {
                return("1");
            }
        }
        else if (spliter == ">")
        {
            if (double.Parse(kama[0]) > double.Parse(kama[1]))
            {
                return("1");
            }
            if (double.Parse(this.Dubexpress(kama[0].Trim())) > double.Parse(this.Dubexpress(kama[1].Trim())))
            {
                return("1");
            }
            if (double.Parse(this.Dubexpress(new SystemCore(this.AV).Numit(kama[0].Trim()))) > double.Parse(this.Dubexpress(new SystemCore(this.AV).Numit(kama[1].Trim()))))
            {
                return("1");
            }
        }
        else if (spliter == "<=")
        {
            if (double.Parse(kama[0]) <= double.Parse(kama[1]))
            {
                return("1");
            }
            if (double.Parse(this.Dubexpress(kama[0].Trim())) <= double.Parse(this.Dubexpress(kama[1].Trim())))
            {
                return("1");
            }
            if (double.Parse(this.Dubexpress(new SystemCore(this.AV).Numit(kama[0].Trim()))) <= double.Parse(this.Dubexpress(new SystemCore(this.AV).Numit(kama[1].Trim()))))
            {
                return("1");
            }
        }
        else if (spliter == ">=")
        {
            if (double.Parse(kama[0]) >= double.Parse(kama[1]))
            {
                return("1");
            }
            if (double.Parse(this.Dubexpress(kama[0].Trim())) >= double.Parse(this.Dubexpress(kama[1].Trim())))
            {
                return("1");
            }
            if (double.Parse(this.Dubexpress(new SystemCore(this.AV).Numit(kama[0].Trim()))) >= double.Parse(this.Dubexpress(new SystemCore(this.AV).Numit(kama[1].Trim()))))
            {
                return("1");
            }
        }
        else
        {
            if (spliter.Equals("$contains$", StringComparison.Ordinal) && kama[0].Contains(kama[1]))
            {
                return("1");
            }
            if (spliter.Equals("$startswith$", StringComparison.Ordinal) && kama[0].StartsWith(kama[1], StringComparison.Ordinal))
            {
                return("1");
            }
            if (spliter.Equals("$endswith$", StringComparison.Ordinal) && kama[0].EndsWith(kama[1], StringComparison.Ordinal))
            {
                return("1");
            }
        }
        try
        {
            string a2 = (!this.AV.ContainsKey(kama[0])) ? new SystemCore(this.AV).Strad(kama[0], "+", false) : (this.AV[kama[0]] as string);
            string b2 = (!this.AV.ContainsKey(kama[0])) ? new SystemCore(this.AV).Strad(kama[1], "+", false) : (this.AV[kama[1]] as string);
            if (a2 != null && spliter.Equals("$contains$", StringComparison.Ordinal))
            {
                string text  = a2;
                string text2 = b2;
                if (text2 == null)
                {
                    throw new InvalidOperationException();
                }
                if (text.Contains(text2))
                {
                    return("1");
                }
            }
            if (a2 != null && spliter.Equals("$startswith$", StringComparison.Ordinal))
            {
                string text3 = a2;
                string text4 = b2;
                if (text4 == null)
                {
                    throw new InvalidOperationException();
                }
                if (text3.StartsWith(text4, StringComparison.Ordinal))
                {
                    return("1");
                }
            }
            if (a2 != null && spliter.Equals("$endswith$", StringComparison.Ordinal))
            {
                string text5 = a2;
                string text6 = b2;
                if (text6 == null)
                {
                    throw new InvalidOperationException();
                }
                if (text5.EndsWith(text6, StringComparison.Ordinal))
                {
                    return("1");
                }
            }
        }
        catch (Exception)
        {
        }
        try
        {
            string a = new SystemCore(this.AV).Strad(this.AV[kama[0]] as string, "+", false);
            string b = new SystemCore(this.AV).Strad(this.AV[kama[1]] as string, "+", false);
            if (spliter.Equals("$contains$", StringComparison.Ordinal) && a.Contains(b))
            {
                return("1");
            }
            if (spliter.Equals("$startswith$", StringComparison.Ordinal) && a.StartsWith(b, StringComparison.Ordinal))
            {
                return("1");
            }
            if (spliter.Equals("$endswith$", StringComparison.Ordinal) && a.EndsWith(b, StringComparison.Ordinal))
            {
                return("1");
            }
        }
        catch (Exception)
        {
        }
        return("0");
    }