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


C# PwDatabase.GetCustomIcon方法代码示例

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


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

示例1: getIcon

 public static Image getIcon(PwDatabase db, ImageList imageList, PwUuid customIconId, PwIcon iconId)
 {
     if (!PwUuid.Zero.Equals(customIconId))
     {
         return db.GetCustomIcon(customIconId, 16, 16);
     }
     else
     {
         return imageList.Images[(int)iconId];
     }
 }
开发者ID:nein23,项目名称:KeePassContext,代码行数:11,代码来源:Util.cs

示例2: ExportGroup

        private static void ExportGroup(StringBuilder sb, PwGroup pg, uint uIndent,
			PwDatabase pd)
        {
            ExportData(sb, uIndent, "<DT><H3", null, false, null, false);
            ExportTimes(sb, pg);
            ExportData(sb, 0, ">", pg.Name, true, "</H3>", true);
            ExportData(sb, uIndent, "<DL><p>", null, false, null, true);

            foreach(PwGroup pgSub in pg.Groups)
            {
                ExportGroup(sb, pgSub, uIndent + 1, pd);
            }

            #if DEBUG
            List<string> l = new List<string>();
            l.Add("Tag 1");
            l.Add("Tag 2");
            Debug.Assert(StrUtil.TagsToString(l, false) == "Tag 1;Tag 2");
            #endif

            foreach(PwEntry pe in pg.Entries)
            {
                string strUrl = pe.Strings.ReadSafe(PwDefs.UrlField);
                if(strUrl.Length == 0) continue;

                // Encode only when really required; '&' does not need
                // to be encoded
                bool bEncUrl = (strUrl.IndexOfAny(new char[] {
                    '\"', '<', '>' }) >= 0);

                ExportData(sb, uIndent + 1, "<DT><A HREF=\"", strUrl, bEncUrl,
                    "\"", false);

                ExportTimes(sb, pe);

                if(!pe.CustomIconUuid.Equals(PwUuid.Zero) && (pd != null))
                {
                    try
                    {
                        Image imgIcon = pd.GetCustomIcon(pe.CustomIconUuid, 16, 16);
                        if(imgIcon != null)
                        {
                            using(MemoryStream msIcon = new MemoryStream())
                            {
                                imgIcon.Save(msIcon, ImageFormat.Png);
                                byte[] pbIcon = msIcon.ToArray();
                                string strIcon = StrUtil.DataToDataUri(pbIcon,
                                    "image/png");

                                ExportData(sb, 0, " ICON=\"", strIcon, false,
                                    "\"", false);
                            }
                        }
                        else { Debug.Assert(false); }
                    }
                    catch(Exception) { Debug.Assert(false); }
                }

                if(pe.Tags.Count > 0)
                {
                    string strTags = StrUtil.TagsToString(pe.Tags, false);
                    strTags = strTags.Replace(';', ','); // Without space

                    ExportData(sb, 0, " TAGS=\"", strTags, true, "\"", false);
                }

                string strTitle = pe.Strings.ReadSafe(PwDefs.TitleField);
                if(strTitle.Length == 0) strTitle = strUrl;

                ExportData(sb, 0, ">", strTitle, true, "</A>", true);

                string strNotes = pe.Strings.ReadSafe(PwDefs.NotesField);
                if(strNotes.Length > 0)
                    ExportData(sb, uIndent + 1, "<DD>", strNotes, true, null, true);
            }

            ExportData(sb, uIndent, "</DL><p>", null, false, null, true);
        }
开发者ID:Stoom,项目名称:KeePass,代码行数:78,代码来源:MozillaBookmarksHtml100.cs

示例3: GetIcon

        internal static Image GetIcon(PwDatabase pd, PwUuid pwUuid)
        {
            if(pd == null) { Debug.Assert(false); return null; }
            if(pwUuid == null) { Debug.Assert(false); return null; }

            int w = ScaleIntX(16);
            int h = ScaleIntY(16);

            return pd.GetCustomIcon(pwUuid, w, h);
        }
开发者ID:MikeA1,项目名称:keepass2,代码行数:10,代码来源:DpiUtil.cs

示例4: GetIconDrawable

        public Drawable GetIconDrawable(Resources res, PwDatabase db, PwUuid icon)
        {
            InitBlank (res);
            if (icon.Equals(PwUuid.Zero)) {
                return _blank;
            }
            Drawable draw;
            if (!_customIconMap.TryGetValue(icon, out draw))
            {
                Bitmap bitmap = db.GetCustomIcon(icon);

                // Could not understand custom icon
                if (bitmap == null) {
                    return _blank;
                }

                bitmap = resize (bitmap);

                draw = new BitmapDrawable(res, bitmap);
                _customIconMap[icon] = draw;
            }

            return draw;
        }
开发者ID:pythe,项目名称:wristpass,代码行数:24,代码来源:DrawableFactory.cs


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