当前位置: 首页>>代码示例>>C#>>正文


C# Collections.ExtendedProperties类代码示例

本文整理汇总了C#中Commons.Collections.ExtendedProperties的典型用法代码示例。如果您正苦于以下问题:C# ExtendedProperties类的具体用法?C# ExtendedProperties怎么用?C# ExtendedProperties使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ExtendedProperties类属于Commons.Collections命名空间,在下文中一共展示了ExtendedProperties类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: NVelocityHelper

 static NVelocityHelper()
 {
     _velocity = new VelocityEngine();
     var props = new ExtendedProperties();
     props.AddProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, ConfigurationManager.AppSettings["TemplateFolder"]);
     _velocity.Init(props);
 }
开发者ID:lynchjames,项目名称:CallJSON,代码行数:7,代码来源:NVelocityHelper.cs

示例2: RenderTemplate

        public string RenderTemplate(string masterPage, string templateName, IDictionary<string, object> data)
        {
            if (string.IsNullOrEmpty(templateName))
            {
                throw new ArgumentException("The \"templateName\" parameter must be specified", "templateName");
            }

            var name = !string.IsNullOrEmpty(masterPage)
                 ? masterPage : templateName;

            var engine = new VelocityEngine();
            var props = new ExtendedProperties();
            props.AddProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, _templatesPath);
            engine.Init(props);
            var template = engine.GetTemplate(name);
            template.Encoding = Encoding.UTF8.BodyName;
            var context = new VelocityContext();

            var templateData = data ?? new Dictionary<string, object>();
            foreach (var key in templateData.Keys)
            {
                context.Put(key, templateData[key]);
            }

            if (!string.IsNullOrEmpty(masterPage))
            {
                context.Put("childContent", templateName);
            }

            using (var writer = new StringWriter())
            {
                engine.MergeTemplate(name, context, writer);
                return writer.GetStringBuilder().ToString();
            }
        }
开发者ID:leon737,项目名称:MvcBlanket,代码行数:35,代码来源:NVelocityTemplateRepository.cs

示例3: Format

        public static string Format(HttpContext context, string pattern, VelocityContext velocitycontext)
        {
                using (var writer = new StringWriter())
                {
                    try
                    {
                        if (!_isInitialized)
                        {
                            var props = new ExtendedProperties();
                            props.AddProperty("file.resource.loader.path",
                                              new ArrayList(new[]
                                                                {
                                                                    ".",
                                                                    Path.Combine(
                                                                        context.Server.MapPath(feed.HandlerBasePath),
                                                                        "Patterns")
                                                                }));
                            Velocity.Init(props);
                            _isInitialized = true;
                        }
                        //Load patterns
                        var template = Patterns.Get(pattern, () => LoadTemplate(pattern));

                        template.Merge(velocitycontext, writer);
                        return writer.GetStringBuilder().ToString();

                    }
                    catch (Exception)
                    {
                        //Format failed some way
                        return writer.GetStringBuilder().ToString();
                    }
                }
        }
开发者ID:ridhouan,项目名称:teamlab.v6.5,代码行数:34,代码来源:Formatter.cs

示例4: Initialize

		public void Initialize()
		{
            ActiveRecordStarter.Initialize( new XmlConfigurationSource("activeRecord.xml"),
              typeof(Acl) ,
              typeof(Category) ,
              typeof(Chat) ,
              typeof(ChatMessage) ,
              typeof(ConfigCombo) ,
              typeof(ConfigModel) ,
              typeof(Container) ,
              typeof(Content) ,
              typeof(DataModel) ,
              typeof(Field) ,
              typeof(FieldTemplate) ,
              typeof(CastlePortal.File) ,
              typeof(Forum) ,
              typeof(ForumFolder) ,
              typeof(ForumMessage) ,
              typeof(Group) ,
              typeof(Menu) ,
              typeof(Role) ,
              typeof(CastlePortal.Template) ,
              typeof(CastlePortal.Type) ,
              typeof(Language),
              typeof(MenuTranslation),
              typeof(TypeTranslation),
              typeof(User)
           );
           
           velocity = new VelocityEngine();
           ExtendedProperties props = new ExtendedProperties();
           velocity.Init(props);
		}
开发者ID:BackupTheBerlios,项目名称:castleportal-svn,代码行数:33,代码来源:Test1.cs

示例5: SetLoaderPath

		private void SetLoaderPath(ExtendedProperties properties)
		{
			string loaderPath = "";
			// TODO: Solve multiple loader path problem in NVelocity
			if (Template.FileName == "")
			{
				loaderPath = BaseFolder;
			}
			else
			{
				loaderPath = Path.GetDirectoryName(Template.GetFullPath());
				if (loaderPath.IndexOf(BaseFolder) < 0 && loaderPath != BaseFolder)
				{
					loaderPath = BaseFolder + "," + loaderPath;
				}
				else if (loaderPath != BaseFolder)
				{
					loaderPath += "," + BaseFolder;
				}
			}
			// HACK: Setting loader path to base folder until loader problem is solved
			//loaderPath = BaseFolder;
			//System.Diagnostics.Debug.WriteLine("NVeleocity:loaderPath=" + loaderPath);
			if (properties.Contains("file.resource.loader.path"))
			{
				properties["file.resource.loader.path"] = loaderPath;
			}
			else
			{
				properties.AddProperty("file.resource.loader.path", loaderPath);
			}
		}
开发者ID:BackupTheBerlios,项目名称:ch3etah-svn,代码行数:32,代码来源:NVelocityTransformationEngine.cs

示例6: InitialiseNVelocity

		protected void InitialiseNVelocity(string templatePath) {

			ExtendedProperties props = new ExtendedProperties();
			props.SetProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, TemplatePath);
			
			Velocity.Init(props);
		}
开发者ID:xcrash,项目名称:cuyahogacontrib-Cuyahoga.Modules.ECommerce,代码行数:7,代码来源:NVelocityTemplateEngine.cs

示例7: CreateCode

        public static void CreateCode(string filepath, string outputpath, VelocityContext context)
        {
            StreamWriter writer=null;
            try
            {
                VelocityEngine engine = null;//new VelocityEngine();
                ExtendedProperties extendedProperties = new ExtendedProperties();
                //extendedProperties.SetProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, filepath.Substring(0, filepath.LastIndexOf("\\")));

                engine.Init(extendedProperties);
                //Template template = engine.GetTemplate(filepath.Substring(filepath.LastIndexOf("\\")+1));
                //FileStream fos = new FileStream(outputpath + "\\1.vm", FileMode.Create);
                //writer = new StreamWriter(fos);
                //template.Merge(context, writer);
                //writer.Flush();
                //writer.Close();
                StringWriter output=new StringWriter();
                engine.Evaluate(context, output, "", filepath);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (writer != null)
                {
                    writer.Close();
                }
            }
        }
开发者ID:Tony-Liang,项目名称:CodeGenernate,代码行数:31,代码来源:VelocityWrapper.cs

示例8: Test

        public void Test()
        {
            var velocityEngine = new VelocityEngine();

            ExtendedProperties extendedProperties = new ExtendedProperties();
            extendedProperties.SetProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, TemplateTest.FILE_RESOURCE_LOADER_PATH);

            velocityEngine.Init(extendedProperties);

            VelocityContext context = new VelocityContext();

            context.Put("yada", "line");

            Template template = velocityEngine.GetTemplate(
                GetFileName(null, "nv37", TemplateTest.TMPL_FILE_EXT));

            StringWriter writer = new StringWriter();

            #pragma warning disable 612,618
            velocityEngine.MergeTemplate("nv37.vm", context, writer);
            #pragma warning restore 612,618

            //template.Merge(context, writer);

            Console.WriteLine(writer);
        }
开发者ID:hatjhie,项目名称:NVelocity,代码行数:26,代码来源:NVelocity37.cs

示例9: CreateVelocityEngine

 private VelocityEngine CreateVelocityEngine()
 {
     var velocity = new VelocityEngine();
     var props = new ExtendedProperties();
     props.SetProperty("file.resource.loader.path", _templateDirectory);
     velocity.Init(props);
     return velocity;
 }
开发者ID:chrcar01,项目名称:SchemaProber,代码行数:8,代码来源:VelociWrapper.cs

示例10: GetBasicProperties

 private static ExtendedProperties GetBasicProperties()
 {
     ExtendedProperties properties = new ExtendedProperties();
     properties.AddProperty("resource.loader", "assembly");
     properties.AddProperty("assembly.resource.loader.class",
         "NVelocity.Runtime.Resource.Loader.AssemblyResourceLoader, NVelocity");
     return properties;
 }
开发者ID:hatjhie,项目名称:NVelocity,代码行数:8,代码来源:AssemblyResourceLoaderTestCase.cs

示例11: NVelocityTemplateRepository

        public NVelocityTemplateRepository(string templateDirectory)
        {
            engine = new VelocityEngine();
            ExtendedProperties props = new ExtendedProperties();
            props.AddProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, templateDirectory);

            engine.Init(props);
        }
开发者ID:zhsh1241,项目名称:Sconit5_Shenya,代码行数:8,代码来源:NVelocityTemplateRepository.cs

示例12: CreateVelocityEngine

 /// <inheritdoc />
 public VelocityEngine CreateVelocityEngine()
 {
     var properties = new ExtendedProperties();
     SetupVelocityEngine(properties);
     var engine = new VelocityEngine(properties);
     engine.Init();
     return engine;
 }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:9,代码来源:DefaultVelocityEngineFactory.cs

示例13: TemplateHelper

 public TemplateHelper(string templatePath)
 {
     velocity = new VelocityEngine();
     ExtendedProperties props = new ExtendedProperties();
     props.AddProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, templatePath);
     props.AddProperty(RuntimeConstants.INPUT_ENCODING, "utf-8");
     velocity.Init(props);
     context = new VelocityContext();
 }
开发者ID:hhahh2011,项目名称:CH.EasyCode,代码行数:9,代码来源:TemplateHelper.cs

示例14: Configure

        public virtual bool Configure()
        {
            _engine = new VelocityEngine();
            var props = new ExtendedProperties();
            props.AddProperty("file.resource.loader.path", TemplatePath);
            _engine.Init(props);

            return true;
        }
开发者ID:raghavrkapoor,项目名称:RagzRepo,代码行数:9,代码来源:NVelocityEmailProviderAbstract.cs

示例15: GetInitialisedEngine

 private VelocityEngine GetInitialisedEngine()
 {
     VelocityEngine engine = new VelocityEngine();
     ExtendedProperties properties = new ExtendedProperties();
     properties.SetProperty(RuntimeConstants.RESOURCE_LOADER, "file");
     properties.SetProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, agencyService.CurrentAgency.TemplateDirectory);
     engine.Init(properties);
     return engine;
 }
开发者ID:liammclennan,项目名称:Herald,代码行数:9,代码来源:TemplateService.cs


注:本文中的Commons.Collections.ExtendedProperties类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。