diff --git a/VisualCard.Calendar/Parsers/VCalendarParser.cs b/VisualCard.Calendar/Parsers/VCalendarParser.cs index 8aca9c5..d237c1b 100644 --- a/VisualCard.Calendar/Parsers/VCalendarParser.cs +++ b/VisualCard.Calendar/Parsers/VCalendarParser.cs @@ -115,6 +115,10 @@ public Parts.Calendar Parse() bool isWithType = splitArgs.Length > 0; List finalArgs = []; + // Extract the group name + string group = prefix.Contains(".") ? prefix.Substring(0, prefix.IndexOf(".")) : ""; + prefix = prefix.RemovePrefix($"{group}."); + // Check to see if we have a BEGIN or an END prefix if (prefix == VcardConstants._beginSpecifier) { @@ -203,10 +207,11 @@ public Parts.Calendar Parse() continue; // Set the string for real + var stringValueInfo = new CalendarValueInfo([.. finalArgs], elementTypes, group, valueType, finalValue); if (subPart is not null) - subPart.SetString(stringType, finalValue); + subPart.SetString(stringType, stringValueInfo); else - calendar.SetString(stringType, finalValue); + calendar.SetString(stringType, stringValueInfo); } break; case PartType.Integers: @@ -220,10 +225,11 @@ public Parts.Calendar Parse() double finalDouble = double.Parse(finalValue); // Set the integer for real + var stringValueInfo = new CalendarValueInfo([.. finalArgs], elementTypes, group, valueType, finalDouble); if (subPart is not null) - subPart.SetInteger(integerType, finalDouble); + subPart.SetInteger(integerType, stringValueInfo); else - calendar.SetInteger(integerType, finalDouble); + calendar.SetInteger(integerType, stringValueInfo); } break; case PartType.PartsArray: @@ -238,7 +244,7 @@ public Parts.Calendar Parse() // Now, get the part info finalValue = partsArrayType is CalendarPartsArrayEnum.IanaNames or CalendarPartsArrayEnum.NonstandardNames ? _value : value; - var partInfo = fromString(finalValue, [.. finalArgs], elementTypes, valueType, CalendarVersion); + var partInfo = fromString(finalValue, [.. finalArgs], elementTypes, group, valueType, CalendarVersion); // Set the array for real if (subPart is not null) @@ -353,7 +359,7 @@ private bool HasComponent(string expectedFieldName, TComponent compo { case PartType.Strings: { - string value = component.GetString((CalendarStringsEnum)enumeration); + string value = component.GetString((CalendarStringsEnum)enumeration)?.Value ?? ""; exists = !string.IsNullOrEmpty(value); } break; @@ -367,7 +373,7 @@ private bool HasComponent(string expectedFieldName, TComponent compo break; case PartType.Integers: { - double value = component.GetInteger((CalendarIntegersEnum)enumeration); + double value = component.GetInteger((CalendarIntegersEnum)enumeration)?.Value ?? -1; exists = value != -1; } break; @@ -385,7 +391,7 @@ private void ValidateAlarm(CalendarAlarm alarmInfo) string[] expectedAudioAlarmFields = [VCalendarConstants._attachSpecifier]; string[] expectedDisplayAlarmFields = [VCalendarConstants._descriptionSpecifier]; string[] expectedMailAlarmFields = [VCalendarConstants._descriptionSpecifier, VCalendarConstants._summarySpecifier, VCalendarConstants._attendeeSpecifier]; - string type = alarmInfo.GetString(CalendarStringsEnum.Action); + string type = alarmInfo.GetString(CalendarStringsEnum.Action)?.Value ?? ""; switch (type) { case "AUDIO": @@ -403,7 +409,7 @@ private void ValidateAlarm(CalendarAlarm alarmInfo) } // Check to see if there is a repeat property - int repeat = (int)alarmInfo.GetInteger(CalendarIntegersEnum.Repeat); + int repeat = (int)(alarmInfo.GetInteger(CalendarIntegersEnum.Repeat)?.Value ?? -1); string[] expectedRepeatedAlarmFields = [VCalendarConstants._durationSpecifier]; if (repeat >= 1) { diff --git a/VisualCard.Calendar/Parsers/VCalendarParserTools.cs b/VisualCard.Calendar/Parsers/VCalendarParserTools.cs index 77f1f55..22898dd 100644 --- a/VisualCard.Calendar/Parsers/VCalendarParserTools.cs +++ b/VisualCard.Calendar/Parsers/VCalendarParserTools.cs @@ -252,7 +252,7 @@ internal static (CalendarPartsArrayEnum, PartCardinality) GetPartsArrayEnumFromT return (CalendarPartsArrayEnum.IanaNames, PartCardinality.Any); } - internal static (PartType type, object enumeration, Type? enumType, Func? fromStringFunc, string defaultType, string defaultValue, string defaultValueType, string[] allowedExtraTypes, string[] allowedValues) GetPartType(string prefix, string objectType, Version calendarVersion) + internal static (PartType type, object enumeration, Type? enumType, Func? fromStringFunc, string defaultType, string defaultValue, string defaultValueType, string[] allowedExtraTypes, string[] allowedValues) GetPartType(string prefix, string objectType, Version calendarVersion) { string[] allowedStatuses = objectType == VCalendarConstants._objectVEventSpecifier && calendarVersion.Major == 2 ? ["TENTATIVE", "CONFIRMED", "CANCELLED"] : diff --git a/VisualCard.Calendar/Parts/BaseCalendarPartInfo.cs b/VisualCard.Calendar/Parts/BaseCalendarPartInfo.cs index f2b9d71..def3439 100644 --- a/VisualCard.Calendar/Parts/BaseCalendarPartInfo.cs +++ b/VisualCard.Calendar/Parts/BaseCalendarPartInfo.cs @@ -34,17 +34,22 @@ public abstract class BaseCalendarPartInfo : IEquatable /// /// Final arguments /// - public virtual ArgumentInfo[]? Arguments { get; internal set; } + public virtual ArgumentInfo[] Arguments { get; internal set; } = []; /// /// Card element type (home, work, ...) /// - public virtual string[]? ElementTypes { get; internal set; } + public virtual string[] ElementTypes { get; internal set; } = []; /// /// Value type (usually set by VALUE=) /// - public virtual string? ValueType { get; internal set; } + public virtual string ValueType { get; internal set; } = ""; + + /// + /// Property group + /// + public virtual string Group { get; internal set; } = ""; /// /// Is this part preferred? @@ -95,6 +100,7 @@ public bool Equals(BaseCalendarPartInfo source, BaseCalendarPartInfo target) source.Arguments.SequenceEqual(target.Arguments) && source.ElementTypes.SequenceEqual(target.ElementTypes) && source.ValueType == target.ValueType && + source.Group == target.Group && EqualsInternal(source, target) ; } @@ -106,10 +112,11 @@ public override bool Equals(object obj) => /// public override int GetHashCode() { - int hashCode = -452519667; - hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(Arguments); - hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(ElementTypes); - hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(ValueType); + int hashCode = -1053170623; + hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(Arguments); + hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(ElementTypes); + hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(ValueType); + hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(Group); return hashCode; } @@ -124,18 +131,19 @@ public override int GetHashCode() internal virtual bool EqualsInternal(BaseCalendarPartInfo source, BaseCalendarPartInfo target) => true; - internal abstract BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version calendarVersion); + internal abstract BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version calendarVersion); internal abstract string ToStringVcalendarInternal(Version calendarVersion); internal BaseCalendarPartInfo() { } - internal BaseCalendarPartInfo(ArgumentInfo[] arguments, string[] elementTypes, string valueType) + internal BaseCalendarPartInfo(ArgumentInfo[] arguments, string[] elementTypes, string group, string valueType) { Arguments = arguments; ElementTypes = elementTypes; ValueType = valueType; + Group = group; } } } diff --git a/VisualCard.Calendar/Parts/Calendar.cs b/VisualCard.Calendar/Parts/Calendar.cs index a9f88f1..2f45c6a 100644 --- a/VisualCard.Calendar/Parts/Calendar.cs +++ b/VisualCard.Calendar/Parts/Calendar.cs @@ -46,8 +46,8 @@ public class Calendar : IEquatable internal readonly List others = []; private readonly Version version; private readonly Dictionary> partsArray = []; - private readonly Dictionary strings = []; - private readonly Dictionary integers = []; + private readonly Dictionary> strings = []; + private readonly Dictionary> integers = []; /// /// The vCalendar version @@ -59,7 +59,7 @@ public class Calendar : IEquatable /// Unique ID for this card /// public string UniqueId => - GetString(CalendarStringsEnum.Uid); + GetString(CalendarStringsEnum.Uid)?.Value ?? ""; /// /// Event list @@ -209,50 +209,52 @@ internal BaseCalendarPartInfo[] GetPartsArray(Type partType, CalendarPartsArrayE /// Gets a string from a specified key /// /// A key to use - /// A value, or "individual" if the kind doesn't exist, or an empty string ("") if any other type either doesn't exist or the type is not supported by the card version - public string GetString(CalendarStringsEnum key) => + /// A value or null if any other type either doesn't exist or the type is not supported by the card version + public CalendarValueInfo? GetString(CalendarStringsEnum key) => GetString(key, version, strings); - internal string GetString(CalendarStringsEnum key, Version version, Dictionary strings) + internal CalendarValueInfo? GetString(CalendarStringsEnum key, Version version, Dictionary> strings) { // Check for version support if (!VCalendarParserTools.StringSupported(key, version, GetType())) - return ""; + return null; // Get the fallback value string fallback = ""; + var valueInfo = new CalendarValueInfo([], [], "", "", fallback); // Check to see if the string has a value or not - bool hasValue = strings.TryGetValue(key, out string value); + bool hasValue = strings.TryGetValue(key, out var value); if (!hasValue) - return fallback; + return valueInfo; // Now, verify that the string is not empty - hasValue = !string.IsNullOrEmpty(value); - return hasValue ? value : fallback; + hasValue = !string.IsNullOrEmpty(value.Value); + return hasValue ? value : valueInfo; } /// /// Gets a integer from a specified key /// /// A key to use - /// A value or -1 if any other type either doesn't exist or the type is not supported by the card version - public double GetInteger(CalendarIntegersEnum key) => + /// A value or null if any other type either doesn't exist or the type is not supported by the card version + public CalendarValueInfo? GetInteger(CalendarIntegersEnum key) => GetInteger(key, version, integers); - internal double GetInteger(CalendarIntegersEnum key, Version version, Dictionary integers) + internal CalendarValueInfo? GetInteger(CalendarIntegersEnum key, Version version, Dictionary> integers) { // Check for version support if (!VCalendarParserTools.IntegerSupported(key, version, GetType())) - return -1; + return null; // Get the fallback value int fallback = -1; + var valueInfo = new CalendarValueInfo([], [], "", "", fallback); // Check to see if the integer has a value or not - bool hasValue = integers.TryGetValue(key, out double value); + bool hasValue = integers.TryGetValue(key, out var value); if (!hasValue) - return fallback; + return valueInfo; return value; } @@ -262,7 +264,7 @@ internal double GetInteger(CalendarIntegersEnum key, Version version, Dictionary public string SaveToString() => SaveToString(version, partsArray, strings, integers, VCalendarConstants._objectVCalendarSpecifier); - internal string SaveToString(Version version, Dictionary> partsArray, Dictionary strings, Dictionary integers, string objectType) + internal string SaveToString(Version version, Dictionary> partsArray, Dictionary> strings, Dictionary> integers, string objectType) { // Initialize the card builder var cardBuilder = new StringBuilder(); @@ -277,28 +279,55 @@ internal string SaveToString(Version version, Dictionary>.Default.GetHashCode(timeZones); hashCode = hashCode * -1521134295 + EqualityComparer>.Default.GetHashCode(others); hashCode = hashCode * -1521134295 + EqualityComparer>>.Default.GetHashCode(partsArray); - hashCode = hashCode * -1521134295 + EqualityComparer>.Default.GetHashCode(strings); - hashCode = hashCode * -1521134295 + EqualityComparer>.Default.GetHashCode(integers); + hashCode = hashCode * -1521134295 + EqualityComparer>>.Default.GetHashCode(strings); + hashCode = hashCode * -1521134295 + EqualityComparer>>.Default.GetHashCode(integers); return hashCode; } @@ -478,12 +510,12 @@ internal void AddPartToArray(CalendarPartsArrayEnum key, BaseCalendarPartInfo va } } - internal void SetString(CalendarStringsEnum key, string value) => + internal void SetString(CalendarStringsEnum key, CalendarValueInfo value) => SetString(key, value, strings); - internal void SetString(CalendarStringsEnum key, string value, Dictionary strings) + internal void SetString(CalendarStringsEnum key, CalendarValueInfo value, Dictionary> strings) { - if (string.IsNullOrEmpty(value)) + if (value is null || string.IsNullOrEmpty(value.Value)) return; // If we don't have this key yet, add it. @@ -493,12 +525,12 @@ internal void SetString(CalendarStringsEnum key, string value, Dictionary + internal void SetInteger(CalendarIntegersEnum key, CalendarValueInfo value) => SetInteger(key, value, integers); - internal void SetInteger(CalendarIntegersEnum key, double value, Dictionary integers) + internal void SetInteger(CalendarIntegersEnum key, CalendarValueInfo value, Dictionary> integers) { - if (value == -1) + if (value is null || value.Value == -1) return; // If we don't have this key yet, add it. diff --git a/VisualCard.Calendar/Parts/CalendarAlarm.cs b/VisualCard.Calendar/Parts/CalendarAlarm.cs index a22d213..d2fe348 100644 --- a/VisualCard.Calendar/Parts/CalendarAlarm.cs +++ b/VisualCard.Calendar/Parts/CalendarAlarm.cs @@ -33,8 +33,8 @@ namespace VisualCard.Calendar.Parts public class CalendarAlarm : Calendar, IEquatable { private readonly Dictionary> partsArray = []; - private readonly Dictionary strings = []; - private readonly Dictionary integers = []; + private readonly Dictionary> strings = []; + private readonly Dictionary> integers = []; /// /// Gets a part array from a specified key @@ -61,10 +61,18 @@ public class CalendarAlarm : Calendar, IEquatable /// Gets a string from a specified key /// /// A key to use - /// A value, or "individual" if the kind doesn't exist, or an empty string ("") if any other type either doesn't exist or the type is not supported by the card version - public new string GetString(CalendarStringsEnum key) => + /// A value or null if any other type either doesn't exist or the type is not supported by the card version + public new CalendarValueInfo? GetString(CalendarStringsEnum key) => GetString(key, CalendarVersion, strings); + /// + /// Gets a integer from a specified key + /// + /// A key to use + /// A value or null if any other type either doesn't exist or the type is not supported by the card version + public new CalendarValueInfo? GetInteger(CalendarIntegersEnum key) => + GetInteger(key, CalendarVersion, integers); + /// /// Saves this parsed card to the string /// @@ -115,8 +123,8 @@ public override int GetHashCode() int hashCode = 1333672311; hashCode = hashCode * -1521134295 + base.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer>>.Default.GetHashCode(partsArray); - hashCode = hashCode * -1521134295 + EqualityComparer>.Default.GetHashCode(strings); - hashCode = hashCode * -1521134295 + EqualityComparer>.Default.GetHashCode(integers); + hashCode = hashCode * -1521134295 + EqualityComparer>>.Default.GetHashCode(strings); + hashCode = hashCode * -1521134295 + EqualityComparer>>.Default.GetHashCode(integers); return hashCode; } @@ -131,10 +139,10 @@ public override int GetHashCode() internal new void AddPartToArray(CalendarPartsArrayEnum key, BaseCalendarPartInfo value) => AddPartToArray(key, value, CalendarVersion, partsArray, VCalendarConstants._objectVAlarmSpecifier); - internal new void SetString(CalendarStringsEnum key, string value) => + internal new void SetString(CalendarStringsEnum key, CalendarValueInfo value) => SetString(key, value, strings); - internal new void SetInteger(CalendarIntegersEnum key, double value) => + internal new void SetInteger(CalendarIntegersEnum key, CalendarValueInfo value) => SetInteger(key, value, integers); internal CalendarAlarm(Version version) : diff --git a/VisualCard.Calendar/Parts/CalendarBuilderTools.cs b/VisualCard.Calendar/Parts/CalendarBuilderTools.cs index 40f8fc2..7d3b07d 100644 --- a/VisualCard.Calendar/Parts/CalendarBuilderTools.cs +++ b/VisualCard.Calendar/Parts/CalendarBuilderTools.cs @@ -18,78 +18,22 @@ // using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using VisualCard.Calendar.Parts.Implementations; -using VisualCard.Parsers; +using VisualCard.Parts; namespace VisualCard.Calendar.Parts { internal static class CalendarBuilderTools { - internal static string BuildArguments(BaseCalendarPartInfo partInfo, string defaultType, string defaultValue) + internal static string BuildArguments(BaseCalendarPartInfo partInfo, Version cardVersion, string defaultType, string defaultValue) { - // Filter the list of types and values first - string valueType = partInfo.ValueType ?? ""; - var valueArguments = partInfo.Arguments ?? []; - string[] finalElementTypes = partInfo.ElementTypes.Where((type) => !type.Equals(defaultType, StringComparison.OrdinalIgnoreCase)).ToArray(); - string finalValue = valueType.Equals(defaultValue, StringComparison.OrdinalIgnoreCase) ? "" : valueType; - - // Check to see if we've been provided arguments - bool noSemicolon = valueArguments.Length == 0 && finalElementTypes.Length == 0 && string.IsNullOrEmpty(finalValue); string extraKeyName = (partInfo is XNameInfo xName ? xName.XKeyName : partInfo is ExtraInfo exName ? exName.KeyName : "") ?? ""; - if (noSemicolon) - return extraKeyName + VcardConstants._argumentDelimiter.ToString(); - - // Now, initialize the argument builder - StringBuilder argumentsBuilder = new(extraKeyName + VcardConstants._fieldDelimiter.ToString()); - bool installArguments = valueArguments.Length > 0; - bool installElementTypes = finalElementTypes.Length > 0; - bool installValueType = !string.IsNullOrEmpty(finalValue); - - // Install the element types parameter if it exists - if (installElementTypes) - { - argumentsBuilder.Append(VcardConstants._typeArgumentSpecifier + string.Join(",", finalElementTypes)); - noSemicolon = !installArguments && !installValueType; - if (noSemicolon) - { - argumentsBuilder.Append(VcardConstants._argumentDelimiter.ToString()); - return argumentsBuilder.ToString(); - } - else - argumentsBuilder.Append(VcardConstants._fieldDelimiter.ToString()); - } - - // Then, install the value type parameter if it exists - if (installValueType) - { - argumentsBuilder.Append(VcardConstants._valueArgumentSpecifier + string.Join(",", finalValue)); - noSemicolon = !installArguments; - if (noSemicolon) - { - argumentsBuilder.Append(VcardConstants._argumentDelimiter.ToString()); - return argumentsBuilder.ToString(); - } - else - argumentsBuilder.Append(VcardConstants._fieldDelimiter.ToString()); - } - - // Finally, install the remaining arguments if they exist and contain keys and values - if (installArguments) - { - List finalArguments = []; - foreach (var arg in valueArguments) - finalArguments.Add(arg.BuildArguments()); - argumentsBuilder.Append(string.Join(VcardConstants._fieldDelimiter.ToString(), finalArguments)); - } - - // We've reached the end. - argumentsBuilder.Append(VcardConstants._argumentDelimiter.ToString()); - return argumentsBuilder.ToString(); + return CardBuilderTools.BuildArguments(partInfo.ElementTypes, partInfo.ValueType, -1, partInfo.Arguments, extraKeyName, cardVersion, defaultType, defaultValue); } + + internal static string BuildArguments(CalendarValueInfo partInfo, Version cardVersion, string defaultType, string defaultValue) => + CardBuilderTools.BuildArguments(partInfo.ElementTypes, partInfo.ValueType, -1, partInfo.Arguments, "", cardVersion, defaultType, defaultValue); } } diff --git a/VisualCard.Calendar/Parts/CalendarDaylight.cs b/VisualCard.Calendar/Parts/CalendarDaylight.cs index adeff77..f25f97c 100644 --- a/VisualCard.Calendar/Parts/CalendarDaylight.cs +++ b/VisualCard.Calendar/Parts/CalendarDaylight.cs @@ -33,8 +33,8 @@ namespace VisualCard.Calendar.Parts public class CalendarDaylight : Calendar, IEquatable { private readonly Dictionary> partsArray = []; - private readonly Dictionary strings = []; - private readonly Dictionary integers = []; + private readonly Dictionary> strings = []; + private readonly Dictionary> integers = []; /// /// Gets a part array from a specified key @@ -61,10 +61,18 @@ public class CalendarDaylight : Calendar, IEquatable /// Gets a string from a specified key /// /// A key to use - /// A value, or "individual" if the kind doesn't exist, or an empty string ("") if any other type either doesn't exist or the type is not supported by the card version - public new string GetString(CalendarStringsEnum key) => + /// A value or null if any other type either doesn't exist or the type is not supported by the card version + public new CalendarValueInfo? GetString(CalendarStringsEnum key) => GetString(key, CalendarVersion, strings); + /// + /// Gets a integer from a specified key + /// + /// A key to use + /// A value or null if any other type either doesn't exist or the type is not supported by the card version + public new CalendarValueInfo? GetInteger(CalendarIntegersEnum key) => + GetInteger(key, CalendarVersion, integers); + /// /// Saves this parsed card to the string /// @@ -115,8 +123,8 @@ public override int GetHashCode() int hashCode = 1333672311; hashCode = hashCode * -1521134295 + base.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer>>.Default.GetHashCode(partsArray); - hashCode = hashCode * -1521134295 + EqualityComparer>.Default.GetHashCode(strings); - hashCode = hashCode * -1521134295 + EqualityComparer>.Default.GetHashCode(integers); + hashCode = hashCode * -1521134295 + EqualityComparer>>.Default.GetHashCode(strings); + hashCode = hashCode * -1521134295 + EqualityComparer>>.Default.GetHashCode(integers); return hashCode; } @@ -131,10 +139,10 @@ public override int GetHashCode() internal new void AddPartToArray(CalendarPartsArrayEnum key, BaseCalendarPartInfo value) => AddPartToArray(key, value, CalendarVersion, partsArray, VCalendarConstants._objectVDaylightSpecifier); - internal new void SetString(CalendarStringsEnum key, string value) => + internal new void SetString(CalendarStringsEnum key, CalendarValueInfo value) => SetString(key, value, strings); - internal new void SetInteger(CalendarIntegersEnum key, double value) => + internal new void SetInteger(CalendarIntegersEnum key, CalendarValueInfo value) => SetInteger(key, value, integers); internal CalendarDaylight(Version version) : diff --git a/VisualCard.Calendar/Parts/CalendarEvent.cs b/VisualCard.Calendar/Parts/CalendarEvent.cs index 5cc47e8..68d3be7 100644 --- a/VisualCard.Calendar/Parts/CalendarEvent.cs +++ b/VisualCard.Calendar/Parts/CalendarEvent.cs @@ -34,8 +34,8 @@ public class CalendarEvent : Calendar, IEquatable { internal readonly List alarms = []; private readonly Dictionary> partsArray = []; - private readonly Dictionary strings = []; - private readonly Dictionary integers = []; + private readonly Dictionary> strings = []; + private readonly Dictionary> integers = []; /// /// Alarm list @@ -68,10 +68,18 @@ public class CalendarEvent : Calendar, IEquatable /// Gets a string from a specified key /// /// A key to use - /// A value, or "individual" if the kind doesn't exist, or an empty string ("") if any other type either doesn't exist or the type is not supported by the card version - public new string GetString(CalendarStringsEnum key) => + /// A value or null if any other type either doesn't exist or the type is not supported by the card version + public new CalendarValueInfo? GetString(CalendarStringsEnum key) => GetString(key, CalendarVersion, strings); + /// + /// Gets a integer from a specified key + /// + /// A key to use + /// A value or null if any other type either doesn't exist or the type is not supported by the card version + public new CalendarValueInfo? GetInteger(CalendarIntegersEnum key) => + GetInteger(key, CalendarVersion, integers); + /// /// Saves this parsed card to the string /// @@ -124,8 +132,8 @@ public override int GetHashCode() hashCode = hashCode * -1521134295 + base.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer>.Default.GetHashCode(alarms); hashCode = hashCode * -1521134295 + EqualityComparer>>.Default.GetHashCode(partsArray); - hashCode = hashCode * -1521134295 + EqualityComparer>.Default.GetHashCode(strings); - hashCode = hashCode * -1521134295 + EqualityComparer>.Default.GetHashCode(integers); + hashCode = hashCode * -1521134295 + EqualityComparer>>.Default.GetHashCode(strings); + hashCode = hashCode * -1521134295 + EqualityComparer>>.Default.GetHashCode(integers); return hashCode; } @@ -140,10 +148,10 @@ public override int GetHashCode() internal new void AddPartToArray(CalendarPartsArrayEnum key, BaseCalendarPartInfo value) => AddPartToArray(key, value, CalendarVersion, partsArray, VCalendarConstants._objectVEventSpecifier); - internal new void SetString(CalendarStringsEnum key, string value) => + internal new void SetString(CalendarStringsEnum key, CalendarValueInfo value) => SetString(key, value, strings); - internal new void SetInteger(CalendarIntegersEnum key, double value) => + internal new void SetInteger(CalendarIntegersEnum key, CalendarValueInfo value) => SetInteger(key, value, integers); internal CalendarEvent(Version version) : diff --git a/VisualCard.Calendar/Parts/CalendarFreeBusy.cs b/VisualCard.Calendar/Parts/CalendarFreeBusy.cs index 0e7bc1f..17b771d 100644 --- a/VisualCard.Calendar/Parts/CalendarFreeBusy.cs +++ b/VisualCard.Calendar/Parts/CalendarFreeBusy.cs @@ -33,8 +33,8 @@ namespace VisualCard.Calendar.Parts public class CalendarFreeBusy : Calendar, IEquatable { private readonly Dictionary> partsArray = []; - private readonly Dictionary strings = []; - private readonly Dictionary integers = []; + private readonly Dictionary> strings = []; + private readonly Dictionary> integers = []; /// /// Gets a part array from a specified key @@ -61,10 +61,18 @@ public class CalendarFreeBusy : Calendar, IEquatable /// Gets a string from a specified key /// /// A key to use - /// A value, or "individual" if the kind doesn't exist, or an empty string ("") if any other type either doesn't exist or the type is not supported by the card version - public new string GetString(CalendarStringsEnum key) => + /// A value or null if any other type either doesn't exist or the type is not supported by the card version + public new CalendarValueInfo? GetString(CalendarStringsEnum key) => GetString(key, CalendarVersion, strings); + /// + /// Gets a integer from a specified key + /// + /// A key to use + /// A value or null if any other type either doesn't exist or the type is not supported by the card version + public new CalendarValueInfo? GetInteger(CalendarIntegersEnum key) => + GetInteger(key, CalendarVersion, integers); + /// /// Saves this parsed card to the string /// @@ -115,8 +123,8 @@ public override int GetHashCode() int hashCode = 1333672311; hashCode = hashCode * -1521134295 + base.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer>>.Default.GetHashCode(partsArray); - hashCode = hashCode * -1521134295 + EqualityComparer>.Default.GetHashCode(strings); - hashCode = hashCode * -1521134295 + EqualityComparer>.Default.GetHashCode(integers); + hashCode = hashCode * -1521134295 + EqualityComparer>>.Default.GetHashCode(strings); + hashCode = hashCode * -1521134295 + EqualityComparer>>.Default.GetHashCode(integers); return hashCode; } @@ -131,10 +139,10 @@ public override int GetHashCode() internal new void AddPartToArray(CalendarPartsArrayEnum key, BaseCalendarPartInfo value) => AddPartToArray(key, value, CalendarVersion, partsArray, VCalendarConstants._objectVFreeBusySpecifier); - internal new void SetString(CalendarStringsEnum key, string value) => + internal new void SetString(CalendarStringsEnum key, CalendarValueInfo value) => SetString(key, value, strings); - internal new void SetInteger(CalendarIntegersEnum key, double value) => + internal new void SetInteger(CalendarIntegersEnum key, CalendarValueInfo value) => SetInteger(key, value, integers); internal CalendarFreeBusy(Version version) : diff --git a/VisualCard.Calendar/Parts/CalendarJournal.cs b/VisualCard.Calendar/Parts/CalendarJournal.cs index a824387..1558794 100644 --- a/VisualCard.Calendar/Parts/CalendarJournal.cs +++ b/VisualCard.Calendar/Parts/CalendarJournal.cs @@ -33,8 +33,8 @@ namespace VisualCard.Calendar.Parts public class CalendarJournal : Calendar, IEquatable { private readonly Dictionary> partsArray = []; - private readonly Dictionary strings = []; - private readonly Dictionary integers = []; + private readonly Dictionary> strings = []; + private readonly Dictionary> integers = []; /// /// Gets a part array from a specified key @@ -61,10 +61,18 @@ public class CalendarJournal : Calendar, IEquatable /// Gets a string from a specified key /// /// A key to use - /// A value, or "individual" if the kind doesn't exist, or an empty string ("") if any other type either doesn't exist or the type is not supported by the card version - public new string GetString(CalendarStringsEnum key) => + /// A value or null if any other type either doesn't exist or the type is not supported by the card version + public new CalendarValueInfo? GetString(CalendarStringsEnum key) => GetString(key, CalendarVersion, strings); + /// + /// Gets a integer from a specified key + /// + /// A key to use + /// A value or null if any other type either doesn't exist or the type is not supported by the card version + public new CalendarValueInfo? GetInteger(CalendarIntegersEnum key) => + GetInteger(key, CalendarVersion, integers); + /// /// Saves this parsed card to the string /// @@ -115,8 +123,8 @@ public override int GetHashCode() int hashCode = 1333672311; hashCode = hashCode * -1521134295 + base.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer>>.Default.GetHashCode(partsArray); - hashCode = hashCode * -1521134295 + EqualityComparer>.Default.GetHashCode(strings); - hashCode = hashCode * -1521134295 + EqualityComparer>.Default.GetHashCode(integers); + hashCode = hashCode * -1521134295 + EqualityComparer>>.Default.GetHashCode(strings); + hashCode = hashCode * -1521134295 + EqualityComparer>>.Default.GetHashCode(integers); return hashCode; } @@ -131,10 +139,10 @@ public override int GetHashCode() internal new void AddPartToArray(CalendarPartsArrayEnum key, BaseCalendarPartInfo value) => AddPartToArray(key, value, CalendarVersion, partsArray, VCalendarConstants._objectVJournalSpecifier); - internal new void SetString(CalendarStringsEnum key, string value) => + internal new void SetString(CalendarStringsEnum key, CalendarValueInfo value) => SetString(key, value, strings); - internal new void SetInteger(CalendarIntegersEnum key, double value) => + internal new void SetInteger(CalendarIntegersEnum key, CalendarValueInfo value) => SetInteger(key, value, integers); internal CalendarJournal(Version version) : diff --git a/VisualCard.Calendar/Parts/CalendarOtherComponent.cs b/VisualCard.Calendar/Parts/CalendarOtherComponent.cs index 22b1a5d..f71c516 100644 --- a/VisualCard.Calendar/Parts/CalendarOtherComponent.cs +++ b/VisualCard.Calendar/Parts/CalendarOtherComponent.cs @@ -34,8 +34,8 @@ public class CalendarOtherComponent : Calendar, IEquatable> partsArray = []; - private readonly Dictionary strings = []; - private readonly Dictionary integers = []; + private readonly Dictionary> strings = []; + private readonly Dictionary> integers = []; /// /// Component name @@ -68,10 +68,18 @@ public class CalendarOtherComponent : Calendar, IEquatable /// A key to use - /// A value, or "individual" if the kind doesn't exist, or an empty string ("") if any other type either doesn't exist or the type is not supported by the card version - public new string GetString(CalendarStringsEnum key) => + /// A value or null if any other type either doesn't exist or the type is not supported by the card version + public new CalendarValueInfo? GetString(CalendarStringsEnum key) => GetString(key, CalendarVersion, strings); + /// + /// Gets a integer from a specified key + /// + /// A key to use + /// A value or null if any other type either doesn't exist or the type is not supported by the card version + public new CalendarValueInfo? GetInteger(CalendarIntegersEnum key) => + GetInteger(key, CalendarVersion, integers); + /// /// Saves this parsed card to the string /// @@ -123,8 +131,8 @@ public override int GetHashCode() hashCode = hashCode * -1521134295 + base.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(componentName); hashCode = hashCode * -1521134295 + EqualityComparer>>.Default.GetHashCode(partsArray); - hashCode = hashCode * -1521134295 + EqualityComparer>.Default.GetHashCode(strings); - hashCode = hashCode * -1521134295 + EqualityComparer>.Default.GetHashCode(integers); + hashCode = hashCode * -1521134295 + EqualityComparer>>.Default.GetHashCode(strings); + hashCode = hashCode * -1521134295 + EqualityComparer>>.Default.GetHashCode(integers); return hashCode; } @@ -139,10 +147,10 @@ public override int GetHashCode() internal new void AddPartToArray(CalendarPartsArrayEnum key, BaseCalendarPartInfo value) => AddPartToArray(key, value, CalendarVersion, partsArray, componentName); - internal new void SetString(CalendarStringsEnum key, string value) => + internal new void SetString(CalendarStringsEnum key, CalendarValueInfo value) => SetString(key, value, strings); - internal new void SetInteger(CalendarIntegersEnum key, double value) => + internal new void SetInteger(CalendarIntegersEnum key, CalendarValueInfo value) => SetInteger(key, value, integers); internal CalendarOtherComponent(Version version, string componentName) : diff --git a/VisualCard.Calendar/Parts/CalendarStandard.cs b/VisualCard.Calendar/Parts/CalendarStandard.cs index 696d149..047aa05 100644 --- a/VisualCard.Calendar/Parts/CalendarStandard.cs +++ b/VisualCard.Calendar/Parts/CalendarStandard.cs @@ -33,8 +33,8 @@ namespace VisualCard.Calendar.Parts public class CalendarStandard : Calendar, IEquatable { private readonly Dictionary> partsArray = []; - private readonly Dictionary strings = []; - private readonly Dictionary integers = []; + private readonly Dictionary> strings = []; + private readonly Dictionary> integers = []; /// /// Gets a part array from a specified key @@ -61,10 +61,18 @@ public class CalendarStandard : Calendar, IEquatable /// Gets a string from a specified key /// /// A key to use - /// A value, or "individual" if the kind doesn't exist, or an empty string ("") if any other type either doesn't exist or the type is not supported by the card version - public new string GetString(CalendarStringsEnum key) => + /// A value or null if any other type either doesn't exist or the type is not supported by the card version + public new CalendarValueInfo? GetString(CalendarStringsEnum key) => GetString(key, CalendarVersion, strings); + /// + /// Gets a integer from a specified key + /// + /// A key to use + /// A value or null if any other type either doesn't exist or the type is not supported by the card version + public new CalendarValueInfo? GetInteger(CalendarIntegersEnum key) => + GetInteger(key, CalendarVersion, integers); + /// /// Saves this parsed card to the string /// @@ -115,8 +123,8 @@ public override int GetHashCode() int hashCode = 1333672311; hashCode = hashCode * -1521134295 + base.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer>>.Default.GetHashCode(partsArray); - hashCode = hashCode * -1521134295 + EqualityComparer>.Default.GetHashCode(strings); - hashCode = hashCode * -1521134295 + EqualityComparer>.Default.GetHashCode(integers); + hashCode = hashCode * -1521134295 + EqualityComparer>>.Default.GetHashCode(strings); + hashCode = hashCode * -1521134295 + EqualityComparer>>.Default.GetHashCode(integers); return hashCode; } @@ -131,10 +139,10 @@ public override int GetHashCode() internal new void AddPartToArray(CalendarPartsArrayEnum key, BaseCalendarPartInfo value) => AddPartToArray(key, value, CalendarVersion, partsArray, VCalendarConstants._objectVStandardSpecifier); - internal new void SetString(CalendarStringsEnum key, string value) => + internal new void SetString(CalendarStringsEnum key, CalendarValueInfo value) => SetString(key, value, strings); - internal new void SetInteger(CalendarIntegersEnum key, double value) => + internal new void SetInteger(CalendarIntegersEnum key, CalendarValueInfo value) => SetInteger(key, value, integers); internal CalendarStandard(Version version) : diff --git a/VisualCard.Calendar/Parts/CalendarTimeZone.cs b/VisualCard.Calendar/Parts/CalendarTimeZone.cs index a7be05a..1f0bb03 100644 --- a/VisualCard.Calendar/Parts/CalendarTimeZone.cs +++ b/VisualCard.Calendar/Parts/CalendarTimeZone.cs @@ -35,8 +35,8 @@ public class CalendarTimeZone : Calendar, IEquatable internal readonly List standards = []; internal readonly List daylights = []; private readonly Dictionary> partsArray = []; - private readonly Dictionary strings = []; - private readonly Dictionary integers = []; + private readonly Dictionary> strings = []; + private readonly Dictionary> integers = []; /// /// Standard time list @@ -75,10 +75,18 @@ public class CalendarTimeZone : Calendar, IEquatable /// Gets a string from a specified key /// /// A key to use - /// A value, or "individual" if the kind doesn't exist, or an empty string ("") if any other type either doesn't exist or the type is not supported by the card version - public new string GetString(CalendarStringsEnum key) => + /// A value or null if any other type either doesn't exist or the type is not supported by the card version + public new CalendarValueInfo? GetString(CalendarStringsEnum key) => GetString(key, CalendarVersion, strings); + /// + /// Gets a integer from a specified key + /// + /// A key to use + /// A value or null if any other type either doesn't exist or the type is not supported by the card version + public new CalendarValueInfo? GetInteger(CalendarIntegersEnum key) => + GetInteger(key, CalendarVersion, integers); + /// /// Saves this parsed card to the string /// @@ -133,8 +141,8 @@ public override int GetHashCode() hashCode = hashCode * -1521134295 + EqualityComparer>.Default.GetHashCode(standards); hashCode = hashCode * -1521134295 + EqualityComparer>.Default.GetHashCode(daylights); hashCode = hashCode * -1521134295 + EqualityComparer>>.Default.GetHashCode(partsArray); - hashCode = hashCode * -1521134295 + EqualityComparer>.Default.GetHashCode(strings); - hashCode = hashCode * -1521134295 + EqualityComparer>.Default.GetHashCode(integers); + hashCode = hashCode * -1521134295 + EqualityComparer>>.Default.GetHashCode(strings); + hashCode = hashCode * -1521134295 + EqualityComparer>>.Default.GetHashCode(integers); return hashCode; } @@ -149,10 +157,10 @@ public override int GetHashCode() internal new void AddPartToArray(CalendarPartsArrayEnum key, BaseCalendarPartInfo value) => AddPartToArray(key, value, CalendarVersion, partsArray, VCalendarConstants._objectVTimeZoneSpecifier); - internal new void SetString(CalendarStringsEnum key, string value) => + internal new void SetString(CalendarStringsEnum key, CalendarValueInfo value) => SetString(key, value, strings); - internal new void SetInteger(CalendarIntegersEnum key, double value) => + internal new void SetInteger(CalendarIntegersEnum key, CalendarValueInfo value) => SetInteger(key, value, integers); internal CalendarTimeZone(Version version) : diff --git a/VisualCard.Calendar/Parts/CalendarTodo.cs b/VisualCard.Calendar/Parts/CalendarTodo.cs index 363efb9..3e3cdc9 100644 --- a/VisualCard.Calendar/Parts/CalendarTodo.cs +++ b/VisualCard.Calendar/Parts/CalendarTodo.cs @@ -34,8 +34,8 @@ public class CalendarTodo : Calendar, IEquatable { internal readonly List alarms = []; private readonly Dictionary> partsArray = []; - private readonly Dictionary strings = []; - private readonly Dictionary integers = []; + private readonly Dictionary> strings = []; + private readonly Dictionary> integers = []; /// /// Alarm list @@ -68,10 +68,18 @@ public class CalendarTodo : Calendar, IEquatable /// Gets a string from a specified key /// /// A key to use - /// A value, or "individual" if the kind doesn't exist, or an empty string ("") if any other type either doesn't exist or the type is not supported by the card version - public new string GetString(CalendarStringsEnum key) => + /// A value or null if any other type either doesn't exist or the type is not supported by the card version + public new CalendarValueInfo? GetString(CalendarStringsEnum key) => GetString(key, CalendarVersion, strings); + /// + /// Gets a integer from a specified key + /// + /// A key to use + /// A value or null if any other type either doesn't exist or the type is not supported by the card version + public new CalendarValueInfo? GetInteger(CalendarIntegersEnum key) => + GetInteger(key, CalendarVersion, integers); + /// /// Saves this parsed card to the string /// @@ -124,8 +132,8 @@ public override int GetHashCode() hashCode = hashCode * -1521134295 + base.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer>.Default.GetHashCode(alarms); hashCode = hashCode * -1521134295 + EqualityComparer>>.Default.GetHashCode(partsArray); - hashCode = hashCode * -1521134295 + EqualityComparer>.Default.GetHashCode(strings); - hashCode = hashCode * -1521134295 + EqualityComparer>.Default.GetHashCode(integers); + hashCode = hashCode * -1521134295 + EqualityComparer>>.Default.GetHashCode(strings); + hashCode = hashCode * -1521134295 + EqualityComparer>>.Default.GetHashCode(integers); return hashCode; } @@ -140,10 +148,10 @@ public override int GetHashCode() internal new void AddPartToArray(CalendarPartsArrayEnum key, BaseCalendarPartInfo value) => AddPartToArray(key, value, CalendarVersion, partsArray, VCalendarConstants._objectVTodoSpecifier); - internal new void SetString(CalendarStringsEnum key, string value) => + internal new void SetString(CalendarStringsEnum key, CalendarValueInfo value) => SetString(key, value, strings); - internal new void SetInteger(CalendarIntegersEnum key, double value) => + internal new void SetInteger(CalendarIntegersEnum key, CalendarValueInfo value) => SetInteger(key, value, integers); internal CalendarTodo(Version version) : diff --git a/VisualCard.Calendar/Parts/CalendarValueInfo.cs b/VisualCard.Calendar/Parts/CalendarValueInfo.cs new file mode 100644 index 0000000..417dda4 --- /dev/null +++ b/VisualCard.Calendar/Parts/CalendarValueInfo.cs @@ -0,0 +1,148 @@ +// +// VisualCard Copyright (C) 2021-2024 Aptivi +// +// This file is part of VisualCard +// +// VisualCard is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// VisualCard is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using VisualCard.Parsers.Arguments; + +namespace VisualCard.Calendar.Parts +{ + /// + /// Calendar value information + /// + [DebuggerDisplay("Calendar value | TYPE: {ElementTypes}, VALUE: {ValueType}")] + public class CalendarValueInfo : IEquatable> + { + /// + /// Final arguments + /// + public virtual ArgumentInfo[] Arguments { get; internal set; } = []; + + /// + /// Calendar element type (home, work, ...) + /// + public virtual string[] ElementTypes { get; internal set; } = []; + + /// + /// Value type (usually set by VALUE=) + /// + public virtual string ValueType { get; internal set; } = ""; + + /// + /// Property group + /// + public virtual string Group { get; internal set; } = ""; + + /// + /// Value + /// + public virtual TValue Value { get; internal set; } + + /// + /// Is this part preferred? + /// + public bool IsPreferred => + HasType("PREF"); + + /// + /// Checks to see if this part has a specific type + /// + /// Type to check (home, work, ...) + /// True if found; otherwise, false. + public bool HasType(string type) + { + bool found = false; + foreach (string elementType in ElementTypes) + { + if (type.Equals(elementType, StringComparison.OrdinalIgnoreCase)) + found = true; + } + return found; + } + + /// + /// Checks to see if both the parts are equal + /// + /// The target instance to check to see if they equal + /// True if all the part elements are equal. Otherwise, false. + public bool Equals(CalendarValueInfo other) => + Equals(this, other); + + /// + /// Checks to see if both the parts are equal + /// + /// The source instance to check to see if they equal + /// The target instance to check to see if they equal + /// True if all the part elements are equal. Otherwise, false. + public bool Equals(CalendarValueInfo source, CalendarValueInfo target) + { + // We can't perform this operation on null. + if (source is null || target is null) + return false; + + // Check all the properties + return + source.Arguments.SequenceEqual(target.Arguments) && + source.ElementTypes.SequenceEqual(target.ElementTypes) && + source.ValueType == target.ValueType && + source.Group == target.Group && + EqualsInternal(source, target) + ; + } + + /// + public override bool Equals(object obj) => + Equals((CalendarValueInfo)obj); + + /// + public override int GetHashCode() + { + int hashCode = -1427366701; + hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(Arguments); + hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(ElementTypes); + hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(ValueType); + hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(Group); + hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(Value); + return hashCode; + } + + /// + public static bool operator ==(CalendarValueInfo left, CalendarValueInfo right) => + left.Equals(right); + + /// + public static bool operator !=(CalendarValueInfo left, CalendarValueInfo right) => + !(left == right); + + internal virtual bool EqualsInternal(CalendarValueInfo source, CalendarValueInfo target) => + true; + + internal CalendarValueInfo(ArgumentInfo[] arguments, string[] elementTypes, string group, string valueType, TValue? value) + { + Arguments = arguments; + ElementTypes = elementTypes; + ValueType = valueType; + Group = group; + Value = value ?? + throw new ArgumentNullException(nameof(value)); + } + } +} diff --git a/VisualCard.Calendar/Parts/Comparers/PartComparison.cs b/VisualCard.Calendar/Parts/Comparers/PartComparison.cs index c92b806..1dac6f6 100644 --- a/VisualCard.Calendar/Parts/Comparers/PartComparison.cs +++ b/VisualCard.Calendar/Parts/Comparers/PartComparison.cs @@ -63,8 +63,8 @@ internal static bool PartsArrayEnumEqual( } internal static bool StringsEqual( - IDictionary source, - IDictionary target) + IDictionary> source, + IDictionary> target) { // Verify the dictionaries if (!VerifyDicts(source, target)) @@ -77,7 +77,7 @@ internal static bool StringsEqual( // Now, test the equality bool equal = source.All(kvp => { - bool exists = target.TryGetValue(kvp.Key, out string part); + bool exists = target.TryGetValue(kvp.Key, out var part); bool partsEqual = kvp.Value == part; return exists && partsEqual; }); @@ -85,8 +85,8 @@ internal static bool StringsEqual( } internal static bool IntegersEqual( - IDictionary source, - IDictionary target) + IDictionary> source, + IDictionary> target) { // Verify the dictionaries if (!VerifyDicts(source, target)) @@ -99,7 +99,7 @@ internal static bool IntegersEqual( // Now, test the equality bool equal = source.All(kvp => { - bool exists = target.TryGetValue(kvp.Key, out double part); + bool exists = target.TryGetValue(kvp.Key, out var part); bool partsEqual = kvp.Value == part; return exists && partsEqual; }); diff --git a/VisualCard.Calendar/Parts/Implementations/AttachInfo.cs b/VisualCard.Calendar/Parts/Implementations/AttachInfo.cs index 8fa2e80..ddb6b8e 100644 --- a/VisualCard.Calendar/Parts/Implementations/AttachInfo.cs +++ b/VisualCard.Calendar/Parts/Implementations/AttachInfo.cs @@ -46,13 +46,13 @@ public class AttachInfo : BaseCalendarPartInfo, IEquatable public bool IsBlob => VcardCommonTools.IsEncodingBlob(Arguments, AttachEncoded); - internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version calendarVersion) => - new AttachInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, valueType, calendarVersion); + internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version calendarVersion) => + new AttachInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, group, valueType, calendarVersion); internal override string ToStringVcalendarInternal(Version calendarVersion) => AttachEncoded ?? ""; - internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version calendarVersion) + internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version calendarVersion) { // Check to see if the value is prepended by the ENCODING= argument string attachEncoding = VcardCommonTools.GetValuesString(finalArgs, "b", VcardConstants._encodingArgumentSpecifier); @@ -65,7 +65,7 @@ internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, } // Populate the fields - AttachInfo _attach = new(finalArgs, elementTypes, valueType, attachEncoding, value); + AttachInfo _attach = new(finalArgs, elementTypes, group, valueType, attachEncoding, value); return _attach; } @@ -130,8 +130,8 @@ internal override bool EqualsInternal(BaseCalendarPartInfo source, BaseCalendarP internal AttachInfo() { } - internal AttachInfo(ArgumentInfo[] arguments, string[] elementTypes, string valueType, string encoding, string attachEncoded) : - base(arguments, elementTypes, valueType) + internal AttachInfo(ArgumentInfo[] arguments, string[] elementTypes, string group, string valueType, string encoding, string attachEncoded) : + base(arguments, elementTypes, group, valueType) { Encoding = encoding; AttachEncoded = attachEncoded; diff --git a/VisualCard.Calendar/Parts/Implementations/AttendeeInfo.cs b/VisualCard.Calendar/Parts/Implementations/AttendeeInfo.cs index bd7c704..66a334a 100644 --- a/VisualCard.Calendar/Parts/Implementations/AttendeeInfo.cs +++ b/VisualCard.Calendar/Parts/Implementations/AttendeeInfo.cs @@ -36,19 +36,19 @@ public class AttendeeInfo : BaseCalendarPartInfo, IEquatable /// public string? Attendee { get; } - internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) => - new AttendeeInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, valueType, cardVersion); + internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) => + new AttendeeInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, group, valueType, cardVersion); internal override string ToStringVcalendarInternal(Version cardVersion) => Attendee ?? ""; - internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) + internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) { // Populate the fields var attendee = Regex.Unescape(value); // Add the fetched information - AttendeeInfo _time = new([], elementTypes, valueType, attendee); + AttendeeInfo _time = new([], elementTypes, group, valueType, attendee); return _time; } @@ -104,8 +104,8 @@ internal override bool EqualsInternal(BaseCalendarPartInfo source, BaseCalendarP internal AttendeeInfo() { } - internal AttendeeInfo(ArgumentInfo[] arguments, string[] elementTypes, string valueType, string attendee) : - base(arguments, elementTypes, valueType) + internal AttendeeInfo(ArgumentInfo[] arguments, string[] elementTypes, string group, string valueType, string attendee) : + base(arguments, elementTypes, group, valueType) { Attendee = attendee; } diff --git a/VisualCard.Calendar/Parts/Implementations/CommentInfo.cs b/VisualCard.Calendar/Parts/Implementations/CommentInfo.cs index abea82f..82520b2 100644 --- a/VisualCard.Calendar/Parts/Implementations/CommentInfo.cs +++ b/VisualCard.Calendar/Parts/Implementations/CommentInfo.cs @@ -36,19 +36,19 @@ public class CommentInfo : BaseCalendarPartInfo, IEquatable /// public string? Comment { get; } - internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) => - new CommentInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, valueType, cardVersion); + internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) => + new CommentInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, group, valueType, cardVersion); internal override string ToStringVcalendarInternal(Version cardVersion) => Comment ?? ""; - internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) + internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) { // Populate the fields var comment = Regex.Unescape(value); // Add the fetched information - CommentInfo _time = new([], elementTypes, valueType, comment); + CommentInfo _time = new([], elementTypes, group, valueType, comment); return _time; } @@ -104,8 +104,8 @@ internal override bool EqualsInternal(BaseCalendarPartInfo source, BaseCalendarP internal CommentInfo() { } - internal CommentInfo(ArgumentInfo[] arguments, string[] elementTypes, string valueType, string comment) : - base(arguments, elementTypes, valueType) + internal CommentInfo(ArgumentInfo[] arguments, string[] elementTypes, string group, string valueType, string comment) : + base(arguments, elementTypes, group, valueType) { Comment = comment; } diff --git a/VisualCard.Calendar/Parts/Implementations/ContactInfo.cs b/VisualCard.Calendar/Parts/Implementations/ContactInfo.cs index 343c7cc..0a9fbec 100644 --- a/VisualCard.Calendar/Parts/Implementations/ContactInfo.cs +++ b/VisualCard.Calendar/Parts/Implementations/ContactInfo.cs @@ -36,19 +36,19 @@ public class ContactInfo : BaseCalendarPartInfo, IEquatable /// public string? Contact { get; } - internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) => - new ContactInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, valueType, cardVersion); + internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) => + new ContactInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, group, valueType, cardVersion); internal override string ToStringVcalendarInternal(Version cardVersion) => Contact ?? ""; - internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) + internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) { // Populate the fields var contact = Regex.Unescape(value); // Add the fetched information - ContactInfo _time = new([], elementTypes, valueType, contact); + ContactInfo _time = new([], elementTypes, group, valueType, contact); return _time; } @@ -104,8 +104,8 @@ internal override bool EqualsInternal(BaseCalendarPartInfo source, BaseCalendarP internal ContactInfo() { } - internal ContactInfo(ArgumentInfo[] arguments, string[] elementTypes, string valueType, string contact) : - base(arguments, elementTypes, valueType) + internal ContactInfo(ArgumentInfo[] arguments, string[] elementTypes, string group, string valueType, string contact) : + base(arguments, elementTypes, group, valueType) { Contact = contact; } diff --git a/VisualCard.Calendar/Parts/Implementations/DateCreatedInfo.cs b/VisualCard.Calendar/Parts/Implementations/DateCreatedInfo.cs index 146305b..fd34c52 100644 --- a/VisualCard.Calendar/Parts/Implementations/DateCreatedInfo.cs +++ b/VisualCard.Calendar/Parts/Implementations/DateCreatedInfo.cs @@ -35,19 +35,19 @@ public class DateCreatedInfo : BaseCalendarPartInfo, IEquatable /// public DateTimeOffset DateCreated { get; } - internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) => - new DateCreatedInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, valueType, cardVersion); + internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) => + new DateCreatedInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, group, valueType, cardVersion); internal override string ToStringVcalendarInternal(Version cardVersion) => $"{VcardCommonTools.SavePosixDate(DateCreated)}"; - internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) + internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) { // Populate the fields DateTimeOffset created = VcardCommonTools.ParsePosixDateTime(value); // Add the fetched information - DateCreatedInfo _time = new(finalArgs, elementTypes, valueType, created); + DateCreatedInfo _time = new(finalArgs, elementTypes, group, valueType, created); return _time; } @@ -103,8 +103,8 @@ internal override bool EqualsInternal(BaseCalendarPartInfo source, BaseCalendarP internal DateCreatedInfo() { } - internal DateCreatedInfo(ArgumentInfo[] arguments, string[] elementTypes, string valueType, DateTimeOffset rev) : - base(arguments, elementTypes, valueType) + internal DateCreatedInfo(ArgumentInfo[] arguments, string[] elementTypes, string group, string valueType, DateTimeOffset rev) : + base(arguments, elementTypes, group, valueType) { DateCreated = rev; } diff --git a/VisualCard.Calendar/Parts/Implementations/DurationInfo.cs b/VisualCard.Calendar/Parts/Implementations/DurationInfo.cs index c740f40..52b44aa 100644 --- a/VisualCard.Calendar/Parts/Implementations/DurationInfo.cs +++ b/VisualCard.Calendar/Parts/Implementations/DurationInfo.cs @@ -49,19 +49,19 @@ public class DurationInfo : BaseCalendarPartInfo, IEquatable public DateTimeOffset DurationResult => VcardCommonTools.GetDurationSpan(Duration ?? "").result; - internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) => - new DurationInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, valueType, cardVersion); + internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) => + new DurationInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, group, valueType, cardVersion); internal override string ToStringVcalendarInternal(Version cardVersion) => Duration ?? ""; - internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) + internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) { // Populate the fields string duration = Regex.Unescape(value); // Add the fetched information - DurationInfo _time = new(finalArgs, elementTypes, valueType, duration); + DurationInfo _time = new(finalArgs, elementTypes, group, valueType, duration); return _time; } @@ -117,8 +117,8 @@ internal override bool EqualsInternal(BaseCalendarPartInfo source, BaseCalendarP internal DurationInfo() { } - internal DurationInfo(ArgumentInfo[] arguments, string[] elementTypes, string valueType, string duration) : - base(arguments, elementTypes, valueType) + internal DurationInfo(ArgumentInfo[] arguments, string[] elementTypes, string group, string valueType, string duration) : + base(arguments, elementTypes, group, valueType) { Duration = duration; } diff --git a/VisualCard.Calendar/Parts/Implementations/Event/CategoriesInfo.cs b/VisualCard.Calendar/Parts/Implementations/Event/CategoriesInfo.cs index 7eaf530..eb2328f 100644 --- a/VisualCard.Calendar/Parts/Implementations/Event/CategoriesInfo.cs +++ b/VisualCard.Calendar/Parts/Implementations/Event/CategoriesInfo.cs @@ -36,19 +36,19 @@ public class CategoriesInfo : BaseCalendarPartInfo, IEquatable /// public string[]? Categories { get; } - internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) => - new CategoriesInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, valueType, cardVersion); + internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) => + new CategoriesInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, group, valueType, cardVersion); internal override string ToStringVcalendarInternal(Version cardVersion) => $"{string.Join(cardVersion.Major == 1 ? ";" : ",", Categories)}"; - internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) + internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) { // Populate the fields var categories = Regex.Unescape(value).Split(cardVersion.Major == 1 ? ';' : ','); // Add the fetched information - CategoriesInfo _time = new([], elementTypes, valueType, categories); + CategoriesInfo _time = new([], elementTypes, group, valueType, categories); return _time; } @@ -104,8 +104,8 @@ internal override bool EqualsInternal(BaseCalendarPartInfo source, BaseCalendarP internal CategoriesInfo() { } - internal CategoriesInfo(ArgumentInfo[] arguments, string[] elementTypes, string valueType, string[] categories) : - base(arguments, elementTypes, valueType) + internal CategoriesInfo(ArgumentInfo[] arguments, string[] elementTypes, string group, string valueType, string[] categories) : + base(arguments, elementTypes, group, valueType) { Categories = categories; } diff --git a/VisualCard.Calendar/Parts/Implementations/Event/DateEndInfo.cs b/VisualCard.Calendar/Parts/Implementations/Event/DateEndInfo.cs index 6ec1e93..5352d61 100644 --- a/VisualCard.Calendar/Parts/Implementations/Event/DateEndInfo.cs +++ b/VisualCard.Calendar/Parts/Implementations/Event/DateEndInfo.cs @@ -35,8 +35,8 @@ public class DateEndInfo : BaseCalendarPartInfo, IEquatable /// public DateTimeOffset DateEnd { get; } - internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) => - new DateEndInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, valueType, cardVersion); + internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) => + new DateEndInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, group, valueType, cardVersion); internal override string ToStringVcalendarInternal(Version cardVersion) { @@ -48,7 +48,7 @@ internal override string ToStringVcalendarInternal(Version cardVersion) return value; } - internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) + internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) { // Populate the fields string type = valueType ?? ""; @@ -58,7 +58,7 @@ internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, VcardCommonTools.ParsePosixDateTime(value); // Add the fetched information - DateEndInfo _time = new(finalArgs, elementTypes, valueType ?? "", end); + DateEndInfo _time = new(finalArgs, elementTypes, group, valueType ?? "", end); return _time; } @@ -114,8 +114,8 @@ internal override bool EqualsInternal(BaseCalendarPartInfo source, BaseCalendarP internal DateEndInfo() { } - internal DateEndInfo(ArgumentInfo[] arguments, string[] elementTypes, string valueType, DateTimeOffset rev) : - base(arguments, elementTypes, valueType) + internal DateEndInfo(ArgumentInfo[] arguments, string[] elementTypes, string group, string valueType, DateTimeOffset rev) : + base(arguments, elementTypes, group, valueType) { DateEnd = rev; } diff --git a/VisualCard.Calendar/Parts/Implementations/Event/DateStampInfo.cs b/VisualCard.Calendar/Parts/Implementations/Event/DateStampInfo.cs index 20fac96..211ca67 100644 --- a/VisualCard.Calendar/Parts/Implementations/Event/DateStampInfo.cs +++ b/VisualCard.Calendar/Parts/Implementations/Event/DateStampInfo.cs @@ -35,19 +35,19 @@ public class DateStampInfo : BaseCalendarPartInfo, IEquatable /// public DateTimeOffset DateStamp { get; } - internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) => - new DateStampInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, valueType, cardVersion); + internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) => + new DateStampInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, group, valueType, cardVersion); internal override string ToStringVcalendarInternal(Version cardVersion) => $"{VcardCommonTools.SavePosixDate(DateStamp)}"; - internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) + internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) { // Populate the fields DateTimeOffset stamp = VcardCommonTools.ParsePosixDateTime(value); // Add the fetched information - DateStampInfo _time = new(finalArgs, elementTypes, valueType, stamp); + DateStampInfo _time = new(finalArgs, elementTypes, group, valueType, stamp); return _time; } @@ -103,8 +103,8 @@ internal override bool EqualsInternal(BaseCalendarPartInfo source, BaseCalendarP internal DateStampInfo() { } - internal DateStampInfo(ArgumentInfo[] arguments, string[] elementTypes, string valueType, DateTimeOffset rev) : - base(arguments, elementTypes, valueType) + internal DateStampInfo(ArgumentInfo[] arguments, string[] elementTypes, string group, string valueType, DateTimeOffset rev) : + base(arguments, elementTypes, group, valueType) { DateStamp = rev; } diff --git a/VisualCard.Calendar/Parts/Implementations/Event/DateStartInfo.cs b/VisualCard.Calendar/Parts/Implementations/Event/DateStartInfo.cs index 0b76a14..cab767d 100644 --- a/VisualCard.Calendar/Parts/Implementations/Event/DateStartInfo.cs +++ b/VisualCard.Calendar/Parts/Implementations/Event/DateStartInfo.cs @@ -35,8 +35,8 @@ public class DateStartInfo : BaseCalendarPartInfo, IEquatable /// public DateTimeOffset DateStart { get; } - internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) => - new DateStartInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, valueType, cardVersion); + internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) => + new DateStartInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, group, valueType, cardVersion); internal override string ToStringVcalendarInternal(Version cardVersion) { @@ -48,7 +48,7 @@ internal override string ToStringVcalendarInternal(Version cardVersion) return value; } - internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) + internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) { // Populate the fields string type = valueType ?? ""; @@ -58,7 +58,7 @@ internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, VcardCommonTools.ParsePosixDateTime(value); // Add the fetched information - DateStartInfo _time = new(finalArgs, elementTypes, valueType ?? "", start); + DateStartInfo _time = new(finalArgs, elementTypes, group, valueType ?? "", start); return _time; } @@ -114,8 +114,8 @@ internal override bool EqualsInternal(BaseCalendarPartInfo source, BaseCalendarP internal DateStartInfo() { } - internal DateStartInfo(ArgumentInfo[] arguments, string[] elementTypes, string valueType, DateTimeOffset rev) : - base(arguments, elementTypes, valueType) + internal DateStartInfo(ArgumentInfo[] arguments, string[] elementTypes, string group, string valueType, DateTimeOffset rev) : + base(arguments, elementTypes, group, valueType) { DateStart = rev; } diff --git a/VisualCard.Calendar/Parts/Implementations/ExDateInfo.cs b/VisualCard.Calendar/Parts/Implementations/ExDateInfo.cs index 3d51bc5..e4f7c7a 100644 --- a/VisualCard.Calendar/Parts/Implementations/ExDateInfo.cs +++ b/VisualCard.Calendar/Parts/Implementations/ExDateInfo.cs @@ -38,8 +38,8 @@ public class ExDateInfo : BaseCalendarPartInfo, IEquatable /// public DateTimeOffset[]? ExDates { get; } - internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) => - new ExDateInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, valueType, cardVersion); + internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) => + new ExDateInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, group, valueType, cardVersion); internal override string ToStringVcalendarInternal(Version cardVersion) { @@ -48,7 +48,7 @@ internal override string ToStringVcalendarInternal(Version cardVersion) return $"{string.Join(cardVersion.Major == 1 ? ";" : ",", ExDates.Select((dt) => VcardCommonTools.SavePosixDate(dt, justDate)))}"; } - internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) + internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) { // Populate the fields string type = valueType ?? ""; @@ -64,7 +64,7 @@ internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, } // Add the fetched information - ExDateInfo _time = new([], elementTypes, valueType ?? "", [.. dates]); + ExDateInfo _time = new([], elementTypes, group, valueType ?? "", [.. dates]); return _time; } @@ -120,8 +120,8 @@ internal override bool EqualsInternal(BaseCalendarPartInfo source, BaseCalendarP internal ExDateInfo() { } - internal ExDateInfo(ArgumentInfo[] arguments, string[] elementTypes, string valueType, DateTimeOffset[] exDates) : - base(arguments, elementTypes, valueType) + internal ExDateInfo(ArgumentInfo[] arguments, string[] elementTypes, string group, string valueType, DateTimeOffset[] exDates) : + base(arguments, elementTypes, group, valueType) { ExDates = exDates; } diff --git a/VisualCard.Calendar/Parts/Implementations/ExtraInfo.cs b/VisualCard.Calendar/Parts/Implementations/ExtraInfo.cs index 09f2b29..8a958b1 100644 --- a/VisualCard.Calendar/Parts/Implementations/ExtraInfo.cs +++ b/VisualCard.Calendar/Parts/Implementations/ExtraInfo.cs @@ -41,13 +41,13 @@ public class ExtraInfo : BaseCalendarPartInfo, IEquatable /// public string[]? Values { get; } - internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) => - new ExtraInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, valueType, cardVersion); + internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) => + new ExtraInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, group, valueType, cardVersion); internal override string ToStringVcalendarInternal(Version cardVersion) => string.Join(VcardConstants._fieldDelimiter.ToString(), Values); - internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) + internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) { string[] split = value.Split(VcardConstants._argumentDelimiter); @@ -58,7 +58,7 @@ internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, // Populate the fields string[] _values = split[1].Split(VcardConstants._fieldDelimiter); - ExtraInfo _extraInfo = new(finalArgs, elementTypes, valueType, _extra, _values); + ExtraInfo _extraInfo = new(finalArgs, elementTypes, group, valueType, _extra, _values); return _extraInfo; } @@ -116,8 +116,8 @@ internal override bool EqualsInternal(BaseCalendarPartInfo source, BaseCalendarP internal ExtraInfo() { } - internal ExtraInfo(ArgumentInfo[] arguments, string[] elementTypes, string valueType, string keyName, string[] values) : - base(arguments, elementTypes, valueType) + internal ExtraInfo(ArgumentInfo[] arguments, string[] elementTypes, string group, string valueType, string keyName, string[] values) : + base(arguments, elementTypes, group, valueType) { KeyName = keyName; Values = values; diff --git a/VisualCard.Calendar/Parts/Implementations/FreeBusy/CalendarFreeBusyInfo.cs b/VisualCard.Calendar/Parts/Implementations/FreeBusy/CalendarFreeBusyInfo.cs index d54a8e4..4fa9599 100644 --- a/VisualCard.Calendar/Parts/Implementations/FreeBusy/CalendarFreeBusyInfo.cs +++ b/VisualCard.Calendar/Parts/Implementations/FreeBusy/CalendarFreeBusyInfo.cs @@ -37,8 +37,8 @@ public class CalendarFreeBusyInfo : BaseCalendarPartInfo, IEquatable public TimePeriod? FreeBusy { get; } - internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) => - new CalendarFreeBusyInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, valueType, cardVersion); + internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) => + new CalendarFreeBusyInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, group, valueType, cardVersion); internal override string ToStringVcalendarInternal(Version cardVersion) { @@ -50,13 +50,13 @@ internal override string ToStringVcalendarInternal(Version cardVersion) return builder.ToString(); } - internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) + internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) { // Populate the fields var freeBusy = VcardCommonTools.GetTimePeriod(value); // Add the fetched information - CalendarFreeBusyInfo _time = new([], elementTypes, valueType, freeBusy); + CalendarFreeBusyInfo _time = new([], elementTypes, group, valueType, freeBusy); return _time; } @@ -112,8 +112,8 @@ internal override bool EqualsInternal(BaseCalendarPartInfo source, BaseCalendarP internal CalendarFreeBusyInfo() { } - internal CalendarFreeBusyInfo(ArgumentInfo[] arguments, string[] elementTypes, string valueType, TimePeriod freeBusy) : - base(arguments, elementTypes, valueType) + internal CalendarFreeBusyInfo(ArgumentInfo[] arguments, string[] elementTypes, string group, string valueType, TimePeriod freeBusy) : + base(arguments, elementTypes, group, valueType) { FreeBusy = freeBusy; } diff --git a/VisualCard.Calendar/Parts/Implementations/GeoInfo.cs b/VisualCard.Calendar/Parts/Implementations/GeoInfo.cs index 011abb9..1eeca45 100644 --- a/VisualCard.Calendar/Parts/Implementations/GeoInfo.cs +++ b/VisualCard.Calendar/Parts/Implementations/GeoInfo.cs @@ -39,13 +39,13 @@ public class GeoInfo : BaseCalendarPartInfo, IEquatable /// public double Longitude { get; } - internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version calendarVersion) => - new GeoInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, valueType, calendarVersion); + internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version calendarVersion) => + new GeoInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, group, valueType, calendarVersion); internal override string ToStringVcalendarInternal(Version calendarVersion) => $"{Latitude}{(calendarVersion.Major == 1 ? ',' : ';')}{Longitude}"; - internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version calendarVersion) + internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version calendarVersion) { // Get the value string[] _geoSplit = value.Split(calendarVersion.Major == 1 ? ',' : ';'); @@ -57,7 +57,7 @@ internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, throw new ArgumentException($"Invalid longitude {_geoSplit[1]}"); // Populate the fields - GeoInfo _geo = new(finalArgs, elementTypes, valueType, lat, lon); + GeoInfo _geo = new(finalArgs, elementTypes, group, valueType, lat, lon); return _geo; } @@ -115,8 +115,8 @@ internal override bool EqualsInternal(BaseCalendarPartInfo source, BaseCalendarP internal GeoInfo() { } - internal GeoInfo(ArgumentInfo[] arguments, string[] elementTypes, string valueType, double lat, double lon) : - base(arguments, elementTypes, valueType) + internal GeoInfo(ArgumentInfo[] arguments, string[] elementTypes, string group, string valueType, double lat, double lon) : + base(arguments, elementTypes, group, valueType) { Latitude = lat; Longitude = lon; diff --git a/VisualCard.Calendar/Parts/Implementations/LastModifiedInfo.cs b/VisualCard.Calendar/Parts/Implementations/LastModifiedInfo.cs index 4d5a0dd..d468f8f 100644 --- a/VisualCard.Calendar/Parts/Implementations/LastModifiedInfo.cs +++ b/VisualCard.Calendar/Parts/Implementations/LastModifiedInfo.cs @@ -35,19 +35,19 @@ public class LastModifiedInfo : BaseCalendarPartInfo, IEquatable public DateTimeOffset LastModified { get; } - internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) => - new LastModifiedInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, valueType, cardVersion); + internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) => + new LastModifiedInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, group, valueType, cardVersion); internal override string ToStringVcalendarInternal(Version cardVersion) => $"{VcardCommonTools.SavePosixDate(LastModified)}"; - internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) + internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) { // Populate the fields DateTimeOffset created = VcardCommonTools.ParsePosixDateTime(value); // Add the fetched information - LastModifiedInfo _time = new(finalArgs, elementTypes, valueType, created); + LastModifiedInfo _time = new(finalArgs, elementTypes, group, valueType, created); return _time; } @@ -103,8 +103,8 @@ internal override bool EqualsInternal(BaseCalendarPartInfo source, BaseCalendarP internal LastModifiedInfo() { } - internal LastModifiedInfo(ArgumentInfo[] arguments, string[] elementTypes, string valueType, DateTimeOffset rev) : - base(arguments, elementTypes, valueType) + internal LastModifiedInfo(ArgumentInfo[] arguments, string[] elementTypes, string group, string valueType, DateTimeOffset rev) : + base(arguments, elementTypes, group, valueType) { LastModified = rev; } diff --git a/VisualCard.Calendar/Parts/Implementations/Legacy/AudioAlarmInfo.cs b/VisualCard.Calendar/Parts/Implementations/Legacy/AudioAlarmInfo.cs index d4ca338..dbc780c 100644 --- a/VisualCard.Calendar/Parts/Implementations/Legacy/AudioAlarmInfo.cs +++ b/VisualCard.Calendar/Parts/Implementations/Legacy/AudioAlarmInfo.cs @@ -63,8 +63,8 @@ public class AudioAlarmInfo : BaseCalendarPartInfo, IEquatable public DateTimeOffset SnoozeIn => VcardCommonTools.GetDurationSpan(SnoozeTime ?? "").result; - internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version calendarVersion) => - new AudioAlarmInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, valueType, calendarVersion); + internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version calendarVersion) => + new AudioAlarmInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, group, valueType, calendarVersion); internal override string ToStringVcalendarInternal(Version calendarVersion) { @@ -72,7 +72,7 @@ internal override string ToStringVcalendarInternal(Version calendarVersion) return $"{posixRunTime};{SnoozeTime};{RepeatCount};{AudioResource}"; } - internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version calendarVersion) + internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version calendarVersion) { // Get the values string[] split = value.Split(';'); @@ -90,7 +90,7 @@ internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, throw new ArgumentException("Invalid repeat times"); // Populate the fields - AudioAlarmInfo info = new(finalArgs, elementTypes, valueType, runTime, snoozeTime, repeat, audioResource); + AudioAlarmInfo info = new(finalArgs, elementTypes, group, valueType, runTime, snoozeTime, repeat, audioResource); return info; } @@ -152,8 +152,8 @@ internal override bool EqualsInternal(BaseCalendarPartInfo source, BaseCalendarP internal AudioAlarmInfo() { } - internal AudioAlarmInfo(ArgumentInfo[] arguments, string[] elementTypes, string valueType, DateTimeOffset runTime, string snoozeTime, int repeat, string audioResource) : - base(arguments, elementTypes, valueType) + internal AudioAlarmInfo(ArgumentInfo[] arguments, string[] elementTypes, string group, string valueType, DateTimeOffset runTime, string snoozeTime, int repeat, string audioResource) : + base(arguments, elementTypes, group, valueType) { RunTime = runTime; SnoozeTime = snoozeTime; diff --git a/VisualCard.Calendar/Parts/Implementations/Legacy/DaylightInfo.cs b/VisualCard.Calendar/Parts/Implementations/Legacy/DaylightInfo.cs index d643805..862e845 100644 --- a/VisualCard.Calendar/Parts/Implementations/Legacy/DaylightInfo.cs +++ b/VisualCard.Calendar/Parts/Implementations/Legacy/DaylightInfo.cs @@ -61,8 +61,8 @@ public class DaylightInfo : BaseCalendarPartInfo, IEquatable /// public string? DaylightDesignation { get; } - internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version calendarVersion) => - new DaylightInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, valueType, calendarVersion); + internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version calendarVersion) => + new DaylightInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, group, valueType, calendarVersion); internal override string ToStringVcalendarInternal(Version calendarVersion) { @@ -74,12 +74,12 @@ internal override string ToStringVcalendarInternal(Version calendarVersion) return $"TRUE;{posixUtc};{posixStart};{posixEnd};{StandardDesignation};{DaylightDesignation}"; } - internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version calendarVersion) + internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version calendarVersion) { // Get the values string[] split = value.Split(';'); if (split.Length == 1 && split[0] == "FALSE") - return new DaylightInfo(finalArgs, elementTypes, valueType, false, new(), new(), new(), "", ""); + return new DaylightInfo(finalArgs, elementTypes, group, valueType, false, new(), new(), new(), "", ""); if (split.Length != 6) throw new ArgumentException($"When splitting daylight information, the split value is {split.Length} instead of 6."); string unprocessedUtc = split[1]; @@ -94,7 +94,7 @@ internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, DateTimeOffset endDate = VcardCommonTools.ParsePosixDateTime(unprocessedEnd); // Populate the fields - DaylightInfo _geo = new(finalArgs, elementTypes, valueType, true, utcOffset, startDate, endDate, standard, daylight); + DaylightInfo _geo = new(finalArgs, elementTypes, group, valueType, true, utcOffset, startDate, endDate, standard, daylight); return _geo; } @@ -160,8 +160,8 @@ internal override bool EqualsInternal(BaseCalendarPartInfo source, BaseCalendarP internal DaylightInfo() { } - internal DaylightInfo(ArgumentInfo[] arguments, string[] elementTypes, string valueType, bool flag, TimeSpan utcOffset, DateTimeOffset daylightStart, DateTimeOffset daylightEnd, string standardDesignation, string daylightDesignation) : - base(arguments, elementTypes, valueType) + internal DaylightInfo(ArgumentInfo[] arguments, string[] elementTypes, string group, string valueType, bool flag, TimeSpan utcOffset, DateTimeOffset daylightStart, DateTimeOffset daylightEnd, string standardDesignation, string daylightDesignation) : + base(arguments, elementTypes, group, valueType) { Flag = flag; UtcOffset = utcOffset; diff --git a/VisualCard.Calendar/Parts/Implementations/Legacy/DisplayAlarmInfo.cs b/VisualCard.Calendar/Parts/Implementations/Legacy/DisplayAlarmInfo.cs index a9f261e..1176031 100644 --- a/VisualCard.Calendar/Parts/Implementations/Legacy/DisplayAlarmInfo.cs +++ b/VisualCard.Calendar/Parts/Implementations/Legacy/DisplayAlarmInfo.cs @@ -63,8 +63,8 @@ public class DisplayAlarmInfo : BaseCalendarPartInfo, IEquatable VcardCommonTools.GetDurationSpan(SnoozeTime ?? "").result; - internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version calendarVersion) => - new DisplayAlarmInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, valueType, calendarVersion); + internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version calendarVersion) => + new DisplayAlarmInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, group, valueType, calendarVersion); internal override string ToStringVcalendarInternal(Version calendarVersion) { @@ -72,7 +72,7 @@ internal override string ToStringVcalendarInternal(Version calendarVersion) return $"{posixRunTime};{SnoozeTime};{RepeatCount};{Display}"; } - internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version calendarVersion) + internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version calendarVersion) { // Get the values string[] split = value.Split(';'); @@ -90,7 +90,7 @@ internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, throw new ArgumentException("Invalid repeat times"); // Populate the fields - DisplayAlarmInfo info = new(finalArgs, elementTypes, valueType, runTime, snoozeTime, repeat, display); + DisplayAlarmInfo info = new(finalArgs, elementTypes, group, valueType, runTime, snoozeTime, repeat, display); return info; } @@ -152,8 +152,8 @@ internal override bool EqualsInternal(BaseCalendarPartInfo source, BaseCalendarP internal DisplayAlarmInfo() { } - internal DisplayAlarmInfo(ArgumentInfo[] arguments, string[] elementTypes, string valueType, DateTimeOffset runTime, string snoozeTime, int repeat, string display) : - base(arguments, elementTypes, valueType) + internal DisplayAlarmInfo(ArgumentInfo[] arguments, string[] elementTypes, string group, string valueType, DateTimeOffset runTime, string snoozeTime, int repeat, string display) : + base(arguments, elementTypes, group, valueType) { RunTime = runTime; SnoozeTime = snoozeTime; diff --git a/VisualCard.Calendar/Parts/Implementations/Legacy/MailAlarmInfo.cs b/VisualCard.Calendar/Parts/Implementations/Legacy/MailAlarmInfo.cs index 4afcd43..16c4ba9 100644 --- a/VisualCard.Calendar/Parts/Implementations/Legacy/MailAlarmInfo.cs +++ b/VisualCard.Calendar/Parts/Implementations/Legacy/MailAlarmInfo.cs @@ -68,8 +68,8 @@ public class MailAlarmInfo : BaseCalendarPartInfo, IEquatable public DateTimeOffset SnoozeIn => VcardCommonTools.GetDurationSpan(SnoozeTime ?? "").result; - internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version calendarVersion) => - new MailAlarmInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, valueType, calendarVersion); + internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version calendarVersion) => + new MailAlarmInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, group, valueType, calendarVersion); internal override string ToStringVcalendarInternal(Version calendarVersion) { @@ -77,7 +77,7 @@ internal override string ToStringVcalendarInternal(Version calendarVersion) return $"{posixRunTime};{SnoozeTime};{RepeatCount};{Address};{Note}"; } - internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version calendarVersion) + internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version calendarVersion) { // Get the values string[] split = value.Split(';'); @@ -96,7 +96,7 @@ internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, throw new ArgumentException("Invalid repeat times"); // Populate the fields - MailAlarmInfo info = new(finalArgs, elementTypes, valueType, runTime, snoozeTime, repeat, address, note); + MailAlarmInfo info = new(finalArgs, elementTypes, group, valueType, runTime, snoozeTime, repeat, address, note); return info; } @@ -160,8 +160,8 @@ internal override bool EqualsInternal(BaseCalendarPartInfo source, BaseCalendarP internal MailAlarmInfo() { } - internal MailAlarmInfo(ArgumentInfo[] arguments, string[] elementTypes, string valueType, DateTimeOffset runTime, string snoozeTime, int repeat, string address, string note) : - base(arguments, elementTypes, valueType) + internal MailAlarmInfo(ArgumentInfo[] arguments, string[] elementTypes, string group, string valueType, DateTimeOffset runTime, string snoozeTime, int repeat, string address, string note) : + base(arguments, elementTypes, group, valueType) { RunTime = runTime; SnoozeTime = snoozeTime; diff --git a/VisualCard.Calendar/Parts/Implementations/Legacy/ProcedureAlarmInfo.cs b/VisualCard.Calendar/Parts/Implementations/Legacy/ProcedureAlarmInfo.cs index aff099e..cc77011 100644 --- a/VisualCard.Calendar/Parts/Implementations/Legacy/ProcedureAlarmInfo.cs +++ b/VisualCard.Calendar/Parts/Implementations/Legacy/ProcedureAlarmInfo.cs @@ -63,8 +63,8 @@ public class ProcedureAlarmInfo : BaseCalendarPartInfo, IEquatable VcardCommonTools.GetDurationSpan(SnoozeTime ?? "").result; - internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version calendarVersion) => - new ProcedureAlarmInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, valueType, calendarVersion); + internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version calendarVersion) => + new ProcedureAlarmInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, group, valueType, calendarVersion); internal override string ToStringVcalendarInternal(Version calendarVersion) { @@ -72,7 +72,7 @@ internal override string ToStringVcalendarInternal(Version calendarVersion) return $"{posixRunTime};{SnoozeTime};{RepeatCount};{Procedure}"; } - internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version calendarVersion) + internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version calendarVersion) { // Get the values string[] split = value.Split(';'); @@ -90,7 +90,7 @@ internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, throw new ArgumentException("Invalid repeat times"); // Populate the fields - ProcedureAlarmInfo info = new(finalArgs, elementTypes, valueType, runTime, snoozeTime, repeat, procedure); + ProcedureAlarmInfo info = new(finalArgs, elementTypes, group, valueType, runTime, snoozeTime, repeat, procedure); return info; } @@ -152,8 +152,8 @@ internal override bool EqualsInternal(BaseCalendarPartInfo source, BaseCalendarP internal ProcedureAlarmInfo() { } - internal ProcedureAlarmInfo(ArgumentInfo[] arguments, string[] elementTypes, string valueType, DateTimeOffset runTime, string snoozeTime, int repeat, string procedure) : - base(arguments, elementTypes, valueType) + internal ProcedureAlarmInfo(ArgumentInfo[] arguments, string[] elementTypes, string group, string valueType, DateTimeOffset runTime, string snoozeTime, int repeat, string procedure) : + base(arguments, elementTypes, group, valueType) { RunTime = runTime; SnoozeTime = snoozeTime; diff --git a/VisualCard.Calendar/Parts/Implementations/LocationInfo.cs b/VisualCard.Calendar/Parts/Implementations/LocationInfo.cs index 46c0766..882d218 100644 --- a/VisualCard.Calendar/Parts/Implementations/LocationInfo.cs +++ b/VisualCard.Calendar/Parts/Implementations/LocationInfo.cs @@ -36,19 +36,19 @@ public class LocationInfo : BaseCalendarPartInfo, IEquatable /// public string? Location { get; } - internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) => - new LocationInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, valueType, cardVersion); + internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) => + new LocationInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, group, valueType, cardVersion); internal override string ToStringVcalendarInternal(Version cardVersion) => Location ?? ""; - internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) + internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) { // Populate the fields var location = Regex.Unescape(value); // Add the fetched information - LocationInfo _time = new([], elementTypes, valueType, location); + LocationInfo _time = new([], elementTypes, group, valueType, location); return _time; } @@ -104,8 +104,8 @@ internal override bool EqualsInternal(BaseCalendarPartInfo source, BaseCalendarP internal LocationInfo() { } - internal LocationInfo(ArgumentInfo[] arguments, string[] elementTypes, string valueType, string location) : - base(arguments, elementTypes, valueType) + internal LocationInfo(ArgumentInfo[] arguments, string[] elementTypes, string group, string valueType, string location) : + base(arguments, elementTypes, group, valueType) { Location = location; } diff --git a/VisualCard.Calendar/Parts/Implementations/RecDateInfo.cs b/VisualCard.Calendar/Parts/Implementations/RecDateInfo.cs index 8e76d9b..8e5d6fb 100644 --- a/VisualCard.Calendar/Parts/Implementations/RecDateInfo.cs +++ b/VisualCard.Calendar/Parts/Implementations/RecDateInfo.cs @@ -39,8 +39,8 @@ public class RecDateInfo : BaseCalendarPartInfo, IEquatable /// public TimePeriod[]? RecDates { get; } - internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) => - new RecDateInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, valueType, cardVersion); + internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) => + new RecDateInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, group, valueType, cardVersion); internal override string ToStringVcalendarInternal(Version cardVersion) { @@ -60,7 +60,7 @@ internal override string ToStringVcalendarInternal(Version cardVersion) return builder.ToString(); } - internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) + internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) { // Populate the fields TimePeriod[] recDates = []; @@ -97,7 +97,7 @@ internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, } // Add the fetched information - RecDateInfo _time = new([], elementTypes, valueType ?? "", recDates); + RecDateInfo _time = new([], elementTypes, group, valueType ?? "", recDates); return _time; } @@ -153,8 +153,8 @@ internal override bool EqualsInternal(BaseCalendarPartInfo source, BaseCalendarP internal RecDateInfo() { } - internal RecDateInfo(ArgumentInfo[] arguments, string[] elementTypes, string valueType, TimePeriod[] recDates) : - base(arguments, elementTypes, valueType) + internal RecDateInfo(ArgumentInfo[] arguments, string[] elementTypes, string group, string valueType, TimePeriod[] recDates) : + base(arguments, elementTypes, group, valueType) { RecDates = recDates; } diff --git a/VisualCard.Calendar/Parts/Implementations/RelatedToInfo.cs b/VisualCard.Calendar/Parts/Implementations/RelatedToInfo.cs index 6b18c45..b572bbc 100644 --- a/VisualCard.Calendar/Parts/Implementations/RelatedToInfo.cs +++ b/VisualCard.Calendar/Parts/Implementations/RelatedToInfo.cs @@ -36,19 +36,19 @@ public class RelatedToInfo : BaseCalendarPartInfo, IEquatable /// public string? RelatedTo { get; } - internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) => - new RelatedToInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, valueType, cardVersion); + internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) => + new RelatedToInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, group, valueType, cardVersion); internal override string ToStringVcalendarInternal(Version cardVersion) => RelatedTo ?? ""; - internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) + internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) { // Populate the fields var relatedto = Regex.Unescape(value); // Add the fetched information - RelatedToInfo _time = new([], elementTypes, valueType, relatedto); + RelatedToInfo _time = new([], elementTypes, group, valueType, relatedto); return _time; } @@ -104,8 +104,8 @@ internal override bool EqualsInternal(BaseCalendarPartInfo source, BaseCalendarP internal RelatedToInfo() { } - internal RelatedToInfo(ArgumentInfo[] arguments, string[] elementTypes, string valueType, string relatedto) : - base(arguments, elementTypes, valueType) + internal RelatedToInfo(ArgumentInfo[] arguments, string[] elementTypes, string group, string valueType, string relatedto) : + base(arguments, elementTypes, group, valueType) { RelatedTo = relatedto; } diff --git a/VisualCard.Calendar/Parts/Implementations/RequestStatusInfo.cs b/VisualCard.Calendar/Parts/Implementations/RequestStatusInfo.cs index db94c63..6da7b06 100644 --- a/VisualCard.Calendar/Parts/Implementations/RequestStatusInfo.cs +++ b/VisualCard.Calendar/Parts/Implementations/RequestStatusInfo.cs @@ -49,8 +49,8 @@ public class RequestStatusInfo : BaseCalendarPartInfo, IEquatable public string? RequestStatusExtData { get; } - internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) => - new RequestStatusInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, valueType, cardVersion); + internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) => + new RequestStatusInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, group, valueType, cardVersion); internal override string ToStringVcalendarInternal(Version cardVersion) { @@ -71,7 +71,7 @@ internal override string ToStringVcalendarInternal(Version cardVersion) return statusBuilder.ToString(); } - internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) + internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) { // Get the request and split it with the semicolon two times var requestStatus = Regex.Unescape(value); @@ -101,7 +101,7 @@ internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, string statusExtData = pair.Contains(";") ? pair.RemovePrefix($"{statusDesc};") : ""; // Add the fetched information - RequestStatusInfo _time = new([], elementTypes, valueType, statusTuple, statusDesc, statusExtData); + RequestStatusInfo _time = new([], elementTypes, group, valueType, statusTuple, statusDesc, statusExtData); return _time; } @@ -159,8 +159,8 @@ internal override bool EqualsInternal(BaseCalendarPartInfo source, BaseCalendarP internal RequestStatusInfo() { } - internal RequestStatusInfo(ArgumentInfo[] arguments, string[] elementTypes, string valueType, (int, int, int) requestStatus, string statusDesc, string statusExtData) : - base(arguments, elementTypes, valueType) + internal RequestStatusInfo(ArgumentInfo[] arguments, string[] elementTypes, string group, string valueType, (int, int, int) requestStatus, string statusDesc, string statusExtData) : + base(arguments, elementTypes, group, valueType) { RequestStatus = requestStatus; RequestStatusDesc = statusDesc; diff --git a/VisualCard.Calendar/Parts/Implementations/ResourcesInfo.cs b/VisualCard.Calendar/Parts/Implementations/ResourcesInfo.cs index a73855c..c82f59f 100644 --- a/VisualCard.Calendar/Parts/Implementations/ResourcesInfo.cs +++ b/VisualCard.Calendar/Parts/Implementations/ResourcesInfo.cs @@ -37,19 +37,19 @@ public class ResourcesInfo : BaseCalendarPartInfo, IEquatable /// public string[]? Resources { get; } - internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) => - new ResourcesInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, valueType, cardVersion); + internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) => + new ResourcesInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, group, valueType, cardVersion); internal override string ToStringVcalendarInternal(Version cardVersion) => $"{string.Join(VcardConstants._valueDelimiter.ToString(), Resources)}"; - internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) + internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) { // Populate the fields var resources = Regex.Unescape(value).Split(cardVersion.Major == 1 ? ';' : ','); // Add the fetched information - ResourcesInfo _time = new([], elementTypes, valueType, resources); + ResourcesInfo _time = new([], elementTypes, group, valueType, resources); return _time; } @@ -105,8 +105,8 @@ internal override bool EqualsInternal(BaseCalendarPartInfo source, BaseCalendarP internal ResourcesInfo() { } - internal ResourcesInfo(ArgumentInfo[] arguments, string[] elementTypes, string valueType, string[] resources) : - base(arguments, elementTypes, valueType) + internal ResourcesInfo(ArgumentInfo[] arguments, string[] elementTypes, string group, string valueType, string[] resources) : + base(arguments, elementTypes, group, valueType) { Resources = resources; } diff --git a/VisualCard.Calendar/Parts/Implementations/TimeZone/TimeZoneNameInfo.cs b/VisualCard.Calendar/Parts/Implementations/TimeZone/TimeZoneNameInfo.cs index 3d1504e..7b3d084 100644 --- a/VisualCard.Calendar/Parts/Implementations/TimeZone/TimeZoneNameInfo.cs +++ b/VisualCard.Calendar/Parts/Implementations/TimeZone/TimeZoneNameInfo.cs @@ -36,19 +36,19 @@ public class TimeZoneNameInfo : BaseCalendarPartInfo, IEquatable public string? TimeZoneName { get; } - internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) => - new TimeZoneNameInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, valueType, cardVersion); + internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) => + new TimeZoneNameInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, group, valueType, cardVersion); internal override string ToStringVcalendarInternal(Version cardVersion) => TimeZoneName ?? ""; - internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) + internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) { // Populate the fields var timezonename = Regex.Unescape(value); // Add the fetched information - TimeZoneNameInfo _time = new([], elementTypes, valueType, timezonename); + TimeZoneNameInfo _time = new([], elementTypes, group, valueType, timezonename); return _time; } @@ -104,8 +104,8 @@ internal override bool EqualsInternal(BaseCalendarPartInfo source, BaseCalendarP internal TimeZoneNameInfo() { } - internal TimeZoneNameInfo(ArgumentInfo[] arguments, string[] elementTypes, string valueType, string timezonename) : - base(arguments, elementTypes, valueType) + internal TimeZoneNameInfo(ArgumentInfo[] arguments, string[] elementTypes, string group, string valueType, string timezonename) : + base(arguments, elementTypes, group, valueType) { TimeZoneName = timezonename; } diff --git a/VisualCard.Calendar/Parts/Implementations/TimeZone/TimeZoneOffsetFromInfo.cs b/VisualCard.Calendar/Parts/Implementations/TimeZone/TimeZoneOffsetFromInfo.cs index 5d3c209..aa314c0 100644 --- a/VisualCard.Calendar/Parts/Implementations/TimeZone/TimeZoneOffsetFromInfo.cs +++ b/VisualCard.Calendar/Parts/Implementations/TimeZone/TimeZoneOffsetFromInfo.cs @@ -35,19 +35,19 @@ public class TimeZoneOffsetFromInfo : BaseCalendarPartInfo, IEquatable public TimeSpan Offset { get; } - internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) => - new TimeZoneOffsetFromInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, valueType, cardVersion); + internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) => + new TimeZoneOffsetFromInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, group, valueType, cardVersion); internal override string ToStringVcalendarInternal(Version cardVersion) => $"{VcardCommonTools.SaveUtcOffset(Offset)}"; - internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) + internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) { // Populate the fields TimeSpan start = VcardCommonTools.ParseUtcOffset(value); // Add the fetched information - TimeZoneOffsetFromInfo _time = new(finalArgs, elementTypes, valueType, start); + TimeZoneOffsetFromInfo _time = new(finalArgs, elementTypes, group, valueType, start); return _time; } @@ -103,8 +103,8 @@ internal override bool EqualsInternal(BaseCalendarPartInfo source, BaseCalendarP internal TimeZoneOffsetFromInfo() { } - internal TimeZoneOffsetFromInfo(ArgumentInfo[] arguments, string[] elementTypes, string valueType, TimeSpan rev) : - base(arguments, elementTypes, valueType) + internal TimeZoneOffsetFromInfo(ArgumentInfo[] arguments, string[] elementTypes, string group, string valueType, TimeSpan rev) : + base(arguments, elementTypes, group, valueType) { Offset = rev; } diff --git a/VisualCard.Calendar/Parts/Implementations/TimeZone/TimeZoneOffsetToInfo.cs b/VisualCard.Calendar/Parts/Implementations/TimeZone/TimeZoneOffsetToInfo.cs index 66042fc..0cb5105 100644 --- a/VisualCard.Calendar/Parts/Implementations/TimeZone/TimeZoneOffsetToInfo.cs +++ b/VisualCard.Calendar/Parts/Implementations/TimeZone/TimeZoneOffsetToInfo.cs @@ -35,19 +35,19 @@ public class TimeZoneOffsetToInfo : BaseCalendarPartInfo, IEquatable public TimeSpan Offset { get; } - internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) => - new TimeZoneOffsetToInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, valueType, cardVersion); + internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) => + new TimeZoneOffsetToInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, group, valueType, cardVersion); internal override string ToStringVcalendarInternal(Version cardVersion) => $"{VcardCommonTools.SaveUtcOffset(Offset)}"; - internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) + internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) { // Populate the fields TimeSpan start = VcardCommonTools.ParseUtcOffset(value); // Add the fetched information - TimeZoneOffsetToInfo _time = new(finalArgs, elementTypes, valueType, start); + TimeZoneOffsetToInfo _time = new(finalArgs, elementTypes, group, valueType, start); return _time; } @@ -103,8 +103,8 @@ internal override bool EqualsInternal(BaseCalendarPartInfo source, BaseCalendarP internal TimeZoneOffsetToInfo() { } - internal TimeZoneOffsetToInfo(ArgumentInfo[] arguments, string[] elementTypes, string valueType, TimeSpan rev) : - base(arguments, elementTypes, valueType) + internal TimeZoneOffsetToInfo(ArgumentInfo[] arguments, string[] elementTypes, string group, string valueType, TimeSpan rev) : + base(arguments, elementTypes, group, valueType) { Offset = rev; } diff --git a/VisualCard.Calendar/Parts/Implementations/Todo/DateCompletedInfo.cs b/VisualCard.Calendar/Parts/Implementations/Todo/DateCompletedInfo.cs index 0d9738a..381c924 100644 --- a/VisualCard.Calendar/Parts/Implementations/Todo/DateCompletedInfo.cs +++ b/VisualCard.Calendar/Parts/Implementations/Todo/DateCompletedInfo.cs @@ -35,19 +35,19 @@ public class DateCompletedInfo : BaseCalendarPartInfo, IEquatable public DateTimeOffset DateCompleted { get; } - internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) => - new DateCompletedInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, valueType, cardVersion); + internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) => + new DateCompletedInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, group, valueType, cardVersion); internal override string ToStringVcalendarInternal(Version cardVersion) => $"{VcardCommonTools.SavePosixDate(DateCompleted)}"; - internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) + internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) { // Populate the fields DateTimeOffset completed = VcardCommonTools.ParsePosixDateTime(value); // Add the fetched information - DateCompletedInfo _time = new(finalArgs, elementTypes, valueType, completed); + DateCompletedInfo _time = new(finalArgs, elementTypes, group, valueType, completed); return _time; } @@ -103,8 +103,8 @@ internal override bool EqualsInternal(BaseCalendarPartInfo source, BaseCalendarP internal DateCompletedInfo() { } - internal DateCompletedInfo(ArgumentInfo[] arguments, string[] elementTypes, string valueType, DateTimeOffset rev) : - base(arguments, elementTypes, valueType) + internal DateCompletedInfo(ArgumentInfo[] arguments, string[] elementTypes, string group, string valueType, DateTimeOffset rev) : + base(arguments, elementTypes, group, valueType) { DateCompleted = rev; } diff --git a/VisualCard.Calendar/Parts/Implementations/Todo/DueDateInfo.cs b/VisualCard.Calendar/Parts/Implementations/Todo/DueDateInfo.cs index 3bdb2f9..c806127 100644 --- a/VisualCard.Calendar/Parts/Implementations/Todo/DueDateInfo.cs +++ b/VisualCard.Calendar/Parts/Implementations/Todo/DueDateInfo.cs @@ -35,8 +35,8 @@ public class DueDateInfo : BaseCalendarPartInfo, IEquatable /// public DateTimeOffset DueDate { get; } - internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) => - new DueDateInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, valueType, cardVersion); + internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) => + new DueDateInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, group, valueType, cardVersion); internal override string ToStringVcalendarInternal(Version cardVersion) { @@ -48,7 +48,7 @@ internal override string ToStringVcalendarInternal(Version cardVersion) return value; } - internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) + internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) { // Populate the fields string type = valueType ?? ""; @@ -58,7 +58,7 @@ internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, VcardCommonTools.ParsePosixDateTime(value); // Add the fetched information - DueDateInfo _time = new(finalArgs, elementTypes, valueType ?? "", completed); + DueDateInfo _time = new(finalArgs, elementTypes, group, valueType ?? "", completed); return _time; } @@ -114,8 +114,8 @@ internal override bool EqualsInternal(BaseCalendarPartInfo source, BaseCalendarP internal DueDateInfo() { } - internal DueDateInfo(ArgumentInfo[] arguments, string[] elementTypes, string valueType, DateTimeOffset rev) : - base(arguments, elementTypes, valueType) + internal DueDateInfo(ArgumentInfo[] arguments, string[] elementTypes, string group, string valueType, DateTimeOffset rev) : + base(arguments, elementTypes, group, valueType) { DueDate = rev; } diff --git a/VisualCard.Calendar/Parts/Implementations/XNameInfo.cs b/VisualCard.Calendar/Parts/Implementations/XNameInfo.cs index de8e2fd..e835f49 100644 --- a/VisualCard.Calendar/Parts/Implementations/XNameInfo.cs +++ b/VisualCard.Calendar/Parts/Implementations/XNameInfo.cs @@ -41,13 +41,13 @@ public class XNameInfo : BaseCalendarPartInfo, IEquatable /// public string[]? XValues { get; } - internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) => - new XNameInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, valueType, cardVersion); + internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) => + new XNameInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, group, valueType, cardVersion); internal override string ToStringVcalendarInternal(Version cardVersion) => string.Join(VcardConstants._fieldDelimiter.ToString(), XValues); - internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string valueType, Version cardVersion) + internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, ArgumentInfo[] finalArgs, string[] elementTypes, string group, string valueType, Version cardVersion) { string xValue = value.Substring(VcardConstants._xSpecifier.Length); string[] splitX = xValue.Split(VcardConstants._argumentDelimiter); @@ -59,7 +59,7 @@ internal override BaseCalendarPartInfo FromStringVcalendarInternal(string value, // Populate the fields string[] _xValues = splitX[1].Split(VcardConstants._fieldDelimiter); - XNameInfo _x = new(finalArgs, elementTypes, valueType, _xName, _xValues); + XNameInfo _x = new(finalArgs, elementTypes, group, valueType, _xName, _xValues); return _x; } @@ -117,8 +117,8 @@ internal override bool EqualsInternal(BaseCalendarPartInfo source, BaseCalendarP internal XNameInfo() { } - internal XNameInfo(ArgumentInfo[] arguments, string[] elementTypes, string valueType, string xKeyName, string[] xValues) : - base(arguments, elementTypes, valueType) + internal XNameInfo(ArgumentInfo[] arguments, string[] elementTypes, string group, string valueType, string xKeyName, string[] xValues) : + base(arguments, elementTypes, group, valueType) { XKeyName = xKeyName; XValues = xValues; diff --git a/VisualCard.ShowCalendars/Program.cs b/VisualCard.ShowCalendars/Program.cs index c909b1a..59f907a 100644 --- a/VisualCard.ShowCalendars/Program.cs +++ b/VisualCard.ShowCalendars/Program.cs @@ -83,7 +83,7 @@ static void Main(string[] args) TextWriterColor.Write("Calendar start date: {0}", starts[0].DateStart); if (ends.Length > 0) TextWriterColor.Write("Calendar end date: {0}", ends[0].DateEnd); - TextWriterColor.Write("Calendar product ID: {0}", Calendar.GetString(CalendarStringsEnum.ProductId)); + TextWriterColor.Write("Calendar product ID: {0}", Calendar.GetString(CalendarStringsEnum.ProductId)?.Value ?? ""); TextWriterColor.Write("Calendar UUID: {0}", Calendar.UniqueId); TextWriterColor.Write("Calendar events: {0} event(s)", Calendar.Events.Length); diff --git a/VisualCard/Parts/CardValueInfo.cs b/VisualCard/Parts/CardValueInfo.cs index 8d4d9fe..0c6f590 100644 --- a/VisualCard/Parts/CardValueInfo.cs +++ b/VisualCard/Parts/CardValueInfo.cs @@ -121,12 +121,13 @@ public override bool Equals(object obj) => /// public override int GetHashCode() { - int hashCode = 975087586; + int hashCode = -1241979236; hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(Arguments); hashCode = hashCode * -1521134295 + AltId.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(ElementTypes); hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(ValueType); hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(Group); + hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(Value); return hashCode; }