Exemplo n.º 1
0
 private static void OnUserSourcesUpdated(object sender, EventArgs e)
 {
     CustomIcons.Clear();
     UpdateAll(s => {
         s._origins = null;
         s.UpdateReferences(s._server);
     });
 }
Exemplo n.º 2
0
        public override void PopulateChildren(XElement xml, IRandomNumberGenerator rng, KdbxSerializationParameters parameters)
        {
            xml.Add(GetKeePassNode("Generator", Generator, parameters));
            if (parameters.UseXmlHeaderAuthentication && HeaderHash != null)
            {
                xml.Add(GetKeePassNode("HeaderHash", HeaderHash, parameters));
            }

            xml.Add(
                GetKeePassNode("DatabaseName", DatabaseName, parameters),
                GetKeePassNode("DatabaseNameChanged", DatabaseNameChanged, parameters),
                GetKeePassNode("DatabaseDescription", DatabaseDescription, parameters),
                GetKeePassNode("DatabaseDescriptionChanged", DatabaseDescriptionChanged, parameters),
                GetKeePassNode("DefaultUserName", DefaultUserName, parameters),
                GetKeePassNode("DefaultUserNameChanged", DefaultUserNameChanged, parameters),
                GetKeePassNode("MaintenanceHistoryDays", MaintenanceHistoryDays, parameters),
                GetKeePassNode("Color", DbColor, parameters),
                GetKeePassNode("MasterKeyChanged", MasterKeyChanged, parameters),
                GetKeePassNode("MasterKeyChangeRec", MasterKeyChangeRec, parameters),
                GetKeePassNode("MasterKeyChangeForce", MasterKeyChangeForce, parameters),
                MemoryProtection.ToXml(rng, parameters)
                );

            if (CustomIcons != null)
            {
                xml.Add(CustomIcons.ToXml(rng, parameters));
            }

            xml.Add(
                GetKeePassNode("RecycleBinEnabled", RecycleBinEnabled, parameters),
                GetKeePassNode("RecycleBinUUID", RecycleBinUuid, parameters),
                GetKeePassNode("RecycleBinChanged", RecycleBinChanged, parameters),
                GetKeePassNode("EntryTemplatesGroup", EntryTemplatesGroup, parameters),
                GetKeePassNode("EntryTemplatesGroupChanged", EntryTemplatesGroupChanged, parameters),
                GetKeePassNode("HistoryMaxItems", HistoryMaxItems, parameters),
                GetKeePassNode("HistoryMaxSize", HistoryMaxSize, parameters),
                GetKeePassNode("LastSelectedGroup", LastSelectedGroup, parameters),
                GetKeePassNode("LastTopVisibleGroup", LastTopVisibleGroup, parameters)
                );

            // Only both writing this node if we have binaries (compat issue with KeePass)
            if (parameters.BinariesInXml && Binaries != null && Binaries.Binaries.Any())
            {
                xml.Add(Binaries.ToXml(rng, parameters));
            }

            if (CustomData != null)
            {
                xml.Add(CustomData.ToXml(rng, parameters));
            }
        }
        internal void FromIconSet(X14.IconSet ics)
        {
            SetAllNull();

            if (ics.IconSetTypes != null)
            {
                IconSetType = ics.IconSetTypes.Value;
            }
            if (ics.ShowValue != null)
            {
                ShowValue = ics.ShowValue.Value;
            }
            if (ics.Percent != null)
            {
                Percent = ics.Percent.Value;
            }
            if (ics.Reverse != null)
            {
                Reverse = ics.Reverse.Value;
            }

            using (var oxr = OpenXmlReader.Create(ics))
            {
                SLConditionalFormattingValueObject2010 cfvo;
                SLConditionalFormattingIcon2010        cfi;
                while (oxr.Read())
                {
                    if (oxr.ElementType == typeof(X14.ConditionalFormattingValueObject))
                    {
                        cfvo = new SLConditionalFormattingValueObject2010();
                        cfvo.FromConditionalFormattingValueObject(
                            (X14.ConditionalFormattingValueObject)oxr.LoadCurrentElement());
                        Cfvos.Add(cfvo);
                    }
                    else if (oxr.ElementType == typeof(X14.ConditionalFormattingIcon))
                    {
                        cfi = new SLConditionalFormattingIcon2010();
                        cfi.FromConditionalFormattingIcon((X14.ConditionalFormattingIcon)oxr.LoadCurrentElement());
                        CustomIcons.Add(cfi);
                    }
                }
            }
        }
Exemplo n.º 4
0
        public override bool Equals(object obj)
        {
            KdbxMetadata other = obj as KdbxMetadata;

            if (other == null)
            {
                return(false);
            }

            if (Generator != other.Generator)
            {
                return(false);
            }

            if (DatabaseName != other.DatabaseName || DatabaseDescription != other.DatabaseDescription)
            {
                return(false);
            }

            if (DatabaseNameChanged != other.DatabaseNameChanged || DatabaseDescriptionChanged != other.DatabaseDescriptionChanged)
            {
                return(false);
            }

            if (DefaultUserName != other.DefaultUserName || DefaultUserNameChanged != other.DefaultUserNameChanged)
            {
                return(false);
            }

            if (MaintenanceHistoryDays != other.MaintenanceHistoryDays)
            {
                return(false);
            }

            if (DbColor != other.DbColor)
            {
                return(false);
            }

            if (MasterKeyChanged != other.MasterKeyChanged ||
                MasterKeyChangeRec != other.MasterKeyChangeRec ||
                MasterKeyChangeForce != other.MasterKeyChangeForce)
            {
                return(false);
            }

            if (!MemoryProtection.Equals(other.MemoryProtection))
            {
                return(false);
            }

            if (CustomIcons != null)
            {
                if (!CustomIcons.Equals(other.CustomIcons))
                {
                    return(false);
                }
            }
            else
            {
                if (other.CustomIcons != null)
                {
                    return(false);
                }
            }

            if (RecycleBinEnabled != other.RecycleBinEnabled ||
                !RecycleBinUuid.Equals(other.RecycleBinUuid) ||
                RecycleBinChanged != other.RecycleBinChanged)
            {
                return(false);
            }

            if (!EntryTemplatesGroup.Equals(other.EntryTemplatesGroup) || EntryTemplatesGroupChanged != other.EntryTemplatesGroupChanged)
            {
                return(false);
            }

            if (HistoryMaxItems != other.HistoryMaxItems || HistoryMaxSize != other.HistoryMaxSize)
            {
                return(false);
            }

            if (!LastSelectedGroup.Equals(other.LastSelectedGroup) || !LastTopVisibleGroup.Equals(other.LastTopVisibleGroup))
            {
                return(false);
            }

            if (Binaries != null)
            {
                if (!Binaries.Equals(other.Binaries))
                {
                    return(false);
                }
            }
            else
            {
                if (other.Binaries != null)
                {
                    return(false);
                }
            }

            if (CustomData != null)
            {
                if (!CustomData.Equals(other.CustomData))
                {
                    return(false);
                }
            }
            else
            {
                if (other.CustomData != null)
                {
                    return(false);
                }
            }

            return(true);
        }