예제 #1
0
        private static void AddCard(PwGroup pgParent, HspCard hspCard)
        {
            if (hspCard == null)
            {
                Debug.Assert(false); return;
            }

            PwEntry pe = new PwEntry(true, true);

            pgParent.AddEntry(pe, true);

            if (!string.IsNullOrEmpty(hspCard.Name))
            {
                pe.Strings.Set(PwDefs.TitleField, new ProtectedString(false, hspCard.Name));
            }

            if (!string.IsNullOrEmpty(hspCard.Note))
            {
                pe.Strings.Set(PwDefs.NotesField, new ProtectedString(false, hspCard.Note));
            }

            if (hspCard.Fields == null)
            {
                return;
            }
            foreach (HspField fld in hspCard.Fields)
            {
                if (fld == null)
                {
                    Debug.Assert(false); continue;
                }
                if (string.IsNullOrEmpty(fld.Name) || string.IsNullOrEmpty(fld.Value))
                {
                    continue;
                }

                string strKey = ImportUtil.MapNameToStandardField(fld.Name, true);
                if (string.IsNullOrEmpty(strKey))
                {
                    strKey = fld.Name;
                }

                string strValue = pe.Strings.ReadSafe(strKey);
                if (strValue.Length > 0)
                {
                    strValue += ", ";
                }
                strValue += fld.Value;
                pe.Strings.Set(strKey, new ProtectedString(false, strValue));
            }
        }
예제 #2
0
		private static void AddCard(PwGroup pgParent, HspCard hspCard)
		{
			if(hspCard == null) { Debug.Assert(false); return; }

			PwEntry pe = new PwEntry(true, true);
			pgParent.AddEntry(pe, true);

			if(!string.IsNullOrEmpty(hspCard.Name))
				pe.Strings.Set(PwDefs.TitleField, new ProtectedString(false, hspCard.Name));

			if(!string.IsNullOrEmpty(hspCard.Note))
				pe.Strings.Set(PwDefs.NotesField, new ProtectedString(false, hspCard.Note));

			if(hspCard.Fields == null) return;
			foreach(HspField fld in hspCard.Fields)
			{
				if(fld == null) { Debug.Assert(false); continue; }
				if(string.IsNullOrEmpty(fld.Name) || string.IsNullOrEmpty(fld.Value)) continue;

				string strKey = ImportUtil.MapNameToStandardField(fld.Name, true);
				if(string.IsNullOrEmpty(strKey)) strKey = fld.Name;

				string strValue = pe.Strings.ReadSafe(strKey);
				if(strValue.Length > 0) strValue += ", ";
				strValue += fld.Value;
				pe.Strings.Set(strKey, new ProtectedString(false, strValue));
			}
		}