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


C# PwEntry.EqualsEntry方法代码示例

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


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

示例1: SaveEntry

        private bool SaveEntry(PwEntry peTarget, bool bValidate)
        {
            if(m_pwEditMode == PwEditMode.ViewReadOnlyEntry) return true;

            if(bValidate && !m_icgPassword.ValidateData(true)) return false;

            if(this.EntrySaving != null)
            {
                CancellableOperationEventArgs eaCancel = new CancellableOperationEventArgs();
                this.EntrySaving(this, eaCancel);
                if(eaCancel.Cancel) return false;
            }

            peTarget.History = m_vHistory; // Must be called before CreateBackup()
            bool bCreateBackup = (m_pwEditMode != PwEditMode.AddNewEntry);
            if(bCreateBackup) peTarget.CreateBackup(null);

            peTarget.IconId = m_pwEntryIcon;
            peTarget.CustomIconUuid = m_pwCustomIconID;

            if(m_cbCustomForegroundColor.Checked)
                peTarget.ForegroundColor = m_clrForeground;
            else peTarget.ForegroundColor = Color.Empty;
            if(m_cbCustomBackgroundColor.Checked)
                peTarget.BackgroundColor = m_clrBackground;
            else peTarget.BackgroundColor = Color.Empty;

            peTarget.OverrideUrl = m_cmbOverrideUrl.Text;

            List<string> vNewTags = StrUtil.StringToTags(m_tbTags.Text);
            peTarget.Tags.Clear();
            foreach(string strTag in vNewTags) peTarget.AddTag(strTag);

            peTarget.Expires = m_cgExpiry.Checked;
            if(peTarget.Expires) peTarget.ExpiryTime = m_cgExpiry.Value;

            UpdateEntryStrings(true, false, false);

            peTarget.Strings = m_vStrings;
            peTarget.Binaries = m_vBinaries;

            m_atConfig.Enabled = m_cbAutoTypeEnabled.Checked;
            m_atConfig.ObfuscationOptions = (m_cbAutoTypeObfuscation.Checked ?
                AutoTypeObfuscationOptions.UseClipboard :
                AutoTypeObfuscationOptions.None);

            SaveDefaultSeq();

            peTarget.AutoType = m_atConfig;

            peTarget.Touch(true, false); // Touch *after* backup
            if(object.ReferenceEquals(peTarget, m_pwEntry)) m_bTouchedOnce = true;

            StrUtil.NormalizeNewLines(peTarget.Strings, true);

            bool bUndoBackup = false;
            PwCompareOptions cmpOpt = m_cmpOpt;
            if(bCreateBackup) cmpOpt |= PwCompareOptions.IgnoreLastBackup;
            if(peTarget.EqualsEntry(m_pwInitialEntry, cmpOpt, MemProtCmpMode.CustomOnly))
            {
                // No modifications at all => restore last mod time and undo backup
                peTarget.LastModificationTime = m_pwInitialEntry.LastModificationTime;
                bUndoBackup = bCreateBackup;
            }
            else if(bCreateBackup)
            {
                // If only history items have been modified (deleted) => undo
                // backup, but without restoring the last mod time
                PwCompareOptions cmpOptNH = (m_cmpOpt | PwCompareOptions.IgnoreHistory);
                if(peTarget.EqualsEntry(m_pwInitialEntry, cmpOptNH, MemProtCmpMode.CustomOnly))
                    bUndoBackup = true;
            }
            if(bUndoBackup) peTarget.History.RemoveAt(peTarget.History.UCount - 1);

            peTarget.MaintainBackups(m_pwDatabase);

            if(this.EntrySaved != null) this.EntrySaved(this, EventArgs.Empty);

            return true;
        }
开发者ID:rdealexb,项目名称:keepass,代码行数:80,代码来源:PwEntryForm.cs


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