diff --git a/VisualCard.ShowContacts/Program.cs b/VisualCard.ShowContacts/Program.cs index 1d177c5..2492b7e 100644 --- a/VisualCard.ShowContacts/Program.cs +++ b/VisualCard.ShowContacts/Program.cs @@ -65,7 +65,7 @@ static void Main(string[] args) android ? AndroidContactsDb.GetContactsFromDb(args[0]) : mecard ? MeCard.GetContactsFromMeCardString(meCardString) : CardTools.GetCardParsers(args[0]); - List Contacts = new(); + List Contacts = []; // Parse all contacts foreach (BaseVcardParser ContactParser in ContactParsers) diff --git a/VisualCard.Tests/ContactData.cs b/VisualCard.Tests/ContactData.cs index 446f6b0..47315d4 100644 --- a/VisualCard.Tests/ContactData.cs +++ b/VisualCard.Tests/ContactData.cs @@ -66,7 +66,7 @@ public static class ContactData { ContactNames = new NameInfo[] { - new NameInfo(0, Array.Empty(), "Rick", "Hood", Array.Empty(), Array.Empty(), Array.Empty()) + new NameInfo(0, [], "Rick", "Hood", [], [], []) }, ContactFullName = "Rick Hood" }; @@ -79,7 +79,7 @@ public static class ContactData { ContactNames = new NameInfo[] { - new NameInfo(0, Array.Empty(), "Rick", "Hood", Array.Empty(), Array.Empty(), Array.Empty()) + new NameInfo(0, [], "Rick", "Hood", [], [], []) }, ContactFullName = "Rick Hood" }; @@ -104,7 +104,7 @@ public static class ContactData { ContactNames = new NameInfo[] { - new NameInfo(0, Array.Empty(), "Rick", "Hood", Array.Empty(), Array.Empty(), Array.Empty()) + new NameInfo(0, [], "Rick", "Hood", [], [], []) }, ContactFullName = "Rick Hood" }; @@ -129,7 +129,7 @@ public static class ContactData { ContactNames = new NameInfo[] { - new NameInfo(0, Array.Empty(), "Rick", "Hood", Array.Empty(), Array.Empty(), Array.Empty()) + new NameInfo(0, [], "Rick", "Hood", [], [], []) }, ContactFullName = "Rick Hood" }; @@ -165,21 +165,21 @@ public static class ContactData { ContactNames = new NameInfo[] { - new NameInfo(0, Array.Empty(), "John", "Sanders", Array.Empty(), Array.Empty(), Array.Empty()) + new NameInfo(0, [], "John", "Sanders", [], [], []) }, ContactFullName = "John Sanders", ContactTelephones = new TelephoneInfo[] { - new TelephoneInfo(0, Array.Empty(), new string[] { "CELL" }, "495-522-3560") + new TelephoneInfo(0, [], new string[] { "CELL" }, "495-522-3560") }, ContactAddresses = new AddressInfo[] { - new AddressInfo(0, Array.Empty(), new string[] { "HOME" }, "", "", "Los Angeles", "", "", "", "USA") + new AddressInfo(0, [], new string[] { "HOME" }, "", "", "Los Angeles", "", "", "", "USA") }, ContactNotes = "Note test for VisualCard", ContactMails = new EmailInfo[] { - new EmailInfo(0, Array.Empty(), new string[] { "HOME" }, "john.s@acme.co") + new EmailInfo(0, [], new string[] { "HOME" }, "john.s@acme.co") } }; @@ -211,36 +211,36 @@ public static class ContactData { ContactNames = new NameInfo[] { - new NameInfo(0, Array.Empty(), "John", "Sanders", Array.Empty(), Array.Empty(), Array.Empty()) + new NameInfo(0, [], "John", "Sanders", [], [], []) }, ContactFullName = "John Sanders", ContactTelephones = new TelephoneInfo[] { - new TelephoneInfo(0, Array.Empty(), new string[] { "CELL" }, "495-522-3560") + new TelephoneInfo(0, [], new string[] { "CELL" }, "495-522-3560") }, ContactAddresses = new AddressInfo[] { - new AddressInfo(0, Array.Empty(), new string[] { "HOME" }, "", "", "Los Angeles, USA", "", "", "", "") + new AddressInfo(0, [], new string[] { "HOME" }, "", "", "Los Angeles, USA", "", "", "", "") }, ContactOrganizations = new OrganizationInfo[] { - new OrganizationInfo(0, Array.Empty(), "Acme Co.", "", "", new string[] { "WORK" }) + new OrganizationInfo(0, [], "Acme Co.", "", "", new string[] { "WORK" }) }, ContactTitles = new TitleInfo[] { - new TitleInfo(0, Array.Empty(), "Product Manager") + new TitleInfo(0, [], "Product Manager") }, ContactNotes = "Note test for VisualCard", ContactMails = new EmailInfo[] { - new EmailInfo(0, Array.Empty(), new string[] { "HOME" }, "john.s@acme.co") + new EmailInfo(0, [], new string[] { "HOME" }, "john.s@acme.co") }, 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()), + new XNameInfo(0, [], "PHONETIC-FIRST-NAME", new string[] { "Saunders" }, []), + new XNameInfo(0, [], "PHONETIC-LAST-NAME", new string[] { "John" }, []), + new XNameInfo(0, [], "ANDROID-CUSTOM", new string[] { "vnd.android.cursor.item/nickname", "JS", "1", "", "", "", "", "", "", "", "", "", "", "", "", "" }, []), + new XNameInfo(0, [], "AIM", new string[] { "john.s" }, []), } }; #endregion @@ -274,39 +274,39 @@ public static class ContactData { ContactNames = new NameInfo[] { - new NameInfo(0, Array.Empty(), "John", "Sanders", Array.Empty(), Array.Empty(), Array.Empty()) + new NameInfo(0, [], "John", "Sanders", [], [], []) }, ContactFullName = "John Sanders", ContactTelephones = new TelephoneInfo[] { - new TelephoneInfo(0, Array.Empty(), new string[] { "cell" }, "495-522-3560") + new TelephoneInfo(0, [], new string[] { "cell" }, "495-522-3560") }, ContactAddresses = new AddressInfo[] { - new AddressInfo(0, Array.Empty(), new string[] { "home" }, "", "", "Los Angeles, USA", "", "", "", "") + new AddressInfo(0, [], new string[] { "home" }, "", "", "Los Angeles, USA", "", "", "", "") }, ContactOrganizations = new OrganizationInfo[] { - new OrganizationInfo(0, Array.Empty(), "Acme Co.", "", "", new string[] { "WORK" }) + new OrganizationInfo(0, [], "Acme Co.", "", "", new string[] { "WORK" }) }, ContactTitles = new TitleInfo[] { - new TitleInfo(0, Array.Empty(), "Product Manager") + new TitleInfo(0, [], "Product Manager") }, ContactNotes = "Note test for VisualCard", ContactMails = new EmailInfo[] { - new EmailInfo(0, Array.Empty(), new string[] { "home" }, "john.s@acme.co") + new EmailInfo(0, [], new string[] { "home" }, "john.s@acme.co") }, 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()), + new XNameInfo(0, [], "PHONETIC-FIRST-NAME", new string[] { "Saunders" }, []), + new XNameInfo(0, [], "PHONETIC-LAST-NAME", new string[] { "John" }, []), + new XNameInfo(0, [], "AIM", new string[] { "john.s" }, []), }, ContactNicknames = new NicknameInfo[] { - new NicknameInfo(0, Array.Empty(), "JS", new string[] { "HOME" }) + new NicknameInfo(0, [], "JS", new string[] { "HOME" }) } }; #endregion @@ -340,39 +340,39 @@ public static class ContactData { ContactNames = new NameInfo[] { - new NameInfo(0, Array.Empty(), "John", "Sanders", Array.Empty(), Array.Empty(), Array.Empty()) + new NameInfo(0, [], "John", "Sanders", [], [], []) }, ContactFullName = "John Sanders", ContactTelephones = new TelephoneInfo[] { - new TelephoneInfo(0, Array.Empty(), new string[] { "cell" }, "495-522-3560") + new TelephoneInfo(0, [], new string[] { "cell" }, "495-522-3560") }, ContactAddresses = new AddressInfo[] { - new AddressInfo(0, Array.Empty(), new string[] { "home" }, "", "", "Los Angeles, USA", "", "", "", "") + new AddressInfo(0, [], new string[] { "home" }, "", "", "Los Angeles, USA", "", "", "", "") }, ContactOrganizations = new OrganizationInfo[] { - new OrganizationInfo(0, Array.Empty(), "Acme Co.", "", "", new string[] { "WORK" }) + new OrganizationInfo(0, [], "Acme Co.", "", "", new string[] { "WORK" }) }, ContactTitles = new TitleInfo[] { - new TitleInfo(0, Array.Empty(), "Product Manager") + new TitleInfo(0, [], "Product Manager") }, ContactNotes = "Note test for VisualCard", ContactMails = new EmailInfo[] { - new EmailInfo(0, Array.Empty(), new string[] { "HOME" }, "john.s@acme.co") + new EmailInfo(0, [], new string[] { "HOME" }, "john.s@acme.co") }, 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()) + new XNameInfo(0, [], "ANDROID-CUSTOM", new string[] { "vnd.android.cursor.item/nickname", "JS", "1", "", "", "", "", "", "", "", "", "", "", "", "", "" }, []), + new XNameInfo(0, [], "PHONETIC-FIRST-NAME", new string[] { "Saunders" }, []), + new XNameInfo(0, [], "PHONETIC-LAST-NAME", new string[] { "John" }, []) }, ContactImpps = new ImppInfo[] { - new ImppInfo(0, Array.Empty(), "aim:john.s", new string[] { "HOME" }) + new ImppInfo(0, [], "aim:john.s", new string[] { "HOME" }) } }; #endregion @@ -448,34 +448,34 @@ public static class ContactData { ContactNames = new NameInfo[] { - new NameInfo(0, Array.Empty(), "Sarah", "Santos", Array.Empty(), Array.Empty(), Array.Empty()) + new NameInfo(0, [], "Sarah", "Santos", [], [], []) }, ContactFullName = "Sarah Santos", ContactTelephones = new TelephoneInfo[] { - new TelephoneInfo(0, Array.Empty(), new string[] { "CELL" }, "589-210-1059") + new TelephoneInfo(0, [], new string[] { "CELL" }, "589-210-1059") }, ContactAddresses = new AddressInfo[] { - new AddressInfo(0, Array.Empty(), new string[] { "HOME" }, "", "", "New York, USA", "", "", "", "") + new AddressInfo(0, [], new string[] { "HOME" }, "", "", "New York, USA", "", "", "", "") }, ContactOrganizations = new OrganizationInfo[] { - new OrganizationInfo(0, Array.Empty(), "Support Scammer Outcry Organization", "", "", new string[] { "WORK" }) + new OrganizationInfo(0, [], "Support Scammer Outcry Organization", "", "", new string[] { "WORK" }) }, ContactTitles = new TitleInfo[] { - new TitleInfo(0, Array.Empty(), "Chief Executive Officer") + new TitleInfo(0, [], "Chief Executive Officer") }, 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 EmailInfo(0, [], new string[] { "HOME" }, "sarah.s@gmail.com"), + new EmailInfo(0, [], new string[] { "WORK" }, "sarah.s@sso.org"), }, ContactXNames = new XNameInfo[] { - new XNameInfo(0, Array.Empty(), "SIP", new string[] { "sip test" }, Array.Empty()), + new XNameInfo(0, [], "SIP", new string[] { "sip test" }, []), } }; private static readonly Card multipleVcardTwoContactsInstanceThree = new @@ -486,41 +486,41 @@ public static class ContactData { ContactNames = new NameInfo[] { - new NameInfo(0, Array.Empty(), "Neville", "Navasquillo", new string[] { "Neville", "Nevile" }, new string[] { "Mr." }, new string[] { "Jr." }) + new NameInfo(0, [], "Neville", "Navasquillo", new string[] { "Neville", "Nevile" }, new string[] { "Mr." }, new string[] { "Jr." }) }, 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 TelephoneInfo(0, [], new string[] { "CELL" }, "1-234-567-890"), + new TelephoneInfo(0, [], new string[] { "WORK" }, "098-765-4321"), + new TelephoneInfo(0, [], new string[] { "VOICE" }, "078-494-6434"), + new TelephoneInfo(0, [], new string[] { "HOME" }, "348-404-8404"), }, 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 AddressInfo(0, [], new string[] { "WORK" }, "POBOX", "", "Street Address ExtAddress", "Reg", "Loc", "Postal", "Country"), + new AddressInfo(0, [], new string[] { "HOME" }, "", "", "Street Address", "", "", "", ""), }, ContactOrganizations = new OrganizationInfo[] { - new OrganizationInfo(0, Array.Empty(), "Organization", "", "", new string[] { "WORK" }) + new OrganizationInfo(0, [], "Organization", "", "", new string[] { "WORK" }) }, ContactTitles = new TitleInfo[] { - new TitleInfo(0, Array.Empty(), "Title") + new TitleInfo(0, [], "Title") }, 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 EmailInfo(0, [], new string[] { "HOME" }, "neville.nvs@gmail.com"), + new EmailInfo(0, [], new string[] { "WORK" }, "neville.nvs@nvsc.com"), }, 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" }), + new XNameInfo(0, [], "ANDROID-CUSTOM", new string[] { "vnd.android.cursor.item/nickname", "NVL.N", "1", "", "", "", "", "", "", "", "", "", "", "", "", "" }, []), + new XNameInfo(0, [], "AIM", new string[] { "IM" }, new string[] { "HOME" }), + new XNameInfo(0, [], "MSN", new string[] { "Windows LIVE" }, new string[] { "HOME" }), + new XNameInfo(0, [], "YAHOO", new string[] { "Yahoo" }, new string[] { "HOME" }), } }; private static readonly Card multipleVcardTwoContactsInstanceFour = singleVcardTwoContactShortInstance; @@ -597,34 +597,34 @@ public static class ContactData { ContactNames = new NameInfo[] { - new NameInfo(0, Array.Empty(), "Sarah", "Santos", Array.Empty(), Array.Empty(), Array.Empty()) + new NameInfo(0, [], "Sarah", "Santos", [], [], []) }, ContactFullName = "Sarah Santos", ContactTelephones = new TelephoneInfo[] { - new TelephoneInfo(0, Array.Empty(), new string[] { "cell" }, "589-210-1059") + new TelephoneInfo(0, [], new string[] { "cell" }, "589-210-1059") }, ContactAddresses = new AddressInfo[] { - new AddressInfo(0, Array.Empty(), new string[] { "home" }, "", "", "New York, USA", "", "", "", "") + new AddressInfo(0, [], new string[] { "home" }, "", "", "New York, USA", "", "", "", "") }, ContactOrganizations = new OrganizationInfo[] { - new OrganizationInfo(0, Array.Empty(), "Support Scammer Outcry Organization", "", "", new string[] { "WORK" }) + new OrganizationInfo(0, [], "Support Scammer Outcry Organization", "", "", new string[] { "WORK" }) }, ContactTitles = new TitleInfo[] { - new TitleInfo(0, Array.Empty(), "Chief Executive Officer") + new TitleInfo(0, [], "Chief Executive Officer") }, 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 EmailInfo(0, [], new string[] { "home" }, "sarah.s@gmail.com"), + new EmailInfo(0, [], new string[] { "work" }, "sarah.s@sso.org"), }, ContactXNames = new XNameInfo[] { - new XNameInfo(0, Array.Empty(), "SIP", new string[] { "sip test" }, Array.Empty()), + new XNameInfo(0, [], "SIP", new string[] { "sip test" }, []), } }; private static readonly Card multipleVcardThreeContactsInstanceThree = new @@ -635,44 +635,44 @@ public static class ContactData { ContactNames = new NameInfo[] { - new NameInfo(0, Array.Empty(), "Neville", "Navasquillo", new string[] { "Neville", "Nevile" }, new string[] { "Mr." }, new string[] { "Jr." }) + new NameInfo(0, [], "Neville", "Navasquillo", new string[] { "Neville", "Nevile" }, new string[] { "Mr." }, new string[] { "Jr." }) }, 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 TelephoneInfo(0, [], new string[] { "cell" }, "1-234-567-890"), + new TelephoneInfo(0, [], new string[] { "work" }, "098-765-4321"), + new TelephoneInfo(0, [], new string[] { "voice" }, "078-494-6434"), + new TelephoneInfo(0, [], new string[] { "home" }, "348-404-8404"), }, 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 AddressInfo(0, [], new string[] { "work" }, "POBOX", "", "Street Address ExtAddress", "Reg", "Loc", "Postal", "Country"), + new AddressInfo(0, [], new string[] { "home" }, "", "", "Street Address", "", "", "", ""), }, ContactOrganizations = new OrganizationInfo[] { - new OrganizationInfo(0, Array.Empty(), "Organization", "", "", new string[] { "WORK" }) + new OrganizationInfo(0, [], "Organization", "", "", new string[] { "WORK" }) }, ContactTitles = new TitleInfo[] { - new TitleInfo(0, Array.Empty(), "Title") + new TitleInfo(0, [], "Title") }, 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 EmailInfo(0, [], new string[] { "home" }, "neville.nvs@gmail.com"), + new EmailInfo(0, [], new string[] { "work" }, "neville.nvs@nvsc.com"), }, 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" }), + new XNameInfo(0, [], "AIM", new string[] { "IM" }, new string[] { "HOME" }), + new XNameInfo(0, [], "MSN", new string[] { "Windows LIVE" }, new string[] { "HOME" }), + new XNameInfo(0, [], "YAHOO", new string[] { "Yahoo" }, new string[] { "HOME" }), }, ContactNicknames = new NicknameInfo[] { - new NicknameInfo(0, Array.Empty(), "NVL.N", new string[] { "HOME" }) + new NicknameInfo(0, [], "NVL.N", new string[] { "HOME" }) } }; private static readonly Card multipleVcardThreeContactsInstanceFour = singleVcardThreeContactShortInstance; @@ -751,45 +751,45 @@ public static class ContactData { ContactNames = new NameInfo[] { - new NameInfo(0, Array.Empty(), "Neville", "Navasquillo", new string[] { "Neville", "Nevile" }, new string[] { "Mr." }, new string[] { "Jr." }), + new NameInfo(0, [], "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." }) }, 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 TelephoneInfo(0, [], new string[] { "work" }, "098-765-4321"), + new TelephoneInfo(0, [], new string[] { "cell" }, "1-234-567-890"), + new TelephoneInfo(0, [], new string[] { "voice" }, "078-494-6434"), + new TelephoneInfo(0, [], new string[] { "home" }, "348-404-8404"), }, 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 AddressInfo(0, [], new string[] { "work" }, "POBOX", "", "Street Address ExtAddress", "Reg", "Loc", "Postal", "Country"), + new AddressInfo(0, [], new string[] { "home" }, "", "", "Street Address", "", "", "", ""), }, ContactOrganizations = new OrganizationInfo[] { - new OrganizationInfo(0, Array.Empty(), "Organization", "", "", new string[] { "WORK" }) + new OrganizationInfo(0, [], "Organization", "", "", new string[] { "WORK" }) }, ContactTitles = new TitleInfo[] { - new TitleInfo(0, Array.Empty(), "Title") + new TitleInfo(0, [], "Title") }, 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 EmailInfo(0, [], new string[] { "HOME" }, "neville.nvs@gmail.com"), + new EmailInfo(0, [], new string[] { "WORK" }, "neville.nvs@nvsc.com"), }, 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, [], "ANDROID-CUSTOM", new string[] { "vnd.android.cursor.item/nickname", "NVL.N", "1", "", "", "", "", "", "", "", "", "", "", "", "", "" }, []), }, 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" }) + new ImppInfo(0, [], "aim:IM", new string[] { "HOME" }), + new ImppInfo(0, [], "msn:Windows LIVE", new string[] { "HOME" }), + new ImppInfo(0, [], "ymsgr:Yahoo", new string[] { "HOME" }) }, }; private static readonly Card multipleVcardFourContactsInstanceThree = new @@ -800,34 +800,34 @@ public static class ContactData { ContactNames = new NameInfo[] { - new NameInfo(0, Array.Empty(), "Sarah", "Santos", Array.Empty(), Array.Empty(), Array.Empty()) + new NameInfo(0, [], "Sarah", "Santos", [], [], []) }, ContactFullName = "Sarah Santos", ContactTelephones = new TelephoneInfo[] { - new TelephoneInfo(0, Array.Empty(), new string[] { "cell" }, "589-210-1059") + new TelephoneInfo(0, [], new string[] { "cell" }, "589-210-1059") }, ContactAddresses = new AddressInfo[] { - new AddressInfo(0, Array.Empty(), new string[] { "home" }, "", "", "New York, USA", "", "", "", "") + new AddressInfo(0, [], new string[] { "home" }, "", "", "New York, USA", "", "", "", "") }, ContactOrganizations = new OrganizationInfo[] { - new OrganizationInfo(0, Array.Empty(), "Support Scammer Outcry Organization", "", "", new string[] { "WORK" }) + new OrganizationInfo(0, [], "Support Scammer Outcry Organization", "", "", new string[] { "WORK" }) }, ContactTitles = new TitleInfo[] { - new TitleInfo(0, Array.Empty(), "Chief Executive Officer") + new TitleInfo(0, [], "Chief Executive Officer") }, 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 EmailInfo(0, [], new string[] { "HOME" }, "sarah.s@gmail.com"), + new EmailInfo(0, [], new string[] { "WORK" }, "sarah.s@sso.org"), }, ContactXNames = new XNameInfo[] { - new XNameInfo(0, Array.Empty(), "SIP-SIP", new string[] { "sip test" }, Array.Empty()), + new XNameInfo(0, [], "SIP-SIP", new string[] { "sip test" }, []), }, ContactBirthdate = new DateTime(1989, 2, 22), }; @@ -874,25 +874,25 @@ public static class ContactData { ContactNames = new NameInfo[] { - new NameInfo(0, Array.Empty(), "Derik", "Stenerson", Array.Empty(), Array.Empty(), Array.Empty()) + new NameInfo(0, [], "Derik", "Stenerson", [], [], []) }, 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 TelephoneInfo(0, [], new string[] { "WORK", "MSG" }, "+1-425-936-5522"), + new TelephoneInfo(0, [], new string[] { "WORK", "FAX" }, "+1-425-936-7329") }, ContactAddresses = new AddressInfo[] { - new AddressInfo(0, Array.Empty(), new string[] { "WORK", "POSTAL", "PARCEL" }, "", "", "One Microsoft Way", "Redmond", "WA", "98052-6399", "USA") + new AddressInfo(0, [], new string[] { "WORK", "POSTAL", "PARCEL" }, "", "", "One Microsoft Way", "Redmond", "WA", "98052-6399", "USA") }, ContactOrganizations = new OrganizationInfo[] { - new OrganizationInfo(0, Array.Empty(), "Microsoft Corporation", "", "", new string[] { "WORK" }) + new OrganizationInfo(0, [], "Microsoft Corporation", "", "", new string[] { "WORK" }) }, ContactMails = new EmailInfo[] { - new EmailInfo(0, Array.Empty(), new string[] { "INTERNET" }, "deriks@Microsoft.com") + new EmailInfo(0, [], new string[] { "INTERNET" }, "deriks@Microsoft.com") }, ContactBirthdate = new DateTime(1963, 9, 21), }; @@ -904,24 +904,24 @@ public static class ContactData { ContactNames = new NameInfo[] { - new NameInfo(0, Array.Empty(), "Anik", "Ganguly", Array.Empty(), Array.Empty(), Array.Empty()) + new NameInfo(0, [], "Anik", "Ganguly", [], [], []) }, ContactFullName = "Anik Ganguly", ContactTelephones = new TelephoneInfo[] { - new TelephoneInfo(0, Array.Empty(), new string[] { "WORK", "MSG" }, "+1-734-542-5955") + new TelephoneInfo(0, [], new string[] { "WORK", "MSG" }, "+1-734-542-5955") }, 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 AddressInfo(0, [], new string[] { "WORK", "POSTAL", "PARCEL" }, "", "Suite 101", "38777 West Six Mile Road", "Livonia", "MI", "48152", "USA") }, ContactOrganizations = new OrganizationInfo[] { - new OrganizationInfo(0, Array.Empty(), " Open Text Inc.", "", "", new string[] { "WORK" }) + new OrganizationInfo(0, [], " Open Text Inc.", "", "", new string[] { "WORK" }) }, ContactMails = new EmailInfo[] { - new EmailInfo(0, Array.Empty(), new string[] { "INTERNET" }, "ganguly@acm.org") + new EmailInfo(0, [], new string[] { "INTERNET" }, "ganguly@acm.org") } }; private static readonly Card vcardThreeOldSampleInstanceThree = new @@ -932,12 +932,12 @@ public static class ContactData { ContactNames = new NameInfo[] { - new NameInfo(0, Array.Empty(), "Robert", "Moskowitz", Array.Empty(), Array.Empty(), Array.Empty()) + new NameInfo(0, [], "Robert", "Moskowitz", [], [], []) }, ContactFullName = "Robert Moskowitz", ContactMails = new EmailInfo[] { - new EmailInfo(0, Array.Empty(), new string[] { "INTERNET" }, "rgm-ietf@htt-consult.com") + new EmailInfo(0, [], new string[] { "INTERNET" }, "rgm-ietf@htt-consult.com") } }; #endregion diff --git a/VisualCard.Tests/ContactParseTests.cs b/VisualCard.Tests/ContactParseTests.cs index cf633dc..c150868 100644 --- a/VisualCard.Tests/ContactParseTests.cs +++ b/VisualCard.Tests/ContactParseTests.cs @@ -50,7 +50,7 @@ public void GetCardParsersFromDifferentContacts(string cardText) [TestCaseSource(typeof(ContactData), nameof(ContactData.remainingContacts))] public void ParseDifferentContacts(string cardText) { - List parsers = new(); + List parsers = []; Should.NotThrow(() => parsers = CardTools.GetCardParsersFromString(cardText)); foreach (BaseVcardParser parser in parsers) Should.NotThrow(parser.Parse); @@ -63,8 +63,8 @@ public void ParseDifferentContacts(string cardText) [TestCaseSource(typeof(ContactData), nameof(ContactData.remainingContacts))] public void ParseDifferentContactsAndTestEquality(string cardText) { - List parsers = new(); - List cards = new(); + List parsers = []; + List cards = []; // Parse the cards Should.NotThrow(() => parsers = CardTools.GetCardParsersFromString(cardText)); @@ -72,7 +72,7 @@ public void ParseDifferentContactsAndTestEquality(string cardText) cards.Add(Should.NotThrow(parser.Parse)); // Test equality with available data - List foundCards = new(); + List foundCards = []; foreach (Card card in cards) { bool found = false; @@ -94,9 +94,9 @@ public void ParseDifferentContactsAndTestEquality(string cardText) [TestCaseSource(typeof(ContactData), nameof(ContactData.remainingContacts))] public void ParseDifferentContactsSaveToStringAndTestEquality(string cardText) { - List parsers = new(); - List cards = new(); - List savedCards = new(); + List parsers = []; + List cards = []; + List savedCards = []; // Parse the cards Should.NotThrow(() => parsers = CardTools.GetCardParsersFromString(cardText)); @@ -113,7 +113,7 @@ public void ParseDifferentContactsSaveToStringAndTestEquality(string cardText) } // Test equality with available data - List foundCards = new(); + List foundCards = []; foreach (Card card in savedCards) { bool found = false; @@ -132,7 +132,7 @@ public void ParseDifferentContactsSaveToStringAndTestEquality(string cardText) [TestCaseSource(typeof(ContactData), nameof(ContactData.vCardFromMeCardContacts))] public void ParseAndCheckDifferentMeCardContacts((string, string) cardText) { - List parsers = new(); + List parsers = []; Should.NotThrow(() => parsers = MeCard.GetContactsFromMeCardString(cardText.Item1)); Card card = default; foreach (BaseVcardParser parser in parsers) @@ -144,7 +144,7 @@ public void ParseAndCheckDifferentMeCardContacts((string, string) cardText) [TestCaseSource(typeof(ContactData), nameof(ContactData.meCardContacts))] public void ParseDifferentMeCardContacts(string cardText) { - List parsers = new(); + List parsers = []; Should.NotThrow(() => parsers = MeCard.GetContactsFromMeCardString(cardText)); foreach (BaseVcardParser parser in parsers) Should.NotThrow(parser.Parse); @@ -154,8 +154,8 @@ public void ParseDifferentMeCardContacts(string cardText) [TestCaseSource(typeof(ContactData), nameof(ContactData.meCardContacts))] public void ParseDifferentMeCardContactsAndTestEquality(string cardText) { - List parsers = new(); - List cards = new(); + List parsers = []; + List cards = []; // Parse the cards Should.NotThrow(() => parsers = MeCard.GetContactsFromMeCardString(cardText)); @@ -163,7 +163,7 @@ public void ParseDifferentMeCardContactsAndTestEquality(string cardText) cards.Add(Should.NotThrow(parser.Parse)); // Test equality with available data - List foundCards = new(); + List foundCards = []; foreach (Card card in cards) { bool found = false; @@ -182,9 +182,9 @@ public void ParseDifferentMeCardContactsAndTestEquality(string cardText) [TestCaseSource(typeof(ContactData), nameof(ContactData.meCardContacts))] public void ParseDifferentMeCardContactsSaveToStringAndTestEquality(string cardText) { - List parsers = new(); - List cards = new(); - List savedCards = new(); + List parsers = []; + List cards = []; + List savedCards = []; // Parse the cards Should.NotThrow(() => parsers = MeCard.GetContactsFromMeCardString(cardText)); @@ -201,7 +201,7 @@ public void ParseDifferentMeCardContactsSaveToStringAndTestEquality(string cardT } // Test equality with available data - List foundCards = new(); + List foundCards = []; foreach (Card card in savedCards) { bool found = false; @@ -225,7 +225,7 @@ public void InvalidContactShouldThrowWhenGettingCardParsers(string cardText) [TestCaseSource(typeof(ContactDataBogus), nameof(ContactDataBogus.invalidContactsParser))] public void InvalidContactShouldThrowWhenParsing(string cardText) { - List parsers = new(); + List parsers = []; Should.NotThrow(() => parsers = CardTools.GetCardParsersFromString(cardText)); foreach (BaseVcardParser parser in parsers) Should.Throw(parser.Parse); @@ -240,7 +240,7 @@ public void BogusButSeemsValidShouldNotThrowWhenGettingCardParsers(string cardTe [TestCaseSource(typeof(ContactDataBogus), nameof(ContactDataBogus.seemsValidContacts))] public void BogusButSeemsValidShouldNotThrowWhenParsing(string cardText) { - List parsers = new(); + List parsers = []; Should.NotThrow(() => parsers = CardTools.GetCardParsersFromString(cardText)); foreach (BaseVcardParser parser in parsers) Should.NotThrow(parser.Parse); diff --git a/VisualCard/CardTools.cs b/VisualCard/CardTools.cs index 35f979f..06d595b 100644 --- a/VisualCard/CardTools.cs +++ b/VisualCard/CardTools.cs @@ -72,7 +72,7 @@ public static List GetCardParsers(string Path) public static List GetCardParsers(StreamReader stream) { // Variables and flags - List FinalParsers = new(); + List FinalParsers = []; bool BeginSpotted = false; bool VersionSpotted = false; bool EndSpotted = false; diff --git a/VisualCard/Converters/AndroidContactsDb.cs b/VisualCard/Converters/AndroidContactsDb.cs index c89fbd0..cf1b3f2 100644 --- a/VisualCard/Converters/AndroidContactsDb.cs +++ b/VisualCard/Converters/AndroidContactsDb.cs @@ -55,7 +55,7 @@ public static List GetContactsFromDb(string pathToDb) "folder, for example, /data/user/0/com.motorola.blur.providers.contacts/databases/."; if (!File.Exists(pathToDb)) throw new FileNotFoundException("The Android contact database file obtained from the contact provider is not found." + dbObtainTip); - List cardParsers = new(); + List cardParsers = []; try { diff --git a/VisualCard/Parsers/Four/VcardFour.cs b/VisualCard/Parsers/Four/VcardFour.cs index 256c4c4..9bee8a8 100644 --- a/VisualCard/Parsers/Four/VcardFour.cs +++ b/VisualCard/Parsers/Four/VcardFour.cs @@ -75,22 +75,22 @@ public override Card Parse() string _caladrUri = ""; DateTime _rev = DateTime.MinValue; DateTime _bday = DateTime.MinValue; - List _names = new(); - List _telephones = new(); - List _emails = new(); - List _addresses = new(); - List _orgs = new(); - List _titles = new(); - List _logos = new(); - List _photos = new(); - List _sounds = new(); - List _nicks = new(); - List _roles = new(); - List _categories = new(); - List _timezones = new(); - List _geos = new(); - List _impps = new(); - List _xes = new(); + List _names = []; + List _telephones = []; + List _emails = []; + List _addresses = []; + List _orgs = []; + List _titles = []; + List _logos = []; + List _photos = []; + List _sounds = []; + List _nicks = []; + List _roles = []; + List _categories = []; + List _timezones = []; + List _geos = []; + List _impps = []; + List _xes = []; // Full Name specifier is required bool fullNameSpecifierSpotted = false; @@ -120,7 +120,7 @@ public override Card Parse() string[] splitArgs = splitValueParts[0].Split(VcardConstants._fieldDelimiter); splitArgs = splitArgs.Except(new string[] { splitArgs[0] }).ToArray(); string[] splitValues = splitValueParts[1].Split(VcardConstants._fieldDelimiter); - List finalArgs = new(); + List finalArgs = []; int altId = 0; if (splitArgs.Length > 0) @@ -500,29 +500,29 @@ public override Card Parse() return new Card(this, CardVersion, _kind) { CardRevision = _rev, - ContactNames = _names.ToArray(), + ContactNames = [.. _names], ContactFullName = _fullName, - ContactTelephones = _telephones.ToArray(), - ContactAddresses = _addresses.ToArray(), - ContactOrganizations = _orgs.ToArray(), - ContactTitles = _titles.ToArray(), + ContactTelephones = [.. _telephones], + ContactAddresses = [.. _addresses], + ContactOrganizations = [.. _orgs], + ContactTitles = [.. _titles], ContactURL = _url, ContactNotes = _note, - ContactMails = _emails.ToArray(), - ContactXNames = _xes.ToArray(), - ContactPhotos = _photos.ToArray(), - ContactNicknames = _nicks.ToArray(), + ContactMails = [.. _emails], + ContactXNames = [.. _xes], + ContactPhotos = [.. _photos], + ContactNicknames = [.. _nicks], ContactBirthdate = _bday, ContactMailer = "", - ContactRoles = _roles.ToArray(), - ContactCategories = _categories.ToArray(), - ContactLogos = _logos.ToArray(), + ContactRoles = [.. _roles], + ContactCategories = [.. _categories], + ContactLogos = [.. _logos], ContactProdId = _prodId, ContactSortString = _sortString, - ContactTimeZone = _timezones.ToArray(), - ContactGeo = _geos.ToArray(), - ContactSounds = _sounds.ToArray(), - ContactImpps = _impps.ToArray(), + ContactTimeZone = [.. _timezones], + ContactGeo = [.. _geos], + ContactSounds = [.. _sounds], + ContactImpps = [.. _impps], ContactSource = _source, ContactXml = _xml, ContactFreeBusyUrl = _fbUrl, diff --git a/VisualCard/Parsers/Three/VcardThree.cs b/VisualCard/Parsers/Three/VcardThree.cs index 6a26bba..34bce35 100644 --- a/VisualCard/Parsers/Three/VcardThree.cs +++ b/VisualCard/Parsers/Three/VcardThree.cs @@ -72,23 +72,23 @@ public override Card Parse() string _class = ""; DateTime _rev = DateTime.MinValue; DateTime _bday = DateTime.MinValue; - List _names = new(); - List _telephones = new(); - List _emails = new(); - List _addresses = new(); - List _labels = new(); - List _orgs = new(); - List _titles = new(); - List _photos = new(); - List _logos = new(); - List _sounds = new(); - List _nicks = new(); - List _roles = new(); - List _categories = new(); - List _timezones = new(); - List _geos = new(); - List _impps = new(); - List _xes = new(); + List _names = []; + List _telephones = []; + List _emails = []; + List _addresses = []; + List _labels = []; + List _orgs = []; + List _titles = []; + List _photos = []; + List _logos = []; + List _sounds = []; + List _nicks = []; + List _roles = []; + List _categories = []; + List _timezones = []; + List _geos = []; + List _impps = []; + List _xes = []; // Name and Full Name specifiers are required bool nameSpecifierSpotted = false; @@ -393,30 +393,30 @@ public override Card Parse() return new Card(this, CardVersion, "individual") { CardRevision = _rev, - ContactNames = _names.ToArray(), + ContactNames = [.. _names], ContactFullName = _fullName, - ContactTelephones = _telephones.ToArray(), - ContactAddresses = _addresses.ToArray(), - ContactLabels = _labels.ToArray(), - ContactOrganizations = _orgs.ToArray(), - ContactTitles = _titles.ToArray(), + ContactTelephones = [.. _telephones], + ContactAddresses = [.. _addresses], + ContactLabels = [.. _labels], + ContactOrganizations = [.. _orgs], + ContactTitles = [.. _titles], ContactURL = _url, ContactNotes = _note, - ContactMails = _emails.ToArray(), - ContactXNames = _xes.ToArray(), - ContactPhotos = _photos.ToArray(), - ContactNicknames = _nicks.ToArray(), + ContactMails = [.. _emails], + ContactXNames = [.. _xes], + ContactPhotos = [.. _photos], + ContactNicknames = [.. _nicks], ContactBirthdate = _bday, ContactMailer = _mailer, - ContactRoles = _roles.ToArray(), - ContactCategories = _categories.ToArray(), - ContactLogos = _logos.ToArray(), + ContactRoles = [.. _roles], + ContactCategories = [.. _categories], + ContactLogos = [.. _logos], ContactProdId = _prodId, ContactSortString = _sortString, - ContactTimeZone = _timezones.ToArray(), - ContactGeo = _geos.ToArray(), - ContactSounds = _sounds.ToArray(), - ContactImpps = _impps.ToArray(), + ContactTimeZone = [.. _timezones], + ContactGeo = [.. _geos], + ContactSounds = [.. _sounds], + ContactImpps = [.. _impps], ContactSource = _source, ContactXml = "", ContactFreeBusyUrl = "", diff --git a/VisualCard/Parsers/Two/VcardTwo.cs b/VisualCard/Parsers/Two/VcardTwo.cs index 06c288a..82722a5 100644 --- a/VisualCard/Parsers/Two/VcardTwo.cs +++ b/VisualCard/Parsers/Two/VcardTwo.cs @@ -69,21 +69,21 @@ public override Card Parse() string _source = ""; DateTime _rev = DateTime.MinValue; DateTime _bday = DateTime.MinValue; - List _telephones = new(); - List _names = new(); - List _emails = new(); - List _addresses = new(); - List _labels = new(); - List _orgs = new(); - List _titles = new(); - List _photos = new(); - List _logos = new(); - List _sounds = new(); - List _roles = new(); - List _timezones = new(); - List _geos = new(); - List _impps = new(); - List _xes = new(); + List _telephones = []; + List _names = []; + List _emails = []; + List _addresses = []; + List _labels = []; + List _orgs = []; + List _titles = []; + List _photos = []; + List _logos = []; + List _sounds = []; + List _roles = []; + List _timezones = []; + List _geos = []; + List _impps = []; + List _xes = []; // Name specifier is required bool nameSpecifierSpotted = false; @@ -329,30 +329,30 @@ public override Card Parse() return new Card(this, CardVersion, "individual") { CardRevision = _rev, - ContactNames = _names.ToArray(), + ContactNames = [.. _names], ContactFullName = _fullName, - ContactTelephones = _telephones.ToArray(), - ContactAddresses = _addresses.ToArray(), - ContactLabels = _labels.ToArray(), - ContactOrganizations = _orgs.ToArray(), - ContactTitles = _titles.ToArray(), + ContactTelephones = [.. _telephones], + ContactAddresses = [.. _addresses], + ContactLabels = [.. _labels], + ContactOrganizations = [.. _orgs], + ContactTitles = [.. _titles], ContactURL = _url, ContactNotes = _note, - ContactMails = _emails.ToArray(), - ContactXNames = _xes.ToArray(), - ContactPhotos = _photos.ToArray(), - ContactNicknames = Array.Empty(), + ContactMails = [.. _emails], + ContactXNames = [.. _xes], + ContactPhotos = [.. _photos], + ContactNicknames = [], ContactBirthdate = _bday, ContactMailer = _mailer, - ContactRoles = _roles.ToArray(), - ContactCategories = Array.Empty(), - ContactLogos = _logos.ToArray(), + ContactRoles = [.. _roles], + ContactCategories = [], + ContactLogos = [.. _logos], ContactProdId = "", ContactSortString = "", - ContactTimeZone = _timezones.ToArray(), - ContactGeo = _geos.ToArray(), - ContactSounds = _sounds.ToArray(), - ContactImpps = _impps.ToArray(), + ContactTimeZone = [.. _timezones], + ContactGeo = [.. _geos], + ContactSounds = [.. _sounds], + ContactImpps = [.. _impps], ContactSource = _source, ContactXml = "", ContactFreeBusyUrl = "", diff --git a/VisualCard/Parts/AddressInfo.cs b/VisualCard/Parts/AddressInfo.cs index 6b1d755..0bc436f 100644 --- a/VisualCard/Parts/AddressInfo.cs +++ b/VisualCard/Parts/AddressInfo.cs @@ -200,7 +200,7 @@ internal static AddressInfo FromStringVcardTwo(string value) string _addressRegion = Regex.Unescape(splitAddressValues[4]); string _addressPostalCode = Regex.Unescape(splitAddressValues[5]); string _addressCountry = Regex.Unescape(splitAddressValues[6]); - AddressInfo _address = new(0, Array.Empty(), _addressTypes, _addressPOBox, _addressExtended, _addressStreet, _addressLocality, _addressRegion, _addressPostalCode, _addressCountry); + AddressInfo _address = new(0, [], _addressTypes, _addressPOBox, _addressExtended, _addressStreet, _addressLocality, _addressRegion, _addressPostalCode, _addressCountry); return _address; } @@ -226,7 +226,7 @@ internal static AddressInfo FromStringVcardTwoWithType(string value) string _addressRegion = Regex.Unescape(splitAddressValues[4]); string _addressPostalCode = Regex.Unescape(splitAddressValues[5]); string _addressCountry = Regex.Unescape(splitAddressValues[6]); - AddressInfo _address = new(0, Array.Empty(), _addressTypes, _addressPOBox, _addressExtended, _addressStreet, _addressLocality, _addressRegion, _addressPostalCode, _addressCountry); + AddressInfo _address = new(0, [], _addressTypes, _addressPOBox, _addressExtended, _addressStreet, _addressLocality, _addressRegion, _addressPostalCode, _addressCountry); return _address; } @@ -250,7 +250,7 @@ internal static AddressInfo FromStringVcardThree(string value) string _addressRegion = Regex.Unescape(splitAddressValues[4]); string _addressPostalCode = Regex.Unescape(splitAddressValues[5]); string _addressCountry = Regex.Unescape(splitAddressValues[6]); - AddressInfo _address = new(0, Array.Empty(), _addressTypes, _addressPOBox, _addressExtended, _addressStreet, _addressLocality, _addressRegion, _addressPostalCode, _addressCountry); + AddressInfo _address = new(0, [], _addressTypes, _addressPOBox, _addressExtended, _addressStreet, _addressLocality, _addressRegion, _addressPostalCode, _addressCountry); return _address; } @@ -276,7 +276,7 @@ internal static AddressInfo FromStringVcardThreeWithType(string value) string _addressRegion = Regex.Unescape(splitAddressValues[4]); string _addressPostalCode = Regex.Unescape(splitAddressValues[5]); string _addressCountry = Regex.Unescape(splitAddressValues[6]); - AddressInfo _address = new(0, Array.Empty(), _addressTypes, _addressPOBox, _addressExtended, _addressStreet, _addressLocality, _addressRegion, _addressPostalCode, _addressCountry); + AddressInfo _address = new(0, [], _addressTypes, _addressPOBox, _addressExtended, _addressStreet, _addressLocality, _addressRegion, _addressPostalCode, _addressCountry); return _address; } @@ -300,7 +300,7 @@ internal static AddressInfo FromStringVcardFour(string value, int altId) string _addressRegion = Regex.Unescape(splitAddressValues[4]); string _addressPostalCode = Regex.Unescape(splitAddressValues[5]); string _addressCountry = Regex.Unescape(splitAddressValues[6]); - AddressInfo _address = new(altId, Array.Empty(), _addressTypes, _addressPOBox, _addressExtended, _addressStreet, _addressLocality, _addressRegion, _addressPostalCode, _addressCountry); + AddressInfo _address = new(altId, [], _addressTypes, _addressPOBox, _addressExtended, _addressStreet, _addressLocality, _addressRegion, _addressPostalCode, _addressCountry); return _address; } @@ -326,7 +326,7 @@ internal static AddressInfo FromStringVcardFourWithType(string value, List /// /// The contact's names /// - public NameInfo[] ContactNames { get; set; } = Array.Empty(); + public NameInfo[] ContactNames { get; set; } = []; /// /// The contact's full name /// @@ -58,27 +58,27 @@ public class Card : IEquatable /// /// The contact's telephones /// - public TelephoneInfo[] ContactTelephones { get; set; } = Array.Empty(); + public TelephoneInfo[] ContactTelephones { get; set; } = []; /// /// The contact's addresses /// - public AddressInfo[] ContactAddresses { get; set; } = Array.Empty(); + public AddressInfo[] ContactAddresses { get; set; } = []; /// /// The contact's delivery address labels /// - public LabelAddressInfo[] ContactLabels { get; set; } = Array.Empty(); + public LabelAddressInfo[] ContactLabels { get; set; } = []; /// /// The contact's e-mails /// - public EmailInfo[] ContactMails { get; set; } = Array.Empty(); + public EmailInfo[] ContactMails { get; set; } = []; /// /// The contact's organizations /// - public OrganizationInfo[] ContactOrganizations { get; set; } = Array.Empty(); + public OrganizationInfo[] ContactOrganizations { get; set; } = []; /// /// The contact's titles /// - public TitleInfo[] ContactTitles { get; set; } = Array.Empty(); + public TitleInfo[] ContactTitles { get; set; } = []; /// /// The contact's URL /// @@ -86,7 +86,7 @@ public class Card : IEquatable /// /// The contact's photos /// - public PhotoInfo[] ContactPhotos { get; set; } = Array.Empty(); + public PhotoInfo[] ContactPhotos { get; set; } = []; /// /// The contact's notes /// @@ -94,7 +94,7 @@ public class Card : IEquatable /// /// The contact's extended options (usually starts with X-SOMETHING:Value1;Value2...) /// - public XNameInfo[] ContactXNames { get; set; } = Array.Empty(); + public XNameInfo[] ContactXNames { get; set; } = []; /// /// The card revision /// @@ -102,7 +102,7 @@ public class Card : IEquatable /// /// The contact's nicknames /// - public NicknameInfo[] ContactNicknames { get; set; } = Array.Empty(); + public NicknameInfo[] ContactNicknames { get; set; } = []; /// /// The contact's birthdate /// @@ -114,15 +114,15 @@ public class Card : IEquatable /// /// The contact's roles /// - public RoleInfo[] ContactRoles { get; set; } = Array.Empty(); + public RoleInfo[] ContactRoles { get; set; } = []; /// /// The contact's categories /// - public string[] ContactCategories { get; set; } = Array.Empty(); + public string[] ContactCategories { get; set; } = []; /// /// The contact's logos /// - public LogoInfo[] ContactLogos { get; set; } = Array.Empty(); + public LogoInfo[] ContactLogos { get; set; } = []; /// /// The contact's product ID /// @@ -134,19 +134,19 @@ public class Card : IEquatable /// /// The contact's time zones /// - public TimeZoneInfo[] ContactTimeZone { get; set; } = Array.Empty(); + public TimeZoneInfo[] ContactTimeZone { get; set; } = []; /// /// The contact's geographical coordinates in (lat;long) /// - public GeoInfo[] ContactGeo { get; set; } = Array.Empty(); + public GeoInfo[] ContactGeo { get; set; } = []; /// /// The contact's sounds /// - public SoundInfo[] ContactSounds { get; set; } = Array.Empty(); + public SoundInfo[] ContactSounds { get; set; } = []; /// /// The contact's IMPP information /// - public ImppInfo[] ContactImpps { get; set; } = Array.Empty(); + public ImppInfo[] ContactImpps { get; set; } = []; /// /// The contact's card source /// diff --git a/VisualCard/Parts/EmailInfo.cs b/VisualCard/Parts/EmailInfo.cs index 10e8704..488bba2 100644 --- a/VisualCard/Parts/EmailInfo.cs +++ b/VisualCard/Parts/EmailInfo.cs @@ -145,7 +145,7 @@ internal static EmailInfo FromStringVcardTwo(string value) // Populate the fields string[] _emailTypes = new string[] { "HOME" }; string _emailAddress = mail.Address; - EmailInfo _email = new(0, Array.Empty(), _emailTypes, _emailAddress); + EmailInfo _email = new(0, [], _emailTypes, _emailAddress); return _email; } @@ -171,7 +171,7 @@ internal static EmailInfo FromStringVcardTwoWithType(string value) // Populate the fields string[] _emailTypes = VcardParserTools.GetTypes(splitMail, "HOME", false); string _emailAddress = mail.Address; - EmailInfo _email = new(0, Array.Empty(), _emailTypes, _emailAddress); + EmailInfo _email = new(0, [], _emailTypes, _emailAddress); return _email; } @@ -195,7 +195,7 @@ internal static EmailInfo FromStringVcardThree(string value) // Populate the fields string[] _emailTypes = new string[] { "HOME" }; string _emailAddress = mail.Address; - EmailInfo _email = new(0, Array.Empty(), _emailTypes, _emailAddress); + EmailInfo _email = new(0, [], _emailTypes, _emailAddress); return _email; } @@ -221,7 +221,7 @@ internal static EmailInfo FromStringVcardThreeWithType(string value) // Populate the fields string[] _emailTypes = VcardParserTools.GetTypes(splitMail, "HOME", true); string _emailAddress = mail.Address; - EmailInfo _email = new(0, Array.Empty(), _emailTypes, _emailAddress); + EmailInfo _email = new(0, [], _emailTypes, _emailAddress); return _email; } @@ -245,7 +245,7 @@ internal static EmailInfo FromStringVcardFour(string value, int altId) // Populate the fields string[] _emailTypes = new string[] { "HOME" }; string _emailAddress = mail.Address; - EmailInfo _email = new(altId, Array.Empty(), _emailTypes, _emailAddress); + EmailInfo _email = new(altId, [], _emailTypes, _emailAddress); return _email; } @@ -271,7 +271,7 @@ internal static EmailInfo FromStringVcardFourWithType(string value, List // Populate the fields string[] _emailTypes = VcardParserTools.GetTypes(splitMail, "HOME", true); string _emailAddress = mail.Address; - EmailInfo _email = new(altId, finalArgs.ToArray(), _emailTypes, _emailAddress); + EmailInfo _email = new(altId, [.. finalArgs], _emailTypes, _emailAddress); return _email; } diff --git a/VisualCard/Parts/GeoInfo.cs b/VisualCard/Parts/GeoInfo.cs index a0ed5a3..adc74cb 100644 --- a/VisualCard/Parts/GeoInfo.cs +++ b/VisualCard/Parts/GeoInfo.cs @@ -128,7 +128,7 @@ internal static GeoInfo FromStringVcardTwo(string value) { string geoValue = value.Substring(VcardConstants._geoSpecifier.Length + 1); string _geoStr = Regex.Unescape(geoValue); - GeoInfo _geo = new(0, Array.Empty(), Array.Empty(), _geoStr); + GeoInfo _geo = new(0, [], [], _geoStr); return _geo; } @@ -144,7 +144,7 @@ internal static GeoInfo FromStringVcardTwoWithType(string value) string _geoNumber = Regex.Unescape(splitGeo[1]); // Add the fetched information - GeoInfo _geo = new(0, Array.Empty(), _geoTypes, _geoNumber); + GeoInfo _geo = new(0, [], _geoTypes, _geoNumber); return _geo; } @@ -156,7 +156,7 @@ internal static GeoInfo FromStringVcardThree(string value) // Populate the fields string[] _geoTypes = new string[] { "uri" }; string _geoNumber = Regex.Unescape(geoValue); - GeoInfo _geo = new(0, Array.Empty(), _geoTypes, _geoNumber); + GeoInfo _geo = new(0, [], _geoTypes, _geoNumber); return _geo; } @@ -173,7 +173,7 @@ internal static GeoInfo FromStringVcardThreeWithType(string value) string _geoNumber = Regex.Unescape(splitGeo[1]); // Add the fetched information - GeoInfo _geo = new(0, Array.Empty(), _geoTypes, _geoNumber); + GeoInfo _geo = new(0, [], _geoTypes, _geoNumber); return _geo; } @@ -185,7 +185,7 @@ internal static GeoInfo FromStringVcardFour(string value, int altId) // Populate the fields string[] _geoTypes = new string[] { "uri" }; string _geoNumber = Regex.Unescape(geoValue); - GeoInfo _geo = new(altId, Array.Empty(), _geoTypes, _geoNumber); + GeoInfo _geo = new(altId, [], _geoTypes, _geoNumber); return _geo; } @@ -202,7 +202,7 @@ internal static GeoInfo FromStringVcardFourWithType(string value, List f string _geoNumber = Regex.Unescape(splitGeo[1]); // Add the fetched information - GeoInfo _geo = new(altId, finalArgs.ToArray(), _geoTypes, _geoNumber); + GeoInfo _geo = new(altId, [.. finalArgs], _geoTypes, _geoNumber); return _geo; } diff --git a/VisualCard/Parts/ImppInfo.cs b/VisualCard/Parts/ImppInfo.cs index 5b00b75..c792072 100644 --- a/VisualCard/Parts/ImppInfo.cs +++ b/VisualCard/Parts/ImppInfo.cs @@ -134,7 +134,7 @@ internal static ImppInfo FromStringVcardTwo(string value) string imppValue = value.Substring(VcardConstants._imppSpecifier.Length + 1); string[] _imppTypes = new string[] { "HOME" }; string _impp = Regex.Unescape(imppValue); - ImppInfo _imppInstance = new(0, Array.Empty(), _impp, _imppTypes); + ImppInfo _imppInstance = new(0, [], _impp, _imppTypes); return _imppInstance; } @@ -148,7 +148,7 @@ internal static ImppInfo FromStringVcardTwoWithType(string value) // Install the values string[] _imppTypes = VcardParserTools.GetTypes(splitImpp, "SIP", false); string _impp = Regex.Unescape(imppValue.Substring(imppValue.IndexOf(":") + 1)); - ImppInfo _imppInstance = new(0, Array.Empty(), _impp, _imppTypes); + ImppInfo _imppInstance = new(0, [], _impp, _imppTypes); return _imppInstance; } @@ -160,7 +160,7 @@ internal static ImppInfo FromStringVcardThree(string value) // Populate the fields string[] _imppTypes = new string[] { "HOME" }; string _impp = Regex.Unescape(imppValue); - ImppInfo _imppInstance = new(0, Array.Empty(), _impp, _imppTypes); + ImppInfo _imppInstance = new(0, [], _impp, _imppTypes); return _imppInstance; } @@ -175,7 +175,7 @@ internal static ImppInfo FromStringVcardThreeWithType(string value) // Install the values string[] _imppTypes = VcardParserTools.GetTypes(splitImpp, "SIP", true); string _impp = Regex.Unescape(imppValue.Substring(imppValue.IndexOf(":") + 1)); - ImppInfo _imppInstance = new(0, Array.Empty(), _impp, _imppTypes); + ImppInfo _imppInstance = new(0, [], _impp, _imppTypes); return _imppInstance; } @@ -187,7 +187,7 @@ internal static ImppInfo FromStringVcardFour(string value, int altId) // Populate the fields string[] _imppTypes = new string[] { "HOME" }; string _impp = Regex.Unescape(imppValue); - ImppInfo _imppInstance = new(altId, Array.Empty(), _impp, _imppTypes); + ImppInfo _imppInstance = new(altId, [], _impp, _imppTypes); return _imppInstance; } @@ -202,7 +202,7 @@ internal static ImppInfo FromStringVcardFourWithType(string value, List // Install the values string[] _imppTypes = VcardParserTools.GetTypes(splitImpp, "SIP", true); string _impp = Regex.Unescape(imppValue.Substring(imppValue.IndexOf(":") + 1)); - ImppInfo _imppInstance = new(altId, finalArgs.ToArray(), _impp, _imppTypes); + ImppInfo _imppInstance = new(altId, [.. finalArgs], _impp, _imppTypes); return _imppInstance; } diff --git a/VisualCard/Parts/LabelAddressInfo.cs b/VisualCard/Parts/LabelAddressInfo.cs index 2f2cf3b..167fde9 100644 --- a/VisualCard/Parts/LabelAddressInfo.cs +++ b/VisualCard/Parts/LabelAddressInfo.cs @@ -130,7 +130,7 @@ internal static LabelAddressInfo FromStringVcardTwo(string value) // Populate the fields string[] _addressTypes = new string[] { "HOME" }; string _addressLabel = Regex.Unescape(splitAddressValues[0]); - LabelAddressInfo _address = new(0, Array.Empty(), _addressTypes, _addressLabel); + LabelAddressInfo _address = new(0, [], _addressTypes, _addressLabel); return _address; } @@ -150,7 +150,7 @@ internal static LabelAddressInfo FromStringVcardTwoWithType(string value) // Populate the fields string[] _addressTypes = VcardParserTools.GetTypes(splitAdr, "HOME", false); string _addressLabel = Regex.Unescape(splitAddressValues[0]); - LabelAddressInfo _address = new(0, Array.Empty(), _addressTypes, _addressLabel); + LabelAddressInfo _address = new(0, [], _addressTypes, _addressLabel); return _address; } @@ -168,7 +168,7 @@ internal static LabelAddressInfo FromStringVcardThree(string value) // Populate the fields string[] _addressTypes = new string[] { "HOME" }; string _addressLabel = Regex.Unescape(splitAddressValues[0]); - LabelAddressInfo _address = new(0, Array.Empty(), _addressTypes, _addressLabel); + LabelAddressInfo _address = new(0, [], _addressTypes, _addressLabel); return _address; } @@ -188,7 +188,7 @@ internal static LabelAddressInfo FromStringVcardThreeWithType(string value) // Populate the fields string[] _addressTypes = VcardParserTools.GetTypes(splitAdr, "HOME", true); string _addressLabel = Regex.Unescape(splitAddressValues[0]); - LabelAddressInfo _address = new(0, Array.Empty(), _addressTypes, _addressLabel); + LabelAddressInfo _address = new(0, [], _addressTypes, _addressLabel); return _address; } diff --git a/VisualCard/Parts/LogoInfo.cs b/VisualCard/Parts/LogoInfo.cs index ee133a7..57ace53 100644 --- a/VisualCard/Parts/LogoInfo.cs +++ b/VisualCard/Parts/LogoInfo.cs @@ -212,7 +212,7 @@ internal static LogoInfo FromStringVcardTwoWithType(string value, StreamReader c } // Populate the fields - LogoInfo _logo = new(0, Array.Empty(), valueType, logoEncoding, logoType, encodedLogo.ToString()); + LogoInfo _logo = new(0, [], valueType, logoEncoding, logoType, encodedLogo.ToString()); return _logo; } @@ -251,7 +251,7 @@ internal static LogoInfo FromStringVcardThreeWithType(string value, StreamReader } // Populate the fields - LogoInfo _logo = new(0, Array.Empty(), valueType, logoEncoding, logoType, encodedLogo.ToString()); + LogoInfo _logo = new(0, [], valueType, logoEncoding, logoType, encodedLogo.ToString()); return _logo; } @@ -290,7 +290,7 @@ internal static LogoInfo FromStringVcardFourWithType(string value, List } // Populate the fields - LogoInfo _logo = new(altId, finalArgs.ToArray(), valueType, logoEncoding, logoType, encodedLogo.ToString()); + LogoInfo _logo = new(altId, [.. finalArgs], valueType, logoEncoding, logoType, encodedLogo.ToString()); return _logo; } diff --git a/VisualCard/Parts/NameInfo.cs b/VisualCard/Parts/NameInfo.cs index 6115fa2..35906cd 100644 --- a/VisualCard/Parts/NameInfo.cs +++ b/VisualCard/Parts/NameInfo.cs @@ -174,10 +174,10 @@ internal static NameInfo FromStringVcardTwo(string value) // Populate fields string _lastName = Regex.Unescape(splitName[0]); string _firstName = Regex.Unescape(splitName[1]); - string[] _altNames = splitName.Length >= 3 ? Regex.Unescape(splitName[2]).Split(new char[] { VcardConstants._valueDelimiter }, StringSplitOptions.RemoveEmptyEntries) : Array.Empty(); - string[] _prefixes = splitName.Length >= 4 ? Regex.Unescape(splitName[3]).Split(new char[] { VcardConstants._valueDelimiter }, StringSplitOptions.RemoveEmptyEntries) : Array.Empty(); - string[] _suffixes = splitName.Length >= 5 ? Regex.Unescape(splitName[4]).Split(new char[] { VcardConstants._valueDelimiter }, StringSplitOptions.RemoveEmptyEntries) : Array.Empty(); - NameInfo _name = new(0, Array.Empty(), _firstName, _lastName, _altNames, _prefixes, _suffixes); + string[] _altNames = splitName.Length >= 3 ? Regex.Unescape(splitName[2]).Split(new char[] { VcardConstants._valueDelimiter }, StringSplitOptions.RemoveEmptyEntries) : []; + string[] _prefixes = splitName.Length >= 4 ? Regex.Unescape(splitName[3]).Split(new char[] { VcardConstants._valueDelimiter }, StringSplitOptions.RemoveEmptyEntries) : []; + string[] _suffixes = splitName.Length >= 5 ? Regex.Unescape(splitName[4]).Split(new char[] { VcardConstants._valueDelimiter }, StringSplitOptions.RemoveEmptyEntries) : []; + NameInfo _name = new(0, [], _firstName, _lastName, _altNames, _prefixes, _suffixes); return _name; } @@ -192,10 +192,10 @@ internal static NameInfo FromStringVcardThree(string value) // Populate fields string _lastName = Regex.Unescape(splitName[0]); string _firstName = Regex.Unescape(splitName[1]); - string[] _altNames = splitName.Length >= 3 ? Regex.Unescape(splitName[2]).Split(new char[] { VcardConstants._valueDelimiter }, StringSplitOptions.RemoveEmptyEntries) : Array.Empty(); - string[] _prefixes = splitName.Length >= 4 ? Regex.Unescape(splitName[3]).Split(new char[] { VcardConstants._valueDelimiter }, StringSplitOptions.RemoveEmptyEntries) : Array.Empty(); - string[] _suffixes = splitName.Length >= 5 ? Regex.Unescape(splitName[4]).Split(new char[] { VcardConstants._valueDelimiter }, StringSplitOptions.RemoveEmptyEntries) : Array.Empty(); - NameInfo _name = new(0, Array.Empty(), _firstName, _lastName, _altNames, _prefixes, _suffixes); + string[] _altNames = splitName.Length >= 3 ? Regex.Unescape(splitName[2]).Split(new char[] { VcardConstants._valueDelimiter }, StringSplitOptions.RemoveEmptyEntries) : []; + string[] _prefixes = splitName.Length >= 4 ? Regex.Unescape(splitName[3]).Split(new char[] { VcardConstants._valueDelimiter }, StringSplitOptions.RemoveEmptyEntries) : []; + string[] _suffixes = splitName.Length >= 5 ? Regex.Unescape(splitName[4]).Split(new char[] { VcardConstants._valueDelimiter }, StringSplitOptions.RemoveEmptyEntries) : []; + NameInfo _name = new(0, [], _firstName, _lastName, _altNames, _prefixes, _suffixes); return _name; } @@ -212,10 +212,10 @@ internal static NameInfo FromStringVcardFour(string[] splitValues, bool idReserv // Populate fields string _lastName = Regex.Unescape(splitValues[0]); string _firstName = Regex.Unescape(splitValues[1]); - string[] _altNames = splitValues.Length >= 3 ? Regex.Unescape(splitValues[2]).Split(new char[] { VcardConstants._valueDelimiter }, StringSplitOptions.RemoveEmptyEntries) : Array.Empty(); - string[] _prefixes = splitValues.Length >= 4 ? Regex.Unescape(splitValues[3]).Split(new char[] { VcardConstants._valueDelimiter }, StringSplitOptions.RemoveEmptyEntries) : Array.Empty(); - string[] _suffixes = splitValues.Length >= 5 ? Regex.Unescape(splitValues[4]).Split(new char[] { VcardConstants._valueDelimiter }, StringSplitOptions.RemoveEmptyEntries) : Array.Empty(); - NameInfo _name = new(0, Array.Empty(), _firstName, _lastName, _altNames, _prefixes, _suffixes); + string[] _altNames = splitValues.Length >= 3 ? Regex.Unescape(splitValues[2]).Split(new char[] { VcardConstants._valueDelimiter }, StringSplitOptions.RemoveEmptyEntries) : []; + string[] _prefixes = splitValues.Length >= 4 ? Regex.Unescape(splitValues[3]).Split(new char[] { VcardConstants._valueDelimiter }, StringSplitOptions.RemoveEmptyEntries) : []; + string[] _suffixes = splitValues.Length >= 5 ? Regex.Unescape(splitValues[4]).Split(new char[] { VcardConstants._valueDelimiter }, StringSplitOptions.RemoveEmptyEntries) : []; + NameInfo _name = new(0, [], _firstName, _lastName, _altNames, _prefixes, _suffixes); return _name; } @@ -239,10 +239,10 @@ internal static NameInfo FromStringVcardFourWithType(string value, string[] spli // Populate fields string _lastName = Regex.Unescape(splitName[0]); string _firstName = Regex.Unescape(splitName[1]); - string[] _altNames = splitName.Length >= 3 ? Regex.Unescape(splitName[2]).Split(new char[] { VcardConstants._valueDelimiter }, StringSplitOptions.RemoveEmptyEntries) : Array.Empty(); - string[] _prefixes = splitName.Length >= 4 ? Regex.Unescape(splitName[3]).Split(new char[] { VcardConstants._valueDelimiter }, StringSplitOptions.RemoveEmptyEntries) : Array.Empty(); - string[] _suffixes = splitName.Length >= 5 ? Regex.Unescape(splitName[4]).Split(new char[] { VcardConstants._valueDelimiter }, StringSplitOptions.RemoveEmptyEntries) : Array.Empty(); - NameInfo _name = new(altId, finalArgs.ToArray(), _firstName, _lastName, _altNames, _prefixes, _suffixes); + string[] _altNames = splitName.Length >= 3 ? Regex.Unescape(splitName[2]).Split(new char[] { VcardConstants._valueDelimiter }, StringSplitOptions.RemoveEmptyEntries) : []; + string[] _prefixes = splitName.Length >= 4 ? Regex.Unescape(splitName[3]).Split(new char[] { VcardConstants._valueDelimiter }, StringSplitOptions.RemoveEmptyEntries) : []; + string[] _suffixes = splitName.Length >= 5 ? Regex.Unescape(splitName[4]).Split(new char[] { VcardConstants._valueDelimiter }, StringSplitOptions.RemoveEmptyEntries) : []; + NameInfo _name = new(altId, [.. finalArgs], _firstName, _lastName, _altNames, _prefixes, _suffixes); return _name; } diff --git a/VisualCard/Parts/NicknameInfo.cs b/VisualCard/Parts/NicknameInfo.cs index 7add7d6..5ad02a6 100644 --- a/VisualCard/Parts/NicknameInfo.cs +++ b/VisualCard/Parts/NicknameInfo.cs @@ -132,7 +132,7 @@ internal static NicknameInfo FromStringVcardThree(string value) // Populate the fields string[] _nicknameTypes = new string[] { "HOME" }; string _nick = Regex.Unescape(nickValue); - NicknameInfo _nickInstance = new(0, Array.Empty(), _nick, _nicknameTypes); + NicknameInfo _nickInstance = new(0, [], _nick, _nicknameTypes); return _nickInstance; } @@ -147,7 +147,7 @@ internal static NicknameInfo FromStringVcardThreeWithType(string value) // Populate the fields string[] _nicknameTypes = VcardParserTools.GetTypes(splitNick, "WORK", true); string _nick = Regex.Unescape(splitNick[1]); - NicknameInfo _nickInstance = new(0, Array.Empty(), _nick, _nicknameTypes); + NicknameInfo _nickInstance = new(0, [], _nick, _nicknameTypes); return _nickInstance; } @@ -159,7 +159,7 @@ internal static NicknameInfo FromStringVcardFour(string value, int altId) // Populate the fields string[] _nicknameTypes = new string[] { "HOME" }; string _nick = Regex.Unescape(nickValue); - NicknameInfo _nickInstance = new(altId, Array.Empty(), _nick, _nicknameTypes); + NicknameInfo _nickInstance = new(altId, [], _nick, _nicknameTypes); return _nickInstance; } @@ -174,7 +174,7 @@ internal static NicknameInfo FromStringVcardFourWithType(string value, List= 2 ? splitOrg[1] : ""); string _orgUnitRole = Regex.Unescape(splitOrg.Length >= 3 ? splitOrg[2] : ""); - OrganizationInfo _org = new(0, Array.Empty(), _orgName, _orgUnit, _orgUnitRole, splitTypes); + OrganizationInfo _org = new(0, [], _orgName, _orgUnit, _orgUnitRole, splitTypes); return _org; } @@ -180,7 +180,7 @@ internal static OrganizationInfo FromStringVcardTwoWithType(string value) string _orgUnit = Regex.Unescape(splitOrganizationValues.Length >= 2 ? splitOrganizationValues[1] : ""); string _orgUnitRole = Regex.Unescape(splitOrganizationValues.Length >= 3 ? splitOrganizationValues[2] : ""); string[] _orgTypes = VcardParserTools.GetTypes(splitOrg, "WORK", false); - OrganizationInfo _org = new(0, Array.Empty(), _orgName, _orgUnit, _orgUnitRole, _orgTypes); + OrganizationInfo _org = new(0, [], _orgName, _orgUnit, _orgUnitRole, _orgTypes); return _org; } @@ -195,7 +195,7 @@ internal static OrganizationInfo FromStringVcardThree(string value) string _orgName = Regex.Unescape(splitOrg[0]); string _orgUnit = Regex.Unescape(splitOrg.Length >= 2 ? splitOrg[1] : ""); string _orgUnitRole = Regex.Unescape(splitOrg.Length >= 3 ? splitOrg[2] : ""); - OrganizationInfo _org = new(0, Array.Empty(), _orgName, _orgUnit, _orgUnitRole, splitTypes); + OrganizationInfo _org = new(0, [], _orgName, _orgUnit, _orgUnitRole, splitTypes); return _org; } @@ -217,7 +217,7 @@ internal static OrganizationInfo FromStringVcardThreeWithType(string value) string _orgUnit = Regex.Unescape(splitOrganizationValues.Length >= 2 ? splitOrganizationValues[1] : ""); string _orgUnitRole = Regex.Unescape(splitOrganizationValues.Length >= 3 ? splitOrganizationValues[2] : ""); string[] _orgTypes = VcardParserTools.GetTypes(splitOrg, "WORK", true); - OrganizationInfo _org = new(0, Array.Empty(), _orgName, _orgUnit, _orgUnitRole, _orgTypes); + OrganizationInfo _org = new(0, [], _orgName, _orgUnit, _orgUnitRole, _orgTypes); return _org; } @@ -232,7 +232,7 @@ internal static OrganizationInfo FromStringVcardFour(string value, int altId) string _orgName = Regex.Unescape(splitOrg[0]); string _orgUnit = Regex.Unescape(splitOrg.Length >= 2 ? splitOrg[1] : ""); string _orgUnitRole = Regex.Unescape(splitOrg.Length >= 3 ? splitOrg[2] : ""); - OrganizationInfo _org = new(altId, Array.Empty(), _orgName, _orgUnit, _orgUnitRole, splitTypes); + OrganizationInfo _org = new(altId, [], _orgName, _orgUnit, _orgUnitRole, splitTypes); return _org; } @@ -254,7 +254,7 @@ internal static OrganizationInfo FromStringVcardFourWithType(string value, List< string _orgUnit = Regex.Unescape(splitOrganizationValues.Length >= 2 ? splitOrganizationValues[1] : ""); string _orgUnitRole = Regex.Unescape(splitOrganizationValues.Length >= 3 ? splitOrganizationValues[2] : ""); string[] _orgTypes = VcardParserTools.GetTypes(splitOrg, "WORK", true); - OrganizationInfo _org = new(altId, finalArgs.ToArray(), _orgName, _orgUnit, _orgUnitRole, _orgTypes); + OrganizationInfo _org = new(altId, [.. finalArgs], _orgName, _orgUnit, _orgUnitRole, _orgTypes); return _org; } diff --git a/VisualCard/Parts/PhotoInfo.cs b/VisualCard/Parts/PhotoInfo.cs index 0c673ef..c1e554b 100644 --- a/VisualCard/Parts/PhotoInfo.cs +++ b/VisualCard/Parts/PhotoInfo.cs @@ -212,7 +212,7 @@ internal static PhotoInfo FromStringVcardTwoWithType(string value, StreamReader } // Populate the fields - PhotoInfo _photo = new(0, Array.Empty(), valueType, photoEncoding, photoType, encodedPhoto.ToString()); + PhotoInfo _photo = new(0, [], valueType, photoEncoding, photoType, encodedPhoto.ToString()); return _photo; } @@ -251,7 +251,7 @@ internal static PhotoInfo FromStringVcardThreeWithType(string value, StreamReade } // Populate the fields - PhotoInfo _photo = new(0, Array.Empty(), valueType, photoEncoding, photoType, encodedPhoto.ToString()); + PhotoInfo _photo = new(0, [], valueType, photoEncoding, photoType, encodedPhoto.ToString()); return _photo; } @@ -290,7 +290,7 @@ internal static PhotoInfo FromStringVcardFourWithType(string value, List } // Populate the fields - PhotoInfo _photo = new(altId, finalArgs.ToArray(), valueType, photoEncoding, photoType, encodedPhoto.ToString()); + PhotoInfo _photo = new(altId, [.. finalArgs], valueType, photoEncoding, photoType, encodedPhoto.ToString()); return _photo; } diff --git a/VisualCard/Parts/RoleInfo.cs b/VisualCard/Parts/RoleInfo.cs index 412bb14..9c599c1 100644 --- a/VisualCard/Parts/RoleInfo.cs +++ b/VisualCard/Parts/RoleInfo.cs @@ -122,7 +122,7 @@ internal static RoleInfo FromStringVcardTwo(string value) string roleValue = value.Substring(VcardConstants._roleSpecifier.Length + 1); // Populate the fields - RoleInfo _role = new(0, Array.Empty(), roleValue); + RoleInfo _role = new(0, [], roleValue); return _role; } @@ -132,7 +132,7 @@ internal static RoleInfo FromStringVcardThree(string value) string roleValue = value.Substring(VcardConstants._roleSpecifier.Length + 1); // Populate the fields - RoleInfo _role = new(0, Array.Empty(), roleValue); + RoleInfo _role = new(0, [], roleValue); return _role; } @@ -142,7 +142,7 @@ internal static RoleInfo FromStringVcardFour(string value, int altId) string roleValue = value.Substring(VcardConstants._roleSpecifier.Length + 1); // Populate the fields - RoleInfo _role = new(altId, Array.Empty(), roleValue); + RoleInfo _role = new(altId, [], roleValue); return _role; } @@ -152,7 +152,7 @@ internal static RoleInfo FromStringVcardFourWithType(string value, List string roleValue = value.Substring(VcardConstants._roleSpecifier.Length + 1); // Populate the fields - RoleInfo _role = new(altId, finalArgs.ToArray(), roleValue); + RoleInfo _role = new(altId, [.. finalArgs], roleValue); return _role; } diff --git a/VisualCard/Parts/SoundInfo.cs b/VisualCard/Parts/SoundInfo.cs index c324502..2ed55e0 100644 --- a/VisualCard/Parts/SoundInfo.cs +++ b/VisualCard/Parts/SoundInfo.cs @@ -212,7 +212,7 @@ internal static SoundInfo FromStringVcardTwoWithType(string value, StreamReader } // Populate the fields - SoundInfo _sound = new(0, Array.Empty(), valueType, soundEncoding, soundType, encodedSound.ToString()); + SoundInfo _sound = new(0, [], valueType, soundEncoding, soundType, encodedSound.ToString()); return _sound; } @@ -251,7 +251,7 @@ internal static SoundInfo FromStringVcardThreeWithType(string value, StreamReade } // Populate the fields - SoundInfo _sound = new(0, Array.Empty(), valueType, soundEncoding, soundType, encodedSound.ToString()); + SoundInfo _sound = new(0, [], valueType, soundEncoding, soundType, encodedSound.ToString()); return _sound; } @@ -290,7 +290,7 @@ internal static SoundInfo FromStringVcardFourWithType(string value, List } // Populate the fields - SoundInfo _sound = new(altId, finalArgs.ToArray(), valueType, soundEncoding, soundType, encodedSound.ToString()); + SoundInfo _sound = new(altId, [.. finalArgs], valueType, soundEncoding, soundType, encodedSound.ToString()); return _sound; } diff --git a/VisualCard/Parts/TelephoneInfo.cs b/VisualCard/Parts/TelephoneInfo.cs index 107426b..f2f5898 100644 --- a/VisualCard/Parts/TelephoneInfo.cs +++ b/VisualCard/Parts/TelephoneInfo.cs @@ -134,7 +134,7 @@ internal static TelephoneInfo FromStringVcardTwo(string value) // Populate the fields string[] _telephoneTypes = new string[] { "CELL" }; string _telephoneNumber = Regex.Unescape(telValue); - TelephoneInfo _telephone = new(0, Array.Empty(), _telephoneTypes, _telephoneNumber); + TelephoneInfo _telephone = new(0, [], _telephoneTypes, _telephoneNumber); return _telephone; } @@ -149,7 +149,7 @@ internal static TelephoneInfo FromStringVcardTwoWithType(string value) // Populate the fields string[] _telephoneTypes = VcardParserTools.GetTypes(splitTel, "CELL", false); string _telephoneNumber = Regex.Unescape(splitTel[1]); - TelephoneInfo _telephone = new(0, Array.Empty(), _telephoneTypes, _telephoneNumber); + TelephoneInfo _telephone = new(0, [], _telephoneTypes, _telephoneNumber); return _telephone; } @@ -161,7 +161,7 @@ internal static TelephoneInfo FromStringVcardThree(string value) // Populate the fields string[] _telephoneTypes = new string[] { "CELL" }; string _telephoneNumber = Regex.Unescape(telValue); - TelephoneInfo _telephone = new(0, Array.Empty(), _telephoneTypes, _telephoneNumber); + TelephoneInfo _telephone = new(0, [], _telephoneTypes, _telephoneNumber); return _telephone; } @@ -176,7 +176,7 @@ internal static TelephoneInfo FromStringVcardThreeWithType(string value) // Populate the fields string[] _telephoneTypes = VcardParserTools.GetTypes(splitTel, "CELL", true); string _telephoneNumber = Regex.Unescape(splitTel[1]); - TelephoneInfo _telephone = new(0, Array.Empty(), _telephoneTypes, _telephoneNumber); + TelephoneInfo _telephone = new(0, [], _telephoneTypes, _telephoneNumber); return _telephone; } @@ -188,7 +188,7 @@ internal static TelephoneInfo FromStringVcardFour(string value, int altId) // Populate the fields string[] _telephoneTypes = new string[] { "CELL" }; string _telephoneNumber = Regex.Unescape(telValue); - TelephoneInfo _telephone = new(altId, Array.Empty(), _telephoneTypes, _telephoneNumber); + TelephoneInfo _telephone = new(altId, [], _telephoneTypes, _telephoneNumber); return _telephone; } @@ -203,7 +203,7 @@ internal static TelephoneInfo FromStringVcardFourWithType(string value, List(), Array.Empty(), _timeZoneStr); + TimeZoneInfo _timeZone = new(0, [], [], _timeZoneStr); return _timeZone; } @@ -144,7 +144,7 @@ internal static TimeZoneInfo FromStringVcardTwoWithType(string value) string _timeZoneNumber = Regex.Unescape(splitTz[1]); // Add the fetched information - TimeZoneInfo _timeZone = new(0, Array.Empty(), _timeZoneTypes, _timeZoneNumber); + TimeZoneInfo _timeZone = new(0, [], _timeZoneTypes, _timeZoneNumber); return _timeZone; } @@ -156,7 +156,7 @@ internal static TimeZoneInfo FromStringVcardThree(string value) // Populate the fields string[] _timeZoneTypes = new string[] { "uri-offset" }; string _timeZoneNumber = Regex.Unescape(tzValue); - TimeZoneInfo _timeZone = new(0, Array.Empty(), _timeZoneTypes, _timeZoneNumber); + TimeZoneInfo _timeZone = new(0, [], _timeZoneTypes, _timeZoneNumber); return _timeZone; } @@ -173,7 +173,7 @@ internal static TimeZoneInfo FromStringVcardThreeWithType(string value) string _timeZoneNumber = Regex.Unescape(splitTz[1]); // Add the fetched information - TimeZoneInfo _timeZone = new(0, Array.Empty(), _timeZoneTypes, _timeZoneNumber); + TimeZoneInfo _timeZone = new(0, [], _timeZoneTypes, _timeZoneNumber); return _timeZone; } @@ -185,7 +185,7 @@ internal static TimeZoneInfo FromStringVcardFour(string value, int altId) // Populate the fields string[] _timeZoneTypes = new string[] { "uri-offset" }; string _timeZoneNumber = Regex.Unescape(tzValue); - TimeZoneInfo _timeZone = new(altId, Array.Empty(), _timeZoneTypes, _timeZoneNumber); + TimeZoneInfo _timeZone = new(altId, [], _timeZoneTypes, _timeZoneNumber); return _timeZone; } @@ -202,7 +202,7 @@ internal static TimeZoneInfo FromStringVcardFourWithType(string value, List(), _title); + TitleInfo title = new(0, [], _title); return title; } @@ -135,7 +135,7 @@ internal static TitleInfo FromStringVcardThree(string value) // Populate field string _title = Regex.Unescape(titleValue); - TitleInfo title = new(0, Array.Empty(), _title); + TitleInfo title = new(0, [], _title); return title; } @@ -146,7 +146,7 @@ internal static TitleInfo FromStringVcardFour(string value, int altId) // Populate field string _title = Regex.Unescape(titleValue); - TitleInfo title = new(altId, Array.Empty(), _title); + TitleInfo title = new(altId, [], _title); return title; } @@ -158,7 +158,7 @@ internal static TitleInfo FromStringVcardFourWithType(string value, List // Populate field string _title = Regex.Unescape(splitTitleParts[1]); - TitleInfo title = new(altId, finalArgs.ToArray(), _title); + TitleInfo title = new(altId, [.. finalArgs], _title); return title; } diff --git a/VisualCard/Parts/XNameInfo.cs b/VisualCard/Parts/XNameInfo.cs index 52cbb1c..de0b10d 100644 --- a/VisualCard/Parts/XNameInfo.cs +++ b/VisualCard/Parts/XNameInfo.cs @@ -144,9 +144,9 @@ internal static XNameInfo FromStringVcardTwo(string value) string[] _xTypes = splitX[0].Contains(VcardConstants._fieldDelimiter.ToString()) ? splitX[0].Substring(splitX[0].IndexOf(VcardConstants._fieldDelimiter) + 1) .Split(VcardConstants._fieldDelimiter) : - Array.Empty(); + []; string[] _xValues = splitX[1].Split(VcardConstants._fieldDelimiter); - XNameInfo _x = new(0, Array.Empty(), _xName, _xValues, _xTypes); + XNameInfo _x = new(0, [], _xName, _xValues, _xTypes); return _x; } @@ -165,9 +165,9 @@ internal static XNameInfo FromStringVcardThree(string value) string[] _xTypes = splitX[0].Contains(VcardConstants._fieldDelimiter.ToString()) ? splitX[0].Substring(splitX[0].IndexOf(VcardConstants._fieldDelimiter) + 1) .Split(VcardConstants._fieldDelimiter) : - Array.Empty(); + []; string[] _xValues = splitX[1].Split(VcardConstants._fieldDelimiter); - XNameInfo _x = new(0, Array.Empty(), _xName, _xValues, _xTypes); + XNameInfo _x = new(0, [], _xName, _xValues, _xTypes); return _x; } @@ -186,9 +186,9 @@ internal static XNameInfo FromStringVcardFour(string value, List finalAr string[] _xTypes = splitX[0].Contains(VcardConstants._fieldDelimiter.ToString()) ? splitX[0].Substring(splitX[0].IndexOf(VcardConstants._fieldDelimiter) + 1) .Split(VcardConstants._fieldDelimiter) : - Array.Empty(); + []; string[] _xValues = splitX[1].Split(VcardConstants._fieldDelimiter); - XNameInfo _x = new(altId, finalArgs.ToArray(), _xName, _xValues, _xTypes); + XNameInfo _x = new(altId, [.. finalArgs], _xName, _xValues, _xTypes); return _x; }