Beispiel #1
0
    private bool Gate(string rawD)
    {
        string ra2 = rawD;

        try
        {
            string[] piu = (from g in ra2.Split('(', ')')
                            where g.Trim() != ""
                            select g).ToArray();
            ra2 = piu.Aggregate(ra2, (string current, string t) => current.Replace(string.Format("({0})", t), Maths.Aor(t).ToString()));
        }
        catch
        {
        }
        ra2 = ra2.Replace(" ", "").Replace("&&", " && ").Replace("||", " || ");
        while (ra2.Contains(" "))
        {
            string[] tam = ra2.Split(Array.Empty <char>());
            string   chk = string.Format("{0} {1} {2}", tam[0], tam[1], tam[2]);
            ra2 = ra2.Replace(chk, Maths.Aor(chk).ToString()).Trim();
        }
        return(ra2 == "1");
    }