Beispiel #1
0
        public KdbxEntry(IKeePassGroup parent, IRandomNumberGenerator rng, KdbxMetadata metadata)
            : this(false)
        {
            DebugHelper.Assert(parent != null);
            DebugHelper.Assert(rng != null);
            if (rng == null)
            {
                throw new ArgumentNullException("rng");
            }

            DebugHelper.Assert(metadata != null);
            if (metadata == null)
            {
                throw new ArgumentNullException("metadata");
            }

            Parent  = parent ?? throw new ArgumentNullException("parent");
            Uuid    = new KeePassUuid();
            IconID  = KdbxEntry.DefaultIconId;
            Times   = new KdbxTimes();
            History = new KdbxHistory(metadata);

            KdbxMemoryProtection memProtection = metadata.MemoryProtection;
            Title = new KdbxString("Title", string.Empty, rng, memProtection.ProtectTitle);
            string initialUsername = metadata.DefaultUserName ?? string.Empty;
            UserName       = new KdbxString("UserName", initialUsername, rng, memProtection.ProtectUserName);
            Password       = new KdbxString("Password", string.Empty, rng, memProtection.ProtectPassword);
            Url            = new KdbxString("URL", string.Empty, rng, memProtection.ProtectUrl);
            Notes          = new KdbxString("Notes", string.Empty, rng, memProtection.ProtectNotes);
            Tags           = string.Empty;
            OverrideUrl    = string.Empty;
            this._metadata = metadata;
        }
Beispiel #2
0
 public KdbxGroup(IKeePassGroup parent) : this()
 {
     Parent              = parent;
     Title               = new KdbxString("Name", String.Empty, null);
     Notes               = new KdbxString("Notes", String.Empty, null);
     Uuid                = new KeePassUuid();
     IconID              = KdbxGroup.DefaultIconId;
     Times               = new KdbxTimes();
     IsExpanded          = true;
     LastTopVisibleEntry = KeePassUuid.Empty;
 }
Beispiel #3
0
        public IKeePassTimes Clone()
        {
            IKeePassTimes clone = new KdbxTimes(
                LastModificationTime,
                CreationTime,
                LastAccessTime,
                ExpiryTime,
                Expires,
                UsageCount,
                LocationChanged
                );

            return(clone);
        }
Beispiel #4
0
        protected KdbxNode(XElement xml, KdbxSerializationParameters parameters)
            : base(xml)
        {
            Uuid           = GetUuid("UUID");
            IconID         = GetInt("IconID");
            CustomIconUuid = GetUuid("CustomIconUUID", false);
            Times          = new KdbxTimes(GetNode(KdbxTimes.RootName), parameters);

            XElement dataElement = GetNode(KdbxCustomData.RootName);

            if (dataElement != null)
            {
                CustomData = new KdbxCustomData(dataElement);
            }
        }
Beispiel #5
0
        public override bool Equals(object obj)
        {
            KdbxTimes other = obj as KdbxTimes;

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

            return(LastModificationTime == other.LastModificationTime &&
                   CreationTime == other.CreationTime &&
                   LastAccessTime == other.LastAccessTime &&
                   ExpiryTime == other.ExpiryTime &&
                   Expires == other.Expires &&
                   UsageCount == other.UsageCount &&
                   LocationChanged == other.LocationChanged);
        }