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


C# ExtendedProperties.GetString方法代码示例

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


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

示例1: Init

 public override void Init(ExtendedProperties configuration)
 {
     this.pluginNameAndPathSplitString = configuration.GetString("class.pluginNameAndPathSplitString");
     if (this.pluginNameAndPathSplitString == null)
         this.pluginNameAndPathSplitString = ":";
     this.viewNamePrefix = configuration.GetString("class.viewNamePrefix");
     if (this.viewNamePrefix == null)
         this.viewNamePrefix = "view/";
     this.viewNameSuffix = configuration.GetString("class.viewNameSuffix");
     if (this.viewNameSuffix == null)
         this.viewNameSuffix = ".html";
 }
开发者ID:HongJunRen,项目名称:Quick.OwinMVC,代码行数:12,代码来源:EmbedResourceLoader.cs

示例2: Test_ExtendedProperties

        public void Test_ExtendedProperties()
        {
            FileInfo file = new FileInfo("test1.properties");
            StreamWriter sw = file.CreateText();
            sw.WriteLine("# lines starting with # are comments.  Blank lines are ignored");
            sw.WriteLine("");
            sw.WriteLine("# This is the simplest property");
            sw.WriteLine("key = value");
            sw.WriteLine("");
            sw.WriteLine("# A long property may be separated on multiple lines");
            sw.WriteLine("longvalue = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \\");
            sw.WriteLine("            aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
            sw.WriteLine("");
            sw.WriteLine("# This is a property with many tokens");
            sw.WriteLine("tokens_on_a_line = first token, second token");
            sw.WriteLine("");
            sw.WriteLine("# This sequence generates exactly the same result");
            sw.WriteLine("tokens_on_multiple_lines = first token");
            sw.WriteLine("tokens_on_multiple_lines = second token");
            sw.WriteLine("");
            sw.WriteLine("# commas may be escaped in tokens");
            sw.WriteLine("commas.excaped = Hi\\, what'up?");
            sw.Flush();
            sw.Close();

            StreamReader sr = file.OpenText();
            String s = sr.ReadToEnd();
            sr.Close();

            // TODO: could build string, then write, then read and compare.
            ExtendedProperties props = new ExtendedProperties(file.FullName);

            Assertion.Assert("expected to have 5 properties, had " + props.Count.ToString(), props.Count==5);

            Assertion.Assert("key was not correct: " + props.GetString("key"), props.GetString("key").Equals("value"));
            Assertion.Assert("commas.excaped was not correct: " + props.GetString("commas.excaped"), props.GetString("commas.excaped").Equals("Hi, what'up?"));

            Object o = props.GetProperty("tokens_on_a_line");
            Assertion.Assert("tokens_on_a_line was expected to be an ArrayList", (o is ArrayList));
            Assertion.Assert("tokens_on_a_line was expected to be an ArrayList with 2 elements", ((ArrayList)o).Count==2);

            StringWriter writer = new StringWriter();
            props.Save(writer, "header");
        }
开发者ID:DF-thangld,项目名称:web_game,代码行数:44,代码来源:CommonsTest.cs

示例3: 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

示例4: NVelocityViewEngine

        public NVelocityViewEngine(IDictionary properties)
        {
            if( properties == null ) properties = DEFAULT_PROPERTIES;

            var props = new ExtendedProperties();
            foreach(string key in properties.Keys)
            {
                props.AddProperty(key, properties[key]);
            }

            _masterFolder = props.GetString("master.folder", string.Empty);

            _engine = new VelocityEngine();
            _engine.Init(props);
        }
开发者ID:lozanotek,项目名称:mvcextensions,代码行数:15,代码来源:NVelocityViewEngine.cs

示例5: CommonInit

		/// <summary>
		/// This initialization is used by all resource
		/// loaders and must be called to set up common
		/// properties shared by all resource loaders
		/// </summary>
		public void CommonInit(IRuntimeServices rs, ExtendedProperties configuration)
		{
			rsvc = rs;

			// these two properties are not required for all loaders.
			// For example, for ClasspathLoader, what would cache mean? 
			// so adding default values which I think are the safest

			// don't cache, and modCheckInterval irrelevant...

			isCachingOn = configuration.GetBoolean("cache", false);
			modificationCheckInterval = configuration.GetLong("modificationCheckInterval", 0);

			// this is a must!
			className = configuration.GetString("class");
		}
开发者ID:nats,项目名称:castle-1.0.3-mono,代码行数:21,代码来源:ResourceLoader.cs

示例6: commonInit

	/// <summary> This initialization is used by all resource
	/// loaders and must be called to set up common
	/// properties shared by all resource loaders
	/// </summary>
	public virtual void  commonInit(RuntimeServices rs, ExtendedProperties configuration) {
	    this.rsvc = rs;

	    /*
	    *  these two properties are not required for all loaders.
	    *  For example, for ClasspathLoader, what would cache mean? 
	    *  so adding default values which I think are the safest
	    *
	    *  don't cache, and modCheckInterval irrelevant...
	    */

	    isCachingOn_Renamed_Field = configuration.GetBoolean("cache", false);
	    modificationCheckInterval = configuration.GetLong("modificationCheckInterval", 0);

	    /*
	    * this is a must!
	    */

	    className = configuration.GetString("class");
	}
开发者ID:BackupTheBerlios,项目名称:ch3etah-svn,代码行数:24,代码来源:ResourceLoader.cs

示例7: Test_run

        public virtual void Test_run()
        {
            System.IO.StreamWriter result = null;
            ExtendedProperties c = null;
            try {
            assureResultsDirectoryExists(RESULTS_DIR);
            c = new ExtendedProperties(TEST_CONFIG);
            result = new System.IO.StreamWriter(getFileName(RESULTS_DIR, "output", "res"));
            } catch (System.Exception e) {
            throw new System.Exception("Cannot setup CommonsExtPropTestCase!", e);
            }

            message(result, "Testing order of keys ...");
            showIterator(result, c.Keys);

            message(result, "Testing retrieval of CSV values ...");
            showVector(result, c.GetVector("resource.loader"));

            message(result, "Testing subset(prefix).getKeys() ...");
            ExtendedProperties subset = c.Subset("file.resource.loader");
            showIterator(result, subset.Keys);

            message(result, "Testing getVector(prefix) ...");
            showVector(result, subset.GetVector("path"));

            message(result, "Testing getString(key) ...");
            result.Write(c.GetString("config.string.value"));
            result.Write("\n\n");

            message(result, "Testing getBoolean(key) ...");
            //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Boolean.toString' may return a different value. 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="jlca1043"'
            result.Write(c.GetBoolean("config.boolean.value").ToString());
            result.Write("\n\n");

            message(result, "Testing getByte(key) ...");
            result.Write(c.GetByte("config.byte.value").ToString());
            result.Write("\n\n");

            message(result, "Testing getShort(key) ...");
            result.Write(c.GetShort("config.short.value").ToString());
            result.Write("\n\n");

            message(result, "Testing getInt(key) ...");
            result.Write(c.GetInt("config.int.value").ToString());
            result.Write("\n\n");

            message(result, "Testing getLong(key) ...");
            result.Write(c.GetLong("config.long.value").ToString());
            result.Write("\n\n");

            message(result, "Testing getFloat(key) ...");
            result.Write(c.GetFloat("config.float.value").ToString());
            result.Write("\n\n");

            message(result, "Testing getDouble(key) ...");
            result.Write(c.GetDouble("config.double.value").ToString());
            result.Write("\n\n");

            message(result, "Testing escaped-comma scalar...");
            result.Write(c.GetString("escape.comma1"));
            result.Write("\n\n");

            message(result, "Testing escaped-comma vector...");
            showVector(result, c.GetVector("escape.comma2"));
            result.Write("\n\n");

            result.Flush();
            result.Close();

            if (!isMatch(RESULTS_DIR, COMPARE_DIR, "output", "res", "cmp")) {
            Assertion.Fail("Output incorrect.");
            }
        }
开发者ID:DF-thangld,项目名称:web_game,代码行数:73,代码来源:CommonsExtPropTestCase.cs


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