Fixed config issue when no legacy birthday files are found.

This commit is contained in:
JoshuaNavarro 2019-07-07 17:21:01 -07:00
parent 5c8a7d8abb
commit 04b245d41a
1 changed files with 6 additions and 0 deletions

View File

@ -94,7 +94,10 @@ namespace Omegasis.HappyBirthday
if (File.Exists(Path.Combine(HappyBirthday.ModHelper.DirectoryPath, villagerGifts)))
this.defaultBirthdayGifts = HappyBirthday.ModHelper.Data.ReadJsonFile<Dictionary<string, string>>(villagerGifts);
else
{
HappyBirthday.ModHelper.Data.WriteJsonFile<Dictionary<string, string>>(villagerGifts, this.defaultBirthdayGifts);
this.defaultBirthdayGifts = HappyBirthday.ModHelper.Data.ReadJsonFile<Dictionary<string, string>>(villagerGifts);
}
}
else
{
@ -109,6 +112,9 @@ namespace Omegasis.HappyBirthday
{
HappyBirthday.ModMonitor.Log("No birthday gift information found. Loading from internal birthday list and generating villagerGifts.json");
HappyBirthday.ModHelper.Data.WriteJsonFile<Dictionary<string, string>>(villagerGifts, this.defaultBirthdayGifts);
HappyBirthday.Config.useLegacyBirthdayFiles = false;
this.defaultBirthdayGifts = HappyBirthday.ModHelper.Data.ReadJsonFile<Dictionary<string, string>>(villagerGifts);
HappyBirthday.ModHelper.WriteConfig<ModConfig>(HappyBirthday.Config);
}
}
}