From 924e636e881cd46d6627326c56c360f864f448ec Mon Sep 17 00:00:00 2001 From: inga-lovinde <52715130+inga-lovinde@users.noreply.github.com> Date: Wed, 7 Jul 2010 22:15:04 +0000 Subject: [PATCH] Fixes in ShallerDBProcessor --- ImportConsole/ShallerDBProcessor.cs | 1 + Importer/DictionaryConverter.cs | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ImportConsole/ShallerDBProcessor.cs b/ImportConsole/ShallerDBProcessor.cs index 6e06776..e5cce28 100644 --- a/ImportConsole/ShallerDBProcessor.cs +++ b/ImportConsole/ShallerDBProcessor.cs @@ -270,6 +270,7 @@ namespace FLocal.ImportConsole { } } + Console.WriteLine("Finished parsing"); Console.ReadLine(); int j=0; foreach(var insert in inserts) { diff --git a/Importer/DictionaryConverter.cs b/Importer/DictionaryConverter.cs index abaf0a5..7aa57de 100644 --- a/Importer/DictionaryConverter.cs +++ b/Importer/DictionaryConverter.cs @@ -13,8 +13,10 @@ namespace FLocal.Importer { public static Dictionary FromDump(string dump) { Dictionary result = new Dictionary(); - foreach(var kvp in (from elem in dump.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries) let parts = elem.Split(new char[] { '=' }, 2) select new KeyValuePair(HttpUtility.UrlDecode(parts[0], ShallerConnector.encoding), HttpUtility.UrlDecode(parts[1], ShallerConnector.encoding)))) { - result[kvp.Key] = kvp.Value; + foreach(var str in dump.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)) {// let parts = elem.Split(new char[] { '=' }, 2) select new KeyValuePair(HttpUtility.UrlDecode(parts[0], ShallerConnector.encoding), HttpUtility.UrlDecode(parts[1], ShallerConnector.encoding)))) { + 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; }