public bool Search(string scriptName, int line, int column, out string sourceFile, out Tuple <int, int> preConsolidationPosition)
        {
            this.AssureSymbolsAreLoaded();
            preConsolidationPosition = null;
            sourceFile = null;
            ConsolidationSymbolsMap.ConsolidationSymbol item = default(ConsolidationSymbolsMap.ConsolidationSymbol);
            item.ScriptEndLine     = line;
            item.ScriptStartLine   = line;
            item.ScriptEndColumn   = column;
            item.ScriptStartColumn = column;
            List <ConsolidationSymbolsMap.ConsolidationSymbol> list;

            if (!this.symbolMaps.TryGetValue(scriptName, out list))
            {
                return(false);
            }
            List <ConsolidationSymbolsMap.ConsolidationSymbol> list2 = this.symbolMaps[scriptName];
            int num = list2.BinarySearch(item, ConsolidationSymbolsMap.ConsolidationSymbolComparer.Instance);

            if (num < 0)
            {
                return(false);
            }
            ConsolidationSymbolsMap.ConsolidationSymbol consolidationSymbol = list2[num];
            int num2 = line - consolidationSymbol.ScriptStartLine;
            int num3 = column - consolidationSymbol.ScriptStartColumn;

            preConsolidationPosition = new Tuple <int, int>(consolidationSymbol.SourceStartLine + num2, consolidationSymbol.SourceStartColumn + num3);
            sourceFile = this.sourceFileIds[consolidationSymbol.SourceFileId];
            return(true);
        }
        private void UnsafeAssureSymbolsAreLoaded()
        {
            if (this.symbolsLoaded)
            {
                return;
            }
            Stopwatch stopwatch = Stopwatch.StartNew();

            foreach (string path in ConsolidationSymbolsMap.ConsolidationMapFileNames)
            {
                string text = Path.Combine(this.symbolsMapFolder, path);
                using (TextReader textReader = new StreamReader(text, Encoding.UTF8))
                {
                    Dictionary <string, int> dictionary = new Dictionary <string, int>(40, StringComparer.InvariantCultureIgnoreCase);
                    string text2;
                    while ((text2 = textReader.ReadLine()) != null)
                    {
                        if (!string.IsNullOrEmpty(text2))
                        {
                            if (text2.StartsWith("#"))
                            {
                                string[] array = text2.Split(new char[]
                                {
                                    ' ',
                                    ','
                                });
                                string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(array[1]);
                                if (this.VerifyChecksum(fileNameWithoutExtension, array[2]))
                                {
                                    this.symbolMaps.Add(fileNameWithoutExtension, new List <ConsolidationSymbolsMap.ConsolidationSymbol>(1024));
                                }
                                else
                                {
                                    this.scriptsOutOfSync.Add(fileNameWithoutExtension);
                                }
                            }
                            else
                            {
                                string[] array2 = text2.Split(new char[]
                                {
                                    ','
                                });
                                string fileNameWithoutExtension2 = Path.GetFileNameWithoutExtension(array2[0]);
                                int    count;
                                if (!dictionary.TryGetValue(fileNameWithoutExtension2, out count))
                                {
                                    count = this.sourceFileIds.Count;
                                    dictionary.Add(fileNameWithoutExtension2, count);
                                    this.sourceFileIds.Add(fileNameWithoutExtension2);
                                }
                                string fileNameWithoutExtension3 = Path.GetFileNameWithoutExtension(array2[5]);
                                if (this.symbolMaps.ContainsKey(fileNameWithoutExtension3))
                                {
                                    ConsolidationSymbolsMap.ConsolidationSymbol item = new ConsolidationSymbolsMap.ConsolidationSymbol
                                    {
                                        SourceStartLine   = int.Parse(array2[1]),
                                        SourceStartColumn = int.Parse(array2[2]),
                                        SourceEndLine     = int.Parse(array2[3]),
                                        SourceEndColumn   = int.Parse(array2[4]),
                                        ScriptStartLine   = int.Parse(array2[6]),
                                        ScriptStartColumn = int.Parse(array2[7]),
                                        ScriptEndLine     = int.Parse(array2[8]),
                                        ScriptEndColumn   = int.Parse(array2[9]),
                                        SourceFileId      = count
                                    };
                                    this.symbolMaps[fileNameWithoutExtension3].Add(item);
                                }
                            }
                        }
                    }
                }
                OwaServerLogger.AppendToLog(SymbolMapLoadLogEvent.CreateForSuccess(text, stopwatch.Elapsed));
            }
            foreach (List <ConsolidationSymbolsMap.ConsolidationSymbol> list in this.symbolMaps.Values)
            {
                list.TrimExcess();
            }
        }