/// <summary>
 /// 
 /// </summary>
 static DMEWeb_TemplateDocumentConfig()
 {
     DMEWeb_TemplateDocumentConfig.Default = new DMEWeb_TemplateDocumentConfig();
     DMEWeb_TemplateDocumentConfig.Full = new DMEWeb_TemplateDocumentConfig(DMEWeb_TagOpenMode.Full, false);
     DMEWeb_TemplateDocumentConfig.Compress = new DMEWeb_TemplateDocumentConfig(DMEWeb_TagOpenMode.Simple, true);
     DMEWeb_TemplateDocumentConfig.Compatible = new DMEWeb_TemplateDocumentConfig(DMEWeb_TagOpenMode.Simple, false, true);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 根据文件内容进行解析
 /// </summary>
 /// <param name="fileName"></param>
 /// <param name="charset"></param>
 /// <param name="documentConfig"></param>
 public DMEWeb_TemplateDocument(string fileName, Encoding charset, DMEWeb_TemplateDocumentConfig documentConfig)
 {
     string text = System.IO.File.ReadAllText(fileName, charset);
     this.File = Path.GetFullPath(fileName);
     this.Charset = charset;
     this.AddFileDependency(this.File);
     this.DocumentConfig = documentConfig;
     this.ParseString(this, text);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 根据字符串进行解析
 /// </summary>
 /// <param name="text"></param>
 /// <param name="documentConfig"></param>
 public DMEWeb_TemplateDocument(string text, DMEWeb_TemplateDocumentConfig documentConfig)
 {
     this.DocumentConfig = documentConfig;
     this.ParseString(text);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 根据TextRader数据进行解析
 /// </summary>
 /// <param name="reader"></param>
 /// <param name="documentConfig"></param>
 public DMEWeb_TemplateDocument(TextReader reader, DMEWeb_TemplateDocumentConfig documentConfig)
 {
     this.DocumentConfig = documentConfig;
     this.ParseString(reader.ReadToEnd());
 }
Ejemplo n.º 5
0
        /// <summary>
        /// 从文件缓存中构建模板文档对象
        /// </summary>
        /// <param name="fileName"></param>
        /// <param name="charset"></param>
        /// <param name="documentConfig"></param>
        /// <returns></returns>
        public static DMEWeb_TemplateDocument FromFileCache(string fileName, Encoding charset, DMEWeb_TemplateDocumentConfig documentConfig)
        {
            Cache cache = HttpRuntime.Cache;
            if (documentConfig == null) documentConfig = DMEWeb_TemplateDocumentConfig.Default;

            //没有缓存则直接返回实例
            if (cache == null) return new DMEWeb_TemplateDocument(fileName, charset, documentConfig);
            fileName = Path.GetFullPath(fileName);

            string cacheKey = string.Format("TEMPLATE_DOCUMENT_CACHE_ITEM_{0}_{1}_{2}", documentConfig.TagOpenMode, documentConfig.CompressText, fileName);
            DMEWeb_TemplateDocument document = cache.Get(cacheKey) as DMEWeb_TemplateDocument;
            if (document == null)
            {
                document = new DMEWeb_TemplateDocument(fileName, charset, documentConfig);
                cache.Insert(cacheKey, document, new CacheDependency(document.FileDependencies));
            }
            //返回副本
            return document.Clone();
        }
Ejemplo n.º 6
0
 /// <summary>
 /// 
 /// </summary>
 private DMEWeb_TemplateDocument(DMEWeb_TemplateDocumentConfig documentConfig)
 {
     this.DocumentConfig = documentConfig;
 }
Ejemplo n.º 7
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="documentElement"></param>
 /// <param name="container"></param>
 /// <param name="text"></param>
 /// <param name="documentConfig"></param>
 internal DMEWeb_TemplateDocument(DMEWeb_Template documentElement, DMEWeb_Tag container, string text, DMEWeb_TemplateDocumentConfig documentConfig)
 {
     this.DocumentConfig = documentConfig;
     this.AppendChild(documentElement);
     this.ChildTemplates.Add(documentElement);
     this.ParseString(documentElement, container, text);
 }
Ejemplo n.º 8
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="documentElement"></param>
 /// <param name="text"></param>
 /// <param name="documentConfig"></param>
 internal DMEWeb_TemplateDocument(DMEWeb_Template documentElement, string text, DMEWeb_TemplateDocumentConfig documentConfig)
     : this(documentElement, documentElement, text, documentConfig)
 {
 }