From f86e002e8102ace900b16ec78a71fbd2be8c4d5d Mon Sep 17 00:00:00 2001 From: Aptivi CEO Date: Wed, 2 Oct 2024 21:39:03 +0300 Subject: [PATCH] fix - reg - Fixed bugs regarding GetValuesString() --- As per the recent improvements concerning the argument parsing, one of them broke parsing the GetValuesString() function. We've finally fixed it to eliminate many bugs! --- Type: fix Breaking: False Doc Required: False Backport Required: False Part: 1/1 --- VisualCard/Parsers/VcardCommonTools.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/VisualCard/Parsers/VcardCommonTools.cs b/VisualCard/Parsers/VcardCommonTools.cs index 6d26fe1..3905dee 100644 --- a/VisualCard/Parsers/VcardCommonTools.cs +++ b/VisualCard/Parsers/VcardCommonTools.cs @@ -18,6 +18,7 @@ // using System; +using System.Collections.Generic; using System.Globalization; using System.IO; using System.Linq; @@ -473,10 +474,16 @@ internal static string GetValuesString(ArgumentInfo[] args, string @default, str string finalSpecifierName = argSpecifier.EndsWith("=") ? argSpecifier.Substring(0, argSpecifier.Length - 1) : argSpecifier; var argFromSpecifier = args.Where((arg) => arg.Key.Equals(finalSpecifierName, StringComparison.OrdinalIgnoreCase)); + // Flatten the strings + var stringArrays = argFromSpecifier.Select((arg) => arg.AllValues); + List flattened = []; + foreach (var stringArray in stringArrays) + flattened.AddRange(stringArray); + // Attempt to get the value from the key string argString = - argFromSpecifier.Count() > 0 ? - string.Join(VcardConstants._valueDelimiter.ToString(), argFromSpecifier.Select((arg) => arg.AllValues)) : + flattened.Count() > 0 ? + string.Join(VcardConstants._valueDelimiter.ToString(), flattened) : @default; return argString; }