Skip to content

Commit

Permalink
rem - doc - Removed explicit kind check
Browse files Browse the repository at this point in the history
---

VisualCard can now accurately detect kind as individual without it being
specified for vCard 4.0+.

---

Type: rem
Breaking: False
Doc Required: True
Backport Required: False
Part: 1/1
  • Loading branch information
AptiviCEO committed Feb 9, 2025
1 parent 1aa33ce commit 3e1a34f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
6 changes: 2 additions & 4 deletions public/VisualCard/Parsers/VcardParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,8 @@ internal static void Process(string _value, Card card, Version version)
{
StringsEnum stringType = (StringsEnum)partType.enumeration;

// Let VisualCard know that we've explicitly specified a kind.
if (stringType == StringsEnum.Kind)
card.kindExplicitlySpecified = true;
else if (stringType == StringsEnum.Profile && !finalValue.Equals("vcard", StringComparison.OrdinalIgnoreCase))
// Check if the profile is vCard or not.
if (stringType == StringsEnum.Profile && !finalValue.Equals("vcard", StringComparison.OrdinalIgnoreCase))
throw new InvalidDataException("Profile must be \"vCard\"");

// Set the string for real
Expand Down
5 changes: 0 additions & 5 deletions public/VisualCard/Parts/Card.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ namespace VisualCard.Parts
[DebuggerDisplay("vCard version {CardVersion.ToString()}, parts: (A [{partsArray.Count}] | S [{strings.Count}]), explicit kind: {kindExplicitlySpecified}")]
public class Card : IEquatable<Card>
{
internal bool kindExplicitlySpecified = false;
internal List<Card> nestedCards = [];
private readonly Version version;
private readonly Dictionary<PartsArrayEnum, List<BaseCardPartInfo>> partsArray = [];
Expand Down Expand Up @@ -210,10 +209,6 @@ public string SaveToString()
if (array is null || array.Length == 0)
continue;

// Check to see if kind is specified
if (!kindExplicitlySpecified && stringEnum == StringsEnum.Kind)
continue;

// Get the prefix
string prefix = VcardParserTools.GetPrefixFromStringsEnum(stringEnum);
var type = VcardParserTools.GetPartType(prefix, version, CardKindStr);
Expand Down

0 comments on commit 3e1a34f

Please sign in to comment.