style: remove repeated code, group in tasks
This commit is contained in:
+13
-18
@@ -10,33 +10,28 @@ if (!hasInitialized)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Info("Getting character data and icons");
|
var dumpTasks = new (string Name, Action Execute)[]
|
||||||
|
{
|
||||||
|
("character", () => { dumper.DumpCharacters(); dumper.DumpCharacterIcons(); }),
|
||||||
|
("item", () => { dumper.DumpItems(); dumper.DumpItemIcons(); }),
|
||||||
|
("offering", () => { dumper.DumpOfferings(); dumper.DumpOfferingIcons(); })
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (var task in dumpTasks)
|
||||||
|
{
|
||||||
|
log.Info($"Getting {task.Name} data and icons");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
dumper.DumpCharacters();
|
task.Execute();
|
||||||
dumper.DumpCharacterIcons();
|
|
||||||
}
|
}
|
||||||
catch (Exception er)
|
catch (Exception er)
|
||||||
{
|
{
|
||||||
log.Error("Error while dumping characters");
|
log.Error($"Error while dumping {task.Name}s");
|
||||||
log.Error("Exception: {0}", er.ToString());
|
log.Error("Exception: {0}", er.ToString());
|
||||||
Console.ReadKey();
|
Console.ReadKey();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Info("Getting item data and icons");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
dumper.DumpItems();
|
|
||||||
dumper.DumpItemIcons();
|
|
||||||
}
|
|
||||||
catch (Exception er)
|
|
||||||
{
|
|
||||||
log.Error("Error while dumping items");
|
|
||||||
log.Error("Exception: {0}", er.ToString());
|
|
||||||
Console.ReadKey();
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Info("Dump finished");
|
log.Info("Dump finished");
|
||||||
|
|||||||
Reference in New Issue
Block a user