Fix for PT data file move

Makes PTM work with PT 2.1.0+ after data file move.
This commit is contained in:
djbadders 2018-08-11 00:14:22 +01:00
parent ba2d009d61
commit b282c364b7
2 changed files with 16 additions and 2 deletions

View File

@ -23,7 +23,21 @@ namespace Core.Main.DataObjects {
_ptmBasePath = ptmBasePath;
_systemConfiguration = systemConfiguration;
PTData rawPTData = JsonConvert.DeserializeObject<PTData>(File.ReadAllText(systemConfiguration.GeneralSettings.Application.ProfitTrailerPath + "ProfitTrailerData.json"));
// Find the path to the Profit Trailer data file
string ptDataFilePath = Path.Combine(systemConfiguration.GeneralSettings.Application.ProfitTrailerPath, "data", "ProfitTrailerData.json");
if (!File.Exists(ptDataFilePath))
{
// Try the older location for PT 1.x and PT 2.0.x
ptDataFilePath = Path.Combine(systemConfiguration.GeneralSettings.Application.ProfitTrailerPath, "ProfitTrailerData.json");
if (!File.Exists(ptDataFilePath))
{
// Can't find the Profit Trailer Data
throw new Exception("Unable to load Profit Trailer data file at: " + ptDataFilePath);
}
}
PTData rawPTData = JsonConvert.DeserializeObject<PTData>(File.ReadAllText(ptDataFilePath));
if (rawPTData.SellLogData != null) {
this.BuildSellLogData(rawPTData.SellLogData, _systemConfiguration);
}

View File

@ -7,7 +7,7 @@ using Core.Helper;
using Core.Main.DataObjects.PTMagicData;
using Microsoft.Extensions.DependencyInjection;
[assembly: AssemblyVersion("2.0.3")]
[assembly: AssemblyVersion("2.0.4")]
[assembly: AssemblyProduct("PT Magic")]
namespace PTMagic {