private static bool ParseSubCharsCommand(int numForms, CommandSubCharsSet[] forms,
                                                 string commandString, ArrayList indices)
        {
            indices.Clear();
            int numUsedChars = 0;

            for (int i = 0; i < numForms; i++)
            {
                CommandSubCharsSet charsSet = forms[i];
                int currentIndex            = -1;
                int len = charsSet.Chars.Length;
                for (int j = 0; j < len; j++)
                {
                    char c        = charsSet.Chars[j];
                    int  newIndex = commandString.IndexOf(c);
                    if (newIndex >= 0)
                    {
                        if (currentIndex >= 0)
                        {
                            return(false);
                        }

                        if (commandString.IndexOf(c, newIndex + 1) >= 0)
                        {
                            return(false);
                        }

                        currentIndex = j;
                        numUsedChars++;
                    }
                }

                if (currentIndex == -1 && !charsSet.EmptyAllowed)
                {
                    return(false);
                }

                indices.Add(currentIndex);
            }

            return(numUsedChars == commandString.Length);
        }
Esempio n. 2
0
        private static bool ParseSubCharsCommand(int numForms, CommandSubCharsSet[] forms, string commandString,
                                                 ArrayList indices)
        {
            indices.Clear();
            int num = 0;

            for (int i = 0; i < numForms; i++)
            {
                CommandSubCharsSet commandSubCharsSet = forms[i];
                int num2   = -1;
                int length = commandSubCharsSet.Chars.Length;
                for (int j = 0; j < length; j++)
                {
                    char value = commandSubCharsSet.Chars[j];
                    int  num3  = commandString.IndexOf(value);
                    if (num3 >= 0)
                    {
                        if (num2 >= 0)
                        {
                            return(false);
                        }

                        if (commandString.IndexOf(value, num3 + 1) >= 0)
                        {
                            return(false);
                        }

                        num2 = j;
                        num++;
                    }
                }

                if (num2 == -1 && !commandSubCharsSet.EmptyAllowed)
                {
                    return(false);
                }

                indices.Add(num2);
            }

            return(num == commandString.Length);
        }
Esempio n. 3
0
        private static bool ParseSubCharsCommand(
            int numForms,
            CommandSubCharsSet[] forms,
            string commandString,
            ArrayList indices)
        {
            indices.Clear();
            int num1 = 0;

            for (int index1 = 0; index1 < numForms; ++index1)
            {
                CommandSubCharsSet form = forms[index1];
                int num2   = -1;
                int length = form.Chars.Length;
                for (int index2 = 0; index2 < length; ++index2)
                {
                    char ch   = form.Chars[index2];
                    int  num3 = commandString.IndexOf(ch);
                    if (num3 >= 0)
                    {
                        if (num2 >= 0 || commandString.IndexOf(ch, num3 + 1) >= 0)
                        {
                            return(false);
                        }
                        num2 = index2;
                        ++num1;
                    }
                }
                if (num2 == -1 && !form.EmptyAllowed)
                {
                    return(false);
                }
                indices.Add((object)num2);
            }
            return(num1 == commandString.Length);
        }
Esempio n. 4
0
        static bool ParseSubCharsCommand(int numForms, CommandSubCharsSet[] forms,
			string commandString, ArrayList indices)
        {
            indices.Clear();
            int numUsedChars = 0;
            for (int i = 0; i < numForms; i++)
            {
                CommandSubCharsSet charsSet = forms[i];
                int currentIndex = -1;
                int len = charsSet.Chars.Length;
                for (int j = 0; j < len; j++)
                {
                    char c = charsSet.Chars[j];
                    int newIndex = commandString.IndexOf(c);
                    if (newIndex >= 0)
                    {
                        if (currentIndex >= 0)
                            return false;
                        if (commandString.IndexOf(c, newIndex + 1) >= 0)
                            return false;
                        currentIndex = j;
                        numUsedChars++;
                    }
                }
                if (currentIndex == -1 && !charsSet.EmptyAllowed)
                    return false;
                indices.Add(currentIndex);
            }
            return (numUsedChars == commandString.Length);
        }