// Token: 0x060000A6 RID: 166 RVA: 0x000078BF File Offset: 0x00005ABF
 public void SetTextFilter(string text)
 {
     this._filterResult = SearchTextParser.Parse(text);
     this.UpdateFilter();
     base.Sort();
     base.DoChanged();
 }
Esempio n. 2
0
        // Token: 0x0600026A RID: 618 RVA: 0x0002CBE4 File Offset: 0x0002ADE4
        public static SearchTextParser.Result Parse(string text)
        {
            SearchTextParser.Result result = new SearchTextParser.Result();
            if (string.IsNullOrEmpty(text))
            {
                return(result);
            }
            List <SearchTextParser.ResultExpr> namesExpr = result.NamesExpr;
            List <string> types         = result.Types;
            List <string> labels        = result.Labels;
            StringBuilder stringBuilder = new StringBuilder(64);
            int           num           = 0;

            SearchTextParser.LogicalOperator logicalOperator = SearchTextParser.LogicalOperator.And;
            bool not   = false;
            bool exact = false;
            int  num2  = 0;

            while (num2 < text.Length && ++num <= 10000)
            {
                SearchTextParser.SkipWhiteSpace(text, ref num2);
                if (num2 + 1 < text.Length)
                {
                    if (text[num2] == '&' && text[num2 + 1] == '&')
                    {
                        num2           += 2;
                        logicalOperator = SearchTextParser.LogicalOperator.And;
                        exact           = false;
                        continue;
                    }
                    if (text[num2] == '|' && text[num2 + 1] == '|')
                    {
                        num2           += 2;
                        logicalOperator = SearchTextParser.LogicalOperator.Or;
                        exact           = false;
                        continue;
                    }
                    if (text[num2] == '=' && text[num2 + 1] == '=')
                    {
                        num2 += 2;
                        exact = true;
                        continue;
                    }
                    if (text[num2] == '!')
                    {
                        num2++;
                        not = true;
                        continue;
                    }
                    if (text[num2] == '"' || text[num2] == '„')
                    {
                        SearchTextParser.GetNextQuotedWord(text, ref num2, stringBuilder);
                        if (stringBuilder.Length > 0)
                        {
                            if (namesExpr.Count > 0 && logicalOperator == SearchTextParser.LogicalOperator.Or)
                            {
                                namesExpr[namesExpr.Count - 1].Op = SearchTextParser.LogicalOperator.Or;
                            }
                            namesExpr.Add(new SearchTextParser.ResultExpr
                            {
                                Op    = logicalOperator,
                                Text  = stringBuilder.ToString().Trim(),
                                Not   = not,
                                Exact = exact
                            });
                            stringBuilder.Length = 0;
                            not             = false;
                            logicalOperator = SearchTextParser.LogicalOperator.And;
                            continue;
                        }
                        continue;
                    }
                    else if (text[num2 + 1] == ':')
                    {
                        if (text[num2] == 't' || text[num2] == 'T')
                        {
                            num2 += 2;
                            SearchTextParser.SkipWhiteSpace(text, ref num2);
                            SearchTextParser.GetNextWord(text, ref num2, stringBuilder);
                            if (stringBuilder.Length > 0)
                            {
                                string text2 = stringBuilder.ToString().Trim();
                                if (string.Compare(text2, "prefab", StringComparison.OrdinalIgnoreCase) == 0)
                                {
                                    text2 = "GameObject";
                                }
                                types.Add(text2);
                                stringBuilder.Length = 0;
                                continue;
                            }
                        }
                        else if (text[num2] == 'l' || text[num2] == 'L')
                        {
                            num2 += 2;
                            SearchTextParser.SkipWhiteSpace(text, ref num2);
                            SearchTextParser.GetNextWord(text, ref num2, stringBuilder);
                            if (stringBuilder.Length > 0)
                            {
                                labels.Add(stringBuilder.ToString().Trim());
                                stringBuilder.Length = 0;
                                continue;
                            }
                        }
                    }
                }
                SearchTextParser.GetNextWord(text, ref num2, stringBuilder);
                if (stringBuilder.Length > 0)
                {
                    if (namesExpr.Count > 0 && logicalOperator == SearchTextParser.LogicalOperator.Or)
                    {
                        namesExpr[namesExpr.Count - 1].Op = SearchTextParser.LogicalOperator.Or;
                    }
                    namesExpr.Add(new SearchTextParser.ResultExpr
                    {
                        Op    = logicalOperator,
                        Text  = stringBuilder.ToString().Trim(),
                        Not   = not,
                        Exact = exact
                    });
                    stringBuilder.Length = 0;
                    not             = false;
                    logicalOperator = SearchTextParser.LogicalOperator.And;
                }
            }
            foreach (SearchTextParser.ResultExpr resultExpr in result.NamesExpr)
            {
                result.Names.Add(resultExpr.Text);
            }
            List <SearchTextParser.ResultExpr> list = new List <SearchTextParser.ResultExpr>();

            foreach (SearchTextParser.ResultExpr resultExpr2 in result.NamesExpr)
            {
                if (resultExpr2.Op == SearchTextParser.LogicalOperator.And)
                {
                    list.Add(resultExpr2);
                }
            }
            foreach (SearchTextParser.ResultExpr resultExpr3 in result.NamesExpr)
            {
                if (resultExpr3.Op == SearchTextParser.LogicalOperator.Or)
                {
                    list.Add(resultExpr3);
                }
            }
            result.NamesExpr = list;
            return(result);
        }