本文整理汇总了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];
}
}
示例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);
}
示例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);
}
示例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;
}