Fixes in ShallerDBProcessor

main
Inga 🏳‍🌈 15 years ago
parent a64ebdb987
commit 924e636e88
  1. 1
      ImportConsole/ShallerDBProcessor.cs
  2. 6
      Importer/DictionaryConverter.cs

@ -270,6 +270,7 @@ namespace FLocal.ImportConsole {
} }
} }
Console.WriteLine("Finished parsing");
Console.ReadLine(); Console.ReadLine();
int j=0; int j=0;
foreach(var insert in inserts) { foreach(var insert in inserts) {

@ -13,8 +13,10 @@ namespace FLocal.Importer {
public static Dictionary<string, string> FromDump(string dump) { public static Dictionary<string, string> FromDump(string dump) {
Dictionary<string, string> result = new Dictionary<string,string>(); Dictionary<string, string> result = new Dictionary<string,string>();
foreach(var kvp in (from elem in dump.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries) let parts = elem.Split(new char[] { '=' }, 2) select new KeyValuePair<string, string>(HttpUtility.UrlDecode(parts[0], ShallerConnector.encoding), HttpUtility.UrlDecode(parts[1], ShallerConnector.encoding)))) { foreach(var str in dump.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)) {// let parts = elem.Split(new char[] { '=' }, 2) select new KeyValuePair<string, string>(HttpUtility.UrlDecode(parts[0], ShallerConnector.encoding), HttpUtility.UrlDecode(parts[1], ShallerConnector.encoding)))) {
result[kvp.Key] = kvp.Value; string[] parts = str.Split(new char[] { '=' }, 2);
if(parts.Length != 2) throw new ApplicationException("wrong parts count " + parts.Length);
result[parts[0]] = parts[1];
} }
return result; return result;
} }

Loading…
Cancel
Save