Slight optimization in ShallerDBProcessor

main
Inga 🏳‍🌈 15 years ago
parent 71bf53b960
commit a6147e19cf
  1. 4
      ImportConsole/ShallerDBProcessor.cs

@ -162,7 +162,6 @@ namespace FLocal.ImportConsole {
if(Config.instance.mainConnection.GetCountByConditions(Post.TableSpec.instance, new ComparisonCondition(Post.TableSpec.instance.getIdSpec(), ComparisonType.EQUAL, postId.ToString())) > 0) { if(Config.instance.mainConnection.GetCountByConditions(Post.TableSpec.instance, new ComparisonCondition(Post.TableSpec.instance.getIdSpec(), ComparisonType.EQUAL, postId.ToString())) > 0) {
Console.Write("-"); Console.Write("-");
} else { } else {
inserts.Add(new KeyValuePair<int, Action>(postId, () => {
int localMain = int.Parse(data["Local_Main"]); int localMain = int.Parse(data["Local_Main"]);
int main = int.Parse(data["Main"]); int main = int.Parse(data["Main"]);
int UnixTime; int UnixTime;
@ -205,6 +204,7 @@ namespace FLocal.ImportConsole {
if(data.ContainsKey("Layer")) { if(data.ContainsKey("Layer")) {
layer = PostLayer.LoadById(int.Parse(data["Layer"])); layer = PostLayer.LoadById(int.Parse(data["Layer"]));
} }
inserts.Add(new KeyValuePair<int, Action>(postId, () => {
if(postId == main || postId == localMain) { if(postId == main || postId == localMain) {
//first post in the thread //first post in the thread
string legacyBoardName; string legacyBoardName;
@ -237,8 +237,8 @@ namespace FLocal.ImportConsole {
} }
post.Reply(user, title, body, layer, date, postId); post.Reply(user, title, body, layer, date, postId);
} }
Console.Write("+");
})); }));
Console.Write("+");
} }
} catch(Exception e) { } catch(Exception e) {
Console.Error.WriteLine("Cannot process post #" + postId + ": " + e.GetType().FullName + ": " + e.Message); Console.Error.WriteLine("Cannot process post #" + postId + ": " + e.GetType().FullName + ": " + e.Message);

Loading…
Cancel
Save