Esempio n. 1
0
        public LoadedContent LoadFeatures(string xmlFile)
        {
            var         csscontent = new LoadedContent();
            string      xmlcontent = System.IO.File.ReadAllText(string.Concat(CSS_BASE_DIR, xmlFile));
            XmlDocument doc        = new XmlDocument();

            doc.LoadXml(xmlcontent);
            XmlNodeList   files = doc.GetElementsByTagName("files");
            StringBuilder sb    = new StringBuilder();

            foreach (XmlElement file in files)
            {
                XmlNodeList links = file.GetElementsByTagName("link");
                foreach (XmlElement link in links)
                {
                    String source   = link.Attributes["href"].Value;
                    string filename = string.Concat(CSS_BASE_DIR, source);
                    csscontent.filenames.Add(filename);
                    string content = System.IO.File.ReadAllText(filename);
                    sb.Append(content);
                }
            }
#if DEBUG
            csscontent.content = sb.ToString();
#else
            csscontent.content = MyMin.parse(sb.ToString(), false, true);
#endif
            return(csscontent);
        }
Esempio n. 2
0
        public LoadedContent LoadFeatures(string featurePath, string xmlFile)
        {
            var         jscontent  = new LoadedContent();
            string      xmlcontent = System.IO.File.ReadAllText(string.Concat(JAVASCRIPT_BASE_DIR, featurePath, "/", xmlFile));
            XmlDocument doc        = new XmlDocument();

            doc.LoadXml(xmlcontent);
            XmlNodeList   files = doc.GetElementsByTagName("files");
            StringBuilder sb    = new StringBuilder();

            foreach (XmlElement file in files)
            {
                XmlNodeList libraries = file.GetElementsByTagName("script");
                foreach (XmlElement script in libraries)
                {
                    String source   = script.Attributes["src"].Value;
                    string filename = string.Concat(JAVASCRIPT_BASE_DIR, featurePath, "/", source);
                    jscontent.filenames.Add(filename);
                    string content = System.IO.File.ReadAllText(filename);
                    sb.Append(content);
                }
            }
#if DEBUG
            jscontent.content = sb.ToString();
#else
            // can't use closure at the moment because it messes up jqgrid
            jscontent.content = MyMin.parse(sb.ToString(), false, false);
#endif
            return(jscontent);
        }