示例#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;
        }
示例#2
0
 public MockGroup GetGroup(string name, KeePassUuid uuid, IKeePassGroup parent = null)
 {
     return(new MockGroup
     {
         Title = new KdbxString("Title", name, null),
         Uuid = uuid,
         Parent = parent
     });
 }
示例#3
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;
 }
示例#4
0
 public KdbxMetadata(string databaseName)
 {
     Generator                  = PKGenerator;
     HeaderHash                 = null;
     DatabaseName               = databaseName;
     DatabaseDescription        = null;
     DefaultUserName            = null;
     MaintenanceHistoryDays     = 365;
     RecycleBinEnabled          = false;
     RecycleBinUuid             = new KeePassUuid(Guid.Empty);
     RecycleBinChanged          = DateTime.Now;
     EntryTemplatesGroup        = new KeePassUuid(Guid.Empty);
     EntryTemplatesGroupChanged = DateTime.Now;
     HistoryMaxItems            = 10;
     HistoryMaxSize             = -1;
     DbColor              = null;
     MasterKeyChanged     = DateTime.Now;
     MasterKeyChangeRec   = -1;
     MasterKeyChangeForce = -1;
     MemoryProtection     = new KdbxMemoryProtection();
     CustomIcons          = null;
 }