本文整理汇总了C#中PwObjectList类的典型用法代码示例。如果您正苦于以下问题:C# PwObjectList类的具体用法?C# PwObjectList怎么用?C# PwObjectList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PwObjectList类属于命名空间,在下文中一共展示了PwObjectList类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: PerformGlobal
public static bool PerformGlobal(List<PwDatabase> vSources,
ImageList ilIcons)
{
Debug.Assert(vSources != null); if(vSources == null) return false;
IntPtr hWnd;
string strWindow;
try
{
hWnd = NativeMethods.GetForegroundWindow();
strWindow = NativeMethods.GetWindowText(hWnd);
}
catch(Exception) { Debug.Assert(false); hWnd = IntPtr.Zero; strWindow = null; }
if((strWindow == null) || (strWindow.Length == 0)) return false;
PwObjectList<PwEntry> m_vList = new PwObjectList<PwEntry>();
DateTime dtNow = DateTime.Now;
EntryHandler eh = delegate(PwEntry pe)
{
// Ignore expired entries
if(pe.Expires && (pe.ExpiryTime < dtNow)) return true;
if(GetSequenceForWindow(pe, strWindow, true) != null)
m_vList.Add(pe);
return true;
};
foreach(PwDatabase pwSource in vSources)
{
if(pwSource.IsOpen == false) continue;
pwSource.RootGroup.TraverseTree(TraversalMethod.PreOrder, null, eh);
}
if(m_vList.UCount == 1)
AutoType.PerformInternal(m_vList.GetAt(0), strWindow);
else if(m_vList.UCount > 1)
{
EntryListForm elf = new EntryListForm();
elf.InitEx(KPRes.AutoTypeEntrySelection, KPRes.AutoTypeEntrySelectionDescShort,
KPRes.AutoTypeEntrySelectionDescLong,
Properties.Resources.B48x48_KGPG_Key2, ilIcons, m_vList);
elf.EnsureForeground = true;
if(elf.ShowDialog() == DialogResult.OK)
{
try { NativeMethods.EnsureForegroundWindow(hWnd); }
catch(Exception) { Debug.Assert(false); }
if(elf.SelectedEntry != null)
AutoType.PerformInternal(elf.SelectedEntry, strWindow);
}
}
return true;
}
开发者ID:jonbws,项目名称:strengthreport,代码行数:60,代码来源:AutoType.cs
示例2: FindMatchingEntries
private IEnumerable<PwEntry> FindMatchingEntries(Request r, Aes aes)
{
string submithost = null;
string realm = null;
var list = new PwObjectList<PwEntry>();
string formhost, searchHost;
formhost = searchHost = GetHost(CryptoTransform(r.Url, true, false, aes, CMode.DECRYPT));
if (r.SubmitUrl != null) {
submithost = GetHost(CryptoTransform(r.SubmitUrl, true, false, aes, CMode.DECRYPT));
}
if (r.Realm != null)
realm = CryptoTransform(r.Realm, true, false, aes, CMode.DECRYPT);
var origSearchHost = searchHost;
var parms = MakeSearchParameters();
var root = host.Database.RootGroup;
while (list.UCount == 0 && (origSearchHost == searchHost || searchHost.IndexOf(".") != -1))
{
parms.SearchString = String.Format("^{0}$|/{0}/?", searchHost);
root.SearchEntries(parms, list);
searchHost = searchHost.Substring(searchHost.IndexOf(".") + 1);
if (searchHost == origSearchHost)
break;
}
Func<PwEntry, bool> filter = delegate(PwEntry e)
{
var title = e.Strings.ReadSafe(PwDefs.TitleField);
var entryUrl = e.Strings.ReadSafe(PwDefs.UrlField);
var c = GetEntryConfig(e);
if (c != null)
{
if (c.Allow.Contains(formhost) && (submithost == null || c.Allow.Contains(submithost)))
return true;
if (c.Deny.Contains(formhost) || (submithost != null && c.Deny.Contains(submithost)))
return false;
if (realm != null && c.Realm != realm)
return false;
}
if (title.StartsWith("http://") || title.StartsWith("https://"))
{
var u = new Uri(title);
if (formhost.Contains(u.Host))
return true;
}
if (entryUrl != null && entryUrl.StartsWith("http://") || entryUrl.StartsWith("https://"))
{
var u = new Uri(entryUrl);
if (formhost.Contains(u.Host))
return true;
}
return formhost.Contains(title) || (entryUrl != null && formhost.Contains(entryUrl));
};
return from e in list where filter(e) select e;
}
开发者ID:Aldjinn,项目名称:keepasshttp,代码行数:58,代码来源:Handlers.cs
示例3: InitEx
public void InitEx(string strTitle, string strDescShort,
string strDescLong, Image imgIcon, ImageList ilIcons,
PwObjectList<PwEntry> vEntries)
{
m_strTitle = strTitle;
m_strDescShort = strDescShort;
m_strDescLong = strDescLong;
m_imgIcon = imgIcon;
m_ilIcons = UIUtil.CloneImageList(ilIcons, true);
m_vEntries = vEntries;
}
开发者ID:amiryal,项目名称:keepass2,代码行数:11,代码来源:EntryListForm.cs
示例4: FindMatchingEntries
private IEnumerable<PwEntryDatabase> FindMatchingEntries(Request r, Aes aes)
{
string submithost = null;
string realm = null;
var listResult = new List<PwEntryDatabase>();
string formhost, searchHost;
formhost = searchHost = GetHost(CryptoTransform(r.Url, true, false, aes, CMode.DECRYPT));
if (r.SubmitUrl != null) {
submithost = GetHost(CryptoTransform(r.SubmitUrl, true, false, aes, CMode.DECRYPT));
}
if (r.Realm != null)
realm = CryptoTransform(r.Realm, true, false, aes, CMode.DECRYPT);
var origSearchHost = searchHost;
var parms = MakeSearchParameters();
List<PwDatabase> listDatabases = new List<PwDatabase>();
var configOpt = new ConfigOpt(this.host.CustomConfig);
if (configOpt.SearchInAllOpenedDatabases)
{
foreach (PwDocument doc in host.MainWindow.DocumentManager.Documents)
{
if (doc.Database.IsOpen)
{
listDatabases.Add(doc.Database);
}
}
}
else
{
listDatabases.Add(host.Database);
}
int listCount = 0;
foreach (PwDatabase db in listDatabases)
{
searchHost = origSearchHost;
//get all possible entries for given host-name
while (listResult.Count == listCount && (origSearchHost == searchHost || searchHost.IndexOf(".") != -1))
{
parms.SearchString = String.Format("^{0}$|/{0}/?", searchHost);
var listEntries = new PwObjectList<PwEntry>();
db.RootGroup.SearchEntries(parms, listEntries);
foreach (var le in listEntries)
{
listResult.Add(new PwEntryDatabase(le, db));
}
searchHost = searchHost.Substring(searchHost.IndexOf(".") + 1);
//searchHost contains no dot --> prevent possible infinite loop
if (searchHost == origSearchHost)
break;
}
listCount = listResult.Count;
}
Func<PwEntry, bool> filter = delegate(PwEntry e)
{
var title = e.Strings.ReadSafe(PwDefs.TitleField);
var entryUrl = e.Strings.ReadSafe(PwDefs.UrlField);
var c = GetEntryConfig(e);
if (c != null)
{
if (c.Allow.Contains(formhost) && (submithost == null || c.Allow.Contains(submithost)))
return true;
if (c.Deny.Contains(formhost) || (submithost != null && c.Deny.Contains(submithost)))
return false;
if (realm != null && c.Realm != realm)
return false;
}
if (title.StartsWith("http://") || title.StartsWith("https://"))
{
var u = new Uri(title);
if (formhost.Contains(u.Host))
return true;
}
if (entryUrl != null && entryUrl.StartsWith("http://") || entryUrl.StartsWith("https://"))
{
var u = new Uri(entryUrl);
if (formhost.Contains(u.Host))
return true;
}
return formhost.Contains(title) || (entryUrl != null && formhost.Contains(entryUrl));
};
return from e in listResult where filter(e.entry) select e;
}
开发者ID:nelsonst47,项目名称:keepasshttp,代码行数:88,代码来源:Handlers.cs
示例5: OnEntryAdd
private void OnEntryAdd(object sender, EventArgs e)
{
PwGroup pg = GetSelectedGroup();
Debug.Assert(pg != null); if(pg == null) return;
if(pg.IsVirtual)
{
MessageService.ShowWarning(KPRes.GroupCannotStoreEntries,
KPRes.SelectDifferentGroup);
return;
}
PwDatabase pwDb = m_docMgr.ActiveDatabase;
PwEntry pwe = new PwEntry(true, true);
pwe.Strings.Set(PwDefs.UserNameField, new ProtectedString(
pwDb.MemoryProtection.ProtectUserName,
pwDb.DefaultUserName));
ProtectedString psAutoGen = new ProtectedString(
pwDb.MemoryProtection.ProtectPassword);
PwGenerator.Generate(psAutoGen, Program.Config.PasswordGenerator.AutoGeneratedPasswordsProfile,
null, Program.PwGeneratorPool);
pwe.Strings.Set(PwDefs.PasswordField, psAutoGen);
int nExpireDays = Program.Config.Defaults.NewEntryExpiresInDays;
if(nExpireDays >= 0)
{
pwe.Expires = true;
pwe.ExpiryTime = DateTime.Now.AddDays(nExpireDays);
}
if((pg.IconId != PwIcon.Folder) && (pg.IconId != PwIcon.FolderOpen) &&
(pg.IconId != PwIcon.FolderPackage))
{
pwe.IconId = pg.IconId; // Inherit icon from group
}
pwe.CustomIconUuid = pg.CustomIconUuid;
// Temporarily assume that the entry is in pg; required for retrieving
// the default auto-type sequence
pwe.ParentGroup = pg;
PwEntryForm pForm = new PwEntryForm();
pForm.InitEx(pwe, PwEditMode.AddNewEntry, pwDb, m_ilCurrentIcons,
false, false);
if(UIUtil.ShowDialogAndDestroy(pForm) == DialogResult.OK)
{
pg.AddEntry(pwe, true);
UpdateUI(false, null, pwDb.UINeedsIconUpdate, null, true,
null, true, m_lvEntries);
PwObjectList<PwEntry> vSelect = new PwObjectList<PwEntry>();
vSelect.Add(pwe);
SelectEntries(vSelect, true, true);
EnsureVisibleEntry(pwe.Uuid);
}
else UpdateUI(false, null, pwDb.UINeedsIconUpdate, null,
pwDb.UINeedsIconUpdate, null, false);
}
开发者ID:amiryal,项目名称:keepass2,代码行数:60,代码来源:MainForm.cs
示例6: FindRefTarget
public static PwEntry FindRefTarget(string strFullRef, SprContext ctx,
out char chScan, out char chWanted)
{
chScan = char.MinValue;
chWanted = char.MinValue;
if(strFullRef == null) { Debug.Assert(false); return null; }
if(!strFullRef.StartsWith(StrRefStart, SprEngine.ScMethod) ||
!strFullRef.EndsWith(StrRefEnd, SprEngine.ScMethod))
return null;
if((ctx == null) || (ctx.Database == null)) { Debug.Assert(false); return null; }
string strRef = strFullRef.Substring(StrRefStart.Length,
strFullRef.Length - StrRefStart.Length - StrRefEnd.Length);
if(strRef.Length <= 4) return null;
if(strRef[1] != '@') return null;
if(strRef[3] != ':') return null;
chScan = char.ToUpper(strRef[2]);
chWanted = char.ToUpper(strRef[0]);
SearchParameters sp = SearchParameters.None;
sp.SearchString = strRef.Substring(4);
sp.RespectEntrySearchingDisabled = false;
if(chScan == 'T') sp.SearchInTitles = true;
else if(chScan == 'U') sp.SearchInUserNames = true;
else if(chScan == 'A') sp.SearchInUrls = true;
else if(chScan == 'P') sp.SearchInPasswords = true;
else if(chScan == 'N') sp.SearchInNotes = true;
else if(chScan == 'I') sp.SearchInUuids = true;
else if(chScan == 'O') sp.SearchInOther = true;
else return null;
PwObjectList<PwEntry> lFound = new PwObjectList<PwEntry>();
ctx.Database.RootGroup.SearchEntries(sp, lFound);
return ((lFound.UCount > 0) ? lFound.GetAt(0) : null);
}
开发者ID:dbremner,项目名称:keepass2,代码行数:39,代码来源:SprEngine.cs
示例7: OnEntryDuplicate
private void OnEntryDuplicate(object sender, EventArgs e)
{
PwGroup pgSelected = GetSelectedGroup();
PwEntry[] vSelected = GetSelectedEntries();
if((vSelected == null) || (vSelected.Length == 0)) return;
PwObjectList<PwEntry> vNewEntries = new PwObjectList<PwEntry>();
foreach(PwEntry pe in vSelected)
{
PwEntry peNew = pe.CloneDeep();
peNew.Uuid = new PwUuid(true); // Create new UUID
ProtectedString psTitle = peNew.Strings.Get(PwDefs.TitleField);
if(psTitle != null)
peNew.Strings.Set(PwDefs.TitleField, new ProtectedString(
psTitle.IsProtected, psTitle.ReadString() + " - " +
KPRes.CopyOfItem));
Debug.Assert(pe.ParentGroup == peNew.ParentGroup);
PwGroup pg = (pe.ParentGroup ?? pgSelected);
if((pg == null) && (m_docMgr.ActiveDocument != null))
pg = m_docMgr.ActiveDatabase.RootGroup;
if(pg == null) continue;
pg.AddEntry(peNew, true, true);
vNewEntries.Add(peNew);
}
AddEntriesToList(vNewEntries);
SelectEntries(vNewEntries, true);
if((m_lvEntries.ShowGroups == false) && (m_lvEntries.Items.Count >= 1))
m_lvEntries.EnsureVisible(m_lvEntries.Items.Count - 1);
else EnsureVisibleSelected(true);
UpdateUIState(true);
}
开发者ID:elitak,项目名称:keepass,代码行数:38,代码来源:MainForm.cs
示例8: ReadDeletedObjects
/*
private void ReadDeletedObjects(XmlNode xmlNode, PwObjectList<PwDeletedObject> list)
{
ProcessNode(xmlNode);
foreach(XmlNode xmlChild in xmlNode.ChildNodes)
{
if(xmlChild.Name == ElemDeletedObject)
list.Add(ReadDeletedObject(xmlChild));
else ReadUnknown(xmlChild);
}
}
private PwDeletedObject ReadDeletedObject(XmlNode xmlNode)
{
ProcessNode(xmlNode);
PwDeletedObject pdo = new PwDeletedObject();
foreach(XmlNode xmlChild in xmlNode.ChildNodes)
{
if(xmlChild.Name == ElemUuid)
pdo.Uuid = ReadUuid(xmlChild);
else if(xmlChild.Name == ElemDeletionTime)
pdo.DeletionTime = ReadTime(xmlChild);
else ReadUnknown(xmlChild);
}
return pdo;
}
*/
private void ReadHistory(XmlNode xmlNode, PwObjectList<PwEntry> plStorage)
{
ProcessNode(xmlNode);
foreach(XmlNode xmlChild in xmlNode.ChildNodes)
{
if(xmlChild.Name == ElemEntry)
{
plStorage.Add(ReadEntry(xmlChild));
}
else ReadUnknown(xmlChild);
}
}
开发者ID:jonbws,项目名称:strengthreport,代码行数:43,代码来源:Kdb4File.Read.Dom.cs
示例9: EntriesHaveSameParent
public static bool EntriesHaveSameParent(PwObjectList<PwEntry> v)
{
if(v == null) { Debug.Assert(false); return true; }
if(v.UCount == 0) return true;
PwGroup pg = v.GetAt(0).ParentGroup;
foreach(PwEntry pe in v)
{
if(pe.ParentGroup != pg) return false;
}
return true;
}
开发者ID:rdealexb,项目名称:keepass,代码行数:13,代码来源:EntryUtil.cs
示例10: SelectEntries
internal void SelectEntries(PwObjectList<PwEntry> lEntries,
bool bDeselectOthers, bool bFocusFirst)
{
++m_uBlockEntrySelectionEvent;
bool bFirst = true;
for(int i = 0; i < m_lvEntries.Items.Count; ++i)
{
PwEntry pe = ((PwListItem)m_lvEntries.Items[i].Tag).Entry;
if(pe == null) { Debug.Assert(false); continue; }
bool bFound = false;
foreach(PwEntry peFocus in lEntries)
{
if(pe == peFocus)
{
m_lvEntries.Items[i].Selected = true;
if(bFirst && bFocusFirst)
{
UIUtil.SetFocusedItem(m_lvEntries,
m_lvEntries.Items[i], false);
bFirst = false;
}
bFound = true;
break;
}
}
if(bDeselectOthers && !bFound)
m_lvEntries.Items[i].Selected = false;
}
--m_uBlockEntrySelectionEvent;
}
开发者ID:riking,项目名称:go-keepass2,代码行数:36,代码来源:MainForm_Functions.cs
示例11: ShowEntriesByTag
internal void ShowEntriesByTag(string strTag)
{
if(strTag == null) { Debug.Assert(false); return; }
if(strTag.Length == 0) return; // No assert
PwDatabase pd = m_docMgr.ActiveDatabase;
if((pd == null) || !pd.IsOpen) return; // No assert (call from trigger)
PwObjectList<PwEntry> vEntries = new PwObjectList<PwEntry>();
pd.RootGroup.FindEntriesByTag(strTag, vEntries, true);
PwGroup pgResults = new PwGroup(true, true);
pgResults.IsVirtual = true;
foreach(PwEntry pe in vEntries) pgResults.AddEntry(pe, false);
UpdateUI(false, null, false, null, true, pgResults, false);
}
开发者ID:riking,项目名称:go-keepass2,代码行数:17,代码来源:MainForm_Functions.cs
示例12: Clear
private void Clear()
{
m_pgRootGroup = null;
m_vDeletedObjects = new PwObjectList<PwDeletedObject>();
m_uuidDataCipher = StandardAesEngine.AesUuid;
m_caCompression = PwCompressionAlgorithm.GZip;
m_uKeyEncryptionRounds = PwDefs.DefaultKeyEncryptionRounds;
m_pwUserKey = null;
m_memProtConfig = new MemoryProtectionConfig();
m_vCustomIcons = new List<PwCustomIcon>();
m_strName = string.Empty;
m_strDesc = string.Empty;
m_strDefaultUserName = string.Empty;
m_bUINeedsIconUpdate = true;
m_ioSource = new IOConnectionInfo();
m_bDatabaseOpened = false;
m_bModified = false;
m_pwLastSelectedGroup = PwUuid.Zero;
m_pwLastTopVisibleGroup = PwUuid.Zero;
m_pbHashOfFileOnDisk = null;
m_pbHashOfLastIO = null;
}
开发者ID:jonbws,项目名称:strengthreport,代码行数:31,代码来源:PwDatabase.cs
示例13: OnEntryDuplicate
private void OnEntryDuplicate(object sender, EventArgs e)
{
PwDatabase pd = m_docMgr.ActiveDatabase;
PwGroup pgSelected = GetSelectedGroup();
PwEntry[] vSelected = GetSelectedEntries();
if((vSelected == null) || (vSelected.Length == 0)) return;
DuplicationForm dlg = new DuplicationForm();
if(UIUtil.ShowDialogAndDestroy(dlg) != DialogResult.OK) return;
PwObjectList<PwEntry> vNewEntries = new PwObjectList<PwEntry>();
foreach(PwEntry pe in vSelected)
{
PwEntry peNew = pe.CloneDeep();
peNew.SetUuid(new PwUuid(true), true); // Create new UUID
if(dlg.AppendCopyToTitles && (pd != null))
{
string strTitle = peNew.Strings.ReadSafe(PwDefs.TitleField);
peNew.Strings.Set(PwDefs.TitleField, new ProtectedString(
pd.MemoryProtection.ProtectTitle, strTitle + " - " +
KPRes.CopyOfItem));
}
if(dlg.ReplaceDataByFieldRefs && (pd != null))
{
string strUser = @"{REF:[email protected]:" + pe.Uuid.ToHexString() + @"}";
peNew.Strings.Set(PwDefs.UserNameField, new ProtectedString(
pd.MemoryProtection.ProtectUserName, strUser));
string strPw = @"{REF:[email protected]:" + pe.Uuid.ToHexString() + @"}";
peNew.Strings.Set(PwDefs.PasswordField, new ProtectedString(
pd.MemoryProtection.ProtectPassword, strPw));
}
Debug.Assert(pe.ParentGroup == peNew.ParentGroup);
PwGroup pg = (pe.ParentGroup ?? pgSelected);
if((pg == null) && (pd != null)) pg = pd.RootGroup;
if(pg == null) continue;
pg.AddEntry(peNew, true, true);
vNewEntries.Add(peNew);
}
AddEntriesToList(vNewEntries);
SelectEntries(vNewEntries, true, false);
if(!m_lvEntries.ShowGroups && (m_lvEntries.Items.Count >= 1))
m_lvEntries.EnsureVisible(m_lvEntries.Items.Count - 1);
else EnsureVisibleSelected(true);
UpdateUIState(true, m_lvEntries);
}
开发者ID:amiryal,项目名称:keepass2,代码行数:54,代码来源:MainForm.cs
示例14: ApplyDeletions
/// <summary>
/// Apply a list of deleted objects.
/// </summary>
/// <param name="listDelObjects">List of deleted objects.</param>
private void ApplyDeletions(PwObjectList<PwDeletedObject> listDelObjects,
bool bCopyDeletionInfoToLocal)
{
Debug.Assert(listDelObjects != null); if(listDelObjects == null) throw new ArgumentNullException("listDelObjects");
LinkedList<PwGroup> listGroupsToDelete = new LinkedList<PwGroup>();
LinkedList<PwEntry> listEntriesToDelete = new LinkedList<PwEntry>();
GroupHandler gh = delegate(PwGroup pg)
{
if(pg == m_pgRootGroup) return true;
foreach(PwDeletedObject pdo in listDelObjects)
{
if(pg.Uuid.EqualsValue(pdo.Uuid))
if(pg.LastModificationTime < pdo.DeletionTime)
listGroupsToDelete.AddLast(pg);
}
return true;
};
EntryHandler eh = delegate(PwEntry pe)
{
foreach(PwDeletedObject pdo in listDelObjects)
{
if(pe.Uuid.EqualsValue(pdo.Uuid))
if(pe.LastModificationTime < pdo.DeletionTime)
listEntriesToDelete.AddLast(pe);
}
return true;
};
m_pgRootGroup.TraverseTree(TraversalMethod.PreOrder, gh, eh);
foreach(PwGroup pg in listGroupsToDelete)
pg.ParentGroup.Groups.Remove(pg);
foreach(PwEntry pe in listEntriesToDelete)
pe.ParentGroup.Entries.Remove(pe);
if(bCopyDeletionInfoToLocal)
{
foreach(PwDeletedObject pdoNew in listDelObjects)
{
bool bCopy = true;
foreach(PwDeletedObject pdoLocal in m_vDeletedObjects)
{
if(pdoNew.Uuid.EqualsValue(pdoLocal.Uuid))
{
bCopy = false;
if(pdoNew.DeletionTime > pdoLocal.DeletionTime)
pdoLocal.DeletionTime = pdoNew.DeletionTime;
break;
}
}
if(bCopy) m_vDeletedObjects.Add(pdoNew);
}
}
}
开发者ID:jonbws,项目名称:strengthreport,代码行数:68,代码来源:PwDatabase.cs
示例15: OnFilterKeyDown
private void OnFilterKeyDown(object sender, KeyEventArgs e)
{
if((e.KeyCode == Keys.Return) || (e.KeyCode == Keys.Enter))
{
e.SuppressKeyPress = true;
SearchParameters sp = new SearchParameters();
sp.SearchString = m_tbFilter.Text;
sp.SearchInPasswords = true;
PwObjectList<PwEntry> lResults = new PwObjectList<PwEntry>();
m_pgEntrySource.SearchEntries(sp, lResults);
UIUtil.CreateEntryList(m_lvEntries, lResults, m_vColumns, m_ilIcons);
}
}
开发者ID:rassilon,项目名称:keepass,代码行数:16,代码来源:FieldRefForm.cs
示例16: IdMatchesMultipleTimes
private bool IdMatchesMultipleTimes(string strSearch, char tchField)
{
if(m_pgEntrySource == null) { Debug.Assert(false); return false; }
SearchParameters sp = SearchParameters.None;
sp.SearchString = strSearch;
sp.RespectEntrySearchingDisabled = false;
if(tchField == 'T') sp.SearchInTitles = true;
else if(tchField == 'U') sp.SearchInUserNames = true;
else if(tchField == 'P') sp.SearchInPasswords = true;
else if(tchField == 'A') sp.SearchInUrls = true;
else if(tchField == 'N') sp.SearchInNotes = true;
else if(tchField == 'I') sp.SearchInUuids = true;
else { Debug.Assert(false); return true; }
PwObjectList<PwEntry> l = new PwObjectList<PwEntry>();
m_pgEntrySource.SearchEntries(sp, l);
if(l.UCount == 0) { Debug.Assert(false); return false; }
else if(l.UCount == 1) return false;
return true;
}
开发者ID:rassilon,项目名称:keepass,代码行数:24,代码来源:FieldRefForm.cs
示例17: SelectEntries
private void SelectEntries(PwObjectList<PwEntry> lEntries, bool bDeselectOthers)
{
m_bBlockEntrySelectionEvent = true;
for(int i = 0; i < m_lvEntries.Items.Count; ++i)
{
PwEntry pe = (m_lvEntries.Items[i].Tag as PwEntry);
if(pe == null) { Debug.Assert(false); continue; }
bool bFound = false;
foreach(PwEntry peFocus in lEntries)
{
if(pe == peFocus)
{
m_lvEntries.Items[i].Selected = true;
bFound = true;
break;
}
}
if(bDeselectOthers && !bFound)
m_lvEntries.Items[i].Selected = false;
}
m_bBlockEntrySelectionEvent = false;
}
开发者ID:elitak,项目名称:keepass,代码行数:26,代码来源:MainForm_Functions.cs
示例18: OnShowEntriesByTag
private void OnShowEntriesByTag(object sender, DynamicMenuEventArgs e)
{
string strTag = (e.Tag as string);
if(strTag == null) { Debug.Assert(false); return; }
if(strTag.Length == 0) return; // No assert
PwDatabase pd = m_docMgr.ActiveDatabase;
if((pd == null) || !pd.IsOpen) { Debug.Assert(false); return; }
PwObjectList<PwEntry> vEntries = new PwObjectList<PwEntry>();
pd.RootGroup.FindEntriesByTag(strTag, vEntries, true);
PwGroup pgResults = new PwGroup(true, true);
pgResults.IsVirtual = true;
foreach(PwEntry pe in vEntries) pgResults.AddEntry(pe, false);
UpdateUI(false, null, false, null, true, pgResults, false);
}
开发者ID:elitak,项目名称:keepass,代码行数:18,代码来源:MainForm_Functions.cs
示例19: OnEntryViewLinkClicked
private void OnEntryViewLinkClicked(object sender, LinkClickedEventArgs e)
{
string strLink = e.LinkText;
if(string.IsNullOrEmpty(strLink)) { Debug.Assert(false); return; }
PwEntry pe = GetSelectedEntry(false);
ProtectedBinary pb = ((pe != null) ? pe.Binaries.Get(strLink) : null);
string strEntryUrl = string.Empty;
if(pe != null)
strEntryUrl = SprEngine.Compile(pe.Strings.ReadSafe(PwDefs.UrlField),
GetEntryListSprContext(pe, m_docMgr.SafeFindContainerOf(pe)));
if((pe != null) && (pe.ParentGroup != null) &&
(pe.ParentGroup.Name == strLink))
{
UpdateUI(false, null, true, pe.ParentGroup, true, null, false);
EnsureVisibleSelected(false);
ResetDefaultFocus(m_lvEntries);
}
else if(strEntryUrl == strLink)
PerformDefaultUrlAction(null, false);
else if(pb != null)
ExecuteBinaryEditView(strLink, pb);
else if(strLink.StartsWith(SprEngine.StrRefStart, StrUtil.CaseIgnoreCmp) &&
strLink.EndsWith(SprEngine.StrRefEnd, StrUtil.CaseIgnoreCmp))
{
// If multiple references are amalgamated, only use first one
string strFirstRef = strLink;
int iEnd = strLink.IndexOf(SprEngine.StrRefEnd, StrUtil.CaseIgnoreCmp);
if(iEnd != (strLink.Length - SprEngine.StrRefEnd.Length))
strFirstRef = strLink.Substring(0, iEnd + 1);
char chScan, chWanted;
PwEntry peRef = SprEngine.FindRefTarget(strFirstRef, GetEntryListSprContext(
pe, m_docMgr.SafeFindContainerOf(pe)), out chScan, out chWanted);
if(peRef != null)
{
UpdateUI(false, null, true, peRef.ParentGroup, true, null,
false, m_lvEntries);
PwObjectList<PwEntry> lSel = new PwObjectList<PwEntry>();
lSel.Add(peRef);
SelectEntries(lSel, true, true);
EnsureVisibleSelected(false);
ShowEntryDetails(peRef);
}
}
else WinUtil.OpenUrl(strLink, pe);
}
开发者ID:amiryal,项目名称:keepass2,代码行数:49,代码来源:MainForm.cs
示例20: GetPossibleTemplates
public static PwObjectList<PwEntry> GetPossibleTemplates(IPluginHost m_host)
{
PwObjectList<PwEntry> entries = new PwObjectList<PwEntry>();
PwGroup group = template_group(m_host);
if (group == null)
return entries;
PwObjectList<PwEntry> all_entries = group.GetEntries(true);
foreach (PwEntry entry in all_entries) {
if (entry.Strings.Exists("_etm_template"))
entries.Add(entry);
}
return entries;
}
开发者ID:mitchcapper,项目名称:KPEntryTemplates,代码行数:13,代码来源:EntryTemplateManager.cs
注:本文中的PwObjectList类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论