本文整理汇总了C#中System.util.Properties.AddAll方法的典型用法代码示例。如果您正苦于以下问题:C# Properties.AddAll方法的具体用法?C# Properties.AddAll怎么用?C# Properties.AddAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.util.Properties
的用法示例。
在下文中一共展示了Properties.AddAll方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetFont
/// <summary>
/// Constructs a Font-object.
/// </summary>
/// <param name="attributes">the attributes of a Font object</param>
/// <returns>a Font object</returns>
public virtual Font GetFont(Properties attributes) {
string fontname = null;
string encoding = defaultEncoding;
bool embedded = defaultEmbedding;
float size = Font.UNDEFINED;
int style = Font.NORMAL;
BaseColor color = null;
string value = attributes[Markup.HTML_ATTR_STYLE];
if (value != null && value.Length > 0) {
Properties styleAttributes = Markup.ParseAttributes(value);
if (styleAttributes.Count == 0) {
attributes.Add(Markup.HTML_ATTR_STYLE, value);
}
else {
fontname = styleAttributes[Markup.CSS_KEY_FONTFAMILY];
if (fontname != null) {
string tmp;
while (fontname.IndexOf(',') != -1) {
tmp = fontname.Substring(0, fontname.IndexOf(','));
if (IsRegistered(tmp)) {
fontname = tmp;
}
else {
fontname = fontname.Substring(fontname.IndexOf(',') + 1);
}
}
}
if ((value = styleAttributes[Markup.CSS_KEY_FONTSIZE]) != null) {
size = Markup.ParseLength(value);
}
if ((value = styleAttributes[Markup.CSS_KEY_FONTWEIGHT]) != null) {
style |= Font.GetStyleValue(value);
}
if ((value = styleAttributes[Markup.CSS_KEY_FONTSTYLE]) != null) {
style |= Font.GetStyleValue(value);
}
if ((value = styleAttributes[Markup.CSS_KEY_COLOR]) != null) {
color = Markup.DecodeColor(value);
}
attributes.AddAll(styleAttributes);
}
}
if ((value = attributes[ElementTags.ENCODING]) != null) {
encoding = value;
}
if ("true".Equals(attributes[ElementTags.EMBEDDED])) {
embedded = true;
}
if ((value = attributes[ElementTags.FONT]) != null) {
fontname = value;
}
if ((value = attributes[ElementTags.SIZE]) != null) {
size = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
}
if ((value = attributes[Markup.HTML_ATTR_STYLE]) != null) {
style |= Font.GetStyleValue(value);
}
if ((value = attributes[ElementTags.STYLE]) != null) {
style |= Font.GetStyleValue(value);
}
string r = attributes[ElementTags.RED];
string g = attributes[ElementTags.GREEN];
string b = attributes[ElementTags.BLUE];
if (r != null || g != null || b != null) {
int red = 0;
int green = 0;
int blue = 0;
if (r != null) red = int.Parse(r);
if (g != null) green = int.Parse(g);
if (b != null) blue = int.Parse(b);
color = new BaseColor(red, green, blue);
}
else if ((value = attributes[ElementTags.COLOR]) != null) {
color = Markup.DecodeColor(value);
}
if (fontname == null) {
return GetFont(null, encoding, embedded, size, style, color);
}
return GetFont(fontname, encoding, embedded, size, style, color);
}
示例2: GetAttributes
/**
* @see com.lowagie.text.xml.XmlPeer#getAttributes(org.xml.sax.Attributes)
*/
public override Properties GetAttributes(Hashtable attrs)
{
Properties attributes = new Properties();
attributes.AddAll(attributeValues);
if (defaultContent != null) {
attributes[ElementTags.ITEXT] = defaultContent;
}
if (attrs != null) {
foreach (string key in attrs.Keys) {
attributes.Add(GetName(key).ToLower(CultureInfo.InvariantCulture), (string)attrs[key]);
}
}
return attributes;
}
示例3: GetAttributes
/// <summary> Gets the list of attributes of the peer. </summary>
public virtual Properties GetAttributes(Hashtable attrs)
{
Properties attributes = new Properties();
attributes.AddAll(attributeValues);
if (defaultContent != null) {
attributes.Add(ElementTags.ITEXT, defaultContent);
}
if (attrs != null) {
foreach (string key in attrs.Keys) {
attributes.Add(GetName(key), (string)attrs[key]);
}
}
return attributes;
}