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


C# util.Properties类代码示例

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


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

示例1: GetAnchor

 public static Anchor GetAnchor(Properties attributes)
 {
     Anchor anchor = new Anchor(GetPhrase(attributes));
     String value;
     value = attributes[ElementTags.NAME];
     if (value != null) {
         anchor.Name = value;
     }
     value = (String)attributes.Remove(ElementTags.REFERENCE);
     if (value != null) {
         anchor.Reference = value;
     }
     return anchor;
 }
开发者ID:bmictech,项目名称:iTextSharp,代码行数:14,代码来源:ElementFactory.cs

示例2: GetChunk

 public static Chunk GetChunk(Properties attributes) {
     Chunk chunk = new Chunk();
     
     chunk.Font = FontFactory.GetFont(attributes);
     String value;
     
     value = attributes[ElementTags.ITEXT];
     if (value != null) {
         chunk.Append(value);
     }
     value = attributes[ElementTags.LOCALGOTO];
     if (value != null) {
         chunk.SetLocalGoto(value);
     }
     value = attributes[ElementTags.REMOTEGOTO];
     if (value != null) {
         String page = attributes[ElementTags.PAGE];
         if (page != null) {
             chunk.SetRemoteGoto(value, int.Parse(page));
         }
         else {
             String destination = attributes[ElementTags.DESTINATION];
             if (destination != null) {
                 chunk.SetRemoteGoto(value, destination);
             }
         }
     }
     value = attributes[ElementTags.LOCALDESTINATION];
     if (value != null) {
         chunk.SetLocalDestination(value);
     }
     value = attributes[ElementTags.SUBSUPSCRIPT];
     if (value != null) {
         chunk.SetTextRise(float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo));
     }
     value = attributes[Markup.CSS_KEY_VERTICALALIGN];
     if (value != null && value.EndsWith("%")) {
         float p = float.Parse(value.Substring(0, value.Length - 1), System.Globalization.NumberFormatInfo.InvariantInfo) / 100f;
         chunk.SetTextRise(p * chunk.Font.Size);
     }
     value = attributes[ElementTags.GENERICTAG];
     if (value != null) {
         chunk.SetGenericTag(value);
     }
     value = attributes[ElementTags.BACKGROUNDCOLOR];
     if (value != null) {
         chunk.SetBackground(Markup.DecodeColor(value));
     }
     return chunk;
 }
开发者ID:pusp,项目名称:o2platform,代码行数:50,代码来源:ElementFactory.cs

示例3: SetRectangleProperties

        /**
        * Sets some Rectangle properties (for a Cell, Table,...).
        */
        private static void SetRectangleProperties(Rectangle rect, Properties attributes)
        {
            String value;
            value = attributes[ElementTags.BORDERWIDTH];
            if (value != null) {
                rect.BorderWidth = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
            }
            int border = 0;
            if (Utilities.CheckTrueOrFalse(attributes, ElementTags.LEFT)) {
                border |= Rectangle.LEFT_BORDER;
            }
            if (Utilities.CheckTrueOrFalse(attributes, ElementTags.RIGHT)) {
                border |= Rectangle.RIGHT_BORDER;
            }
            if (Utilities.CheckTrueOrFalse(attributes, ElementTags.TOP)) {
                border |= Rectangle.TOP_BORDER;
            }
            if (Utilities.CheckTrueOrFalse(attributes, ElementTags.BOTTOM)) {
                border |= Rectangle.BOTTOM_BORDER;
            }
            rect.Border = border;

            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);
                rect.BorderColor = new Color(red, green, blue);
            }
            else {
                rect.BorderColor = Markup.DecodeColor(attributes[ElementTags.BORDERCOLOR]);
            }
            r = (String)attributes.Remove(ElementTags.BGRED);
            g = (String)attributes.Remove(ElementTags.BGGREEN);
            b = (String)attributes.Remove(ElementTags.BGBLUE);
            value = attributes[ElementTags.BACKGROUNDCOLOR];
            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);
                rect.BackgroundColor = new Color(red, green, blue);
            }
            else if (value != null) {
                rect.BackgroundColor = Markup.DecodeColor(value);
            }
            else {
                value = attributes[ElementTags.GRAYFILL];
                if (value != null) {
                    rect.GrayFill = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
                }
            }
        }
开发者ID:bmictech,项目名称:iTextSharp,代码行数:63,代码来源:ElementFactory.cs

示例4: GetSection

 public static Section GetSection(Section parent, Properties attributes)
 {
     Section section = parent.AddSection("");
     SetSectionParameters(section, attributes);
     return section;
 }
开发者ID:bmictech,项目名称:iTextSharp,代码行数:6,代码来源:ElementFactory.cs

示例5: GetParagraph

 public static Paragraph GetParagraph(Properties attributes)
 {
     Paragraph paragraph = new Paragraph(GetPhrase(attributes));
     String value;
     value = attributes[ElementTags.ALIGN];
     if (value != null) {
         paragraph.SetAlignment(value);
     }
     value = attributes[ElementTags.INDENTATIONLEFT];
     if (value != null) {
         paragraph.IndentationLeft = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
     }
     value = attributes[ElementTags.INDENTATIONRIGHT];
     if (value != null) {
         paragraph.IndentationRight = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
     }
     return paragraph;
 }
开发者ID:bmictech,项目名称:iTextSharp,代码行数:18,代码来源:ElementFactory.cs

示例6: GetList

        public static List GetList(Properties attributes)
        {
            List list = new List();

            list.Numbered = Utilities.CheckTrueOrFalse(attributes, ElementTags.NUMBERED);
            list.Lettered = Utilities.CheckTrueOrFalse(attributes, ElementTags.LETTERED);
            list.Lowercase = Utilities.CheckTrueOrFalse(attributes, ElementTags.LOWERCASE);
            list.Autoindent = Utilities.CheckTrueOrFalse(attributes, ElementTags.AUTO_INDENT_ITEMS);
            list.Alignindent = Utilities.CheckTrueOrFalse(attributes, ElementTags.ALIGN_INDENTATION_ITEMS);

            String value;

            value = attributes[ElementTags.FIRST];
            if (value != null) {
                char character = value[0];
                if (char.IsLetter(character) ) {
                    list.First = (int)character;
                }
                else {
                    list.First = int.Parse(value);
                }
            }

            value = attributes[ElementTags.LISTSYMBOL];
            if (value != null) {
                list.ListSymbol = new Chunk(value, FontFactory.GetFont(attributes));
            }

            value = attributes[ElementTags.INDENTATIONLEFT];
            if (value != null) {
                list.IndentationLeft = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
            }

            value = attributes[ElementTags.INDENTATIONRIGHT];
            if (value != null) {
                list.IndentationRight = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
            }

            value = attributes[ElementTags.SYMBOLINDENT];
            if (value != null) {
                list.SymbolIndent = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
            }

            return list;
        }
开发者ID:bmictech,项目名称:iTextSharp,代码行数:45,代码来源:ElementFactory.cs

示例7: Set

 // public methods
 /// <summary>
 /// Alters the attributes of this Section.
 /// </summary>
 /// <param name="attributes">the attributes</param>
 public void Set(Properties attributes)
 {
     string value;
     if ((value = attributes.Remove(ElementTags.NUMBERDEPTH)) != null) {
         NumberDepth = int.Parse(value);
     }
     if ((value = attributes.Remove(ElementTags.INDENT)) != null) {
         Indentation = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
     }
     if ((value = attributes.Remove(ElementTags.INDENTATIONLEFT)) != null) {
         IndentationLeft = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
     }
     if ((value = attributes.Remove(ElementTags.INDENTATIONRIGHT)) != null) {
         IndentationRight = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
     }
 }
开发者ID:hjgode,项目名称:iTextSharpCF,代码行数:21,代码来源:Section.cs

示例8: AddSection

 /// <summary>
 /// Creates a given Section following a set of attributes and adds it to this one.
 /// </summary>
 /// <param name="attributes">the attributes</param>
 /// <returns>the newly added Section</returns>
 public virtual Section AddSection(Properties attributes)
 {
     Section section = new Section(new Paragraph(""), 1);
     string value;
     if ((value = attributes.Remove(ElementTags.NUMBER)) != null) {
         subsections = int.Parse(value) - 1;
     }
     if ((value = attributes.Remove(ElementTags.BOOKMARKOPEN)) != null) {
         this.BookmarkOpen = bool.Parse(value);
     }
     section.Set(attributes);
     Add(section);
     return section;
 }
开发者ID:hjgode,项目名称:iTextSharpCF,代码行数:19,代码来源:Section.cs

示例9: GetInstance

 /// <summary>
 /// Returns an Image that has been constructed taking in account
 /// the value of some attributes.
 /// </summary>
 /// <param name="attributes">Some attributes</param>
 /// <returns>an Image</returns>
 public static Image GetInstance(Properties attributes)
 {
     string value = attributes.Remove(ElementTags.URL);
     if (value == null) throw new Exception("The URL of the image is missing.");
     Image image = Image.GetInstance(value);
     int align = Element.ALIGN_LEFT;
     if ((value = attributes.Remove(ElementTags.ALIGN)) != null) {
         if (ElementTags.ALIGN_LEFT.ToLower().Equals(value)) align |= Image.LEFT_ALIGN;
         else if (ElementTags.ALIGN_RIGHT.ToLower().Equals(value)) align |= Image.RIGHT_ALIGN;
         else if (ElementTags.ALIGN_MIDDLE.ToLower().Equals(value)) align |= Image.MIDDLE_ALIGN;
     }
     if ((value = attributes.Remove(ElementTags.UNDERLYING)) != null) {
         if (bool.Parse(value)) align |= Image.UNDERLYING;
     }
     if ((value = attributes.Remove(ElementTags.TEXTWRAP)) != null) {
         if (bool.Parse(value)) align |= Image.TEXTWRAP;
     }
     image.alignment = align;
     if ((value = attributes.Remove(ElementTags.ALT)) != null) {
         image.Alt = value;
     }
     string x;
     string y;
     if (((x = attributes.Remove(ElementTags.ABSOLUTEX)) != null)
         && ((y = attributes.Remove(ElementTags.ABSOLUTEY)) != null)) {
         image.SetAbsolutePosition(float.Parse(x), float.Parse(y, System.Globalization.NumberFormatInfo.InvariantInfo));
     }
     if ((value = attributes.Remove(ElementTags.PLAINWIDTH)) != null) {
         image.ScaleAbsoluteWidth(float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo));
     }
     if ((value = attributes.Remove(ElementTags.PLAINHEIGHT)) != null) {
         image.ScaleAbsoluteHeight(float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo));
     }
     if ((value = attributes.Remove(ElementTags.ROTATION)) != null) {
         image.Rotation = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
     }
     return image;
 }
开发者ID:hjgode,项目名称:iTextSharpCF,代码行数:44,代码来源:Image.cs

示例10: Chapter

 /// <summary>
 /// Creates a new Chapter following a set of attributes.
 /// </summary>
 /// <param name="attributes">the attributes</param>
 /// <param name="number">the Chapter number</param>
 /// <overoads>
 /// Has three overloads.
 /// </overoads>
 public Chapter(Properties attributes, int number)
     : this(new Paragraph(""), number)
 {
     string value;
     if ((value = attributes.Remove(ElementTags.NUMBERDEPTH)) != null)
     {
         this.NumberDepth = int.Parse(value);
     }
     if ((value = attributes.Remove(ElementTags.INDENT)) != null)
     {
         this.Indentation = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
     }
     if ((value = attributes.Remove(ElementTags.INDENTATIONLEFT)) != null)
     {
         this.IndentationLeft = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
     }
     if ((value = attributes.Remove(ElementTags.INDENTATIONRIGHT)) != null)
     {
         this.IndentationRight = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
     }
     if ((value = attributes.Remove(ElementTags.BOOKMARKOPEN)) != null)
     {
         this.BookmarkOpen = bool.Parse(value);
     }
 }
开发者ID:hjgode,项目名称:iTextSharpCF,代码行数:33,代码来源:Chapter.cs

示例11: HeaderFooter

 public HeaderFooter(Properties attributes) : base(0, 0, 0, 0) {
     string value;
     
     if ((value = attributes.Remove(ElementTags.NUMBERED)) != null) {
         this.numbered = bool.Parse(value);
     }
     if ((value = attributes.Remove(ElementTags.ALIGN)) != null) {
         this.SetAlignment(value);
     }
     if ((value = attributes.Remove("border")) != null) {
         this.Border = int.Parse(value);
     } else {
         this.Border = TOP_BORDER + BOTTOM_BORDER;
     }
 }
开发者ID:nicecai,项目名称:iTextSharp-4.1.6,代码行数:15,代码来源:HeaderFooter.cs

示例12: LoadProperties

 private static void LoadProperties()
 {
     if (propertiesLoaded)
     return;
     lock (allFonts) {
     if (propertiesLoaded)
         return;
     try {
         Stream isp = GetResourceStream(RESOURCE_PATH + "cjkfonts.properties");
         cjkFonts.Load(isp);
         isp.Close();
         isp = GetResourceStream(RESOURCE_PATH + "cjkencodings.properties");
         cjkEncodings.Load(isp);
         isp.Close();
     }
     catch {
         cjkFonts = new Properties();
         cjkEncodings = new Properties();
     }
     propertiesLoaded = true;
     }
 }
开发者ID:bmictech,项目名称:iTextSharp,代码行数:22,代码来源:CJKFont.cs

示例13: ReadFontProperties

 internal static Hashtable ReadFontProperties(String name)
 {
     try {
     name += ".properties";
     Stream isp = GetResourceStream(RESOURCE_PATH + name);
     Properties p = new Properties();
     p.Load(isp);
     isp.Close();
     IntHashtable W = CreateMetric(p["W"]);
     p.Remove("W");
     IntHashtable W2 = CreateMetric(p["W2"]);
     p.Remove("W2");
     Hashtable map = new Hashtable();
     foreach (string key in p.Keys) {
         map[key] = p[key];
     }
     map["W"] = W;
     map["W2"] = W2;
     return map;
     }
     catch {
     // empty on purpose
     }
     return null;
 }
开发者ID:bmictech,项目名称:iTextSharp,代码行数:25,代码来源:CJKFont.cs

示例14: GetChapter

 public static ChapterAutoNumber GetChapter(Properties attributes)
 {
     ChapterAutoNumber chapter = new ChapterAutoNumber("");
     SetSectionParameters(chapter, attributes);
     return chapter;
 }
开发者ID:bmictech,项目名称:iTextSharp,代码行数:6,代码来源:ElementFactory.cs

示例15: GetImage

        /// <summary>
        /// Returns an Image that has been constructed taking in account
        /// the value of some attributes.
        /// </summary>
        /// <param name="attributes">Some attributes</param>
        /// <returns>an Image</returns>
        public static Image GetImage(Properties attributes)
        {
            String value;

            value = attributes[ElementTags.URL];
            if (value == null)
                throw new ArgumentException("The URL of the image is missing.");
            Image image = Image.GetInstance(value);

            value = attributes[ElementTags.ALIGN];
            int align = 0;
            if (value != null) {
                if (Util.EqualsIgnoreCase(ElementTags.ALIGN_LEFT, value))
                    align |= Image.ALIGN_LEFT;
                else if (Util.EqualsIgnoreCase(ElementTags.ALIGN_RIGHT, value))
                    align |= Image.ALIGN_RIGHT;
                else if (Util.EqualsIgnoreCase(ElementTags.ALIGN_MIDDLE, value))
                    align |= Image.ALIGN_MIDDLE;
            }
            if (Util.EqualsIgnoreCase("true", attributes[ElementTags.UNDERLYING]))
                align |= Image.UNDERLYING;
            if (Util.EqualsIgnoreCase("true", attributes[ElementTags.TEXTWRAP]))
                align |= Image.TEXTWRAP;
            image.Alignment = align;

            value = attributes[ElementTags.ALT];
            if (value != null) {
                image.Alt = value;
            }

            String x = attributes[ElementTags.ABSOLUTEX];
            String y = attributes[ElementTags.ABSOLUTEY];
            if ((x != null) && (y != null)) {
                image.SetAbsolutePosition(float.Parse(x, System.Globalization.NumberFormatInfo.InvariantInfo),
                        float.Parse(y, System.Globalization.NumberFormatInfo.InvariantInfo));
            }
            value = attributes[ElementTags.PLAINWIDTH];
            if (value != null) {
                image.ScaleAbsoluteWidth(float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo));
            }
            value = attributes[ElementTags.PLAINHEIGHT];
            if (value != null) {
                image.ScaleAbsoluteHeight(float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo));
            }
            value = attributes[ElementTags.ROTATION];
            if (value != null) {
                image.Rotation = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
            }
            return image;
        }
开发者ID:bmictech,项目名称:iTextSharp,代码行数:56,代码来源:ElementFactory.cs


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