Esempio n. 1
0
        private void LoadSymbols()
        {
            this.bootSlabSymbolsMap = new ConsolidationSymbolsMap(this.symbolsFolderPath, this.OwaVersion);
            string[] files = Directory.GetFiles(this.symbolsFolderPath, "*_obfuscate.xml");
            ScriptSharpSourceMapLoader scriptSharpSourceMapLoader = new ScriptSharpSourceMapLoader(files);

            this.obfuscationSymbolsMap = scriptSharpSourceMapLoader.Load();
            List <string> list  = new List <string>();
            List <string> list2 = new List <string>();

            string[] files2 = Directory.GetFiles(this.symbolsFolderPath, "**_minify.xml");
            int      length = "*_minify.xml".Length;

            foreach (string text in files2)
            {
                string fileName   = Path.GetFileName(text);
                string scriptName = fileName.Substring(0, fileName.Length - length + 1);
                if (this.obfuscationSymbolsMap.HasSymbolsLoadedForScript(scriptName))
                {
                    list.Add(text);
                }
                else
                {
                    list2.Add(text);
                }
            }
            AjaxMinSourceMapLoader <AjaxMinSymbolForJavaScript>  ajaxMinSourceMapLoader  = new AjaxMinSourceMapLoader <AjaxMinSymbolForJavaScript>(list2, new AjaxMinSymbolParserForJavaScript());
            AjaxMinSourceMapLoader <AjaxMinSymbolForScriptSharp> ajaxMinSourceMapLoader2 = new AjaxMinSourceMapLoader <AjaxMinSymbolForScriptSharp>(list, new AjaxMinSymbolParserForScriptSharp());

            this.minificationSymbolsMapForJavaScript  = ajaxMinSourceMapLoader.Load();
            this.minificationSymbolsMapForScriptSharp = ajaxMinSourceMapLoader2.Load();
        }
        // Token: 0x0600243A RID: 9274 RVA: 0x00083058 File Offset: 0x00081258
        protected override void LoadSymbolsMapFromFile(string filePath, Dictionary <string, List <T> > symbolMaps, Dictionary <uint, string> sourceFileIdMap, ClientWatsonFunctionNamePool functionNamePool)
        {
            uint             count   = (uint)sourceFileIdMap.Count;
            string           text    = null;
            HashSet <string> hashSet = new HashSet <string>();
            Dictionary <string, Stack <int> > dictionary = new Dictionary <string, Stack <int> >();

            using (XmlReader xmlReader = XmlReader.Create(filePath))
            {
                while (xmlReader.Read())
                {
                    if (xmlReader.IsStartElement("s"))
                    {
                        T t;
                        if (this.symbolParser.TryParseSymbolData(xmlReader.ReadString(), functionNamePool, out t))
                        {
                            if (text == null)
                            {
                                throw new XmlException("Found a <s> tag outside of a <scriptFile> section.");
                            }
                            t.SourceFileId += count;
                            Stack <int> stack;
                            if (!dictionary.TryGetValue(text, out stack))
                            {
                                stack = new Stack <int>();
                                dictionary.Add(text, stack);
                            }
                            List <T> list   = symbolMaps[text];
                            int      count2 = list.Count;
                            while (stack.Count > 0)
                            {
                                int index = stack.Peek();
                                T   t2    = list[index];
                                if (!AjaxMinSourceMapLoader <T> .CheckSymbolContainsAnother(t, t2))
                                {
                                    break;
                                }
                                t2.ParentSymbolIndex = count2;
                                list[index]          = t2;
                                stack.Pop();
                            }
                            t.ParentSymbolIndex = -1;
                            stack.Push(count2);
                            list.Add(t);
                        }
                    }
                    else if (xmlReader.Name == "sourceFile")
                    {
                        string attribute = xmlReader.GetAttribute("id");
                        if (attribute == null)
                        {
                            throw new XmlException("One of the source files had a null id");
                        }
                        sourceFileIdMap.Add(uint.Parse(attribute) + count, xmlReader.GetAttribute("path"));
                    }
                    else if (xmlReader.IsStartElement("scriptFile"))
                    {
                        string attribute2 = xmlReader.GetAttribute("path");
                        if (!this.symbolParser.ExtractScriptPackageName(filePath, attribute2, out text))
                        {
                            throw new XmlException("Unable to determine the script package name: " + filePath);
                        }
                        symbolMaps[text] = new List <T>(1024);
                        hashSet.Add(text);
                    }
                }
            }
            foreach (string key in hashSet)
            {
                symbolMaps[key].TrimExcess();
            }
        }