Exemplo n.º 1
0
        public User Clone()
        {
            var clone = new User
            {
                Id     = Id.Clone() as string,
                Avatar = Avatar.Clone() as string,
                Name   = Name.Clone() as string,
                Email  = Email.Clone() as string,
                Phone  = Phone.Clone() as string,
                OtherConnectionField = OtherConnectionField.Clone() as string,
                Agreement            = Agreement,
                Password             = Password.Clone() as string,
                Username             = Username.Clone() as string,
                UILang         = UILang.Clone() as string,
                Token          = Token.Clone() as string,
                WorkedProjects = new Dictionary <string, string>(),
                ProjectRoles   = new Dictionary <string, string>()
            };

            foreach (var projId in WorkedProjects.Keys)
            {
                clone.WorkedProjects.Add(projId.Clone() as string, WorkedProjects[projId].Clone() as string);
            }

            foreach (var projId in ProjectRoles.Keys)
            {
                clone.ProjectRoles.Add(projId.Clone() as string, ProjectRoles[projId].Clone() as string);
            }

            return(clone);
        }
Exemplo n.º 2
0
        public User Clone()
        {
            var clone = new User
            {
                Id                   = (string)Id.Clone(),
                Avatar               = (string)Avatar.Clone(),
                HasAvatar            = HasAvatar,
                Name                 = (string)Name.Clone(),
                Email                = (string)Email.Clone(),
                Phone                = (string)Phone.Clone(),
                OtherConnectionField = (string)OtherConnectionField.Clone(),
                Agreement            = Agreement,
                Password             = (string)Password.Clone(),
                Username             = (string)Username.Clone(),
                UILang               = (string)UILang.Clone(),
                Token                = (string)Token.Clone(),
                WorkedProjects       = new Dictionary <string, string>(),
                ProjectRoles         = new Dictionary <string, string>()
            };

            foreach (var projId in WorkedProjects.Keys)
            {
                clone.WorkedProjects.Add((string)projId.Clone(), (string)WorkedProjects[projId].Clone());
            }

            foreach (var projId in ProjectRoles.Keys)
            {
                clone.ProjectRoles.Add((string)projId.Clone(), (string)ProjectRoles[projId].Clone());
            }

            return(clone);
        }
        public UserModel Clone()
        {
            var user = new UserModel
            {
                Id          = Id,
                CreatedDate = CreatedDate,
                Name        = (string)Name.Clone(),
                Login       = (string)Login.Clone(),
                Password    = (string)Password.Clone(),
                LastLogin   = LastLogin,
                Enabled     = Enabled
            };

            if (UserGroups != null)
            {
                foreach (var u in UserGroups)
                {
                    user.UserGroups.Add(u.Clone());
                }
            }

            return(user);
        }
Exemplo 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);
        }