First part of fixing issue that leads to global properties not getting written to PT
This commit is contained in:
parent
e7bd3ec8ba
commit
1b6a05676b
|
@ -1067,7 +1067,7 @@ namespace Core.Main {
|
|||
}
|
||||
|
||||
private void ActivateSetting(ref bool headerLinesAdded, ref GlobalSetting triggeredSetting, ref List<string> matchedTriggers) {
|
||||
string activeSettingName = SettingsHandler.GetActiveSetting(this.PTMagicConfiguration, this.DefaultSettingName, ref headerLinesAdded, this.PairsLines, this.DCALines, this.IndicatorsLines, this.Log);
|
||||
string activeSettingName = SettingsHandler.GetActiveSetting(this, ref headerLinesAdded);
|
||||
if (activeSettingName.Equals("") && this.PTMagicConfiguration.GeneralSettings.Application.TestMode) {
|
||||
activeSettingName = this.ActiveSetting;
|
||||
}
|
||||
|
|
|
@ -46,10 +46,10 @@ namespace Core.ProfitTrailer {
|
|||
return result;
|
||||
}
|
||||
|
||||
public static string GetActiveSetting(PTMagicConfiguration systemConfiguration, string defaultSettingName, ref bool headerLinesAdded, List<string> pairsLines, List<string> dcaLines, List<string> indicatorsLines, LogHelper log) {
|
||||
public static string GetActiveSetting(PTMagic ptmagicInstance, ref bool headerLinesAdded) {
|
||||
string result = "";
|
||||
|
||||
foreach (string line in pairsLines) {
|
||||
foreach (string line in ptmagicInstance.PairsLines) {
|
||||
if (line.IndexOf("PTMagic_ActiveSetting", StringComparison.InvariantCultureIgnoreCase) > -1) {
|
||||
result = line.Replace("PTMagic_ActiveSetting", "", StringComparison.InvariantCultureIgnoreCase);
|
||||
result = result.Replace("#", "");
|
||||
|
@ -59,24 +59,26 @@ namespace Core.ProfitTrailer {
|
|||
}
|
||||
}
|
||||
|
||||
if (result.Equals("")) {
|
||||
SettingsHandler.WriteHeaderLines(ref pairsLines, defaultSettingName, systemConfiguration);
|
||||
SettingsHandler.WriteHeaderLines(ref dcaLines, defaultSettingName, systemConfiguration);
|
||||
SettingsHandler.WriteHeaderLines(ref indicatorsLines, defaultSettingName, systemConfiguration);
|
||||
if (result.Equals("Default")) {
|
||||
SettingsHandler.WriteHeaderLines("Pairs", ptmagicInstance);
|
||||
SettingsHandler.WriteHeaderLines("DCA", ptmagicInstance);
|
||||
SettingsHandler.WriteHeaderLines("Indicators", ptmagicInstance);
|
||||
headerLinesAdded = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void WriteHeaderLines(ref List<string> lines, string settingName, PTMagicConfiguration systemConfiguration) {
|
||||
public static void WriteHeaderLines(string fileType, PTMagic ptmagicInstance) {
|
||||
List<string> fileLines = (List<string>)ptmagicInstance.GetType().GetProperty(fileType + "Lines").GetValue(ptmagicInstance, null);
|
||||
|
||||
// Writing Header lines
|
||||
lines.Insert(0, "");
|
||||
lines.Insert(0, "# ####################################");
|
||||
lines.Insert(0, "# PTMagic_LastChanged = " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString());
|
||||
lines.Insert(0, "# PTMagic_ActiveSetting = " + SystemHelper.StripBadCode(settingName, Constants.WhiteListProperties));
|
||||
lines.Insert(0, "# ####### PTMagic Current Setting ########");
|
||||
lines.Insert(0, "# ####################################");
|
||||
fileLines.Insert(0, "");
|
||||
fileLines.Insert(0, "# ####################################");
|
||||
fileLines.Insert(0, "# PTMagic_LastChanged = " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString());
|
||||
fileLines.Insert(0, "# PTMagic_ActiveSetting = " + SystemHelper.StripBadCode(ptmagicInstance.DefaultSettingName, Constants.WhiteListProperties));
|
||||
fileLines.Insert(0, "# ####### PTMagic Current Setting ########");
|
||||
fileLines.Insert(0, "# ####################################");
|
||||
}
|
||||
|
||||
public static Dictionary<string, string> GetPropertiesAsDictionary(List<string> propertyLines) {
|
||||
|
|
|
@ -7,7 +7,7 @@ using Core.Helper;
|
|||
using Core.Main.DataObjects.PTMagicData;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
[assembly: AssemblyVersion("2.0.0")]
|
||||
[assembly: AssemblyVersion("2.0.1")]
|
||||
[assembly: AssemblyProduct("PT Magic")]
|
||||
|
||||
namespace PTMagic {
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
# ####################################
|
||||
# ####### PTMagic Current Setting ########
|
||||
# PTMagic_ActiveSetting = Default
|
||||
# PTMagic_LastChanged = 3/26/2018 11:52 AM
|
||||
# ####################################
|
||||
|
||||
#
|
||||
market = USDT
|
||||
#
|
||||
|
|
Loading…
Reference in New Issue