Пример #1
0
        protected static List <DefineSymbol> FindDefineSymbols(string regex)
        {
            // first search for symbols that match the given expressions and
            // are on lines that have #*, then filter out the #*
            string path = Application.dataPath;
            string arg  = string.Format("-Roh --include=\"*.cs\" \"\\#.*[[:<:]]{0}[[:>:]]\" .", regex);

            string[] args = { arg };
            string   error;
            string   output = RunCommand("grep", path, out error, args);

            string[] matches = output.Split(new char[] { '\n' }, System.StringSplitOptions.RemoveEmptyEntries).
                               OrderBy(a => a).
                               Distinct().
                               ToArray();

            arg = string.Format("-ohw \"{0}\"", regex);
            string filteredOutput = RunCommand("grep", path, matches, out error, new string[] { arg });

            List <string> symbolNames = filteredOutput.Split(new char[] { '\n' }, System.StringSplitOptions.RemoveEmptyEntries).
                                        OrderBy(a => a).
                                        Distinct().
                                        ToList();

            List <DefineSymbol> symbols = new List <DefineSymbol>();

            foreach (var symbolName in symbolNames)
            {
                bool         isDefined = DebugEditorUtils.IsSymbolDefined(symbolName);
                DefineSymbol symbol    = new DefineSymbol(symbolName, isDefined);
                symbols.Add(symbol);
            }

            return(symbols);
        }
Пример #2
0
        override protected void FindDefineSymbols()
        {
            base.FindDefineSymbols();

            const string baseName = "SAGO_DEBUG";

            if (this.DefineSymbols.FirstOrDefault(ds => ds.Name == baseName) == null)
            {
                bool         isDefined = DebugEditorUtils.IsSymbolDefined(baseName);
                DefineSymbol symbol    = new DefineSymbol(baseName, isDefined);
                this.DefineSymbols.Insert(0, symbol);
            }
        }