removing BootTasks file
This commit is contained in:
parent
f363f7b4fe
commit
871b59adae
2 changed files with 1 additions and 47 deletions
|
@ -1,40 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Runtime.Serialization.Json;
|
||||
using System.Threading.Tasks;
|
||||
using Geekbot.net.Modules;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace Geekbot.net.Lib
|
||||
{
|
||||
public class BootTasks
|
||||
{
|
||||
public static async Task CheckSettingsFile()
|
||||
{
|
||||
// ToDO: Check settings file, if invalid, reconfig it
|
||||
// Console.WriteLine(Path.GetFullPath("./settings.json"));
|
||||
}
|
||||
|
||||
public static void ParseOldDatabase(string path)
|
||||
{
|
||||
Console.WriteLine("Starting Database Conversion...");
|
||||
path = Path.GetFullPath(path);
|
||||
Console.WriteLine($"Old db location: {path}");
|
||||
var redis = new RedisClient().Client;
|
||||
Console.WriteLine("Connected to Redis...");
|
||||
var allfiles = Directory.GetFiles(path, "*.json", SearchOption.AllDirectories);
|
||||
foreach ( var file in allfiles)
|
||||
{
|
||||
var info = new FileInfo(file);
|
||||
if (info.Name.StartsWith("-")) continue;
|
||||
Console.WriteLine(info.FullName);
|
||||
dynamic json = JObject.Parse(File.ReadAllText(file));
|
||||
var key = info.Name.Substring(0, info.Name.Length - 5) + "-messages";
|
||||
Console.WriteLine($"{key} - {json.messages}");
|
||||
redis.StringSet(key, json.messages.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -26,12 +26,6 @@ namespace Geekbot.net
|
|||
Console.WriteLine("=========================================");
|
||||
Console.WriteLine("Starting...");
|
||||
|
||||
//Task.WaitAll(BootTasks.CheckSettingsFile());
|
||||
if (args.Length == 2 && args[0] == "--parse-db")
|
||||
{
|
||||
BootTasks.ParseOldDatabase(args[1]);
|
||||
Environment.Exit(1);
|
||||
}
|
||||
Task.WaitAll(new Program().MainAsync());
|
||||
}
|
||||
|
||||
|
@ -143,4 +137,4 @@ namespace Geekbot.net
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue