Logger log = new Logger("Main");
Dumper dumper = new Dumper("./dump/");

log.Info("Initializing dumper");
bool hasInitialized = dumper.Init();
if (!hasInitialized)
{
    log.Error("Dumper.InitAsync failed");
    Console.ReadKey();
    return 1;
}

var dumpTasks = new (string Name, Action Execute)[]
{
    ("character", () => { dumper.DumpCharacters(); dumper.DumpCharacterIcons(); }),
    ("item",      () => { dumper.DumpItems();      dumper.DumpItemIcons(); }),
    ("addon",      () => { dumper.DumpAddons();      dumper.DumpAddonIcons(); }),
    ("perk", () => { dumper.DumpPerks(); dumper.DumpPerkIcons(); }),
    ("offering",  () => { dumper.DumpOfferings();  dumper.DumpOfferingIcons(); }),
    ("customization", () => { dumper.DumpCustomizations(); dumper.DumpCustomizationIcons(); }),
    ("dlc", () => { dumper.DumpDLCs(); })
};

foreach (var task in dumpTasks)
{
    log.Info($"Getting {task.Name} data and icons");

    try
    {
        task.Execute();
    }
    catch (Exception er)
    {
        log.Error($"Error while dumping {task.Name}s");
        log.Error("Exception: {0}", er.ToString());
        Console.ReadKey();
        return 1;
    }
}

log.Info("Dump finished");

return 0;