• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Collections.ExtendedProperties类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Init

		/// <summary> 
		/// Initialize the template loader with a
		/// a resources class.
		/// </summary>
		public override void Init(ExtendedProperties configuration)
		{
			assemblyNames = configuration.GetVector("assembly");
			prefixes = configuration.GetVector("prefix");
			if (assemblyNames.Count != prefixes.Count)
			{
				throw new ResourceNotFoundException("Need to specify prefixes!");
			}
		}
开发者ID:rambo-returns,项目名称:MonoRail,代码行数:13,代码来源:AssemblyRelativeResourceLoader.cs


示例17: Apply

        public void  Apply(IEnumerable<ChangeScript> changeScripts)
        {
            string filename = string.Format(CultureInfo.InvariantCulture, "{0}_{1}.vm", this.syntax, this.GetTemplateQualifier());

            var model = new Hashtable();
            
            model.Add("scripts", changeScripts);
            model.Add("changeLogTableName", this.changeLogTableName);
            model.Add("delimiter", this.delimiter);
            model.Add("separator", this.delimiterType is RowDelimiter ? Environment.NewLine : string.Empty);

            try
            {
                ExtendedProperties props = new ExtendedProperties();

                var assemblyName = typeof(TemplateBasedApplier).Assembly.GetName().Name;

                ReplaceManagersWithDbDeployVersions(props, assemblyName);

                if (this.templateDirectory == null)
                {
                    props.AddProperty("resource.loader", "assembly");

                    // The ";" will be replaced by "," in the resource loader factory.
                    // This is because if we add a property with a comma in the value, it will add *two* values to the property.
                    props.AddProperty(
                        "assembly.resource.loader.class",
                        typeof(DbDeployAssemblyResourceLoader).FullName + "; " + assemblyName);

                    props.AddProperty("assembly.resource.loader.assembly", assemblyName);
                    filename = "Net.Sf.Dbdeploy.Resources." + filename;
                }
                else
                {
                    props.SetProperty("file.resource.loader.path", this.templateDirectory.FullName);
                }

                var templateEngine = new VelocityEngine(props);

                var context = new VelocityContext(model);

                Template template = templateEngine.GetTemplate(filename);

                template.Merge(context, this.writer);
            }
            catch (ResourceNotFoundException ex)
            {
                string locationMessage = templateDirectory == null 
                    ? string.Empty 
                    : (" at " + templateDirectory.FullName);

                throw new UsageException(
                    "Could not find template named " + filename + locationMessage + Environment.NewLine + "Check that you have got the name of the database syntax correct.",
                    ex);
            }
        }
开发者ID:peschuster,项目名称:dbdeploy.net,代码行数:56,代码来源:TemplateBasedApplier.cs


示例18: Configure

        public override void Configure(DirectoryInfo workingDirectory, NameValueCollection props)
        {
            try
            {
                File.Delete("nvelocity.log");
            }
            catch (IOException)
            {
                // TODO: This is evil! need to investigate further. Cannot get
                // exclusive lock on the log file with this assembly now a
                // library (as opposed to an exe). However not convinced that
                // the line isn't a hangover from java conversion. Need to
                // investigate further.
                ;
            }
            base.Configure(workingDirectory, props);
            ExtendedProperties p = new ExtendedProperties();
            string templateName = props["template"];
            string templateSrc;
            if (templateName == null)
            {
                log.Info("No template file was specified, using default");
                p.SetProperty("resource.loader", "class");
                p.SetProperty("class.resource.loader.class", "NHibernate.Tool.hbm2net.StringResourceLoader;NHibernate.Tool.hbm2net");
                templateSrc =
                    new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("NHibernate.Tool.hbm2net.convert.vm")).
                        ReadToEnd();
            }
            else
            {
                // NH-242 raised issue of where NVelocity looks when supplied with a unpathed file name. Hence
                // will take responsiblity of explicitly instructing NVelocity where to look.
                if (!Path.IsPathRooted(templateName))
                {
                    templateName = Path.Combine(this.WorkingDirectory.FullName, templateName);
                }
                if (!File.Exists(templateName))
                {
                    string msg =
                        string.Format("Cannot find template file using absolute path or relative to '{0}'.",
                                      this.WorkingDirectory.FullName);
                    throw new IOException(msg);
                }

                p.SetProperty("resource.loader", "class");
                p.SetProperty("class.resource.loader.class", "NHibernate.Tool.hbm2net.StringResourceLoader;NHibernate.Tool.hbm2net");
                using (StreamReader sr = new StreamReader(File.OpenRead(templateName)))
                {
                    templateSrc = sr.ReadToEnd();
                    sr.Close();
                }
            }
            ve = new VelocityEngine();
            ve.Init(p);
            template = ve.GetTemplate(templateSrc);
        }
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:56,代码来源:VelocityRenderer.cs


示例19: LoadConfiguration

	/// <summary>
	/// overridden LoadConfiguration that will create a properties file on the fly
	/// </summary>
	/// <returns></returns>
	protected override ExtendedProperties LoadConfiguration() {
	    ExtendedProperties p = new ExtendedProperties();

	    // override the loader path and log file locations based on where the physical application path is
	    p.SetProperty(NVelocity.Runtime.RuntimeConstants_Fields.FILE_RESOURCE_LOADER_PATH, context.Request.PhysicalApplicationPath);
	    p.SetProperty(NVelocity.Runtime.RuntimeConstants_Fields.RUNTIME_LOG,
			  context.Request.PhysicalApplicationPath + p.GetString(NVelocity.Runtime.RuntimeConstants_Fields.RUNTIME_LOG, "nvelocity.log"));

	    return p;
	}
开发者ID:DF-thangld,项目名称:web_game,代码行数:14,代码来源:SimpleNVelocityHandler.cs


示例20: NVelocity

 static NVelocity()
 {
     filePath = Utils.GetMapPath(BaseConfigs.GetForumPath);
     engine = new VelocityEngine();
     props = new ExtendedProperties();
     props.AddProperty(RuntimeConstants.INPUT_ENCODING, "utf-8");
     props.AddProperty(RuntimeConstants.OUTPUT_ENCODING, "utf-8");
     props.AddProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, filePath);
     engine.Init(props);
 }
开发者ID:ChalmerLin,项目名称:dnt_v3.6.711,代码行数:10,代码来源:NVelocity.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CsharpSqlite.Pager类代码示例发布时间:2022-05-24
下一篇:
C# CommonSuite.frmInfoBox类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap