Inheritance: PwCommon, IGroup
Exemple #1
0
        public PwEntry(XElement element, PwGroup parentGroup)
        {
            _parentGroup = parentGroup;
            Element = element;

            SetupFields();       
        }
 public async void Save()
 {
     CanSave = false;
     var groupElement = GetNewGroupElement();
     var group = new PwGroup(groupElement);
     ParentGroup.AddGroupToDocument(group);
     await _dataSource.SavePwDatabase();
     _navigationService.GoBack();
 }
 private void FillGroups(PwGroup rootGroup, int level)
 {
     _availableGroups.Add(new PwGroupLevels { Group = rootGroup, Level = level });
     level++;
     foreach (var subGroup in rootGroup.SubGroups)
     {
         FillGroups(subGroup, level);
     }
 }
Exemple #4
0
 public void AddGroupToDocument(PwGroup group)
 {
     Element.Add(group.Element);
     _subGroups.Add(group);
 }
Exemple #5
0
        public static PwEntry New(PwGroup parent)     
        {
            var entryTemplate = @"
                <Entry>
                    <UUID>{0}</UUID>
                    <IconID>0</IconID>
                    <Times>
                        <LastModificationTime>{1}</LastModificationTime>
                        <CreationTime>{1}</CreationTime>
                        <LastAccessTime>{1}</LastAccessTime>
                        <ExpiryTime>{1}</ExpiryTime>
                        <LocationChanged>{1}</LocationChanged>
                        <Expires>False</Expires>
                        <UsageCount>0</UsageCount>
                    </Times>
                    <String>
                        <Key>Title</Key>
                        <Value>{2}</Value>
                    </String>
                    <String>
                        <Key>UserName</Key>
                        <Value>{3}</Value>
                    </String>
                    <String>
                        <Key>Password</Key>
                        <Value Protected=""True"">{4}</Value>
                    </String>
                    <String>
                        <Key>URL</Key>
                        <Value>{5}</Value>
                    </String>
                    <String>
                        <Key>Notes</Key>
                        <Value>{6}</Value>
                    </String>
                </Entry>
            ";
            var uuid = new PwUuid(true);

            entryTemplate = String.Format(entryTemplate, 
                Convert.ToBase64String(uuid.UuidBytes), 
                DateTime.Now.ToFormattedUtcTime(), 
                Sanitize("Title"), 
                Sanitize("Username"), 
                Sanitize("Password") ,
                Sanitize("Url") , 
                Sanitize("Notes"));

            var element = XElement.Parse(entryTemplate);
            var pwEntry = new PwEntry(element,parent);
            parent.AddEntryToDocument(pwEntry);
           
            return pwEntry;
        }
 private void GetParentGroup(IObservedChange<AddOrEditGroupViewModel, string> obj)
 {
     ParentGroup = _databaseSource.PwDatabase.Tree.FindGroupByUuid(ParentGroupUuid);
 }