예제 #1
0
        private void WriteMeta()
        {
            m_xmlWriter.WriteStartElement(ElemMeta);

            WriteObject(ElemGenerator, PwDatabase.LocalizedAppName, false);

            if ((m_pbHashOfHeader != null) && (m_uFileVersion < FileVersion32_4))
            {
                WriteObject(ElemHeaderHash, Convert.ToBase64String(
                                m_pbHashOfHeader), false);
            }

            if (m_uFileVersion >= FileVersion32_4)
            {
                WriteObject(ElemSettingsChanged, m_pwDatabase.SettingsChanged);
            }

            WriteObject(ElemDbName, m_pwDatabase.Name, true);
            WriteObject(ElemDbNameChanged, m_pwDatabase.NameChanged);
            WriteObject(ElemDbDesc, m_pwDatabase.Description, true);
            WriteObject(ElemDbDescChanged, m_pwDatabase.DescriptionChanged);
            WriteObject(ElemDbDefaultUser, m_pwDatabase.DefaultUserName, true);
            WriteObject(ElemDbDefaultUserChanged, m_pwDatabase.DefaultUserNameChanged);
            WriteObject(ElemDbMntncHistoryDays, m_pwDatabase.MaintenanceHistoryDays);
            WriteObject(ElemDbColor, StrUtil.ColorToUnnamedHtml(m_pwDatabase.Color, true), false);
            WriteObject(ElemDbKeyChanged, m_pwDatabase.MasterKeyChanged);
            WriteObject(ElemDbKeyChangeRec, m_pwDatabase.MasterKeyChangeRec);
            WriteObject(ElemDbKeyChangeForce, m_pwDatabase.MasterKeyChangeForce);
            if (m_pwDatabase.MasterKeyChangeForceOnce)
            {
                WriteObject(ElemDbKeyChangeForceOnce, true);
            }

            WriteList(ElemMemoryProt, m_pwDatabase.MemoryProtection);

            WriteCustomIconList();

            WriteObject(ElemRecycleBinEnabled, m_pwDatabase.RecycleBinEnabled);
            WriteObject(ElemRecycleBinUuid, m_pwDatabase.RecycleBinUuid);
            WriteObject(ElemRecycleBinChanged, m_pwDatabase.RecycleBinChanged);
            WriteObject(ElemEntryTemplatesGroup, m_pwDatabase.EntryTemplatesGroup);
            WriteObject(ElemEntryTemplatesGroupChanged, m_pwDatabase.EntryTemplatesGroupChanged);
            WriteObject(ElemHistoryMaxItems, m_pwDatabase.HistoryMaxItems);
            WriteObject(ElemHistoryMaxSize, m_pwDatabase.HistoryMaxSize);

            WriteObject(ElemLastSelectedGroup, m_pwDatabase.LastSelectedGroup);
            WriteObject(ElemLastTopVisibleGroup, m_pwDatabase.LastTopVisibleGroup);

            if ((m_format != KdbxFormat.Default) || (m_uFileVersion < FileVersion32_4))
            {
                WriteBinPool();
            }

            WriteList(ElemCustomData, m_pwDatabase.CustomData);

            m_xmlWriter.WriteEndElement();
        }
예제 #2
0
        private void WriteEntry(PwEntry pe, bool bIsHistory)
        {
            Debug.Assert(pe != null); if (pe == null)
            {
                throw new ArgumentNullException("pe");
            }

            m_xmlWriter.WriteStartElement(ElemEntry);

            WriteObject(ElemUuid, pe.Uuid);
            WriteObject(ElemIcon, (int)pe.IconId);

            if (!pe.CustomIconUuid.Equals(PwUuid.Zero))
            {
                WriteObject(ElemCustomIconID, pe.CustomIconUuid);
            }

            WriteObject(ElemFgColor, StrUtil.ColorToUnnamedHtml(pe.ForegroundColor, true), false);
            WriteObject(ElemBgColor, StrUtil.ColorToUnnamedHtml(pe.BackgroundColor, true), false);
            WriteObject(ElemOverrideUrl, pe.OverrideUrl, true);

            if ((m_uFileVersion >= FileVersion32_4_1) && !pe.QualityCheck)
            {
                WriteObject(ElemQualityCheck, false);
            }

            WriteObject(ElemTags, StrUtil.TagsToString(pe.Tags, false), true);

            if ((m_uFileVersion >= FileVersion32_4_1) &&
                !pe.PreviousParentGroup.Equals(PwUuid.Zero))
            {
                WriteObject(ElemPreviousParentGroup, pe.PreviousParentGroup);
            }

            WriteList(ElemTimes, pe);

            WriteList(pe.Strings, true);
            WriteList(pe.Binaries);
            WriteList(ElemAutoType, pe.AutoType);

            if (pe.CustomData.Count > 0)
            {
                WriteList(ElemCustomData, pe.CustomData);
            }

            if (!bIsHistory)
            {
                WriteList(ElemHistory, pe.History, true);
            }
            else
            {
                Debug.Assert(pe.History.UCount == 0);
            }

            m_xmlWriter.WriteEndElement();
        }
예제 #3
0
        private void WriteEntry(PwEntry pe, bool bIsHistory)
        {
            Debug.Assert(pe != null);
            if (pe == null)
            {
                throw new ArgumentNullException("pe");
            }

            m_xmlWriter.WriteStartElement(ElemEntry);

            WriteObject(ElemUuid, pe.Uuid);
            WriteObject(ElemIcon, (int)pe.IconId);

            if (pe.CustomIconUuid != PwUuid.Zero)
            {
                WriteObject(ElemCustomIconID, pe.CustomIconUuid);
            }

            WriteObject(ElemFgColor, StrUtil.ColorToUnnamedHtml(pe.ForegroundColor, true), false);
            WriteObject(ElemBgColor, StrUtil.ColorToUnnamedHtml(pe.BackgroundColor, true), false);
            WriteObject(ElemOverrideUrl, pe.OverrideUrl, true);
            WriteObject(ElemTags, StrUtil.TagsToString(pe.Tags, false), true);

            WriteList(ElemTimes, pe);

            WriteList(pe.Strings, true);
            WriteList(pe.Binaries);
            WriteList(ElemAutoType, pe.AutoType);

            if (!bIsHistory)
            {
                WriteList(ElemHistory, pe.History, true);
            }
            else
            {
                Debug.Assert(pe.History.UCount == 0);
            }

            m_xmlWriter.WriteEndElement();
        }
예제 #4
0
        private void WriteMeta()
        {
            m_xmlWriter.WriteStartElement(ElemMeta);

            WriteObject(ElemGenerator, PwDatabase.LocalizedAppName, false); // Generator name
            WriteObject(ElemDbName, m_pwDatabase.Name, true);
            WriteObject(ElemDbNameChanged, m_pwDatabase.NameChanged);
            WriteObject(ElemDbDesc, m_pwDatabase.Description, true);
            WriteObject(ElemDbDescChanged, m_pwDatabase.DescriptionChanged);
            WriteObject(ElemDbDefaultUser, m_pwDatabase.DefaultUserName, true);
            WriteObject(ElemDbDefaultUserChanged, m_pwDatabase.DefaultUserNameChanged);
            WriteObject(ElemDbMntncHistoryDays, m_pwDatabase.MaintenanceHistoryDays);
            WriteObject(ElemDbColor, StrUtil.ColorToUnnamedHtml(m_pwDatabase.Color, true), false);
            WriteObject(ElemDbKeyChanged, m_pwDatabase.MasterKeyChanged);
            WriteObject(ElemDbKeyChangeRec, m_pwDatabase.MasterKeyChangeRec);
            WriteObject(ElemDbKeyChangeForce, m_pwDatabase.MasterKeyChangeForce);

            WriteList(ElemMemoryProt, m_pwDatabase.MemoryProtection);

            WriteCustomIconList();

            WriteObject(ElemRecycleBinEnabled, m_pwDatabase.RecycleBinEnabled);
            WriteObject(ElemRecycleBinUuid, m_pwDatabase.RecycleBinUuid);
            WriteObject(ElemRecycleBinChanged, m_pwDatabase.RecycleBinChanged);
            WriteObject(ElemEntryTemplatesGroup, m_pwDatabase.EntryTemplatesGroup);
            WriteObject(ElemEntryTemplatesGroupChanged, m_pwDatabase.EntryTemplatesGroupChanged);
            WriteObject(ElemHistoryMaxItems, m_pwDatabase.HistoryMaxItems);
            WriteObject(ElemHistoryMaxSize, m_pwDatabase.HistoryMaxSize);

            WriteObject(ElemLastSelectedGroup, m_pwDatabase.LastSelectedGroup);
            WriteObject(ElemLastTopVisibleGroup, m_pwDatabase.LastTopVisibleGroup);

            WriteBinPool();
            WriteList(ElemCustomData, m_pwDatabase.CustomData);

            m_xmlWriter.WriteEndElement();
        }