diff --git a/VisualCard.Tests/ContactData.cs b/VisualCard.Tests/ContactData.cs index 794cfe0..80941b3 100644 --- a/VisualCard.Tests/ContactData.cs +++ b/VisualCard.Tests/ContactData.cs @@ -44,41 +44,15 @@ public static class ContactData private static readonly Card singleVcardTwoContactShortInstance = new ( null, - "2.1", - new NameInfo[] - { - new NameInfo(0, Array.Empty(), "Rick", "Hood", Array.Empty(), Array.Empty(), Array.Empty()) - }, - "Rick Hood", - Array.Empty(), - Array.Empty(), - Array.Empty(), - Array.Empty(), - "", - "", - Array.Empty(), - Array.Empty(), - "individual", - Array.Empty(), - default, - Array.Empty(), - default(DateTime), - "", - Array.Empty(), - Array.Empty(), - Array.Empty(), - "", - "", - Array.Empty(), - Array.Empty(), - Array.Empty(), - Array.Empty(), - "", - "", - "", - "", - "" - ); + "2.1" + ) + { + ContactNames = new NameInfo[] + { + new NameInfo(0, Array.Empty(), "Rick", "Hood", Array.Empty(), Array.Empty(), Array.Empty()) + }, + ContactFullName = "Rick Hood" + }; #endregion #region singleVcardThreeContactShort @@ -95,41 +69,15 @@ public static class ContactData private static readonly Card singleVcardThreeContactShortInstance = new ( null, - "3.0", - new NameInfo[] - { + "3.0" + ) + { + ContactNames = new NameInfo[] + { new NameInfo(0, Array.Empty(), "Rick", "Hood", Array.Empty(), Array.Empty(), Array.Empty()) }, - "Rick Hood", - Array.Empty(), - Array.Empty(), - Array.Empty(), - Array.Empty(), - "", - "", - Array.Empty(), - Array.Empty(), - "individual", - Array.Empty(), - default, - Array.Empty(), - default(DateTime), - "", - Array.Empty(), - Array.Empty(), - Array.Empty(), - "", - "", - Array.Empty(), - Array.Empty(), - Array.Empty(), - Array.Empty(), - "", - "", - "", - "", - "" - ); + ContactFullName = "Rick Hood" + }; #endregion #region singleVcardFourContactShort @@ -146,41 +94,15 @@ public static class ContactData private static readonly Card singleVcardFourContactShortInstance = new ( null, - "4.0", - new NameInfo[] + "4.0" + ) + { + ContactNames = new NameInfo[] { new NameInfo(0, Array.Empty(), "Rick", "Hood", Array.Empty(), Array.Empty(), Array.Empty()) }, - "Rick Hood", - Array.Empty(), - Array.Empty(), - Array.Empty(), - Array.Empty(), - "", - "", - Array.Empty(), - Array.Empty(), - "individual", - Array.Empty(), - default, - Array.Empty(), - default(DateTime), - "", - Array.Empty(), - Array.Empty(), - Array.Empty(), - "", - "", - Array.Empty(), - Array.Empty(), - Array.Empty(), - Array.Empty(), - "", - "", - "", - "", - "" - ); + ContactFullName = "Rick Hood" + }; #endregion #region singleVcardTwoContact @@ -207,62 +129,43 @@ public static class ContactData private static readonly Card singleVcardTwoContactInstance = new ( null, - "2.1", - new NameInfo[] + "2.1" + ) + { + ContactNames = new NameInfo[] { new NameInfo(0, Array.Empty(), "John", "Sanders", Array.Empty(), Array.Empty(), Array.Empty()) }, - "John Sanders", - new TelephoneInfo[] + ContactFullName = "John Sanders", + ContactTelephones = new TelephoneInfo[] { new TelephoneInfo(0, Array.Empty(), new string[] { "CELL" }, "495-522-3560") }, - new AddressInfo[] + ContactAddresses = new AddressInfo[] { new AddressInfo(0, Array.Empty(), new string[] { "HOME" }, "", "", "Los Angeles, USA", "", "", "", "") - }, - new OrganizationInfo[] + }, + ContactOrganizations = new OrganizationInfo[] { new OrganizationInfo(0, Array.Empty(), "Acme Co.", "", "", new string[] { "WORK" }) }, - new TitleInfo[] + ContactTitles = new TitleInfo[] { new TitleInfo(0, Array.Empty(), "Product Manager") }, - "", - "Note test for VisualCard", - new EmailInfo[] + ContactNotes = "Note test for VisualCard", + ContactMails = new EmailInfo[] { new EmailInfo(0, Array.Empty(), new string[] { "HOME" }, "john.s@acme.co") }, - new XNameInfo[] + ContactXNames = new XNameInfo[] { new XNameInfo(0, Array.Empty(), "PHONETIC-FIRST-NAME", new string[] { "Saunders" }, Array.Empty()), new XNameInfo(0, Array.Empty(), "PHONETIC-LAST-NAME", new string[] { "John" }, Array.Empty()), new XNameInfo(0, Array.Empty(), "ANDROID-CUSTOM", new string[] { "vnd.android.cursor.item/nickname", "JS", "1", "", "", "", "", "", "", "", "", "", "", "", "", "" }, Array.Empty()), new XNameInfo(0, Array.Empty(), "AIM", new string[] { "john.s" }, Array.Empty()), - }, - "individual", - Array.Empty(), - default, - Array.Empty(), - default(DateTime), - "", - Array.Empty(), - Array.Empty(), - Array.Empty(), - "", - "", - Array.Empty(), - Array.Empty(), - Array.Empty(), - Array.Empty(), - "", - "", - "", - "", - "" - ); + } + }; #endregion #region singleVcardThreeContact @@ -289,64 +192,46 @@ public static class ContactData private static readonly Card singleVcardThreeContactInstance = new ( null, - "3.0", - new NameInfo[] + "3.0" + ) + { + ContactNames = new NameInfo[] { new NameInfo(0, Array.Empty(), "John", "Sanders", Array.Empty(), Array.Empty(), Array.Empty()) }, - "John Sanders", - new TelephoneInfo[] + ContactFullName = "John Sanders", + ContactTelephones = new TelephoneInfo[] { new TelephoneInfo(0, Array.Empty(), new string[] { "cell" }, "495-522-3560") }, - new AddressInfo[] + ContactAddresses = new AddressInfo[] { new AddressInfo(0, Array.Empty(), new string[] { "home" }, "", "", "Los Angeles, USA", "", "", "", "") }, - new OrganizationInfo[] + ContactOrganizations = new OrganizationInfo[] { new OrganizationInfo(0, Array.Empty(), "Acme Co.", "", "", new string[] { "WORK" }) }, - new TitleInfo[] + ContactTitles = new TitleInfo[] { new TitleInfo(0, Array.Empty(), "Product Manager") }, - "", - "Note test for VisualCard", - new EmailInfo[] + ContactNotes = "Note test for VisualCard", + ContactMails = new EmailInfo[] { new EmailInfo(0, Array.Empty(), new string[] { "home" }, "john.s@acme.co") }, - new XNameInfo[] + ContactXNames = new XNameInfo[] { new XNameInfo(0, Array.Empty(), "PHONETIC-FIRST-NAME", new string[] { "Saunders" }, Array.Empty()), new XNameInfo(0, Array.Empty(), "PHONETIC-LAST-NAME", new string[] { "John" }, Array.Empty()), new XNameInfo(0, Array.Empty(), "AIM", new string[] { "john.s" }, Array.Empty()), }, - "individual", - Array.Empty(), - default, - new NicknameInfo[] + ContactNicknames = new NicknameInfo[] { new NicknameInfo(0, Array.Empty(), "JS", new string[] { "HOME" }) - }, - default(DateTime), - "", - Array.Empty(), - Array.Empty(), - Array.Empty(), - "", - "", - Array.Empty(), - Array.Empty(), - Array.Empty(), - Array.Empty(), - "", - "", - "", - "", - "" - ); + } + }; #endregion #region singleVcardFourContact @@ -373,64 +258,46 @@ public static class ContactData private static readonly Card singleVcardFourContactInstance = new ( null, - "4.0", - new NameInfo[] + "4.0" + ) + { + ContactNames = new NameInfo[] { new NameInfo(0, Array.Empty(), "John", "Sanders", Array.Empty(), Array.Empty(), Array.Empty()) }, - "John Sanders", - new TelephoneInfo[] + ContactFullName = "John Sanders", + ContactTelephones = new TelephoneInfo[] { new TelephoneInfo(0, Array.Empty(), new string[] { "cell" }, "495-522-3560") }, - new AddressInfo[] + ContactAddresses = new AddressInfo[] { new AddressInfo(0, Array.Empty(), new string[] { "home" }, "", "", "Los Angeles, USA", "", "", "", "") }, - new OrganizationInfo[] + ContactOrganizations = new OrganizationInfo[] { new OrganizationInfo(0, Array.Empty(), "Acme Co.", "", "", new string[] { "WORK" }) }, - new TitleInfo[] + ContactTitles = new TitleInfo[] { new TitleInfo(0, Array.Empty(), "Product Manager") }, - "", - "Note test for VisualCard", - new EmailInfo[] + ContactNotes = "Note test for VisualCard", + ContactMails = new EmailInfo[] { new EmailInfo(0, Array.Empty(), new string[] { "HOME" }, "john.s@acme.co") }, - new XNameInfo[] + ContactXNames = new XNameInfo[] { new XNameInfo(0, Array.Empty(), "ANDROID-CUSTOM", new string[] { "vnd.android.cursor.item/nickname", "JS", "1", "", "", "", "", "", "", "", "", "", "", "", "", "" }, Array.Empty()), new XNameInfo(0, Array.Empty(), "PHONETIC-FIRST-NAME", new string[] { "Saunders" }, Array.Empty()), new XNameInfo(0, Array.Empty(), "PHONETIC-LAST-NAME", new string[] { "John" }, Array.Empty()) }, - "individual", - Array.Empty(), - default, - Array.Empty(), - default(DateTime), - "", - Array.Empty(), - Array.Empty(), - Array.Empty(), - "", - "", - Array.Empty(), - Array.Empty(), - Array.Empty(), - new ImppInfo[] + ContactImpps = new ImppInfo[] { new ImppInfo(0, Array.Empty(), "aim:john.s", new string[] { "HOME" }) - }, - "", - "", - "", - "", - "" - ); + } + }; #endregion #region multipleVcardTwoContacts @@ -499,124 +366,86 @@ public static class ContactData private static readonly Card multipleVcardTwoContactsInstanceTwo = new ( null, - "2.1", - new NameInfo[] + "2.1" + ) + { + ContactNames = new NameInfo[] { new NameInfo(0, Array.Empty(), "Sarah", "Santos", Array.Empty(), Array.Empty(), Array.Empty()) }, - "Sarah Santos", - new TelephoneInfo[] + ContactFullName = "Sarah Santos", + ContactTelephones = new TelephoneInfo[] { new TelephoneInfo(0, Array.Empty(), new string[] { "CELL" }, "589-210-1059") }, - new AddressInfo[] + ContactAddresses = new AddressInfo[] { new AddressInfo(0, Array.Empty(), new string[] { "HOME" }, "", "", "New York, USA", "", "", "", "") }, - new OrganizationInfo[] + ContactOrganizations = new OrganizationInfo[] { new OrganizationInfo(0, Array.Empty(), "Support Scammer Outcry Organization", "", "", new string[] { "WORK" }) }, - new TitleInfo[] + ContactTitles = new TitleInfo[] { new TitleInfo(0, Array.Empty(), "Chief Executive Officer") }, - "https://sso.org/", - "", - new EmailInfo[] + ContactURL = "https://sso.org/", + ContactMails = new EmailInfo[] { new EmailInfo(0, Array.Empty(), new string[] { "HOME" }, "sarah.s@gmail.com"), new EmailInfo(0, Array.Empty(), new string[] { "WORK" }, "sarah.s@sso.org"), }, - new XNameInfo[] + ContactXNames = new XNameInfo[] { new XNameInfo(0, Array.Empty(), "SIP", new string[] { "sip test" }, Array.Empty()), - }, - "individual", - Array.Empty(), - default, - Array.Empty(), - default(DateTime), - "", - Array.Empty(), - Array.Empty(), - Array.Empty(), - "", - "", - Array.Empty(), - Array.Empty(), - Array.Empty(), - Array.Empty(), - "", - "", - "", - "", - "" - ); + } + }; private static readonly Card multipleVcardTwoContactsInstanceThree = new ( null, - "2.1", - new NameInfo[] + "2.1" + ) + { + ContactNames = new NameInfo[] { new NameInfo(0, Array.Empty(), "Neville", "Navasquillo", new string[] { "Neville", "Nevile" }, new string[] { "Mr." }, new string[] { "Jr." }) }, - "Neville Navasquillo", - new TelephoneInfo[] + ContactFullName = "Neville Navasquillo", + ContactTelephones = new TelephoneInfo[] { new TelephoneInfo(0, Array.Empty(), new string[] { "CELL" }, "1-234-567-890"), new TelephoneInfo(0, Array.Empty(), new string[] { "WORK" }, "098-765-4321"), new TelephoneInfo(0, Array.Empty(), new string[] { "VOICE" }, "078-494-6434"), new TelephoneInfo(0, Array.Empty(), new string[] { "HOME" }, "348-404-8404"), }, - new AddressInfo[] + ContactAddresses = new AddressInfo[] { new AddressInfo(0, Array.Empty(), new string[] { "WORK" }, "POBOX", "", "Street Address ExtAddress", "Reg", "Loc", "Postal", "Country"), new AddressInfo(0, Array.Empty(), new string[] { "HOME" }, "", "", "Street Address", "", "", "", ""), }, - new OrganizationInfo[] + ContactOrganizations = new OrganizationInfo[] { new OrganizationInfo(0, Array.Empty(), "Organization", "", "", new string[] { "WORK" }) }, - new TitleInfo[] + ContactTitles = new TitleInfo[] { new TitleInfo(0, Array.Empty(), "Title") }, - "", - "Notes", - new EmailInfo[] + ContactNotes = "Notes", + ContactMails = new EmailInfo[] { new EmailInfo(0, Array.Empty(), new string[] { "HOME" }, "neville.nvs@gmail.com"), new EmailInfo(0, Array.Empty(), new string[] { "WORK" }, "neville.nvs@nvsc.com"), }, - new XNameInfo[] + ContactXNames = new XNameInfo[] { new XNameInfo(0, Array.Empty(), "ANDROID-CUSTOM", new string[] { "vnd.android.cursor.item/nickname", "NVL.N", "1", "", "", "", "", "", "", "", "", "", "", "", "", "" }, Array.Empty()), new XNameInfo(0, Array.Empty(), "AIM", new string[] { "IM" }, new string[] { "HOME" }), new XNameInfo(0, Array.Empty(), "MSN", new string[] { "Windows LIVE" }, new string[] { "HOME" }), new XNameInfo(0, Array.Empty(), "YAHOO", new string[] { "Yahoo" }, new string[] { "HOME" }), - }, - "individual", - Array.Empty(), - default, - Array.Empty(), - default(DateTime), - "", - Array.Empty(), - Array.Empty(), - Array.Empty(), - "", - "", - Array.Empty(), - Array.Empty(), - Array.Empty(), - Array.Empty(), - "", - "", - "", - "", - "" - ); + } + }; private static readonly Card multipleVcardTwoContactsInstanceFour = singleVcardTwoContactShortInstance; #endregion @@ -686,126 +515,89 @@ public static class ContactData private static readonly Card multipleVcardThreeContactsInstanceTwo = new ( null, - "3.0", - new NameInfo[] + "3.0" + ) + { + ContactNames = new NameInfo[] { new NameInfo(0, Array.Empty(), "Sarah", "Santos", Array.Empty(), Array.Empty(), Array.Empty()) }, - "Sarah Santos", - new TelephoneInfo[] + ContactFullName = "Sarah Santos", + ContactTelephones = new TelephoneInfo[] { new TelephoneInfo(0, Array.Empty(), new string[] { "cell" }, "589-210-1059") }, - new AddressInfo[] + ContactAddresses = new AddressInfo[] { new AddressInfo(0, Array.Empty(), new string[] { "home" }, "", "", "New York, USA", "", "", "", "") }, - new OrganizationInfo[] + ContactOrganizations = new OrganizationInfo[] { new OrganizationInfo(0, Array.Empty(), "Support Scammer Outcry Organization", "", "", new string[] { "WORK" }) }, - new TitleInfo[] + ContactTitles = new TitleInfo[] { new TitleInfo(0, Array.Empty(), "Chief Executive Officer") }, - "https://sso.org/", - "", - new EmailInfo[] + ContactURL = "https://sso.org/", + ContactMails = new EmailInfo[] { new EmailInfo(0, Array.Empty(), new string[] { "home" }, "sarah.s@gmail.com"), new EmailInfo(0, Array.Empty(), new string[] { "work" }, "sarah.s@sso.org"), }, - new XNameInfo[] + ContactXNames = new XNameInfo[] { new XNameInfo(0, Array.Empty(), "SIP", new string[] { "sip test" }, Array.Empty()), - }, - "individual", - Array.Empty(), - default, - Array.Empty(), - default(DateTime), - "", - Array.Empty(), - Array.Empty(), - Array.Empty(), - "", - "", - Array.Empty(), - Array.Empty(), - Array.Empty(), - Array.Empty(), - "", - "", - "", - "", - "" - ); + } + }; private static readonly Card multipleVcardThreeContactsInstanceThree = new ( null, - "3.0", - new NameInfo[] + "3.0" + ) + { + ContactNames = new NameInfo[] { new NameInfo(0, Array.Empty(), "Neville", "Navasquillo", new string[] { "Neville", "Nevile" }, new string[] { "Mr." }, new string[] { "Jr." }) }, - "Neville Navasquillo", - new TelephoneInfo[] + ContactFullName = "Neville Navasquillo", + ContactTelephones = new TelephoneInfo[] { new TelephoneInfo(0, Array.Empty(), new string[] { "cell" }, "1-234-567-890"), new TelephoneInfo(0, Array.Empty(), new string[] { "work" }, "098-765-4321"), new TelephoneInfo(0, Array.Empty(), new string[] { "voice" }, "078-494-6434"), new TelephoneInfo(0, Array.Empty(), new string[] { "home" }, "348-404-8404"), }, - new AddressInfo[] + ContactAddresses = new AddressInfo[] { new AddressInfo(0, Array.Empty(), new string[] { "work" }, "POBOX", "", "Street Address ExtAddress", "Reg", "Loc", "Postal", "Country"), new AddressInfo(0, Array.Empty(), new string[] { "home" }, "", "", "Street Address", "", "", "", ""), }, - new OrganizationInfo[] + ContactOrganizations = new OrganizationInfo[] { new OrganizationInfo(0, Array.Empty(), "Organization", "", "", new string[] { "WORK" }) }, - new TitleInfo[] + ContactTitles = new TitleInfo[] { new TitleInfo(0, Array.Empty(), "Title") }, - "", - "Notes", - new EmailInfo[] + ContactNotes = "Notes", + ContactMails = new EmailInfo[] { new EmailInfo(0, Array.Empty(), new string[] { "home" }, "neville.nvs@gmail.com"), new EmailInfo(0, Array.Empty(), new string[] { "work" }, "neville.nvs@nvsc.com"), }, - new XNameInfo[] + ContactXNames = new XNameInfo[] { new XNameInfo(0, Array.Empty(), "AIM", new string[] { "IM" }, new string[] { "HOME" }), new XNameInfo(0, Array.Empty(), "MSN", new string[] { "Windows LIVE" }, new string[] { "HOME" }), new XNameInfo(0, Array.Empty(), "YAHOO", new string[] { "Yahoo" }, new string[] { "HOME" }), }, - "individual", - Array.Empty(), - default, - new NicknameInfo[] + ContactNicknames = new NicknameInfo[] { new NicknameInfo(0, Array.Empty(), "NVL.N", new string[] { "HOME" }) - }, - default(DateTime), - "", - Array.Empty(), - Array.Empty(), - Array.Empty(), - "", - "", - Array.Empty(), - Array.Empty(), - Array.Empty(), - Array.Empty(), - "", - "", - "", - "", - "" - ); + } + }; private static readonly Card multipleVcardThreeContactsInstanceFour = singleVcardThreeContactShortInstance; #endregion @@ -876,127 +668,90 @@ public static class ContactData private static readonly Card multipleVcardFourContactsInstanceTwo = new ( null, - "4.0", - new NameInfo[] + "4.0" + ) + { + ContactNames = new NameInfo[] { new NameInfo(0, Array.Empty(), "Neville", "Navasquillo", new string[] { "Neville", "Nevile" }, new string[] { "Mr." }, new string[] { "Jr." }), new NameInfo(0, new string[] { "LANGUAGE=de" }, "Neville", "NAVASQUILLO", new string[] { "Neville", "Nevile" }, new string[] { "Mr." }, new string[] { "Jr." }) }, - "Neville Navasquillo", - new TelephoneInfo[] + ContactFullName = "Neville Navasquillo", + ContactTelephones = new TelephoneInfo[] { new TelephoneInfo(0, Array.Empty(), new string[] { "work" }, "098-765-4321"), new TelephoneInfo(0, Array.Empty(), new string[] { "cell" }, "1-234-567-890"), new TelephoneInfo(0, Array.Empty(), new string[] { "voice" }, "078-494-6434"), new TelephoneInfo(0, Array.Empty(), new string[] { "home" }, "348-404-8404"), }, - new AddressInfo[] + ContactAddresses = new AddressInfo[] { new AddressInfo(0, Array.Empty(), new string[] { "work" }, "POBOX", "", "Street Address ExtAddress", "Reg", "Loc", "Postal", "Country"), new AddressInfo(0, Array.Empty(), new string[] { "home" }, "", "", "Street Address", "", "", "", ""), }, - new OrganizationInfo[] + ContactOrganizations = new OrganizationInfo[] { new OrganizationInfo(0, Array.Empty(), "Organization", "", "", new string[] { "WORK" }) }, - new TitleInfo[] + ContactTitles = new TitleInfo[] { new TitleInfo(0, Array.Empty(), "Title") }, - "", - "Notes", - new EmailInfo[] + ContactNotes = "Notes", + ContactMails = new EmailInfo[] { new EmailInfo(0, Array.Empty(), new string[] { "HOME" }, "neville.nvs@gmail.com"), new EmailInfo(0, Array.Empty(), new string[] { "WORK" }, "neville.nvs@nvsc.com"), }, - new XNameInfo[] + ContactXNames = new XNameInfo[] { new XNameInfo(0, Array.Empty(), "ANDROID-CUSTOM", new string[] { "vnd.android.cursor.item/nickname", "NVL.N", "1", "", "", "", "", "", "", "", "", "", "", "", "", "" }, Array.Empty()), }, - "individual", - Array.Empty(), - default, - Array.Empty(), - default(DateTime), - "", - Array.Empty(), - Array.Empty(), - Array.Empty(), - "", - "", - Array.Empty(), - Array.Empty(), - Array.Empty(), - new ImppInfo[] - { + ContactImpps = new ImppInfo[] + { new ImppInfo(0, Array.Empty(), "aim:IM", new string[] { "HOME" }), new ImppInfo(0, Array.Empty(), "msn:Windows LIVE", new string[] { "HOME" }), new ImppInfo(0, Array.Empty(), "ymsgr:Yahoo", new string[] { "HOME" }) - }, - "", - "", - "", - "", - "" - ); + } + }; private static readonly Card multipleVcardFourContactsInstanceThree = new ( null, - "4.0", - new NameInfo[] + "4.0" + ) + { + ContactNames = new NameInfo[] { new NameInfo(0, Array.Empty(), "Sarah", "Santos", Array.Empty(), Array.Empty(), Array.Empty()) }, - "Sarah Santos", - new TelephoneInfo[] + ContactFullName = "Sarah Santos", + ContactTelephones = new TelephoneInfo[] { new TelephoneInfo(0, Array.Empty(), new string[] { "cell" }, "589-210-1059") }, - new AddressInfo[] + ContactAddresses = new AddressInfo[] { new AddressInfo(0, Array.Empty(), new string[] { "home" }, "", "", "New York, USA", "", "", "", "") }, - new OrganizationInfo[] + ContactOrganizations = new OrganizationInfo[] { new OrganizationInfo(0, Array.Empty(), "Support Scammer Outcry Organization", "", "", new string[] { "WORK" }) }, - new TitleInfo[] + ContactTitles = new TitleInfo[] { new TitleInfo(0, Array.Empty(), "Chief Executive Officer") }, - "https://sso.org/", - "", - new EmailInfo[] + ContactURL = "https://sso.org/", + ContactMails = new EmailInfo[] { new EmailInfo(0, Array.Empty(), new string[] { "HOME" }, "sarah.s@gmail.com"), new EmailInfo(0, Array.Empty(), new string[] { "WORK" }, "sarah.s@sso.org"), }, - new XNameInfo[] + ContactXNames = new XNameInfo[] { new XNameInfo(0, Array.Empty(), "SIP-SIP", new string[] { "sip test" }, Array.Empty()), - }, - "individual", - Array.Empty(), - default, - Array.Empty(), - default(DateTime), - "", - Array.Empty(), - Array.Empty(), - Array.Empty(), - "", - "", - Array.Empty(), - Array.Empty(), - Array.Empty(), - Array.Empty(), - "", - "", - "", - "", - "" - ); + } + }; private static readonly Card multipleVcardFourContactsInstanceFour = singleVcardFourContactInstance; #endregion @@ -1035,145 +790,76 @@ public static class ContactData private static readonly Card vcardThreeOldSampleInstanceOne = new ( null, - "3.0", - new NameInfo[] + "3.0" + ) + { + ContactNames = new NameInfo[] { new NameInfo(0, Array.Empty(), "Derik", "Stenerson", Array.Empty(), Array.Empty(), Array.Empty()) }, - "Derik Stenerson", - new TelephoneInfo[] + ContactFullName = "Derik Stenerson", + ContactTelephones = new TelephoneInfo[] { new TelephoneInfo(0, Array.Empty(), new string[] { "WORK", "MSG" }, "+1-425-936-5522"), new TelephoneInfo(0, Array.Empty(), new string[] { "WORK", "FAX" }, "+1-425-936-7329") }, - new AddressInfo[] + ContactAddresses = new AddressInfo[] { new AddressInfo(0, Array.Empty(), new string[] { "WORK", "POSTAL", "PARCEL" }, "", "", "One Microsoft Way", "Redmond", "WA", "98052-6399", "USA") }, - new OrganizationInfo[] + ContactOrganizations = new OrganizationInfo[] { new OrganizationInfo(0, Array.Empty(), "Microsoft Corporation", "", "", new string[] { "WORK" }) }, - Array.Empty(), - "", - "", - new EmailInfo[] + ContactMails = new EmailInfo[] { new EmailInfo(0, Array.Empty(), new string[] { "INTERNET" }, "deriks@Microsoft.com") - }, - Array.Empty(), - "individual", - Array.Empty(), - default, - Array.Empty(), - default(DateTime), - "", - Array.Empty(), - Array.Empty(), - Array.Empty(), - "", - "", - Array.Empty(), - Array.Empty(), - Array.Empty(), - Array.Empty(), - "", - "", - "", - "", - "" - ); + } + }; private static readonly Card vcardThreeOldSampleInstanceTwo = new ( null, - "3.0", - new NameInfo[] + "3.0" + ) + { + ContactNames = new NameInfo[] { new NameInfo(0, Array.Empty(), "Anik", "Ganguly", Array.Empty(), Array.Empty(), Array.Empty()) }, - "Anik Ganguly", - new TelephoneInfo[] + ContactFullName = "Anik Ganguly", + ContactTelephones = new TelephoneInfo[] { new TelephoneInfo(0, Array.Empty(), new string[] { "WORK", "MSG" }, "+1-734-542-5955") }, - new AddressInfo[] + ContactAddresses = new AddressInfo[] { new AddressInfo(0, Array.Empty(), new string[] { "WORK", "POSTAL", "PARCEL" }, "", "Suite 101", "38777 West Six Mile Road", "Livonia", "MI", "48152", "USA") }, - new OrganizationInfo[] + ContactOrganizations = new OrganizationInfo[] { new OrganizationInfo(0, Array.Empty(), " Open Text Inc.", "", "", new string[] { "WORK" }) }, - Array.Empty(), - "", - "", - new EmailInfo[] + ContactMails = new EmailInfo[] { new EmailInfo(0, Array.Empty(), new string[] { "INTERNET" }, "ganguly@acm.org") - }, - Array.Empty(), - "individual", - Array.Empty(), - default, - Array.Empty(), - default(DateTime), - "", - Array.Empty(), - Array.Empty(), - Array.Empty(), - "", - "", - Array.Empty(), - Array.Empty(), - Array.Empty(), - Array.Empty(), - "", - "", - "", - "", - "" - ); + } + }; private static readonly Card vcardThreeOldSampleInstanceThree = new ( null, - "3.0", - new NameInfo[] + "3.0" + ) + { + ContactNames = new NameInfo[] { new NameInfo(0, Array.Empty(), "Robert", "Moskowitz", Array.Empty(), Array.Empty(), Array.Empty()) }, - "Robert Moskowitz", - Array.Empty(), - Array.Empty(), - Array.Empty(), - Array.Empty(), - "", - "", - new EmailInfo[] + ContactFullName = "Robert Moskowitz", + ContactMails = new EmailInfo[] { new EmailInfo(0, Array.Empty(), new string[] { "INTERNET" }, "rgm-ietf@htt-consult.com") - }, - Array.Empty(), - "individual", - Array.Empty(), - default, - Array.Empty(), - default(DateTime), - "", - Array.Empty(), - Array.Empty(), - Array.Empty(), - "", - "", - Array.Empty(), - Array.Empty(), - Array.Empty(), - Array.Empty(), - "", - "", - "", - "", - "" - ); + } + }; #endregion /// diff --git a/VisualCard/Parsers/Four/VcardFour.cs b/VisualCard/Parsers/Four/VcardFour.cs index ac2c696..69baabd 100644 --- a/VisualCard/Parsers/Four/VcardFour.cs +++ b/VisualCard/Parsers/Four/VcardFour.cs @@ -458,7 +458,38 @@ public override Card Parse() throw new InvalidDataException("The full name specifier, \"FN:\", is required."); // Make a new instance of the card - return new Card(this, CardVersion, _names.ToArray(), _fullName, _telephones.ToArray(), _addresses.ToArray(), _orgs.ToArray(), _titles.ToArray(), _url, _note, _emails.ToArray(), _xes.ToArray(), _kind, _photos.ToArray(), _rev, _nicks.ToArray(), _bday, "", _roles.ToArray(), _categories.ToArray(), _logos.ToArray(), _prodId, _sortString, _timezones.ToArray(), _geos.ToArray(), _sounds.ToArray(), _impps.ToArray(), _source, _xml, _fbUrl, _calUri, _caladrUri); + return new Card(this, CardVersion, _kind) + { + CardRevision = _rev, + ContactNames = _names.ToArray(), + ContactFullName = _fullName, + ContactTelephones = _telephones.ToArray(), + ContactAddresses = _addresses.ToArray(), + ContactOrganizations = _orgs.ToArray(), + ContactTitles = _titles.ToArray(), + ContactURL = _url, + ContactNotes = _note, + ContactMails = _emails.ToArray(), + ContactXNames = _xes.ToArray(), + ContactPhotos = _photos.ToArray(), + ContactNicknames = _nicks.ToArray(), + ContactBirthdate = _bday, + ContactMailer = "", + ContactRoles = _roles.ToArray(), + ContactCategories = _categories.ToArray(), + ContactLogos = _logos.ToArray(), + ContactProdId = _prodId, + ContactSortString = _sortString, + ContactTimeZone = _timezones.ToArray(), + ContactGeo = _geos.ToArray(), + ContactSounds = _sounds.ToArray(), + ContactImpps = _impps.ToArray(), + ContactSource = _source, + ContactXml = _xml, + ContactFreeBusyUrl = _fbUrl, + ContactCalendarUrl = _calUri, + ContactCalendarSchedulingRequestUrl = _caladrUri + }; } internal override string SaveToString(Card card) diff --git a/VisualCard/Parsers/Three/VcardThree.cs b/VisualCard/Parsers/Three/VcardThree.cs index 6ba3d0e..c818faa 100644 --- a/VisualCard/Parsers/Three/VcardThree.cs +++ b/VisualCard/Parsers/Three/VcardThree.cs @@ -313,7 +313,38 @@ public override Card Parse() throw new InvalidDataException("The full name specifier, \"FN:\", is required."); // Make a new instance of the card - return new Card(this, CardVersion, _names.ToArray(), _fullName, _telephones.ToArray(), _addresses.ToArray(), _orgs.ToArray(), _titles.ToArray(), _url, _note, _emails.ToArray(), _xes.ToArray(), "individual", _photos.ToArray(), _rev, _nicks.ToArray(), _bday, _mailer, _roles.ToArray(), _categories.ToArray(), _logos.ToArray(), _prodId, _sortString, _timezones.ToArray(), _geos.ToArray(), _sounds.ToArray(), _impps.ToArray(), _source, "", "", "", ""); + return new Card(this, CardVersion, "individual") + { + CardRevision = _rev, + ContactNames = _names.ToArray(), + ContactFullName = _fullName, + ContactTelephones = _telephones.ToArray(), + ContactAddresses = _addresses.ToArray(), + ContactOrganizations = _orgs.ToArray(), + ContactTitles = _titles.ToArray(), + ContactURL = _url, + ContactNotes = _note, + ContactMails = _emails.ToArray(), + ContactXNames = _xes.ToArray(), + ContactPhotos = _photos.ToArray(), + ContactNicknames = _nicks.ToArray(), + ContactBirthdate = _bday, + ContactMailer = _mailer, + ContactRoles = _roles.ToArray(), + ContactCategories = _categories.ToArray(), + ContactLogos = _logos.ToArray(), + ContactProdId = _prodId, + ContactSortString = _sortString, + ContactTimeZone = _timezones.ToArray(), + ContactGeo = _geos.ToArray(), + ContactSounds = _sounds.ToArray(), + ContactImpps = _impps.ToArray(), + ContactSource = _source, + ContactXml = "", + ContactFreeBusyUrl = "", + ContactCalendarUrl = "", + ContactCalendarSchedulingRequestUrl = "" + }; } internal override string SaveToString(Card card) diff --git a/VisualCard/Parsers/Two/VcardTwo.cs b/VisualCard/Parsers/Two/VcardTwo.cs index 0cc3c20..0f5381f 100644 --- a/VisualCard/Parsers/Two/VcardTwo.cs +++ b/VisualCard/Parsers/Two/VcardTwo.cs @@ -256,7 +256,38 @@ public override Card Parse() throw new InvalidDataException("The name specifier, \"N:\", is required."); // Make a new instance of the card - return new Card(this, CardVersion, _names.ToArray(), _fullName, _telephones.ToArray(), _addresses.ToArray(), _orgs.ToArray(), _titles.ToArray(), _url, _note, _emails.ToArray(), _xes.ToArray(), "individual", _photos.ToArray(), _rev, Array.Empty(), _bday, _mailer, _roles.ToArray(), Array.Empty(), _logos.ToArray(), "", "", _timezones.ToArray(), _geos.ToArray(), _sounds.ToArray(), _impps.ToArray(), _source, "", "", "", ""); + return new Card(this, CardVersion, "individual") + { + CardRevision = _rev, + ContactNames = _names.ToArray(), + ContactFullName = _fullName, + ContactTelephones = _telephones.ToArray(), + ContactAddresses = _addresses.ToArray(), + ContactOrganizations = _orgs.ToArray(), + ContactTitles = _titles.ToArray(), + ContactURL = _url, + ContactNotes = _note, + ContactMails = _emails.ToArray(), + ContactXNames = _xes.ToArray(), + ContactPhotos = _photos.ToArray(), + ContactNicknames = Array.Empty(), + ContactBirthdate = _bday, + ContactMailer = _mailer, + ContactRoles = _roles.ToArray(), + ContactCategories = Array.Empty(), + ContactLogos = _logos.ToArray(), + ContactProdId = "", + ContactSortString = "", + ContactTimeZone = _timezones.ToArray(), + ContactGeo = _geos.ToArray(), + ContactSounds = _sounds.ToArray(), + ContactImpps = _impps.ToArray(), + ContactSource = _source, + ContactXml = "", + ContactFreeBusyUrl = "", + ContactCalendarUrl = "", + ContactCalendarSchedulingRequestUrl = "" + }; } internal override string SaveToString(Card card) diff --git a/VisualCard/Parts/Card.cs b/VisualCard/Parts/Card.cs index 8ade289..0c6b56b 100644 --- a/VisualCard/Parts/Card.cs +++ b/VisualCard/Parts/Card.cs @@ -37,127 +37,127 @@ public class Card : IEquatable /// /// The VCard version /// - public string CardVersion { get; } + public string CardVersion { get; } = ""; /// /// The VCard kind (individual is the default) /// - public string CardKind { get; } + public string CardKind { get; } = "individual"; /// /// The contact's names /// - public NameInfo[] ContactNames { get; set; } + public NameInfo[] ContactNames { get; set; } = Array.Empty(); /// /// The contact's full name /// - public string ContactFullName { get; set; } + public string ContactFullName { get; set; } = ""; /// /// The contact's telephones /// - public TelephoneInfo[] ContactTelephones { get; set; } + public TelephoneInfo[] ContactTelephones { get; set; } = Array.Empty(); /// /// The contact's addresses /// - public AddressInfo[] ContactAddresses { get; set; } + public AddressInfo[] ContactAddresses { get; set; } = Array.Empty(); /// /// The contact's e-mails /// - public EmailInfo[] ContactMails { get; set; } + public EmailInfo[] ContactMails { get; set; } = Array.Empty(); /// /// The contact's organizations /// - public OrganizationInfo[] ContactOrganizations { get; set; } + public OrganizationInfo[] ContactOrganizations { get; set; } = Array.Empty(); /// /// The contact's titles /// - public TitleInfo[] ContactTitles { get; set; } + public TitleInfo[] ContactTitles { get; set; } = Array.Empty(); /// /// The contact's URL /// - public string ContactURL { get; set; } + public string ContactURL { get; set; } = ""; /// /// The contact's photos /// - public PhotoInfo[] ContactPhotos { get; set; } + public PhotoInfo[] ContactPhotos { get; set; } = Array.Empty(); /// /// The contact's notes /// - public string ContactNotes { get; set; } + public string ContactNotes { get; set; } = ""; /// /// The contact's extended options (usually starts with X-SOMETHING:Value1;Value2...) /// - public XNameInfo[] ContactXNames { get; set; } + public XNameInfo[] ContactXNames { get; set; } = Array.Empty(); /// /// The card revision /// - public DateTime? CardRevision { get; set; } + public DateTime? CardRevision { get; set; } = default(DateTime); /// /// The contact's nicknames /// - public NicknameInfo[] ContactNicknames { get; set; } + public NicknameInfo[] ContactNicknames { get; set; } = Array.Empty(); /// /// The contact's birthdate /// - public DateTime? ContactBirthdate { get; set; } + public DateTime? ContactBirthdate { get; set; } = default(DateTime); /// /// The contact's mailing software /// - public string ContactMailer { get; set; } + public string ContactMailer { get; set; } = ""; /// /// The contact's roles /// - public RoleInfo[] ContactRoles { get; set; } + public RoleInfo[] ContactRoles { get; set; } = Array.Empty(); /// /// The contact's categories /// - public string[] ContactCategories { get; set; } + public string[] ContactCategories { get; set; } = Array.Empty(); /// /// The contact's logos /// - public LogoInfo[] ContactLogos { get; set; } + public LogoInfo[] ContactLogos { get; set; } = Array.Empty(); /// /// The contact's product ID /// - public string ContactProdId { get; set; } + public string ContactProdId { get; set; } = ""; /// /// The contact's sort string /// - public string ContactSortString { get; set; } + public string ContactSortString { get; set; } = ""; /// /// The contact's time zones /// - public TimeZoneInfo[] ContactTimeZone { get; set; } + public TimeZoneInfo[] ContactTimeZone { get; set; } = Array.Empty(); /// /// The contact's geographical coordinates in (lat;long) /// - public GeoInfo[] ContactGeo { get; set; } + public GeoInfo[] ContactGeo { get; set; } = Array.Empty(); /// /// The contact's sounds /// - public SoundInfo[] ContactSounds { get; set; } + public SoundInfo[] ContactSounds { get; set; } = Array.Empty(); /// /// The contact's IMPP information /// - public ImppInfo[] ContactImpps { get; set; } + public ImppInfo[] ContactImpps { get; set; } = Array.Empty(); /// /// The contact's card source /// - public string ContactSource { get; set; } + public string ContactSource { get; set; } = ""; /// /// The contact's XML code /// - public string ContactXml { get; set; } + public string ContactXml { get; set; } = ""; /// /// The contact's free/busy indicator URL /// - public string ContactFreeBusyUrl { get; set; } + public string ContactFreeBusyUrl { get; set; } = ""; /// /// The contact's calendar URL /// - public string ContactCalendarUrl { get; set; } + public string ContactCalendarUrl { get; set; } = ""; /// /// The contact's calendar scheduling request URL /// - public string ContactCalendarSchedulingRequestUrl { get; set; } + public string ContactCalendarSchedulingRequestUrl { get; set; } = ""; internal BaseVcardParser Parser => _parser; @@ -222,7 +222,12 @@ public bool Equals(Card source, Card target) source.ContactBirthdate == target.ContactBirthdate && source.ContactMailer == target.ContactMailer && source.ContactProdId == target.ContactProdId && - source.ContactSortString == target.ContactSortString + source.ContactSortString == target.ContactSortString && + source.ContactSource == target.ContactSource && + source.ContactXml == target.ContactXml && + source.ContactFreeBusyUrl == target.ContactFreeBusyUrl && + source.ContactCalendarUrl == target.ContactCalendarUrl && + source.ContactCalendarSchedulingRequestUrl == target.ContactCalendarSchedulingRequestUrl ; } @@ -267,40 +272,11 @@ public override int GetHashCode() public static bool operator !=(Card a, Card b) => !a.Equals(b); - internal Card(BaseVcardParser parser, string cardVersion, NameInfo[] contactNames, string contactFullName, TelephoneInfo[] contactTelephones, AddressInfo[] contactAddresses, OrganizationInfo[] contactOrganizations, TitleInfo[] contactTitles, string contactURL, string contactNotes, EmailInfo[] contactMails, XNameInfo[] contactXNames, string cardKind, PhotoInfo[] contactPhotos, DateTime cardRevision, NicknameInfo[] contactNicknames, DateTime? contactBirthdate, string contactMailer, RoleInfo[] contactRoles, string[] contactCategories, LogoInfo[] contactLogos, string contactProdId, string contactSortString, TimeZoneInfo[] contactTimeZone, GeoInfo[] contactGeo, SoundInfo[] contactSounds, ImppInfo[] contactImpps, string contactSource, string contactXml, string contactFreeBusyUrl, string contactCalendarUrl, string contactCalendarSchedulingRequestUrl) + internal Card(BaseVcardParser parser, string cardVersion, string cardKind = "individual") { _parser = parser; CardVersion = cardVersion; - ContactNames = contactNames; - ContactFullName = contactFullName; - ContactTelephones = contactTelephones; - ContactAddresses = contactAddresses; - ContactOrganizations = contactOrganizations; - ContactTitles = contactTitles; - ContactURL = contactURL; - ContactNotes = contactNotes; - ContactMails = contactMails; - ContactXNames = contactXNames; CardKind = cardKind; - ContactPhotos = contactPhotos; - CardRevision = cardRevision; - ContactNicknames = contactNicknames; - ContactBirthdate = contactBirthdate; - ContactMailer = contactMailer; - ContactRoles = contactRoles; - ContactCategories = contactCategories; - ContactLogos = contactLogos; - ContactProdId = contactProdId; - ContactSortString = contactSortString; - ContactTimeZone = contactTimeZone; - ContactGeo = contactGeo; - ContactSounds = contactSounds; - ContactImpps = contactImpps; - ContactSource = contactSource; - ContactXml = contactXml; - ContactFreeBusyUrl = contactFreeBusyUrl; - ContactCalendarUrl = contactCalendarUrl; - ContactCalendarSchedulingRequestUrl = contactCalendarSchedulingRequestUrl; } } }