本文整理汇总了C#中PwEntry.CloneDeep方法的典型用法代码示例。如果您正苦于以下问题:C# PwEntry.CloneDeep方法的具体用法?C# PwEntry.CloneDeep怎么用?C# PwEntry.CloneDeep使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PwEntry
的用法示例。
在下文中一共展示了PwEntry.CloneDeep方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateProxyNode
/// <summary>
/// creates a new ProxyNode for the specified user. This Proxy can be used to mark a
/// PwGroup as "shared" to this user.
/// </summary>
/// <param name="name">oldUserName you want to have a proxyNode of</param>
/// <returns>PwEntry ProxyNode of the specified user</returns>
public static PwEntry CreateProxyNode(PwEntry rootNode)
{
Debug.Assert(rootNode != null, "CreateProxy got rootNode==null!");
string uuid = rootNode.Strings.Exists(KeeShare.UuidLinkField) ? rootNode.Strings.ReadSafe(KeeShare.UuidLinkField) : rootNode.Uuid.ToHexString();
PwEntry proxy = rootNode.CloneDeep();
proxy.SetUuid(new PwUuid(true), false);
Debug.Assert(KeeShare.UuidLinkField != "", "CreateProxy has an empty linkIdentifier!");
proxy.Strings.Set(KeeShare.UuidLinkField, new ProtectedString(true, uuid));
Debug.Assert(proxy != null, "CreateProxy would return null!");
return proxy;
}
示例2: CreateEntry
private static void CreateEntry(PwEntry peTemplate)
{
if(peTemplate == null) { Debug.Assert(false); return; }
PwDatabase pd = Program.MainForm.ActiveDatabase;
if(pd == null) { Debug.Assert(false); return; }
if(pd.IsOpen == false) { Debug.Assert(false); return; }
PwGroup pgContainer = Program.MainForm.GetSelectedGroup();
if(pgContainer == null) pgContainer = pd.RootGroup;
PwEntry pe = peTemplate.Duplicate();
if(EntryTemplates.EntryCreating != null)
EntryTemplates.EntryCreating(null, new TemplateEntryEventArgs(
peTemplate.CloneDeep(), pe));
PwEntryForm pef = new PwEntryForm();
pef.InitEx(pe, PwEditMode.AddNewEntry, pd, Program.MainForm.ClientIcons,
false, true);
if(UIUtil.ShowDialogAndDestroy(pef) == DialogResult.OK)
{
pgContainer.AddEntry(pe, true, true);
MainForm mf = Program.MainForm;
if(mf != null)
{
mf.UpdateUI(false, null, pd.UINeedsIconUpdate, null,
true, null, true);
PwObjectList<PwEntry> vSelect = new PwObjectList<PwEntry>();
vSelect.Add(pe);
mf.SelectEntries(vSelect, true, true);
mf.EnsureVisibleEntry(pe.Uuid);
mf.UpdateUI(false, null, false, null, false, null, false);
}
else { Debug.Assert(false); }
if(EntryTemplates.EntryCreated != null)
EntryTemplates.EntryCreated(null, new TemplateEntryEventArgs(
peTemplate.CloneDeep(), pe));
}
else Program.MainForm.UpdateUI(false, null, pd.UINeedsIconUpdate, null,
pd.UINeedsIconUpdate, null, false);
}
示例3: OnCreate
protected override void OnCreate(Bundle savedInstanceState)
{
ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(this);
long usageCount = prefs.GetLong(GetString(Resource.String.UsageCount_key), 0);
ISharedPreferencesEditor edit = prefs.Edit();
edit.PutLong(GetString(Resource.String.UsageCount_key), usageCount + 1);
edit.Commit();
_showPassword =
!prefs.GetBoolean(GetString(Resource.String.maskpass_key), Resources.GetBoolean(Resource.Boolean.maskpass_default));
base.OnCreate(savedInstanceState);
RequestWindowFeature(WindowFeatures.IndeterminateProgress);
new ActivityDesign(this).ApplyTheme();
SetEntryView();
Database db = App.Kp2a.GetDb();
// Likely the app has been killed exit the activity
if (!db.Loaded || (App.Kp2a.QuickLocked))
{
Finish();
return;
}
SetResult(KeePass.ExitNormal);
Intent i = Intent;
PwUuid uuid = new PwUuid(MemUtil.HexStringToByteArray(i.GetStringExtra(KeyEntry)));
_pos = i.GetIntExtra(KeyRefreshPos, -1);
_appTask = AppTask.GetTaskInOnCreate(savedInstanceState, Intent);
Entry = db.Entries[uuid];
Android.Util.Log.Debug("KP2A", "Notes: " + Entry.Strings.ReadSafe(PwDefs.NotesField));
// Refresh Menu contents in case onCreateMenuOptions was called before Entry was set
ActivityCompat.InvalidateOptionsMenu(this);
// Update last access time.
Entry.Touch(false);
if (PwDefs.IsTanEntry(Entry) && prefs.GetBoolean(GetString(Resource.String.TanExpiresOnUse_key), Resources.GetBoolean(Resource.Boolean.TanExpiresOnUse_default)) && ((Entry.Expires == false) || Entry.ExpiryTime > DateTime.Now))
{
PwEntry backupEntry = Entry.CloneDeep();
Entry.ExpiryTime = DateTime.Now;
Entry.Expires = true;
Entry.Touch(true);
RequiresRefresh();
UpdateEntry update = new UpdateEntry(this, App.Kp2a, backupEntry, Entry, null);
ProgressTask pt = new ProgressTask(App.Kp2a, this, update);
pt.Run();
}
FillData();
SetupEditButtons();
SetupMoveButtons ();
App.Kp2a.GetDb().LastOpenedEntry = new PwEntryOutput(Entry, App.Kp2a.GetDb().KpDatabase);
_pluginActionReceiver = new PluginActionReceiver(this);
RegisterReceiver(_pluginActionReceiver, new IntentFilter(Strings.ActionAddEntryAction));
_pluginFieldReceiver = new PluginFieldReceiver(this);
RegisterReceiver(_pluginFieldReceiver, new IntentFilter(Strings.ActionSetEntryField));
new Thread(NotifyPluginsOnOpen).Start();
//the rest of the things to do depends on the current app task:
_appTask.CompleteOnCreateEntryActivity(this);
}
示例4: CreateEntry
private static void CreateEntry(PwEntry peTemplate)
{
if(peTemplate == null) { Debug.Assert(false); return; }
PwDatabase pd = Program.MainForm.ActiveDatabase;
if(pd == null) { Debug.Assert(false); return; }
if(pd.IsOpen == false) { Debug.Assert(false); return; }
PwGroup pgContainer = Program.MainForm.GetSelectedGroup();
if(pgContainer == null) pgContainer = pd.RootGroup;
PwEntry pe = peTemplate.CloneDeep();
pe.SetUuid(new PwUuid(true), true);
pe.CreationTime = pe.LastModificationTime = pe.LastAccessTime = DateTime.Now;
if(EntryTemplates.EntryCreating != null)
EntryTemplates.EntryCreating(null, new TemplateEntryEventArgs(
peTemplate.CloneDeep(), pe));
PwEntryForm pef = new PwEntryForm();
pef.InitEx(pe, PwEditMode.AddNewEntry, pd, Program.MainForm.ClientIcons,
false, true);
if(UIUtil.ShowDialogAndDestroy(pef) == DialogResult.OK)
{
pgContainer.AddEntry(pe, true, true);
if(EntryTemplates.EntryCreated != null)
EntryTemplates.EntryCreated(null, new TemplateEntryEventArgs(
peTemplate.CloneDeep(), pe));
// Program.MainForm.UpdateEntryList(null, true);
// Program.MainForm.UpdateUIState(true);
Program.MainForm.UpdateUI(false, null, pd.UINeedsIconUpdate, null,
true, null, true);
}
else Program.MainForm.UpdateUI(false, null, pd.UINeedsIconUpdate, null,
pd.UINeedsIconUpdate, null, false);
}
示例5: IsSimilarTo
/// <summary>
/// The function compares two PwEntries in every scope except the Uuid
/// </summary>
/// <param name="entry1">the first entry</param>
/// <param name="entry2">the second entry</param>
/// <param name="bIgnoreKeeShareFields">Should the KeeShare-specific fields be ignored?</param>
/// <returns>True if both entries are equal in all field, accordingly to the parametersettings</returns>
public static bool IsSimilarTo(this PwEntry entry1, PwEntry entry2, bool bIgnoreKeeShareFields)
{
//if both are null they are equal
if (entry1 == null && entry2 == null)
{
return true;
}
//if only one of them is null we could not clone it => they are not equal
if (entry1 == null || entry2 == null)
{
return false;
}
PwEntry copy1 = entry1.CloneDeep();
PwEntry copy2 = entry2.CloneDeep();
if (bIgnoreKeeShareFields)
{
copy1.Strings.Remove(KeeShare.UuidLinkField);
copy2.Strings.Remove(KeeShare.UuidLinkField);
}
//we have to make the Uuids and creation times equal, because PwEntry.EqualsEntry compares these too
//and returns false if they are not equal!!
copy1.SetUuid(copy2.Uuid, false);
copy1.CreationTime = copy2.CreationTime;
PwCompareOptions opts = PwCompareOptions.IgnoreHistory
| PwCompareOptions.IgnoreLastAccess
| PwCompareOptions.IgnoreLastBackup
| PwCompareOptions.IgnoreLastMod
| PwCompareOptions.IgnoreParentGroup
| PwCompareOptions.IgnoreTimes;
return copy1.EqualsEntry(copy2, opts, MemProtCmpMode.Full);
}