From ce58007cc88a45556eaf783aa6fa0617c48ce886 Mon Sep 17 00:00:00 2001 From: Aptivi Date: Wed, 11 Sep 2024 12:38:11 +0300 Subject: [PATCH] upd - Updated libraries --- Type: upd Breaking: False Doc Required: False Backport Required: False Part: 1/1 --- .../Nitrocid.Analyzers.Test.csproj | 2 +- private/Nitrocid.Tests/Nitrocid.Tests.csproj | 2 +- .../Contacts/Commands/ContactInfo.cs | 44 +++++++++---------- .../Contacts/ContactsManager.cs | 4 +- .../Interactives/ContactsManagerCli.cs | 22 +++++----- .../Nitrocid.Extras.Contacts.csproj | 2 +- 6 files changed, 38 insertions(+), 38 deletions(-) diff --git a/private/Nitrocid.Analyzers.Test/Nitrocid.Analyzers.Test.csproj b/private/Nitrocid.Analyzers.Test/Nitrocid.Analyzers.Test.csproj index 7485f1c00..839362bbc 100644 --- a/private/Nitrocid.Analyzers.Test/Nitrocid.Analyzers.Test.csproj +++ b/private/Nitrocid.Analyzers.Test/Nitrocid.Analyzers.Test.csproj @@ -1,4 +1,4 @@ - + ..\KSTest\ diff --git a/private/Nitrocid.Tests/Nitrocid.Tests.csproj b/private/Nitrocid.Tests/Nitrocid.Tests.csproj index e6b66b045..021650d2d 100644 --- a/private/Nitrocid.Tests/Nitrocid.Tests.csproj +++ b/private/Nitrocid.Tests/Nitrocid.Tests.csproj @@ -1,4 +1,4 @@ - + KSTest\ diff --git a/public/Nitrocid.Addons/Nitrocid.Extras.Contacts/Contacts/Commands/ContactInfo.cs b/public/Nitrocid.Addons/Nitrocid.Extras.Contacts/Contacts/Commands/ContactInfo.cs index c1031be06..cb06c1504 100644 --- a/public/Nitrocid.Addons/Nitrocid.Extras.Contacts/Contacts/Commands/ContactInfo.cs +++ b/public/Nitrocid.Addons/Nitrocid.Extras.Contacts/Contacts/Commands/ContactInfo.cs @@ -73,81 +73,81 @@ public override int Execute(CommandParameters parameters, ref string variableVal if (hasFullName) { TextWriters.Write("- " + Translate.DoTranslation("Contact name") + ": ", false, KernelColorType.ListEntry); - TextWriters.Write(contact.GetPartsArray()[0].FullName, KernelColorType.ListValue); + TextWriters.Write(contact.GetPartsArray()[0].FullName ?? "", KernelColorType.ListValue); } if (hasName) { TextWriters.Write(" - " + Translate.DoTranslation("First name") + ": ", false, KernelColorType.ListEntry); - TextWriters.Write(contact.GetPartsArray()[0].ContactFirstName, KernelColorType.ListValue); + TextWriters.Write(contact.GetPartsArray()[0].ContactFirstName ?? "", KernelColorType.ListValue); TextWriters.Write(" - " + Translate.DoTranslation("Last name") + ": ", false, KernelColorType.ListEntry); - TextWriters.Write(contact.GetPartsArray()[0].ContactLastName, KernelColorType.ListValue); + TextWriters.Write(contact.GetPartsArray()[0].ContactLastName ?? "", KernelColorType.ListValue); } if (hasAddress) { var address = contact.GetPartsArray()[0]; - string street = address.StreetAddress; - string postal = address.PostalCode; - string poBox = address.PostOfficeBox; - string extended = address.ExtendedAddress; - string locality = address.Locality; - string region = address.Region; - string country = address.Country; + string street = address.StreetAddress ?? ""; + string postal = address.PostalCode ?? ""; + string poBox = address.PostOfficeBox ?? ""; + string extended = address.ExtendedAddress ?? ""; + string locality = address.Locality ?? ""; + string region = address.Region ?? ""; + string country = address.Country ?? ""; TextWriters.Write(" - " + Translate.DoTranslation("Contact address") + ": ", false, KernelColorType.ListEntry); TextWriters.Write($"{street}, {postal}, {poBox}, {extended}, {locality}, {region}, {country}", KernelColorType.ListValue); } if (hasMail) { TextWriters.Write(" - " + Translate.DoTranslation("Contact mail") + ": ", false, KernelColorType.ListEntry); - TextWriters.Write(contact.GetPartsArray()[0].ContactEmailAddress, KernelColorType.ListValue); + TextWriters.Write(contact.GetPartsArray()[0].ContactEmailAddress ?? "", KernelColorType.ListValue); } if (hasOrganization) { var org = contact.GetPartsArray()[0]; - string name = org.Name; - string unit = org.Unit; - string role = org.Role; + string name = org.Name ?? ""; + string unit = org.Unit ?? ""; + string role = org.Role ?? ""; TextWriters.Write(" - " + Translate.DoTranslation("Contact organization") + ": ", false, KernelColorType.ListEntry); TextWriters.Write($"{name}, {unit}, {role}", KernelColorType.ListValue); } if (hasTelephone) { TextWriters.Write(" - " + Translate.DoTranslation("Contact telephone") + ": ", false, KernelColorType.ListEntry); - TextWriters.Write(contact.GetPartsArray()[0].ContactPhoneNumber, KernelColorType.ListValue); + TextWriters.Write(contact.GetPartsArray()[0].ContactPhoneNumber ?? "", KernelColorType.ListValue); } if (hasURL) { TextWriters.Write(" - " + Translate.DoTranslation("Contact URL") + ": ", false, KernelColorType.ListEntry); - TextWriters.Write(contact.GetPartsArray()[0].Url, KernelColorType.ListValue); + TextWriters.Write(contact.GetPartsArray()[0].Url ?? "", KernelColorType.ListValue); } if (hasGeo) { TextWriters.Write(" - " + Translate.DoTranslation("Contact Geo") + ": ", false, KernelColorType.ListEntry); - TextWriters.Write(contact.GetPartsArray()[0].Geo, KernelColorType.ListValue); + TextWriters.Write(contact.GetPartsArray()[0].Geo ?? "", KernelColorType.ListValue); } if (hasImpp) { TextWriters.Write(" - " + Translate.DoTranslation("Contact IMPP") + ": ", false, KernelColorType.ListEntry); - TextWriters.Write(contact.GetPartsArray()[0].ContactIMPP, KernelColorType.ListValue); + TextWriters.Write(contact.GetPartsArray()[0].ContactIMPP ?? "", KernelColorType.ListValue); } if (hasNickname) { TextWriters.Write(" - " + Translate.DoTranslation("Contact nickname") + ": ", false, KernelColorType.ListEntry); - TextWriters.Write(contact.GetPartsArray()[0].ContactNickname, KernelColorType.ListValue); + TextWriters.Write(contact.GetPartsArray()[0].ContactNickname ?? "", KernelColorType.ListValue); } if (hasRoles) { TextWriters.Write(" - " + Translate.DoTranslation("Contact role") + ": ", false, KernelColorType.ListEntry); - TextWriters.Write(contact.GetPartsArray()[0].ContactRole, KernelColorType.ListValue); + TextWriters.Write(contact.GetPartsArray()[0].ContactRole ?? "", KernelColorType.ListValue); } if (hasTitles) { TextWriters.Write(" - " + Translate.DoTranslation("Contact title") + ": ", false, KernelColorType.ListEntry); - TextWriters.Write(contact.GetPartsArray()[0].ContactTitle, KernelColorType.ListValue); + TextWriters.Write(contact.GetPartsArray()[0].ContactTitle ?? "", KernelColorType.ListValue); } if (hasNotes) { TextWriters.Write(" - " + Translate.DoTranslation("Contact note") + ": ", false, KernelColorType.ListEntry); - TextWriters.Write(contact.GetPartsArray()[0].Note, KernelColorType.ListValue); + TextWriters.Write(contact.GetPartsArray()[0].Note ?? "", KernelColorType.ListValue); } return 0; } diff --git a/public/Nitrocid.Addons/Nitrocid.Extras.Contacts/Contacts/ContactsManager.cs b/public/Nitrocid.Addons/Nitrocid.Extras.Contacts/Contacts/ContactsManager.cs index 49e5cfee6..f8115588e 100644 --- a/public/Nitrocid.Addons/Nitrocid.Extras.Contacts/Contacts/ContactsManager.cs +++ b/public/Nitrocid.Addons/Nitrocid.Extras.Contacts/Contacts/ContactsManager.cs @@ -336,7 +336,7 @@ public static Card GetContact(int contactIndex) cachedSearchExpression = expression; // Get the list of cards satisfying the expression - var satisfiedCards = cards.Where((card) => RegexpTools.IsMatch(card.GetPartsArray()[0].FullName, expression)).ToArray(); + var satisfiedCards = cards.Where((card) => RegexpTools.IsMatch(card.GetPartsArray()[0].FullName ?? "", expression)).ToArray(); // Return a card if the index is valid if (satisfiedCards.Length > 0) @@ -381,7 +381,7 @@ public static Card GetContact(int contactIndex) throw new KernelException(KernelExceptionType.Contacts, Translate.DoTranslation("Regular expression is invalid.")); // Get the list of cards satisfying the expression - var satisfiedCards = cards.Where((card) => RegexpTools.IsMatch(card.GetPartsArray()[0].FullName, expression)).ToArray(); + var satisfiedCards = cards.Where((card) => RegexpTools.IsMatch(card.GetPartsArray()[0].FullName ?? "", expression)).ToArray(); // Compare between the cached expression and the given expression if (expression == cachedSearchExpression) diff --git a/public/Nitrocid.Addons/Nitrocid.Extras.Contacts/Contacts/Interactives/ContactsManagerCli.cs b/public/Nitrocid.Addons/Nitrocid.Extras.Contacts/Contacts/Interactives/ContactsManagerCli.cs index 6e31fd6bd..0be9017b8 100644 --- a/public/Nitrocid.Addons/Nitrocid.Extras.Contacts/Contacts/Interactives/ContactsManagerCli.cs +++ b/public/Nitrocid.Addons/Nitrocid.Extras.Contacts/Contacts/Interactives/ContactsManagerCli.cs @@ -103,7 +103,7 @@ public override string GetEntryFromItem(Card item) Card contact = item; if (contact is null) return ""; - return contact.GetPartsArray()[0].FullName; + return contact.GetPartsArray()[0].FullName ?? ""; } internal void RemoveContact(int index) => @@ -310,13 +310,13 @@ internal string GetContactAddressFinal(Card card) var address = card.GetPartsArray()[0]; List fullElements = []; - string street = address.StreetAddress; - string postal = address.PostalCode; - string poBox = address.PostOfficeBox; - string extended = address.ExtendedAddress; - string locality = address.Locality; - string region = address.Region; - string country = address.Country; + string street = address.StreetAddress ?? ""; + string postal = address.PostalCode ?? ""; + string poBox = address.PostOfficeBox ?? ""; + string extended = address.ExtendedAddress ?? ""; + string locality = address.Locality ?? ""; + string region = address.Region ?? ""; + string country = address.Country ?? ""; if (!string.IsNullOrEmpty(street)) fullElements.Add(street); if (!string.IsNullOrEmpty(postal)) @@ -381,9 +381,9 @@ internal string GetContactOrganizationFinal(Card card) var org = card.GetPartsArray()[0]; List fullElements = []; - string name = org.Name; - string unit = org.Unit; - string role = org.Role; + string name = org.Name ?? ""; + string unit = org.Unit ?? ""; + string role = org.Role ?? ""; if (!string.IsNullOrEmpty(name)) fullElements.Add(name); if (!string.IsNullOrEmpty(unit)) diff --git a/public/Nitrocid.Addons/Nitrocid.Extras.Contacts/Nitrocid.Extras.Contacts.csproj b/public/Nitrocid.Addons/Nitrocid.Extras.Contacts/Nitrocid.Extras.Contacts.csproj index 32145d2ea..3755836ee 100644 --- a/public/Nitrocid.Addons/Nitrocid.Extras.Contacts/Nitrocid.Extras.Contacts.csproj +++ b/public/Nitrocid.Addons/Nitrocid.Extras.Contacts/Nitrocid.Extras.Contacts.csproj @@ -42,7 +42,7 @@ - +