diff --git a/VisualCard.Calendar/Parts/Implementations/Event/DateEndInfo.cs b/VisualCard.Calendar/Parts/Implementations/Event/DateEndInfo.cs index 5352d61..9d7791f 100644 --- a/VisualCard.Calendar/Parts/Implementations/Event/DateEndInfo.cs +++ b/VisualCard.Calendar/Parts/Implementations/Event/DateEndInfo.cs @@ -51,14 +51,13 @@ internal override string ToStringVcalendarInternal(Version cardVersion) internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) { // Populate the fields - string type = valueType ?? ""; DateTimeOffset end = - type.Equals("date", StringComparison.OrdinalIgnoreCase) ? + valueType.Equals("date", StringComparison.OrdinalIgnoreCase) ? VcardCommonTools.ParsePosixDate(value) : VcardCommonTools.ParsePosixDateTime(value); // Add the fetched information - DateEndInfo _time = new(finalArgs, elementTypes, group, valueType ?? "", end); + DateEndInfo _time = new(finalArgs, elementTypes, group, valueType, end); return _time; } diff --git a/VisualCard.Calendar/Parts/Implementations/Event/DateStartInfo.cs b/VisualCard.Calendar/Parts/Implementations/Event/DateStartInfo.cs index cab767d..ca3b89a 100644 --- a/VisualCard.Calendar/Parts/Implementations/Event/DateStartInfo.cs +++ b/VisualCard.Calendar/Parts/Implementations/Event/DateStartInfo.cs @@ -51,14 +51,13 @@ internal override string ToStringVcalendarInternal(Version cardVersion) internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) { // Populate the fields - string type = valueType ?? ""; DateTimeOffset start = - type.Equals("date", StringComparison.OrdinalIgnoreCase) ? + valueType.Equals("date", StringComparison.OrdinalIgnoreCase) ? VcardCommonTools.ParsePosixDate(value) : VcardCommonTools.ParsePosixDateTime(value); // Add the fetched information - DateStartInfo _time = new(finalArgs, elementTypes, group, valueType ?? "", start); + DateStartInfo _time = new(finalArgs, elementTypes, group, valueType, start); return _time; } diff --git a/VisualCard.Calendar/Parts/Implementations/ExDateInfo.cs b/VisualCard.Calendar/Parts/Implementations/ExDateInfo.cs index e4f7c7a..4932638 100644 --- a/VisualCard.Calendar/Parts/Implementations/ExDateInfo.cs +++ b/VisualCard.Calendar/Parts/Implementations/ExDateInfo.cs @@ -51,20 +51,19 @@ internal override string ToStringVcalendarInternal(Version cardVersion) internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) { // Populate the fields - string type = valueType ?? ""; var exDates = Regex.Unescape(value).Split(cardVersion.Major == 1 ? ';' : ','); List dates = []; foreach (var exDate in exDates) { DateTimeOffset date = - type.Equals("date", StringComparison.OrdinalIgnoreCase) ? + valueType.Equals("date", StringComparison.OrdinalIgnoreCase) ? VcardCommonTools.ParsePosixDate(exDate) : VcardCommonTools.ParsePosixDateTime(exDate); dates.Add(date); } // Add the fetched information - ExDateInfo _time = new([], elementTypes, group, valueType ?? "", [.. dates]); + ExDateInfo _time = new([], elementTypes, group, valueType, [.. dates]); return _time; } diff --git a/VisualCard.Calendar/Parts/Implementations/RecDateInfo.cs b/VisualCard.Calendar/Parts/Implementations/RecDateInfo.cs index 8e5d6fb..283bd9e 100644 --- a/VisualCard.Calendar/Parts/Implementations/RecDateInfo.cs +++ b/VisualCard.Calendar/Parts/Implementations/RecDateInfo.cs @@ -76,13 +76,12 @@ internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, else { // Check to see if it's a period - string type = valueType ?? ""; - if (type.Equals("period", StringComparison.OrdinalIgnoreCase)) + if (valueType.Equals("period", StringComparison.OrdinalIgnoreCase)) { var parsedPeriod = VcardCommonTools.GetTimePeriod(value); recDates = [parsedPeriod]; } - else if (type.Equals("date", StringComparison.OrdinalIgnoreCase)) + else if (valueType.Equals("date", StringComparison.OrdinalIgnoreCase)) { // Not a period. Use date var parsedDate = VcardCommonTools.ParsePosixDate(value); @@ -97,7 +96,7 @@ internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, } // Add the fetched information - RecDateInfo _time = new([], elementTypes, group, valueType ?? "", recDates); + RecDateInfo _time = new([], elementTypes, group, valueType, recDates); return _time; } diff --git a/VisualCard.Calendar/Parts/Implementations/Todo/DueDateInfo.cs b/VisualCard.Calendar/Parts/Implementations/Todo/DueDateInfo.cs index c806127..f53e710 100644 --- a/VisualCard.Calendar/Parts/Implementations/Todo/DueDateInfo.cs +++ b/VisualCard.Calendar/Parts/Implementations/Todo/DueDateInfo.cs @@ -51,14 +51,13 @@ internal override string ToStringVcalendarInternal(Version cardVersion) internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) { // Populate the fields - string type = valueType ?? ""; DateTimeOffset completed = - type.Equals("date", StringComparison.OrdinalIgnoreCase) ? + valueType.Equals("date", StringComparison.OrdinalIgnoreCase) ? VcardCommonTools.ParsePosixDate(value) : VcardCommonTools.ParsePosixDateTime(value); // Add the fetched information - DueDateInfo _time = new(finalArgs, elementTypes, group, valueType ?? "", completed); + DueDateInfo _time = new(finalArgs, elementTypes, group, valueType, completed); return _time; }