private static string ContactToVcf(ContactModel contact) { VCard vcard = VCardUtils.ContactToVCard(contact); string seralizedVCard = VCardSerializer.Serialize(vcard); string filePath = Path.Combine(HomePage.APP_DIR, String.Format("BC_{0}_{1}.vcf", contact.LastName, contact.Date.ToString("MM-dd-yyyy"))); File.WriteAllText(filePath, seralizedVCard); return(filePath); }
private static string ContactsToVcf(List <ContactModel> contacts) { IList <VCard> vcards = VCardUtils.ContactsToVCards(contacts); StringBuilder builder = new StringBuilder(); foreach (VCard vcard in vcards) { builder.Append(VCardSerializer.Serialize(vcard)); builder.Append(Environment.NewLine); } string filePath = Path.Combine(HomePage.APP_DIR, String.Format("BC_{0}.vcf", DateTime.Now.ToString("MM-dd-yyyy HH.mm.ss"))); File.WriteAllText(filePath, builder.ToString()); return(filePath); }