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


C# IProperties.GetString方法代码示例

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


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

示例1: CopySettings

 private void CopySettings(IProperties sourceSettings, IProperties targetSettings)
 {
     foreach (string key in sourceSettings.Names)
     {
         targetSettings.SetString(key, sourceSettings.GetString(key, null));
     }
 }
开发者ID:gmilazzoitag,项目名称:OpenLiveWriter,代码行数:7,代码来源:DefaultImageSettings.cs

示例2: GetDefaultBoundsSizeName

        public static ImageSizeName GetDefaultBoundsSizeName(IProperties settings)
        {
            string defaultSizeName = DefaultSizeName;
            if (!Enum.IsDefined(typeof(ImageSizeName), defaultSizeName))
            {
                // This is our fallback if the hosting application returns a bad value.
                defaultSizeName = ImageSizeName.Small.ToString();
            }

            return (ImageSizeName)Enum.Parse(typeof(ImageSizeName), settings.GetString(DEFAULT_SIZE_NAME, defaultSizeName));
        }
开发者ID:gmilazzoitag,项目名称:OpenLiveWriter,代码行数:11,代码来源:HtmlImageResizeDecorator.cs

示例3: RemoveValue

		/// <summary>
		/// Removes saved value of this option from the properties dictionary
		/// </summary>
		/// <param name="properties">Properties dictionary</param>
		public void RemoveValue(IProperties properties)
		{
			if (properties == null)
			{
				throw new ArgumentNullException("properties");
			}
			if (properties.Contains(FullName))
			{
				string currentValue = properties.GetString(FullName, null);
				properties.Remove(FullName);
				if (Removed != null)
				{
					Removed(this, new OptionValueEventArgs(currentValue));
				}
			}
		}
开发者ID:stevebeauge,项目名称:crayon-syntax-snippet-wlw,代码行数:20,代码来源:Option.cs

示例4: SetValue

		/// <summary>
		/// Saves a value for this option in the properties dictionary
		/// </summary>
		/// <param name="properties">Properties dictionary</param>
		/// <param name="value">Value to save</param>
		public void SetValue(IProperties properties, object value)
		{
			if (properties == null)
			{
				throw new ArgumentNullException("properties");
			}
			if (value == null)
			{
				throw new ArgumentNullException("value");
			}

			string currentValue = properties.Contains(FullName) ? properties.GetString(FullName, null) : null;
			string newValue = Convert.ToBase64String(Utils.BinarySerialize(value));
			if ((currentValue == null)
			    || !string.Equals(currentValue, newValue, StringComparison.Ordinal))
			{
				properties.SetString(FullName, newValue);
				if (currentValue == null)
				{
					if (Created != null)
					{
						Created(this, new OptionValueEventArgs(newValue));
					}
				}
				else
				{
					if (Changed != null)
					{
						Changed(this, new OptionChangedEventArgs(currentValue, newValue));
					}
				}
			}
		}
开发者ID:stevebeauge,项目名称:crayon-syntax-snippet-wlw,代码行数:38,代码来源:Option.cs

示例5: GetValue

		/// <summary>
		/// Retrieves this option's value from the properties dictionary
		/// </summary>
		/// <param name="properties">Properties dictionary</param>
		/// <returns>Value of this option</returns>
		public object GetValue(IProperties properties)
		{
			if (properties == null)
			{
				throw new ArgumentNullException("properties");
			}

			string fullName = FullName;
			if (properties.Contains(fullName))
			{
				string val = properties.GetString(fullName, null);
				if (string.IsNullOrEmpty(val))
				{
					return null;
				}
				return Utils.BinaryDeserialize(Convert.FromBase64String(val));
			}
			return DefaultValue;
		}
开发者ID:stevebeauge,项目名称:crayon-syntax-snippet-wlw,代码行数:24,代码来源:Option.cs

示例6: PropertiesInfo

		/// <summary>
		/// Converts Properties dictionary into a string for debugging purposes
		/// </summary>
		/// <param name="properties">Properties</param>
		/// <param name="textWriter">Text writer</param>
		/// <returns>String</returns>
		private static void PropertiesInfo(IProperties properties, IndentedTextWriter textWriter)
		{
			foreach (string name in properties.Names)
			{
				string val = properties.GetString(name, null) ?? "<null>";
				try
				{
					object oVal = Utils.BinaryDeserialize(Convert.FromBase64String(val));
					val = oVal.ToString();
				}
				catch { }
				textWriter.WriteLine("{0}: {1}", name, val);
			}
			foreach (string name in properties.SubPropertyNames)
			{
				textWriter.WriteLine("{0}:", name);
				textWriter.Indent += 1;
				PropertiesInfo(properties.GetSubProperties(name), textWriter);
				textWriter.Indent -= 1;
			}
		}
开发者ID:stevebeauge,项目名称:crayon-syntax-snippet-wlw,代码行数:27,代码来源:Options.cs


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