src/HarmonyHub/StringExtensions.cs
/// <summary>
/// Converts a Logitech param string into a dictionary.
/// </summary>
/// <param name="paramString">String to parse.</param>
/// <returns>A dictionary of parameters.</returns>
Converts a Logitech param string into a dictionary.
Converts a Logitech param string into a dictionary .
public static IDictionary<string, string> ToParamDictionary(this string paramString)
        {
            var result = new Dictionary<string, string>();
            var parameters = paramString.Split(':');
            foreach (var parameter in parameters)
            {
                var parts = parameter.Split('=');
                if (parts.Length != 2)
                {
                    throw new ArgumentException("String conversion to KeyValuePair failed on incorrect format");
                }
                result.Add(parts[0], parts[1]);
            }
            return result;
        }
public static IDictionary < string , string > ToParamDictionary ( this string paramString ) { var result = new Dictionary < string , string > ( ) ; var parameters = paramString . Split ( ' ' ) ; foreach ( var parameter in parameters ) { var parts = parameter . Split ( ' ' ) ; if ( parts . Length != 2 ) { throw new ArgumentException ( " " ) ; } result . Add ( parts [ 0 ] , parts [ 1 ] ) ; } return result ; }
Converts a Logitech param string into a dictionary.
Converts a Logitech param string into a dictionary .
A dictionary of parameters.
A dictionary of parameters .
string
this
paramString
String to parse.
String to parse .