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) {
|
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) {
|
if (activeSettingName.Equals("") && this.PTMagicConfiguration.GeneralSettings.Application.TestMode) {
|
||||||
activeSettingName = this.ActiveSetting;
|
activeSettingName = this.ActiveSetting;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,10 +46,10 @@ namespace Core.ProfitTrailer {
|
||||||
return result;
|
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 = "";
|
string result = "";
|
||||||
|
|
||||||
foreach (string line in pairsLines) {
|
foreach (string line in ptmagicInstance.PairsLines) {
|
||||||
if (line.IndexOf("PTMagic_ActiveSetting", StringComparison.InvariantCultureIgnoreCase) > -1) {
|
if (line.IndexOf("PTMagic_ActiveSetting", StringComparison.InvariantCultureIgnoreCase) > -1) {
|
||||||
result = line.Replace("PTMagic_ActiveSetting", "", StringComparison.InvariantCultureIgnoreCase);
|
result = line.Replace("PTMagic_ActiveSetting", "", StringComparison.InvariantCultureIgnoreCase);
|
||||||
result = result.Replace("#", "");
|
result = result.Replace("#", "");
|
||||||
|
@ -59,24 +59,26 @@ namespace Core.ProfitTrailer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result.Equals("")) {
|
if (result.Equals("Default")) {
|
||||||
SettingsHandler.WriteHeaderLines(ref pairsLines, defaultSettingName, systemConfiguration);
|
SettingsHandler.WriteHeaderLines("Pairs", ptmagicInstance);
|
||||||
SettingsHandler.WriteHeaderLines(ref dcaLines, defaultSettingName, systemConfiguration);
|
SettingsHandler.WriteHeaderLines("DCA", ptmagicInstance);
|
||||||
SettingsHandler.WriteHeaderLines(ref indicatorsLines, defaultSettingName, systemConfiguration);
|
SettingsHandler.WriteHeaderLines("Indicators", ptmagicInstance);
|
||||||
headerLinesAdded = true;
|
headerLinesAdded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
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
|
// Writing Header lines
|
||||||
lines.Insert(0, "");
|
fileLines.Insert(0, "");
|
||||||
lines.Insert(0, "# ####################################");
|
fileLines.Insert(0, "# ####################################");
|
||||||
lines.Insert(0, "# PTMagic_LastChanged = " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString());
|
fileLines.Insert(0, "# PTMagic_LastChanged = " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString());
|
||||||
lines.Insert(0, "# PTMagic_ActiveSetting = " + SystemHelper.StripBadCode(settingName, Constants.WhiteListProperties));
|
fileLines.Insert(0, "# PTMagic_ActiveSetting = " + SystemHelper.StripBadCode(ptmagicInstance.DefaultSettingName, Constants.WhiteListProperties));
|
||||||
lines.Insert(0, "# ####### PTMagic Current Setting ########");
|
fileLines.Insert(0, "# ####### PTMagic Current Setting ########");
|
||||||
lines.Insert(0, "# ####################################");
|
fileLines.Insert(0, "# ####################################");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Dictionary<string, string> GetPropertiesAsDictionary(List<string> propertyLines) {
|
public static Dictionary<string, string> GetPropertiesAsDictionary(List<string> propertyLines) {
|
||||||
|
|
|
@ -7,7 +7,7 @@ using Core.Helper;
|
||||||
using Core.Main.DataObjects.PTMagicData;
|
using Core.Main.DataObjects.PTMagicData;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
[assembly: AssemblyVersion("2.0.0")]
|
[assembly: AssemblyVersion("2.0.1")]
|
||||||
[assembly: AssemblyProduct("PT Magic")]
|
[assembly: AssemblyProduct("PT Magic")]
|
||||||
|
|
||||||
namespace PTMagic {
|
namespace PTMagic {
|
||||||
|
|
|
@ -1,8 +1,4 @@
|
||||||
# ####################################
|
|
||||||
# ####### PTMagic Current Setting ########
|
|
||||||
# PTMagic_ActiveSetting = Default
|
|
||||||
# PTMagic_LastChanged = 3/26/2018 11:52 AM
|
|
||||||
# ####################################
|
|
||||||
#
|
#
|
||||||
market = USDT
|
market = USDT
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in New Issue