Ejemplo n.º 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;
        }
Ejemplo n.º 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;
 }
Ejemplo n.º 3
0
        public IKeePassTimes Clone()
        {
            IKeePassTimes clone = new KdbxTimes(
                LastModificationTime,
                CreationTime,
                LastAccessTime,
                ExpiryTime,
                Expires,
                UsageCount,
                LocationChanged
                );

            return(clone);
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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);
        }