Exemplo n.º 1
0
        static public List <Feet> Afail2(string meter, string code)
        {
            string      mete = "", met1 = "", met2 = "", met3 = "", met4 = "";
            bool        flag1 = false, flag2 = false, flag3 = false, flag4 = false;
            List <Feet> ft = new List <Feet>();

            met1 = meter.Replace("/", "");
            met2 = met1.Replace("+", "") + "-";
            met3 = met1.Replace("+", "-") + "-";
            met4 = met1.Replace("+", "-");
            met1 = met1.Replace("+", "");

            #region original meter
            if (met1.Length == code.Length)
            {
                for (int j = 0; j < met1.Length; j++)
                {
                    char met = met1[j];
                    char cd  = code[j];
                    if (met == '-')
                    {
                        if (cd == '-' || cd == 'x')
                        {
                        }
                        else
                        {
                            flag1 = true;
                            break;
                        }
                    }
                    else if (met == '=')
                    {
                        if (cd == '=' || cd == 'x')
                        {
                        }
                        else
                        {
                            flag1 = true;
                            break;
                        }
                    }
                }
            }
            else
            {
                flag1 = true;
            }

            #endregion
            #region Variation1
            met1 = met2;
            if (met1.Length == code.Length)
            {
                for (int j = 0; j < met1.Length; j++)
                {
                    char met = met1[j];
                    char cd  = code[j];
                    if (met == '-')
                    {
                        if (cd == '-' || cd == 'x')
                        {
                        }
                        else
                        {
                            flag2 = true;
                            break;
                        }
                    }
                    else if (met == '=')
                    {
                        if (cd == '=' || cd == 'x')
                        {
                        }
                        else
                        {
                            flag2 = true;
                            break;
                        }
                    }
                }
            }
            else
            {
                flag2 = true;
            }

            #endregion
            #region Variation2
            met1 = met3;
            if (met1.Length == code.Length)
            {
                for (int j = 0; j < met1.Length; j++)
                {
                    char met = met1[j];
                    char cd  = code[j];
                    if (met == '-')
                    {
                        if (cd == '-' || cd == 'x')
                        {
                        }
                        else
                        {
                            flag3 = true;
                            break;
                        }
                    }
                    else if (met == '=')
                    {
                        if (cd == '=' || cd == 'x')
                        {
                        }
                        else
                        {
                            flag3 = true;
                            break;
                        }
                    }
                }
            }
            else
            {
                flag3 = true;
            }

            #endregion
            #region Variation3
            met1 = met4;
            if (met1.Length == code.Length)
            {
                for (int j = 0; j < met1.Length; j++)
                {
                    char met = met1[j];
                    char cd  = code[j];
                    if (met == '-')
                    {
                        if (cd == '-' || cd == 'x')
                        {
                        }
                        else
                        {
                            flag4 = true;
                            break;
                        }
                    }
                    else if (met == '=')
                    {
                        if (cd == '=' || cd == 'x')
                        {
                        }
                        else
                        {
                            flag4 = true;
                            break;
                        }
                    }
                }
            }
            else
            {
                flag4 = true;
            }

            #endregion

            if (!flag1)
            {
                mete = meter;
            }
            if (!flag2)
            {
                mete = meter + "-";
            }
            if (!flag3)
            {
                mete = meter.Replace("+", "-+") + "-";
            }
            if (!flag4)
            {
                mete = meter.Replace("+", "-+");
            }

            foreach (string s in mete.Split('+'))
            {
                foreach (string foot in s.Split('/'))
                {
                    for (int i = 0; i < feet.Count(); i++)
                    {
                        if (foot.Equals(feet[i]))
                        {
                            Feet temp = new Feet();
                            temp.foot = feetNames[i];
                            temp.code = feet[i];
                            ft.Add(temp);
                        }
                    }
                }
            }

            return(ft);
        }
Exemplo n.º 2
0
        static public List<Feet> Afail2(string meter, string code)
        {
            string mete = "", met1 = "", met2 = "", met3 = "", met4 = "";
            bool flag1 = false, flag2 = false, flag3 = false, flag4 = false;
            List<Feet> ft = new List<Feet>();

            met1 = meter.Replace("/", "");
            met2 = met1.Replace("+", "") + "-";
            met3 = met1.Replace("+", "-") + "-";
            met4 = met1.Replace("+", "-");
            met1 = met1.Replace("+", "");

            #region original meter
            if (met1.Length == code.Length)
            {
                for (int j = 0; j < met1.Length; j++)
                {
                    char met = met1[j];
                    char cd = code[j];
                    if (met == '-')
                    {
                        if (cd == '-' || cd == 'x')
                        {

                        }
                        else
                        {
                            flag1 = true;
                            break;
                        }
                    }
                    else if (met == '=')
                    {
                        if (cd == '=' || cd == 'x')
                        {

                        }
                        else
                        {
                            flag1 = true;
                            break;
                        }
                    }
                }
            }
            else
            {
                flag1 = true;
            }

            #endregion
            #region Variation1
            met1 = met2;
            if (met1.Length == code.Length)
            {
                for (int j = 0; j < met1.Length; j++)
                {
                    char met = met1[j];
                    char cd = code[j];
                    if (met == '-')
                    {
                        if (cd == '-' || cd == 'x')
                        {

                        }
                        else
                        {
                            flag2 = true;
                            break;
                        }
                    }
                    else if (met == '=')
                    {
                        if (cd == '=' || cd == 'x')
                        {

                        }
                        else
                        {
                            flag2 = true;
                            break;
                        }
                    }
                }
            }
            else
            {
                flag2 = true;
            }

            #endregion
            #region Variation2
            met1 = met3;
            if (met1.Length == code.Length)
            {
                for (int j = 0; j < met1.Length; j++)
                {
                    char met = met1[j];
                    char cd = code[j];
                    if (met == '-')
                    {
                        if (cd == '-' || cd == 'x')
                        {

                        }
                        else
                        {
                            flag3 = true;
                            break;
                        }
                    }
                    else if (met == '=')
                    {
                        if (cd == '=' || cd == 'x')
                        {

                        }
                        else
                        {
                            flag3 = true;
                            break;
                        }
                    }
                }
            }
            else
            {
                flag3 = true;
            }

            #endregion
            #region Variation3
            met1 = met4;
            if (met1.Length == code.Length)
            {
                for (int j = 0; j < met1.Length; j++)
                {
                    char met = met1[j];
                    char cd = code[j];
                    if (met == '-')
                    {
                        if (cd == '-' || cd == 'x')
                        {

                        }
                        else
                        {
                            flag4 = true;
                            break;
                        }
                    }
                    else if (met == '=')
                    {
                        if (cd == '=' || cd == 'x')
                        {

                        }
                        else
                        {
                            flag4 = true;
                            break;
                        }
                    }
                }
            }
            else
            {
                flag4 = true;
            }

            #endregion

            if (!flag1)
            {
                mete = meter;
            }
            if (!flag2)
            {
                mete = meter + "-";
            }
            if (!flag3)
            {
                mete = meter.Replace("+", "-+") + "-";
            }
            if (!flag4)
            {
                mete = meter.Replace("+", "-+");
            }

            foreach (string s in mete.Split('+'))
            {
                foreach (string foot in s.Split('/'))
                {
                    for (int i = 0; i < feet.Count(); i++)
                    {
                        if (foot.Equals(feet[i]))
                        {
                            Feet temp = new Feet();
                            temp.foot = feetNames[i];
                            temp.code = feet[i];
                            ft.Add(temp);
                        }
                    }
                }
            }

            return ft;
        }