From d7716d9101b0cde3359a84fb55398275fc502e3c Mon Sep 17 00:00:00 2001 From: djbadders <34887832+djbadders@users.noreply.github.com> Date: Sun, 17 Mar 2019 08:03:07 +0000 Subject: [PATCH] Stop PTM writing file headers to preset files --- Core/ProfitTrailer/SettingsFiles.cs | 32 +++-------------------------- 1 file changed, 3 insertions(+), 29 deletions(-) diff --git a/Core/ProfitTrailer/SettingsFiles.cs b/Core/ProfitTrailer/SettingsFiles.cs index e9350e4..cfb2528 100644 --- a/Core/ProfitTrailer/SettingsFiles.cs +++ b/Core/ProfitTrailer/SettingsFiles.cs @@ -39,20 +39,6 @@ namespace Core.ProfitTrailer } } - public static void WriteHeaderLines(string filePath, string settingName, PTMagicConfiguration systemConfiguration) - { - // Writing Header lines - List lines = File.ReadAllLines(filePath).ToList(); - lines.Insert(0, "#"); - lines.Insert(0, "# ####################################"); - lines.Insert(0, "# PTMagic_LastChanged = " + DateTime.UtcNow.ToShortDateString() + " " + DateTime.UtcNow.ToShortTimeString()); - lines.Insert(0, "# PTMagic_ActiveSetting = " + SystemHelper.StripBadCode(settingName, Constants.WhiteListProperties)); - lines.Insert(0, "# ####### PTMagic Current Setting ########"); - lines.Insert(0, "# ####################################"); - - if (!systemConfiguration.GeneralSettings.Application.TestMode) File.WriteAllLines(filePath, lines); - } - public static string GetActiveSettingFromFile(string filePath, PTMagicConfiguration systemConfiguration, LogHelper log) { string result = ""; @@ -146,11 +132,7 @@ namespace Core.ProfitTrailer string headerPairsSetting = SettingsFiles.GetActiveSettingFromFile(settingPairsPropertiesPath, systemConfiguration, log); if (headerPairsSetting.Equals("")) { - if (File.Exists(settingPairsPropertiesPath)) - { - SettingsFiles.WriteHeaderLines(settingPairsPropertiesPath, setting.SettingName, systemConfiguration); - } - else + if (!File.Exists(settingPairsPropertiesPath)) { Exception ex = new Exception("Not able to find preset file " + SystemHelper.PropertyToString(setting.PairsProperties["File"]) + " for '" + setting.SettingName + "'"); log.DoLogCritical("Not able to find preset file " + SystemHelper.PropertyToString(setting.PairsProperties["File"]) + " for '" + setting.SettingName + "'", ex); @@ -174,11 +156,7 @@ namespace Core.ProfitTrailer string headerDCASetting = SettingsFiles.GetActiveSettingFromFile(settingDCAPropertiesPath, systemConfiguration, log); if (headerDCASetting.Equals("")) { - if (File.Exists(settingDCAPropertiesPath)) - { - SettingsFiles.WriteHeaderLines(settingDCAPropertiesPath, setting.SettingName, systemConfiguration); - } - else + if (!File.Exists(settingDCAPropertiesPath)) { Exception ex = new Exception("Not able to find preset file " + SystemHelper.PropertyToString(setting.DCAProperties["File"]) + " for '" + setting.SettingName + "'"); log.DoLogCritical("Not able to find preset file " + SystemHelper.PropertyToString(setting.DCAProperties["File"]) + " for '" + setting.SettingName + "'", ex); @@ -201,11 +179,7 @@ namespace Core.ProfitTrailer string headerIndicatorsSetting = SettingsFiles.GetActiveSettingFromFile(settingIndicatorsPropertiesPath, systemConfiguration, log); if (headerIndicatorsSetting.Equals("")) { - if (File.Exists(settingIndicatorsPropertiesPath)) - { - SettingsFiles.WriteHeaderLines(settingIndicatorsPropertiesPath, setting.SettingName, systemConfiguration); - } - else + if (!File.Exists(settingIndicatorsPropertiesPath)) { Exception ex = new Exception("Not able to find preset file " + SystemHelper.PropertyToString(setting.IndicatorsProperties["File"]) + " for '" + setting.SettingName + "'"); log.DoLogCritical("Not able to find preset file " + SystemHelper.PropertyToString(setting.IndicatorsProperties["File"]) + " for '" + setting.SettingName + "'", ex);