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

C# HashSet2类代码示例

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

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



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

示例1: RemoveLayers

 /// <summary>
 /// Removes layers from a PDF document </summary>
 /// <param name="reader">	a PdfReader containing a PDF document </param>
 /// <param name="layers">	a sequence of names of OCG layers </param>
 /// <exception cref="IOException"> </exception>
 public virtual void RemoveLayers(PdfReader reader, params string[] layers) {
     int n = reader.NumberOfPages;
     for (int i = 1; i <= n; i++)
         reader.SetPageContent(i, reader.GetPageContent(i));
     ICollection<string> ocgs = new HashSet2<string>();
     for (int i = 0; i < layers.Length; i++) {
         ocgs.Add(layers[i]);
     }
     OCGParser parser = new OCGParser(ocgs);
     for (int i = 1; i <= n; i++) {
         PdfDictionary page = reader.GetPageN(i);
         Parse(parser, page);
         page.Remove(PdfName.PIECEINFO);
         RemoveAnnots(page, ocgs);
         RemoveProperties(page, ocgs);
     }
     PdfDictionary root = reader.Catalog;
     PdfDictionary ocproperties = root.GetAsDict(PdfName.OCPROPERTIES);
     if (ocproperties != null) {
         RemoveOCGsFromArray(ocproperties, PdfName.OCGS, ocgs);
         PdfDictionary d = ocproperties.GetAsDict(PdfName.D);
         if (d != null) {
             RemoveOCGsFromArray(d, PdfName.ON, ocgs);
             RemoveOCGsFromArray(d, PdfName.OFF, ocgs);
             RemoveOCGsFromArray(d, PdfName.LOCKED, ocgs);
             RemoveOCGsFromArray(d, PdfName.RBGROUPS, ocgs);
             RemoveOCGsFromArray(d, PdfName.ORDER, ocgs);
             RemoveOCGsFromArray(d, PdfName.AS, ocgs);
         }
         PdfArray ocgsArray = ocproperties.GetAsArray(PdfName.OCGS);
         if (ocgsArray != null && ocgsArray.IsEmpty()) {
             root.Remove(PdfName.OCPROPERTIES);
             if (PdfName.USEOC.Equals(root.GetAsName(PdfName.PAGEMODE))) {
                 root.Remove(PdfName.PAGEMODE);
             }
         }
     }
     reader.RemoveUnusedObjects();
 }
开发者ID:yu0410aries,项目名称:itextsharp,代码行数:44,代码来源:OCGRemover.cs


示例2: SetAppearance

        virtual public void SetAppearance(PdfName ap, string state, PdfTemplate template) {
            PdfDictionary dicAp = (PdfDictionary)Get(PdfName.AP);
            if (dicAp == null)
                dicAp = new PdfDictionary();

            PdfDictionary dic;
            PdfObject obj = dicAp.Get(ap);
            if (obj != null && obj.IsDictionary())
                dic = (PdfDictionary)obj;
            else
                dic = new PdfDictionary();
            dic.Put(new PdfName(state), template.IndirectReference);
            dicAp.Put(ap, dic);
            Put(PdfName.AP, dicAp);
            if (!form)
                return;
            if (templates == null)
                templates = new HashSet2<PdfTemplate>();
            templates.Add(template);
        }
开发者ID:joshaxey,项目名称:Simple-PDFMerge,代码行数:20,代码来源:PdfAnnotation.cs


示例3: CheckLayer

        protected override void CheckLayer(PdfWriter writer, int key, Object obj1) {
            if (obj1 is IPdfOCG) {

            } else if (obj1 is PdfOCProperties) {
                PdfOCProperties properties = (PdfOCProperties)obj1;
                List<PdfDictionary> configsList = new List<PdfDictionary>();
                PdfDictionary d = GetDirectDictionary(properties.Get(PdfName.D));
                if (d != null)
                    configsList.Add(d);
                PdfArray configs = GetDirectArray(properties.Get(PdfName.CONFIGS));
                if (configs != null) {
                    for (int i = 0; i < configs.Size; i++) {
                        PdfDictionary config = GetDirectDictionary(configs[i]);
                        if (config != null)
                            configsList.Add(config);
                    }
                }
                HashSet2<PdfObject> ocgs = new HashSet2<PdfObject>();
                PdfArray ocgsArray = GetDirectArray(properties.Get(PdfName.OCGS));
                if (ocgsArray != null)
                    for (int i = 0; i < ocgsArray.Size; i++)
                        ocgs.Add(ocgsArray[i]);
                HashSet2<String> names = new HashSet2<String>();
                HashSet2<PdfObject> order = new HashSet2<PdfObject>();
                foreach (PdfDictionary config in configsList) {
                    PdfString name = config.GetAsString(PdfName.NAME);
                    if (name == null) {
                        throw new PdfAConformanceException(MessageLocalization.GetComposedMessage("optional.content.configuration.dictionary.shall.contain.name.entry"));
                    }
                    String name1 = name.ToUnicodeString();
                    if (names.Contains(name1)) {
                        throw new PdfAConformanceException(MessageLocalization.GetComposedMessage("value.of.name.entry.shall.be.unique.amongst.all.optional.content.configuration.dictionaries"));
                    }
                    names.Add(name1);
                    if (config.Contains(PdfName.AS)) {
                        throw new PdfAConformanceException(MessageLocalization.GetComposedMessage("the.as.key.shall.not.appear.in.any.optional.content.configuration.dictionary"));
                    }
                    PdfArray orderArray = GetDirectArray(config.Get(PdfName.ORDER));
                    if (orderArray != null)
                        FillOrderRecursively(orderArray, order);
                }
                if (order.Count != ocgs.Count) {
                    throw new PdfAConformanceException(MessageLocalization.GetComposedMessage("order.array.shall.contain.references.to.all.ocgs"));
                }
                ocgs.RetainAll(order);
                if (order.Count != ocgs.Count) {
                    throw new PdfAConformanceException(MessageLocalization.GetComposedMessage("order.array.shall.contain.references.to.all.ocgs"));
                }
            } else {

            }
        }
开发者ID:smartleos,项目名称:itextsharp,代码行数:52,代码来源:PdfA2Checker.cs


示例4: ApplyDashPattern

        private static Path ApplyDashPattern(Path path, LineDashPattern lineDashPattern) {
            HashSet2<int> modifiedSubpaths = new HashSet2<int>(path.ReplaceCloseWithLine());
            Path dashedPath = new Path();
            int currentSubpath = 0;

            foreach (Subpath subpath in path.Subpaths) {
                IList<Point2D> subpathApprox = subpath.GetPiecewiseLinearApproximation();

                if (subpathApprox.Count > 1) {
                    dashedPath.MoveTo((float) subpathApprox[0].GetX(), (float) subpathApprox[0].GetY());
                    float remainingDist = 0;
                    bool remainingIsGap = false;

                    for (int i = 1; i < subpathApprox.Count; ++i) {
                        Point2D nextPoint = null;

                        if (remainingDist != 0) {
                            nextPoint = GetNextPoint(subpathApprox[i - 1], subpathApprox[i], remainingDist);
                            remainingDist = ApplyDash(dashedPath, subpathApprox[i - 1], subpathApprox[i], nextPoint, remainingIsGap);
                        }

                        while ((Util.compare(remainingDist, 0) == 0) && !dashedPath.CurrentPoint.Equals(subpathApprox[i])) {
                            LineDashPattern.DashArrayElem currentElem = lineDashPattern.Next();
                            nextPoint = GetNextPoint(nextPoint ?? subpathApprox[i - 1], subpathApprox[i], currentElem.Value);
                            remainingDist = ApplyDash(dashedPath, subpathApprox[i - 1], subpathApprox[i], nextPoint, currentElem.IsGap);
                            remainingIsGap = currentElem.IsGap;
                        }
                    }

                    // If true, then the line closing the subpath was explicitly added (see Path.ReplaceCloseWithLine).
                    // This causes a loss of a visual effect of line join style parameter, so in this clause
                    // we simply add overlapping dash (or gap, no matter), which continues the last dash and equals to 
                    // the first dash (or gap) of the path.
                    if (modifiedSubpaths.Contains(currentSubpath)) {
                        lineDashPattern.Reset();
                        LineDashPattern.DashArrayElem currentElem = lineDashPattern.Next();
                        Point2D nextPoint = GetNextPoint(subpathApprox[0], subpathApprox[1], currentElem.Value);
                        ApplyDash(dashedPath, subpathApprox[0], subpathApprox[1], nextPoint, currentElem.IsGap);
                    }
                }

                // According to PDF spec. line dash pattern should be restarted for each new subpath.
                lineDashPattern.Reset();
                ++currentSubpath;
            }

            return dashedPath;
        }
开发者ID:htlp,项目名称:itextsharp,代码行数:48,代码来源:PdfCleanUpRegionFilter.cs


示例5: FillOrderRecursively

 private void FillOrderRecursively(PdfArray orderArray, HashSet2<PdfObject> order) {
     for (int i = 0; i < orderArray.Size; i++) {
         PdfArray orderChild = GetDirectArray(orderArray[i]);
         if (orderChild == null) {
             order.Add(orderArray[i]);
         } else {
             FillOrderRecursively(orderChild, order);
         }
     }
 }
开发者ID:smartleos,项目名称:itextsharp,代码行数:10,代码来源:PdfA2Checker.cs


示例6: MergeTextDecorationRules

        private String MergeTextDecorationRules(String oldRule, String newRule) {
            if (CSS.Value.NONE.Equals(newRule))
                return newRule;

            HashSet2<String> attrSet = new HashSet2<String>();
            if (oldRule != null)
                foreach (String attr in new Regex(@"\s+").Split(oldRule))
                    attrSet.Add(attr);
            if (newRule != null)
                foreach (String attr in new Regex(@"\s+").Split(newRule))
                    attrSet.Add(attr);
            StringBuilder resultantStr = new StringBuilder();
            foreach (String attr in attrSet) {
                if (attr.Equals(CSS.Value.NONE) || attr.Equals(CSS.Value.INHERIT))
                    continue;
                if (resultantStr.Length > 0)
                    resultantStr.Append(' ');
                resultantStr.Append(attr);
            }
            return resultantStr.Length == 0 ? null : resultantStr.ToString();
        }
开发者ID:yu0410aries,项目名称:itextsharp,代码行数:21,代码来源:StyleAttrCSSResolver.cs


示例7: PdfCleanUpContentOperator

 static PdfCleanUpContentOperator() {
     pathPaintingOperators = new HashSet2<string>(strokeOperators);
     pathPaintingOperators.AddAll(nwFillOperators);
     pathPaintingOperators.AddAll(eoFillOperators);
     pathPaintingOperators.Add("n");
 }
开发者ID:Niladri24dutta,项目名称:itextsharp,代码行数:6,代码来源:PdfCleanUpContentOperator.cs


示例8: TrueTypeFontSubSet

 /** Creates a new TrueTypeFontSubSet
  * @param directoryOffset The offset from the start of the file to the table directory
  * @param fileName the file name of the font
  * @param glyphsUsed the glyphs used
  * @param includeCmap <CODE>true</CODE> if the table cmap is to be included in the generated font
  */
 public TrueTypeFontSubSet(string fileName, RandomAccessFileOrArray rf, HashSet2<int> glyphsUsed, int directoryOffset, bool includeCmap, bool includeExtras) {
     this.fileName = fileName;
     this.rf = rf;
     this.glyphsUsed = glyphsUsed;
     this.includeCmap = includeCmap;
     this.includeExtras = includeExtras;
     this.directoryOffset = directoryOffset;
     glyphsInList = new List<int>(glyphsUsed);
 }
开发者ID:jagruti23,项目名称:itextsharp,代码行数:15,代码来源:TrueTypeFontSubSet.cs


示例9: PdfAChecker

 internal PdfAChecker(PdfAConformanceLevel conformanceLevel) {
     keysForCheck = InitKeysForCheck();
     this.conformanceLevel = conformanceLevel;
 }
开发者ID:Niladri24dutta,项目名称:itextsharp,代码行数:4,代码来源:PdfAChecker.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# HashTable类代码示例发布时间:2022-05-24
下一篇:
C# HashSet类代码示例发布时间: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