diff --git a/VisualCard.Calendar/Parsers/VCalendarParser.cs b/VisualCard.Calendar/Parsers/VCalendarParser.cs index 350130e..5b2ca2c 100644 --- a/VisualCard.Calendar/Parsers/VCalendarParser.cs +++ b/VisualCard.Calendar/Parsers/VCalendarParser.cs @@ -115,7 +115,7 @@ public Parts.Calendar Parse() // Get the type and its properties Type calendarType = subPart is not null ? subPart.GetType() : calendar.GetType(); - var partType = VCalendarParserTools.GetPartType(info.Prefix, VCalendarParserTools.GetObjectTypeFromType(calendarType), CalendarVersion, calendarType); + var partType = VCalendarParserTools.GetPartType(info.Prefix, CalendarVersion, calendarType); // Check the type for allowed types string[] elementTypes = VcardCommonTools.GetTypes(info.Arguments, partType.defaultType); @@ -350,7 +350,7 @@ private bool HasComponent(string expectedFieldName, TComponent compo where TComponent : Parts.Calendar { // Requirement checks - var partType = VCalendarParserTools.GetPartType(expectedFieldName, VCalendarParserTools.GetObjectTypeFromComponent(component), CalendarVersion, component.GetType()); + var partType = VCalendarParserTools.GetPartType(expectedFieldName, CalendarVersion, component.GetType()); bool exists = false; switch (partType.type) { diff --git a/VisualCard.Calendar/Parsers/VCalendarParserTools.cs b/VisualCard.Calendar/Parsers/VCalendarParserTools.cs index 5d65c18..4bb2dc0 100644 --- a/VisualCard.Calendar/Parsers/VCalendarParserTools.cs +++ b/VisualCard.Calendar/Parsers/VCalendarParserTools.cs @@ -112,7 +112,7 @@ internal static string GetPrefixFromPartsArrayEnum(CalendarPartsArrayEnum partsA _ => "" }; - internal static CalendarPartsArrayEnum GetPartsArrayEnumFromType(Type? partsArrayType, string objectType, Version cardVersion, Type componentType) + internal static CalendarPartsArrayEnum GetPartsArrayEnumFromType(Type? partsArrayType, Version cardVersion, Type componentType) { if (partsArrayType is null) throw new NotImplementedException("Type is not provided."); @@ -122,21 +122,21 @@ internal static CalendarPartsArrayEnum GetPartsArrayEnumFromType(Type? partsArra foreach (CalendarPartsArrayEnum part in enums) { string prefix = GetPrefixFromPartsArrayEnum(part); - var type = GetPartType(prefix, objectType, cardVersion, componentType); + var type = GetPartType(prefix, cardVersion, componentType); if (type.enumType == partsArrayType) return part; } return CalendarPartsArrayEnum.IanaNames; } - internal static VCalendarPartType GetPartType(string prefix, string objectType, Version calendarVersion, Type componentType) + internal static VCalendarPartType GetPartType(string prefix, Version calendarVersion, Type componentType) { string[] allowedStatuses = - objectType == VCalendarConstants._objectVEventSpecifier && calendarVersion.Major == 2 ? ["TENTATIVE", "CONFIRMED", "CANCELLED"] : - objectType == VCalendarConstants._objectVEventSpecifier && calendarVersion.Major == 1 ? ["NEEDS ACTION", "SENT", "TENTATIVE", "CONFIRMED", "DECLINED", "DELEGATED"] : - objectType == VCalendarConstants._objectVTodoSpecifier && calendarVersion.Major == 2 ? ["NEEDS-ACTION", "COMPLETED", "IN-PROCESS", "CANCELLED"] : - objectType == VCalendarConstants._objectVTodoSpecifier && calendarVersion.Major == 1 ? ["NEEDS ACTION", "SENT", "ACCEPTED", "COMPLETED", "DECLINED", "DELEGATED"] : - objectType == VCalendarConstants._objectVJournalSpecifier ? ["DRAFT", "FINAL", "CANCELLED"] : + componentType == typeof(CalendarEvent) && calendarVersion.Major == 2 ? ["TENTATIVE", "CONFIRMED", "CANCELLED"] : + componentType == typeof(CalendarEvent) && calendarVersion.Major == 1 ? ["NEEDS ACTION", "SENT", "TENTATIVE", "CONFIRMED", "DECLINED", "DELEGATED"] : + componentType == typeof(CalendarTodo) && calendarVersion.Major == 2 ? ["NEEDS-ACTION", "COMPLETED", "IN-PROCESS", "CANCELLED"] : + componentType == typeof(CalendarTodo) && calendarVersion.Major == 1 ? ["NEEDS ACTION", "SENT", "ACCEPTED", "COMPLETED", "DECLINED", "DELEGATED"] : + componentType == typeof(CalendarJournal) ? ["DRAFT", "FINAL", "CANCELLED"] : []; return prefix switch { @@ -201,26 +201,6 @@ internal static VCalendarPartType GetPartType(string prefix, string objectType, }; } - internal static string GetObjectTypeFromComponent(TComponent component) - where TComponent : Parts.Calendar => - GetObjectTypeFromType(component.GetType(), component is CalendarOtherComponent other ? other.ComponentName : ""); - - internal static string GetObjectTypeFromType(Type type, string specifier = "") => - type.Name switch - { - nameof(Parts.Calendar) => VCalendarConstants._objectVCalendarSpecifier, - nameof(CalendarEvent) => VCalendarConstants._objectVEventSpecifier, - nameof(CalendarTodo) => VCalendarConstants._objectVTodoSpecifier, - nameof(CalendarJournal) => VCalendarConstants._objectVJournalSpecifier, - nameof(CalendarFreeBusy) => VCalendarConstants._objectVFreeBusySpecifier, - nameof(CalendarTimeZone) => VCalendarConstants._objectVTimeZoneSpecifier, - nameof(CalendarStandard) => VCalendarConstants._objectVStandardSpecifier, - nameof(CalendarDaylight) => VCalendarConstants._objectVDaylightSpecifier, - nameof(CalendarAlarm) => VCalendarConstants._objectVAlarmSpecifier, - nameof(CalendarOtherComponent) => specifier, - _ => throw new InvalidDataException("Type is not a valid component"), - }; - private static bool TypeMatch(Type componentType, params Type[] expectedTypes) => expectedTypes.Contains(componentType); } diff --git a/VisualCard.Calendar/Parts/Calendar.cs b/VisualCard.Calendar/Parts/Calendar.cs index 1411155..7ff932b 100644 --- a/VisualCard.Calendar/Parts/Calendar.cs +++ b/VisualCard.Calendar/Parts/Calendar.cs @@ -123,7 +123,7 @@ public class Calendar : IEquatable public virtual TPart[] GetPartsArray() where TPart : BaseCalendarPartInfo { // Get the parts enumeration according to the type - var key = VCalendarParserTools.GetPartsArrayEnumFromType(typeof(TPart), VCalendarConstants._objectVCalendarSpecifier, CalendarVersion, GetType()); + var key = VCalendarParserTools.GetPartsArrayEnumFromType(typeof(TPart), CalendarVersion, GetType()); // Now, return the value return GetPartsArray(key); @@ -149,7 +149,7 @@ public virtual BaseCalendarPartInfo[] GetPartsArray(Type partType) throw new InvalidOperationException($"Base type is not BaseCalendarPartInfo [{partType.BaseType.Name}] and the part type is [{partType.Name}] that doesn't represent calendar part."); // Get the parts enumeration according to the type - var key = VCalendarParserTools.GetPartsArrayEnumFromType(partType, VCalendarConstants._objectVCalendarSpecifier, CalendarVersion, GetType()); + var key = VCalendarParserTools.GetPartsArrayEnumFromType(partType, CalendarVersion, GetType()); // Now, return the value return GetPartsArray(partType, key); @@ -178,7 +178,7 @@ public virtual BaseCalendarPartInfo[] GetPartsArray(Type partType, CalendarParts public virtual BaseCalendarPartInfo[] GetPartsArray(CalendarPartsArrayEnum key) { string prefix = VCalendarParserTools.GetPrefixFromPartsArrayEnum(key); - var partType = VCalendarParserTools.GetPartType(prefix, "", CalendarVersion, typeof(Calendar)); + var partType = VCalendarParserTools.GetPartType(prefix, CalendarVersion, typeof(Calendar)); if (partType.enumType is null) throw new ArgumentException($"Enumeration type is not found for {key}"); return GetPartsArray(partType.enumType, key, CalendarVersion, partsArray); @@ -188,7 +188,7 @@ internal TPart[] GetPartsArray(Version version, Dictionary(key, version, partsArray); @@ -201,7 +201,7 @@ internal TPart[] GetPartsArray(CalendarPartsArrayEnum key, Version versio internal BaseCalendarPartInfo[] GetPartsArray(Type partType, Version version, Dictionary> partsArray) { // Get the parts enumeration according to the type - var key = VCalendarParserTools.GetPartsArrayEnumFromType(typeof(BaseCalendarPartInfo), VCalendarConstants._objectVCalendarSpecifier, version, GetType()); + var key = VCalendarParserTools.GetPartsArrayEnumFromType(typeof(BaseCalendarPartInfo), version, GetType()); // Now, return the value return GetPartsArray(partType, key, version, partsArray); @@ -211,7 +211,7 @@ internal BaseCalendarPartInfo[] GetPartsArray(Type partType, CalendarPartsArrayE { // Check for version support string prefix = VCalendarParserTools.GetPrefixFromPartsArrayEnum(key); - var type = VCalendarParserTools.GetPartType(prefix, "", version, GetType()); + var type = VCalendarParserTools.GetPartType(prefix, version, GetType()); if (!type.minimumVersionCondition(version)) return []; @@ -252,7 +252,7 @@ internal CalendarValueInfo[] GetString(CalendarStringsEnum key, Version { // Check for version support string prefix = VCalendarParserTools.GetPrefixFromStringsEnum(key); - var partType = VCalendarParserTools.GetPartType(prefix, "", version, GetType()); + var partType = VCalendarParserTools.GetPartType(prefix, version, GetType()); if (!partType.minimumVersionCondition(version)) return []; @@ -277,7 +277,7 @@ internal CalendarValueInfo[] GetInteger(CalendarIntegersEnum key, Versio { // Check for version support string prefix = VCalendarParserTools.GetPrefixFromIntegersEnum(key); - var partType = VCalendarParserTools.GetPartType(prefix, "", version, GetType()); + var partType = VCalendarParserTools.GetPartType(prefix, version, GetType()); if (!partType.minimumVersionCondition(version)) return []; @@ -316,7 +316,7 @@ internal string SaveToString(Version version, Dictionary !a.Equals(b); internal virtual void AddPartToArray(CalendarPartsArrayEnum key, BaseCalendarPartInfo value) => - AddPartToArray(key, value, version, partsArray, VCalendarConstants._objectVCalendarSpecifier); + AddPartToArray(key, value, version, partsArray); - internal virtual void AddPartToArray(CalendarPartsArrayEnum key, BaseCalendarPartInfo value, Version version, Dictionary> partsArray, string objectType) + internal virtual void AddPartToArray(CalendarPartsArrayEnum key, BaseCalendarPartInfo value, Version version, Dictionary> partsArray) { if (value is null) return; // Get the appropriate type and check it string prefix = VCalendarParserTools.GetPrefixFromPartsArrayEnum(key); - var partType = VCalendarParserTools.GetPartType(prefix, objectType, version, GetType()); + var partType = VCalendarParserTools.GetPartType(prefix, version, GetType()); var enumType = partType.enumType; if (value.GetType() != enumType) return; @@ -547,16 +547,16 @@ internal virtual void AddPartToArray(CalendarPartsArrayEnum key, BaseCalendarPar } internal virtual void AddString(CalendarStringsEnum key, CalendarValueInfo value) => - AddString(key, value, version, strings, VCalendarConstants._objectVCalendarSpecifier); + AddString(key, value, version, strings); - internal virtual void AddString(CalendarStringsEnum key, CalendarValueInfo value, Version version, Dictionary>> strings, string objectType) + internal virtual void AddString(CalendarStringsEnum key, CalendarValueInfo value, Version version, Dictionary>> strings) { if (value is null || string.IsNullOrEmpty(value.Value)) return; // Get the appropriate type string prefix = VCalendarParserTools.GetPrefixFromStringsEnum(key); - var partType = VCalendarParserTools.GetPartType(prefix, objectType, version, GetType()); + var partType = VCalendarParserTools.GetPartType(prefix, version, GetType()); // If we don't have this key yet, add it. if (!strings.ContainsKey(key)) @@ -575,16 +575,16 @@ internal virtual void AddString(CalendarStringsEnum key, CalendarValueInfo value) => - AddInteger(key, value, version, integers, VCalendarConstants._objectVCalendarSpecifier); + AddInteger(key, value, version, integers); - internal virtual void AddInteger(CalendarIntegersEnum key, CalendarValueInfo value, Version version, Dictionary>> integers, string objectType) + internal virtual void AddInteger(CalendarIntegersEnum key, CalendarValueInfo value, Version version, Dictionary>> integers) { if (value is null || value.Value < 0) return; // Get the appropriate type string prefix = VCalendarParserTools.GetPrefixFromIntegersEnum(key); - var partType = VCalendarParserTools.GetPartType(prefix, objectType, version, GetType()); + var partType = VCalendarParserTools.GetPartType(prefix, version, GetType()); // If we don't have this key yet, add it. if (!integers.ContainsKey(key)) diff --git a/VisualCard.Calendar/Parts/CalendarAlarm.cs b/VisualCard.Calendar/Parts/CalendarAlarm.cs index d884f57..1d006e7 100644 --- a/VisualCard.Calendar/Parts/CalendarAlarm.cs +++ b/VisualCard.Calendar/Parts/CalendarAlarm.cs @@ -63,7 +63,7 @@ public class CalendarAlarm : Calendar, IEquatable public override TPart[] GetPartsArray() { // Get the parts enumeration according to the type - var key = VCalendarParserTools.GetPartsArrayEnumFromType(typeof(TPart), VCalendarConstants._objectVAlarmSpecifier, CalendarVersion, GetType()); + var key = VCalendarParserTools.GetPartsArrayEnumFromType(typeof(TPart), CalendarVersion, GetType()); // Now, return the value return GetPartsArray(key, CalendarVersion, partsArray); @@ -85,7 +85,7 @@ public override TPart[] GetPartsArray(CalendarPartsArrayEnum key) => public override BaseCalendarPartInfo[] GetPartsArray(CalendarPartsArrayEnum key) { string prefix = VCalendarParserTools.GetPrefixFromPartsArrayEnum(key); - var partType = VCalendarParserTools.GetPartType(prefix, "", CalendarVersion, typeof(CalendarAlarm)); + var partType = VCalendarParserTools.GetPartType(prefix, CalendarVersion, typeof(CalendarAlarm)); if (partType.enumType is null) throw new ArgumentException($"Enumeration type is not found for {key}"); return GetPartsArray(partType.enumType, key, CalendarVersion, partsArray); @@ -171,13 +171,13 @@ public override int GetHashCode() => !a.Equals(b); internal override void AddPartToArray(CalendarPartsArrayEnum key, BaseCalendarPartInfo value) => - AddPartToArray(key, value, CalendarVersion, partsArray, VCalendarConstants._objectVAlarmSpecifier); + AddPartToArray(key, value, CalendarVersion, partsArray); internal override void AddString(CalendarStringsEnum key, CalendarValueInfo value) => - AddString(key, value, CalendarVersion, strings, VCalendarConstants._objectVAlarmSpecifier); + AddString(key, value, CalendarVersion, strings); internal override void AddInteger(CalendarIntegersEnum key, CalendarValueInfo value) => - AddInteger(key, value, CalendarVersion, integers, VCalendarConstants._objectVAlarmSpecifier); + AddInteger(key, value, CalendarVersion, integers); internal CalendarAlarm(Version version) : base(version) diff --git a/VisualCard.Calendar/Parts/CalendarDaylight.cs b/VisualCard.Calendar/Parts/CalendarDaylight.cs index b7eed18..698e4d9 100644 --- a/VisualCard.Calendar/Parts/CalendarDaylight.cs +++ b/VisualCard.Calendar/Parts/CalendarDaylight.cs @@ -63,7 +63,7 @@ public class CalendarDaylight : Calendar, IEquatable public override TPart[] GetPartsArray() { // Get the parts enumeration according to the type - var key = VCalendarParserTools.GetPartsArrayEnumFromType(typeof(TPart), VCalendarConstants._objectVDaylightSpecifier, CalendarVersion, GetType()); + var key = VCalendarParserTools.GetPartsArrayEnumFromType(typeof(TPart), CalendarVersion, GetType()); // Now, return the value return GetPartsArray(key, CalendarVersion, partsArray); @@ -85,7 +85,7 @@ public override TPart[] GetPartsArray(CalendarPartsArrayEnum key) => public override BaseCalendarPartInfo[] GetPartsArray(CalendarPartsArrayEnum key) { string prefix = VCalendarParserTools.GetPrefixFromPartsArrayEnum(key); - var partType = VCalendarParserTools.GetPartType(prefix, "", CalendarVersion, typeof(CalendarDaylight)); + var partType = VCalendarParserTools.GetPartType(prefix, CalendarVersion, typeof(CalendarDaylight)); if (partType.enumType is null) throw new ArgumentException($"Enumeration type is not found for {key}"); return GetPartsArray(partType.enumType, key, CalendarVersion, partsArray); @@ -171,13 +171,13 @@ public override int GetHashCode() => !a.Equals(b); internal override void AddPartToArray(CalendarPartsArrayEnum key, BaseCalendarPartInfo value) => - AddPartToArray(key, value, CalendarVersion, partsArray, VCalendarConstants._objectVDaylightSpecifier); + AddPartToArray(key, value, CalendarVersion, partsArray); internal override void AddString(CalendarStringsEnum key, CalendarValueInfo value) => - AddString(key, value, CalendarVersion, strings, VCalendarConstants._objectVDaylightSpecifier); + AddString(key, value, CalendarVersion, strings); internal override void AddInteger(CalendarIntegersEnum key, CalendarValueInfo value) => - AddInteger(key, value, CalendarVersion, integers, VCalendarConstants._objectVDaylightSpecifier); + AddInteger(key, value, CalendarVersion, integers); internal CalendarDaylight(Version version) : base(version) diff --git a/VisualCard.Calendar/Parts/CalendarEvent.cs b/VisualCard.Calendar/Parts/CalendarEvent.cs index 31597b2..b4d32c3 100644 --- a/VisualCard.Calendar/Parts/CalendarEvent.cs +++ b/VisualCard.Calendar/Parts/CalendarEvent.cs @@ -70,7 +70,7 @@ public class CalendarEvent : Calendar, IEquatable public override TPart[] GetPartsArray() { // Get the parts enumeration according to the type - var key = VCalendarParserTools.GetPartsArrayEnumFromType(typeof(TPart), VCalendarConstants._objectVEventSpecifier, CalendarVersion, GetType()); + var key = VCalendarParserTools.GetPartsArrayEnumFromType(typeof(TPart), CalendarVersion, GetType()); // Now, return the value return GetPartsArray(key, CalendarVersion, partsArray); @@ -92,7 +92,7 @@ public override TPart[] GetPartsArray(CalendarPartsArrayEnum key) => public override BaseCalendarPartInfo[] GetPartsArray(CalendarPartsArrayEnum key) { string prefix = VCalendarParserTools.GetPrefixFromPartsArrayEnum(key); - var partType = VCalendarParserTools.GetPartType(prefix, "", CalendarVersion, typeof(CalendarEvent)); + var partType = VCalendarParserTools.GetPartType(prefix, CalendarVersion, typeof(CalendarEvent)); if (partType.enumType is null) throw new ArgumentException($"Enumeration type is not found for {key}"); return GetPartsArray(partType.enumType, key, CalendarVersion, partsArray); @@ -180,13 +180,13 @@ public override int GetHashCode() => !a.Equals(b); internal override void AddPartToArray(CalendarPartsArrayEnum key, BaseCalendarPartInfo value) => - AddPartToArray(key, value, CalendarVersion, partsArray, VCalendarConstants._objectVEventSpecifier); + AddPartToArray(key, value, CalendarVersion, partsArray); internal override void AddString(CalendarStringsEnum key, CalendarValueInfo value) => - AddString(key, value, CalendarVersion, strings, VCalendarConstants._objectVEventSpecifier); + AddString(key, value, CalendarVersion, strings); internal override void AddInteger(CalendarIntegersEnum key, CalendarValueInfo value) => - AddInteger(key, value, CalendarVersion, integers, VCalendarConstants._objectVEventSpecifier); + AddInteger(key, value, CalendarVersion, integers); internal CalendarEvent(Version version) : base(version) diff --git a/VisualCard.Calendar/Parts/CalendarFreeBusy.cs b/VisualCard.Calendar/Parts/CalendarFreeBusy.cs index 821e48d..83690b7 100644 --- a/VisualCard.Calendar/Parts/CalendarFreeBusy.cs +++ b/VisualCard.Calendar/Parts/CalendarFreeBusy.cs @@ -63,7 +63,7 @@ public class CalendarFreeBusy : Calendar, IEquatable public override TPart[] GetPartsArray() { // Get the parts enumeration according to the type - var key = VCalendarParserTools.GetPartsArrayEnumFromType(typeof(TPart), VCalendarConstants._objectVFreeBusySpecifier, CalendarVersion, GetType()); + var key = VCalendarParserTools.GetPartsArrayEnumFromType(typeof(TPart), CalendarVersion, GetType()); // Now, return the value return GetPartsArray(key, CalendarVersion, partsArray); @@ -85,7 +85,7 @@ public override TPart[] GetPartsArray(CalendarPartsArrayEnum key) => public override BaseCalendarPartInfo[] GetPartsArray(CalendarPartsArrayEnum key) { string prefix = VCalendarParserTools.GetPrefixFromPartsArrayEnum(key); - var partType = VCalendarParserTools.GetPartType(prefix, "", CalendarVersion, typeof(CalendarFreeBusy)); + var partType = VCalendarParserTools.GetPartType(prefix, CalendarVersion, typeof(CalendarFreeBusy)); if (partType.enumType is null) throw new ArgumentException($"Enumeration type is not found for {key}"); return GetPartsArray(partType.enumType, key, CalendarVersion, partsArray); @@ -171,13 +171,13 @@ public override int GetHashCode() => !a.Equals(b); internal override void AddPartToArray(CalendarPartsArrayEnum key, BaseCalendarPartInfo value) => - AddPartToArray(key, value, CalendarVersion, partsArray, VCalendarConstants._objectVFreeBusySpecifier); + AddPartToArray(key, value, CalendarVersion, partsArray); internal override void AddString(CalendarStringsEnum key, CalendarValueInfo value) => - AddString(key, value, CalendarVersion, strings, VCalendarConstants._objectVFreeBusySpecifier); + AddString(key, value, CalendarVersion, strings); internal override void AddInteger(CalendarIntegersEnum key, CalendarValueInfo value) => - AddInteger(key, value, CalendarVersion, integers, VCalendarConstants._objectVFreeBusySpecifier); + AddInteger(key, value, CalendarVersion, integers); internal CalendarFreeBusy(Version version) : base(version) diff --git a/VisualCard.Calendar/Parts/CalendarJournal.cs b/VisualCard.Calendar/Parts/CalendarJournal.cs index 6ec3847..2e86094 100644 --- a/VisualCard.Calendar/Parts/CalendarJournal.cs +++ b/VisualCard.Calendar/Parts/CalendarJournal.cs @@ -63,7 +63,7 @@ public class CalendarJournal : Calendar, IEquatable public override TPart[] GetPartsArray() { // Get the parts enumeration according to the type - var key = VCalendarParserTools.GetPartsArrayEnumFromType(typeof(TPart), VCalendarConstants._objectVJournalSpecifier, CalendarVersion, GetType()); + var key = VCalendarParserTools.GetPartsArrayEnumFromType(typeof(TPart), CalendarVersion, GetType()); // Now, return the value return GetPartsArray(key, CalendarVersion, partsArray); @@ -85,7 +85,7 @@ public override TPart[] GetPartsArray(CalendarPartsArrayEnum key) => public override BaseCalendarPartInfo[] GetPartsArray(CalendarPartsArrayEnum key) { string prefix = VCalendarParserTools.GetPrefixFromPartsArrayEnum(key); - var partType = VCalendarParserTools.GetPartType(prefix, "", CalendarVersion, typeof(CalendarJournal)); + var partType = VCalendarParserTools.GetPartType(prefix, CalendarVersion, typeof(CalendarJournal)); if (partType.enumType is null) throw new ArgumentException($"Enumeration type is not found for {key}"); return GetPartsArray(partType.enumType, key, CalendarVersion, partsArray); @@ -171,13 +171,13 @@ public override int GetHashCode() => !a.Equals(b); internal override void AddPartToArray(CalendarPartsArrayEnum key, BaseCalendarPartInfo value) => - AddPartToArray(key, value, CalendarVersion, partsArray, VCalendarConstants._objectVJournalSpecifier); + AddPartToArray(key, value, CalendarVersion, partsArray); internal override void AddString(CalendarStringsEnum key, CalendarValueInfo value) => - AddString(key, value, CalendarVersion, strings, VCalendarConstants._objectVJournalSpecifier); + AddString(key, value, CalendarVersion, strings); internal override void AddInteger(CalendarIntegersEnum key, CalendarValueInfo value) => - AddInteger(key, value, CalendarVersion, integers, VCalendarConstants._objectVJournalSpecifier); + AddInteger(key, value, CalendarVersion, integers); internal CalendarJournal(Version version) : base(version) diff --git a/VisualCard.Calendar/Parts/CalendarOtherComponent.cs b/VisualCard.Calendar/Parts/CalendarOtherComponent.cs index 639cec8..4809b99 100644 --- a/VisualCard.Calendar/Parts/CalendarOtherComponent.cs +++ b/VisualCard.Calendar/Parts/CalendarOtherComponent.cs @@ -70,7 +70,7 @@ public class CalendarOtherComponent : Calendar, IEquatable() { // Get the parts enumeration according to the type - var key = VCalendarParserTools.GetPartsArrayEnumFromType(typeof(TPart), ComponentName, CalendarVersion, GetType()); + var key = VCalendarParserTools.GetPartsArrayEnumFromType(typeof(TPart), CalendarVersion, GetType()); // Now, return the value return GetPartsArray(key, CalendarVersion, partsArray); @@ -92,7 +92,7 @@ public override TPart[] GetPartsArray(CalendarPartsArrayEnum key) => public override BaseCalendarPartInfo[] GetPartsArray(CalendarPartsArrayEnum key) { string prefix = VCalendarParserTools.GetPrefixFromPartsArrayEnum(key); - var partType = VCalendarParserTools.GetPartType(prefix, "", CalendarVersion, typeof(CalendarOtherComponent)); + var partType = VCalendarParserTools.GetPartType(prefix, CalendarVersion, typeof(CalendarOtherComponent)); if (partType.enumType is null) throw new ArgumentException($"Enumeration type is not found for {key}"); return GetPartsArray(partType.enumType, key, CalendarVersion, partsArray); @@ -179,13 +179,13 @@ public override int GetHashCode() => !a.Equals(b); internal override void AddPartToArray(CalendarPartsArrayEnum key, BaseCalendarPartInfo value) => - AddPartToArray(key, value, CalendarVersion, partsArray, componentName); + AddPartToArray(key, value, CalendarVersion, partsArray); internal override void AddString(CalendarStringsEnum key, CalendarValueInfo value) => - AddString(key, value, CalendarVersion, strings, componentName); + AddString(key, value, CalendarVersion, strings); internal override void AddInteger(CalendarIntegersEnum key, CalendarValueInfo value) => - AddInteger(key, value, CalendarVersion, integers, componentName); + AddInteger(key, value, CalendarVersion, integers); internal CalendarOtherComponent(Version version, string componentName) : base(version) diff --git a/VisualCard.Calendar/Parts/CalendarStandard.cs b/VisualCard.Calendar/Parts/CalendarStandard.cs index 56425cf..72e7afe 100644 --- a/VisualCard.Calendar/Parts/CalendarStandard.cs +++ b/VisualCard.Calendar/Parts/CalendarStandard.cs @@ -63,7 +63,7 @@ public class CalendarStandard : Calendar, IEquatable public override TPart[] GetPartsArray() { // Get the parts enumeration according to the type - var key = VCalendarParserTools.GetPartsArrayEnumFromType(typeof(TPart), VCalendarConstants._objectVStandardSpecifier, CalendarVersion, GetType()); + var key = VCalendarParserTools.GetPartsArrayEnumFromType(typeof(TPart), CalendarVersion, GetType()); // Now, return the value return GetPartsArray(key, CalendarVersion, partsArray); @@ -85,7 +85,7 @@ public override TPart[] GetPartsArray(CalendarPartsArrayEnum key) => public override BaseCalendarPartInfo[] GetPartsArray(CalendarPartsArrayEnum key) { string prefix = VCalendarParserTools.GetPrefixFromPartsArrayEnum(key); - var partType = VCalendarParserTools.GetPartType(prefix, "", CalendarVersion, typeof(CalendarStandard)); + var partType = VCalendarParserTools.GetPartType(prefix, CalendarVersion, typeof(CalendarStandard)); if (partType.enumType is null) throw new ArgumentException($"Enumeration type is not found for {key}"); return GetPartsArray(partType.enumType, key, CalendarVersion, partsArray); @@ -171,13 +171,13 @@ public override int GetHashCode() => !a.Equals(b); internal override void AddPartToArray(CalendarPartsArrayEnum key, BaseCalendarPartInfo value) => - AddPartToArray(key, value, CalendarVersion, partsArray, VCalendarConstants._objectVStandardSpecifier); + AddPartToArray(key, value, CalendarVersion, partsArray); internal override void AddString(CalendarStringsEnum key, CalendarValueInfo value) => - AddString(key, value, CalendarVersion, strings, VCalendarConstants._objectVStandardSpecifier); + AddString(key, value, CalendarVersion, strings); internal override void AddInteger(CalendarIntegersEnum key, CalendarValueInfo value) => - AddInteger(key, value, CalendarVersion, integers, VCalendarConstants._objectVStandardSpecifier); + AddInteger(key, value, CalendarVersion, integers); internal CalendarStandard(Version version) : base(version) diff --git a/VisualCard.Calendar/Parts/CalendarTimeZone.cs b/VisualCard.Calendar/Parts/CalendarTimeZone.cs index 364f6b1..66a9e8f 100644 --- a/VisualCard.Calendar/Parts/CalendarTimeZone.cs +++ b/VisualCard.Calendar/Parts/CalendarTimeZone.cs @@ -77,7 +77,7 @@ public class CalendarTimeZone : Calendar, IEquatable public override TPart[] GetPartsArray() { // Get the parts enumeration according to the type - var key = VCalendarParserTools.GetPartsArrayEnumFromType(typeof(TPart), VCalendarConstants._objectVTimeZoneSpecifier, CalendarVersion, GetType()); + var key = VCalendarParserTools.GetPartsArrayEnumFromType(typeof(TPart), CalendarVersion, GetType()); // Now, return the value return GetPartsArray(key, CalendarVersion, partsArray); @@ -99,7 +99,7 @@ public override TPart[] GetPartsArray(CalendarPartsArrayEnum key) => public override BaseCalendarPartInfo[] GetPartsArray(CalendarPartsArrayEnum key) { string prefix = VCalendarParserTools.GetPrefixFromPartsArrayEnum(key); - var partType = VCalendarParserTools.GetPartType(prefix, "", CalendarVersion, typeof(CalendarTimeZone)); + var partType = VCalendarParserTools.GetPartType(prefix, CalendarVersion, typeof(CalendarTimeZone)); if (partType.enumType is null) throw new ArgumentException($"Enumeration type is not found for {key}"); return GetPartsArray(partType.enumType, key, CalendarVersion, partsArray); @@ -189,13 +189,13 @@ public override int GetHashCode() => !a.Equals(b); internal override void AddPartToArray(CalendarPartsArrayEnum key, BaseCalendarPartInfo value) => - AddPartToArray(key, value, CalendarVersion, partsArray, VCalendarConstants._objectVTimeZoneSpecifier); + AddPartToArray(key, value, CalendarVersion, partsArray); internal override void AddString(CalendarStringsEnum key, CalendarValueInfo value) => - AddString(key, value, CalendarVersion, strings, VCalendarConstants._objectVTimeZoneSpecifier); + AddString(key, value, CalendarVersion, strings); internal override void AddInteger(CalendarIntegersEnum key, CalendarValueInfo value) => - AddInteger(key, value, CalendarVersion, integers, VCalendarConstants._objectVTimeZoneSpecifier); + AddInteger(key, value, CalendarVersion, integers); internal CalendarTimeZone(Version version) : base(version) diff --git a/VisualCard.Calendar/Parts/CalendarTodo.cs b/VisualCard.Calendar/Parts/CalendarTodo.cs index 62417c7..d4d9b0c 100644 --- a/VisualCard.Calendar/Parts/CalendarTodo.cs +++ b/VisualCard.Calendar/Parts/CalendarTodo.cs @@ -70,7 +70,7 @@ public class CalendarTodo : Calendar, IEquatable public override TPart[] GetPartsArray() { // Get the parts enumeration according to the type - var key = VCalendarParserTools.GetPartsArrayEnumFromType(typeof(TPart), VCalendarConstants._objectVTodoSpecifier, CalendarVersion, GetType()); + var key = VCalendarParserTools.GetPartsArrayEnumFromType(typeof(TPart), CalendarVersion, GetType()); // Now, return the value return GetPartsArray(key, CalendarVersion, partsArray); @@ -92,7 +92,7 @@ public override TPart[] GetPartsArray(CalendarPartsArrayEnum key) => public override BaseCalendarPartInfo[] GetPartsArray(CalendarPartsArrayEnum key) { string prefix = VCalendarParserTools.GetPrefixFromPartsArrayEnum(key); - var partType = VCalendarParserTools.GetPartType(prefix, "", CalendarVersion, typeof(CalendarTodo)); + var partType = VCalendarParserTools.GetPartType(prefix, CalendarVersion, typeof(CalendarTodo)); if (partType.enumType is null) throw new ArgumentException($"Enumeration type is not found for {key}"); return GetPartsArray(partType.enumType, key, CalendarVersion, partsArray); @@ -180,13 +180,13 @@ public override int GetHashCode() => !a.Equals(b); internal override void AddPartToArray(CalendarPartsArrayEnum key, BaseCalendarPartInfo value) => - AddPartToArray(key, value, CalendarVersion, partsArray, VCalendarConstants._objectVTodoSpecifier); + AddPartToArray(key, value, CalendarVersion, partsArray); internal override void AddString(CalendarStringsEnum key, CalendarValueInfo value) => - AddString(key, value, CalendarVersion, strings, VCalendarConstants._objectVTodoSpecifier); + AddString(key, value, CalendarVersion, strings); internal override void AddInteger(CalendarIntegersEnum key, CalendarValueInfo value) => - AddInteger(key, value, CalendarVersion, integers, VCalendarConstants._objectVTodoSpecifier); + AddInteger(key, value, CalendarVersion, integers); internal CalendarTodo(Version version) : base(version)