Beispiel #1
0
        private void OnBtnClose(object sender, EventArgs e)
        {
            m_pwDatabase.MaintenanceHistoryDays = (uint)m_numHistoryDays.Value;

            if (m_sdCustomData.Count != m_pwDatabase.CustomData.Count)
            {
                m_pwDatabase.CustomData = m_sdCustomData;
                m_bModified             = true;
            }
            else
            {
                Debug.Assert(m_sdCustomData.Equals(m_pwDatabase.CustomData));
            }
        }
Beispiel #2
0
        public bool EqualsEntry(PwEntry pe, PwCompareOptions pwOpt,
                                MemProtCmpMode mpCmpStr)
        {
            if (pe == null)
            {
                Debug.Assert(false); return(false);
            }

            bool bNeEqStd = ((pwOpt & PwCompareOptions.NullEmptyEquivStd) !=
                             PwCompareOptions.None);
            bool bIgnoreLastAccess = ((pwOpt & PwCompareOptions.IgnoreLastAccess) !=
                                      PwCompareOptions.None);
            bool bIgnoreLastMod = ((pwOpt & PwCompareOptions.IgnoreLastMod) !=
                                   PwCompareOptions.None);

            if (!m_uuid.Equals(pe.m_uuid))
            {
                return(false);
            }
            if ((pwOpt & PwCompareOptions.IgnoreParentGroup) == PwCompareOptions.None)
            {
                if (m_pParentGroup != pe.m_pParentGroup)
                {
                    return(false);
                }
                if (!bIgnoreLastMod && (m_tParentGroupLastMod != pe.m_tParentGroupLastMod))
                {
                    return(false);
                }
            }

            if (!m_listStrings.EqualsDictionary(pe.m_listStrings, pwOpt, mpCmpStr))
            {
                return(false);
            }
            if (!m_listBinaries.EqualsDictionary(pe.m_listBinaries))
            {
                return(false);
            }

            if (!m_listAutoType.Equals(pe.m_listAutoType))
            {
                return(false);
            }

            if ((pwOpt & PwCompareOptions.IgnoreHistory) == PwCompareOptions.None)
            {
                bool bIgnoreLastBackup = ((pwOpt & PwCompareOptions.IgnoreLastBackup) !=
                                          PwCompareOptions.None);

                if (!bIgnoreLastBackup && (m_listHistory.UCount != pe.m_listHistory.UCount))
                {
                    return(false);
                }
                if (bIgnoreLastBackup && (m_listHistory.UCount == 0))
                {
                    Debug.Assert(false);
                    return(false);
                }
                if (bIgnoreLastBackup && ((m_listHistory.UCount - 1) != pe.m_listHistory.UCount))
                {
                    return(false);
                }

                PwCompareOptions cmpSub = PwCompareOptions.IgnoreParentGroup;
                if (bNeEqStd)
                {
                    cmpSub |= PwCompareOptions.NullEmptyEquivStd;
                }
                if (bIgnoreLastMod)
                {
                    cmpSub |= PwCompareOptions.IgnoreLastMod;
                }
                if (bIgnoreLastAccess)
                {
                    cmpSub |= PwCompareOptions.IgnoreLastAccess;
                }

                for (uint uHist = 0; uHist < pe.m_listHistory.UCount; ++uHist)
                {
                    if (!m_listHistory.GetAt(uHist).EqualsEntry(pe.m_listHistory.GetAt(
                                                                    uHist), cmpSub, MemProtCmpMode.None))
                    {
                        return(false);
                    }
                }
            }

            if (m_pwIcon != pe.m_pwIcon)
            {
                return(false);
            }
            if (!m_pwCustomIconID.Equals(pe.m_pwCustomIconID))
            {
                return(false);
            }

            if (m_clrForeground != pe.m_clrForeground)
            {
                return(false);
            }
            if (m_clrBackground != pe.m_clrBackground)
            {
                return(false);
            }

            if (m_tCreation != pe.m_tCreation)
            {
                return(false);
            }
            if (!bIgnoreLastMod && (m_tLastMod != pe.m_tLastMod))
            {
                return(false);
            }
            if (!bIgnoreLastAccess && (m_tLastAccess != pe.m_tLastAccess))
            {
                return(false);
            }
            if (m_tExpire != pe.m_tExpire)
            {
                return(false);
            }
            if (m_bExpires != pe.m_bExpires)
            {
                return(false);
            }
            if (!bIgnoreLastAccess && (m_uUsageCount != pe.m_uUsageCount))
            {
                return(false);
            }

            if (m_strOverrideUrl != pe.m_strOverrideUrl)
            {
                return(false);
            }

            if (m_vTags.Count != pe.m_vTags.Count)
            {
                return(false);
            }
            for (int iTag = 0; iTag < m_vTags.Count; ++iTag)
            {
                if (m_vTags[iTag] != pe.m_vTags[iTag])
                {
                    return(false);
                }
            }

            if (!m_dCustomData.Equals(pe.m_dCustomData))
            {
                return(false);
            }

            return(true);
        }
Beispiel #3
0
        public bool EqualsEntry(PwEntry pe, PwCompareOptions pwOpt,
                                MemProtCmpMode mpCmpStr)
        {
            if (pe == null)
            {
                Debug.Assert(false); return(false);
            }

            bool bNeEqStd = ((pwOpt & PwCompareOptions.NullEmptyEquivStd) !=
                             PwCompareOptions.None);
            bool bIgnoreLastAccess = ((pwOpt & PwCompareOptions.IgnoreLastAccess) !=
                                      PwCompareOptions.None);
            bool bIgnoreLastMod = ((pwOpt & PwCompareOptions.IgnoreLastMod) !=
                                   PwCompareOptions.None);

            if (!m_uuid.Equals(pe.m_uuid))
            {
                return(false);
            }
            if ((pwOpt & PwCompareOptions.IgnoreParentGroup) == PwCompareOptions.None)
            {
                if (m_pParentGroup != pe.m_pParentGroup)
                {
                    return(false);
                }
                if (!bIgnoreLastMod && (m_tParentGroupLastMod != pe.m_tParentGroupLastMod))
                {
                    return(false);
                }
                if (!m_puPrevParentGroup.Equals(pe.m_puPrevParentGroup))
                {
                    return(false);
                }
            }

            if (!m_dStrings.EqualsDictionary(pe.m_dStrings, pwOpt, mpCmpStr))
            {
                return(false);
            }
            if (!m_dBinaries.EqualsDictionary(pe.m_dBinaries))
            {
                return(false);
            }

            if (!m_cfgAutoType.Equals(pe.m_cfgAutoType))
            {
                return(false);
            }

            if ((pwOpt & PwCompareOptions.IgnoreHistory) == PwCompareOptions.None)
            {
                bool bIgnoreLastBackup = ((pwOpt & PwCompareOptions.IgnoreLastBackup) !=
                                          PwCompareOptions.None);

                if (!bIgnoreLastBackup && (m_lHistory.UCount != pe.m_lHistory.UCount))
                {
                    return(false);
                }
                if (bIgnoreLastBackup && (m_lHistory.UCount == 0))
                {
                    Debug.Assert(false);
                    return(false);
                }
                if (bIgnoreLastBackup && ((m_lHistory.UCount - 1) != pe.m_lHistory.UCount))
                {
                    return(false);
                }

                PwCompareOptions cmpSub = PwCompareOptions.IgnoreParentGroup;
                if (bNeEqStd)
                {
                    cmpSub |= PwCompareOptions.NullEmptyEquivStd;
                }
                if (bIgnoreLastMod)
                {
                    cmpSub |= PwCompareOptions.IgnoreLastMod;
                }
                if (bIgnoreLastAccess)
                {
                    cmpSub |= PwCompareOptions.IgnoreLastAccess;
                }

                for (uint uHist = 0; uHist < pe.m_lHistory.UCount; ++uHist)
                {
                    if (!m_lHistory.GetAt(uHist).EqualsEntry(pe.m_lHistory.GetAt(
                                                                 uHist), cmpSub, MemProtCmpMode.None))
                    {
                        return(false);
                    }
                }
            }

            if (m_pwIcon != pe.m_pwIcon)
            {
                return(false);
            }
            if (!m_puCustomIcon.Equals(pe.m_puCustomIcon))
            {
                return(false);
            }

            if (m_clrForeground != pe.m_clrForeground)
            {
                return(false);
            }
            if (m_clrBackground != pe.m_clrBackground)
            {
                return(false);
            }

            if (m_tCreation != pe.m_tCreation)
            {
                return(false);
            }
            if (!bIgnoreLastMod && (m_tLastMod != pe.m_tLastMod))
            {
                return(false);
            }
            if (!bIgnoreLastAccess && (m_tLastAccess != pe.m_tLastAccess))
            {
                return(false);
            }
            if (m_tExpire != pe.m_tExpire)
            {
                return(false);
            }
            if (m_bExpires != pe.m_bExpires)
            {
                return(false);
            }
            if (!bIgnoreLastAccess && (m_uUsageCount != pe.m_uUsageCount))
            {
                return(false);
            }

            if (m_strOverrideUrl != pe.m_strOverrideUrl)
            {
                return(false);
            }
            if (m_bQualityCheck != pe.m_bQualityCheck)
            {
                return(false);
            }

            // The Tags property normalizes
            if (!MemUtil.ListsEqual <string>(this.Tags, pe.Tags))
            {
                return(false);
            }

            if (!m_dCustomData.Equals(pe.m_dCustomData))
            {
                return(false);
            }

            return(true);
        }