private static Task LoadStatpoints() { //StatpointConverter.Load(); //return Task.Delay(1); return(Task.Run(async() => { var serializer = new JsonSerializer { DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate, NullValueHandling = NullValueHandling.Ignore, TypeNameHandling = TypeNameHandling.Auto, Formatting = Formatting.Indented, Converters = { new BoolConverter() } }; try { using (var stream = new StreamReader("Database\\Statpoints.json")) using (var reader = new JsonTextReader(stream)) Collections.Statpoints = serializer.Deserialize <Dictionary <int, Statpoint> >(reader); } catch (Exception ex) { Output.WriteLine(ex); await StatpointConverter.Load(); using (var stream = new StreamWriter("Database\\Statpoints.json")) serializer.Serialize(stream, Collections.Statpoints, Collections.Statpoints.GetType()); } })); }
public static async Task Convert() { try { if (!Directory.Exists("RAW")) { Output.WriteLine("RAW not found! Restoring!"); //await Content.Content.RestoreAsync(); Output.WriteLine("RAW Restored!"); } if (!Directory.Exists("Database")) { Directory.CreateDirectory("Database"); } Output.WriteLine("Rebuilding"); UniqueIdGenerator.Load(); MapManager.Load(@"RAW\ini\GameMap.dat", Environment.CurrentDirectory + "\\RAW\\"); Item.ItemFactory.LoadDb(); await Task.WhenAll(MonsterDb.Load(), PortalDb.Load(), MagicTypeConverter.Load(), ItemBonusConverter.Load(), StatpointConverter.Load(), LevelExpConverter.Load()); NpcDb.Load(); await Db.SaveAsJsonAsync(SaveType.All); } catch (Exception e) { Output.WriteLine(e); Output.WriteLine("N***a, I couldn't load the Db, nor convert your old db. What the f**k are you doing?"); } }