Esempio n. 1
0
 internal DocumentHandleInfo Clone()
 {
     return(new DocumentHandleInfo(
                Handle,
                FileName == null ? null : FileName.Clone(),
                CustomData == null ? null : CustomData.Clone()
                ));
 }
Esempio n. 2
0
        public IKeePassGroup Clone()
        {
            KdbxGroup clone = new KdbxGroup()
            {
                Parent = Parent
            };

            if (Title != null)
            {
                clone.Title = Title.Clone();
            }
            else
            {
                clone.Title = null;
            }
            clone.Uuid = Uuid.Clone();
            if (Notes != null)
            {
                clone.Notes = Notes.Clone();
            }
            else
            {
                clone.Notes = null;
            }
            clone.IconID = IconID;
            if (CustomIconUuid != null)
            {
                clone.CustomIconUuid = CustomIconUuid.Clone();
            }
            else
            {
                clone.CustomIconUuid = null;
            }
            clone.Times      = Times.Clone();
            clone.IsExpanded = IsExpanded;
            clone.DefaultAutoTypeSequence = DefaultAutoTypeSequence;
            clone.EnableAutoType          = EnableAutoType;
            clone.EnableSearching         = EnableSearching;
            if (LastTopVisibleEntry != null)
            {
                clone.LastTopVisibleEntry = LastTopVisibleEntry.Clone();
            }
            else
            {
                clone.LastTopVisibleEntry = null;
            }
            clone._children = Children;
            if (CustomData != null)
            {
                clone.CustomData = CustomData.Clone();
            }
            else
            {
                clone.CustomData = null;
            }
            return(clone);
        }
        protected override object DeepCloneMe()
        {
            DocumentState cloned = new DocumentState();

            cloned.LinkedDocument = this.LinkedDocument;
            cloned.HasBeenDeleted = this.HasBeenDeleted;
            cloned.Handle         = this.Handle;
            if (FileName != null)
            {
                cloned.FileName = FileName.Clone();
            }
            if (CustomData != null)
            {
                cloned.CustomData = CustomData.Clone();
            }
            return(cloned);
        }
Esempio n. 4
0
        public IKeePassEntry Clone(bool preserveHistory = true)
        {
            KdbxEntry clone = new KdbxEntry(!preserveHistory)
            {
                Parent = Parent,
                Uuid   = Uuid.Clone(),
                IconID = IconID
            };

            if (CustomIconUuid != null)
            {
                clone.CustomIconUuid = CustomIconUuid.Clone();
            }
            else
            {
                clone.CustomIconUuid = null;
            }
            clone.ForegroundColor = ForegroundColor;
            clone.BackgroundColor = BackgroundColor;
            clone.OverrideUrl     = OverrideUrl;
            clone.Tags            = Tags;
            clone.Times           = Times.Clone();
            if (Title != null)
            {
                clone.Title = Title.Clone();
            }
            else
            {
                clone.Title = null;
            }
            clone.Fields = new ObservableCollection <IProtectedString>(Fields.Select(f => f.Clone()));
            if (UserName != null)
            {
                clone.UserName = UserName.Clone();
            }
            else
            {
                clone.UserName = null;
            }
            if (Password != null)
            {
                clone.Password = Password.Clone();
            }
            else
            {
                clone.Password = null;
            }
            if (Url != null)
            {
                clone.Url = Url.Clone();
            }
            else
            {
                clone.Url = null;
            }
            if (Notes != null)
            {
                clone.Notes = Notes.Clone();
            }
            else
            {
                clone.Notes = null;
            }
            clone.Binaries = Binaries;
            clone.AutoType = AutoType;
            if (preserveHistory && History != null)
            {
                clone.History = History.Clone();
            }
            else
            {
                clone.History = null;
            }
            if (CustomData != null)
            {
                clone.CustomData = CustomData.Clone();
            }
            else
            {
                clone.CustomData = null;
            }
            clone._metadata = this._metadata;
            return(clone);
        }