本文整理汇总了C#中PwEntry.RemoveTag方法的典型用法代码示例。如果您正苦于以下问题:C# PwEntry.RemoveTag方法的具体用法?C# PwEntry.RemoveTag怎么用?C# PwEntry.RemoveTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PwEntry
的用法示例。
在下文中一共展示了PwEntry.RemoveTag方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateKeePassEntry
public static void UpdateKeePassEntry(PwEntry entry,
string username = "",
string title = "",
string url = "",
string notes = "",
string password = "",
string[] attachments = null,
string[] tags = null)
{
UpdateValue(entry, "UserName", username);
UpdateValue(entry, "Title", title);
UpdateValue(entry, "URL", url);
UpdateValue(entry, "Notes", notes);
UpdateValue(entry, "Password", password);
if(tags != null)
{
var tagsCopy = entry.Tags.ToArray();
foreach(var tag in tagsCopy)
entry.RemoveTag(tag);
foreach (var tag in tags)
entry.AddTag(tag);
}
if (attachments != null)
{
var fileNames = attachments.Select(o => Path.GetFileName(o)).ToList();
var binaries = entry.Binaries.CloneDeep();
var filesToAdd = new List<string>();
foreach(var binary in binaries)
{
entry.Binaries.Remove(binary.Key);
}
foreach(var attachment in attachments)
{
var fileName = Path.GetFileName(attachment);
var bytes = File.ReadAllBytes(attachment);
if(bytes != null)
{
var protectedBytes = new ProtectedBinary(true, bytes);
entry.Binaries.Set(fileName, protectedBytes);
}
}
}
}