/// <summary> /// Parses the connection string into component parts /// </summary> /// <param name="connectionString">The connection string to parse</param> /// <returns>An array of key-value pairs representing each parameter of the connection string</returns> internal static System.Collections.Generic.SortedList <string, string> ParseConnectionString(string connectionString) { string s = connectionString; int n; SortedList <string, string> ls = new SortedList <string, string>(StringComparer.OrdinalIgnoreCase); // First split into semi-colon delimited values. The Split() function of SQLiteBase accounts for and properly // skips semi-colons in quoted strings string[] arParts = SQLiteConvert.Split(s, ';'); int x = arParts.Length; // For each semi-colon piece, split into key and value pairs by the presence of the = sign for (n = 0; n < x; n++) { int indexOf = arParts[n].IndexOf('='); if (indexOf != -1) { ls.Add(arParts[n].Substring(0, indexOf), arParts[n].Substring(indexOf + 1)); } else { throw new ArgumentException(String.Format(System.Globalization.CultureInfo.CurrentCulture, "Invalid ConnectionString format for part \"{0}\"", arParts[n])); } } return(ls); }