diff --git a/VisualCard/Parts/BaseCardPartInfo.cs b/VisualCard/Parts/BaseCardPartInfo.cs index 9b30080..bd3b0ff 100644 --- a/VisualCard/Parts/BaseCardPartInfo.cs +++ b/VisualCard/Parts/BaseCardPartInfo.cs @@ -19,8 +19,10 @@ using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Diagnostics; using System.Linq; +using VisualCard.Parsers; namespace VisualCard.Parts { @@ -50,6 +52,31 @@ public abstract class BaseCardPartInfo : IEquatable /// public virtual string ValueType { get; internal set; } + /// + /// Arguments in key/value pair format + /// + public ReadOnlyDictionary ArgumentValues + { + get + { + // Check to see if we have an empty list of arguments + Dictionary values = []; + if (Arguments is null || Arguments.Length == 0) + return new(values); + + // Now, separate a key from a value + foreach (var arg in Arguments) + { + string key = arg.Substring(0, arg.IndexOf(VcardConstants._argumentValueDelimiter)); + string value = arg.Substring(arg.IndexOf(VcardConstants._argumentValueDelimiter) + 1); + values.Add(key, value); + } + + // Now, return a read-only dictionary + return new(values); + } + } + /// /// Checks to see if both the parts are equal ///