- Fixed issue #527
- Removed release ZIP files from repository Included task.json in .vscode directory
This commit is contained in:
parent
1b6a05676b
commit
59d742c84e
|
@ -5,11 +5,11 @@ _[Ll]ogfiles
|
||||||
_[Ll]og
|
_[Ll]og
|
||||||
_[Ll]ogs
|
_[Ll]ogs
|
||||||
_[Dd]ata
|
_[Dd]ata
|
||||||
|
_[Rr]eleases
|
||||||
_backups
|
_backups
|
||||||
LocalProfitTrailer
|
LocalProfitTrailer
|
||||||
PTMagic/settings.*.json
|
PTMagic/settings.*.json
|
||||||
Monitor/appsettings.json
|
Monitor/appsettings.json
|
||||||
/.vscode/tasks.json
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ Monitor/appsettings.json
|
||||||
.vscode/*
|
.vscode/*
|
||||||
!.vscode/settings.json
|
!.vscode/settings.json
|
||||||
!.vscode/launch.json
|
!.vscode/launch.json
|
||||||
|
!.vscode/tasks.json
|
||||||
!.vscode/extensions.json
|
!.vscode/extensions.json
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,109 @@
|
||||||
|
{
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"label": "VS build PTMagic",
|
||||||
|
"command": "dotnet",
|
||||||
|
"type": "process",
|
||||||
|
"args": [
|
||||||
|
"build",
|
||||||
|
"PTMagic"
|
||||||
|
],
|
||||||
|
"group": {
|
||||||
|
"kind":"build",
|
||||||
|
"isDefault": true
|
||||||
|
},
|
||||||
|
"presentation": {
|
||||||
|
"reveal": "always",
|
||||||
|
"focus": true
|
||||||
|
},
|
||||||
|
"problemMatcher": "$msCompile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "VS build Monitor",
|
||||||
|
"command": "dotnet",
|
||||||
|
"type": "process",
|
||||||
|
"args": [
|
||||||
|
"build",
|
||||||
|
"Monitor"
|
||||||
|
],
|
||||||
|
"presentation": {
|
||||||
|
"reveal": "always",
|
||||||
|
"focus": true
|
||||||
|
},
|
||||||
|
"problemMatcher": "$msCompile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "VS run PTMagic",
|
||||||
|
"command": "dotnet",
|
||||||
|
"type": "process",
|
||||||
|
"args": [
|
||||||
|
"run",
|
||||||
|
"-p",
|
||||||
|
"PTMagic"
|
||||||
|
],
|
||||||
|
"dependsOn": [
|
||||||
|
"VS build PTMagic"
|
||||||
|
],
|
||||||
|
"presentation": {
|
||||||
|
"reveal": "always"
|
||||||
|
},
|
||||||
|
"problemMatcher": "$msCompile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "VS run Monitor",
|
||||||
|
"command": "dotnet",
|
||||||
|
"type": "process",
|
||||||
|
"args": [
|
||||||
|
"run",
|
||||||
|
"-p",
|
||||||
|
"Monitor"
|
||||||
|
],
|
||||||
|
"dependsOn": [
|
||||||
|
"VS build Monitor"
|
||||||
|
],
|
||||||
|
"presentation": {
|
||||||
|
"reveal": "always"
|
||||||
|
},
|
||||||
|
"problemMatcher": "$msCompile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "VS publish PTMagic",
|
||||||
|
"command": "dotnet",
|
||||||
|
"type": "process",
|
||||||
|
"args": [
|
||||||
|
"publish",
|
||||||
|
"PTMagic",
|
||||||
|
"-c",
|
||||||
|
"Release",
|
||||||
|
"-o",
|
||||||
|
"${workspaceFolder}/PTMagic/bin/Release/PublishOutput"
|
||||||
|
],
|
||||||
|
"presentation": {
|
||||||
|
"reveal": "always",
|
||||||
|
"panel": "new",
|
||||||
|
"focus": true
|
||||||
|
},
|
||||||
|
"problemMatcher": "$msCompile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "VS publish Monitor",
|
||||||
|
"command": "dotnet",
|
||||||
|
"type": "process",
|
||||||
|
"args": [
|
||||||
|
"publish",
|
||||||
|
"Monitor",
|
||||||
|
"-c",
|
||||||
|
"Release",
|
||||||
|
"-o",
|
||||||
|
"${workspaceFolder}/PTMagic/bin/Release/PublishOutput/Monitor"
|
||||||
|
],
|
||||||
|
"presentation": {
|
||||||
|
"reveal": "always",
|
||||||
|
"panel": "new",
|
||||||
|
"focus": true
|
||||||
|
},
|
||||||
|
"problemMatcher": "$msCompile"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -1090,7 +1090,7 @@ namespace Core.Main {
|
||||||
|
|
||||||
// Setting not set => Change setting
|
// Setting not set => Change setting
|
||||||
this.Log.DoLogInfo("Switching global settings to '" + triggeredSetting.SettingName + "'...");
|
this.Log.DoLogInfo("Switching global settings to '" + triggeredSetting.SettingName + "'...");
|
||||||
SettingsHandler.CompileProperties(this.DefaultSettingName, triggeredSetting, this.PTMagicConfiguration, this.PairsLines, this.DCALines, this.IndicatorsLines, this.Log);
|
SettingsHandler.CompileProperties(this, triggeredSetting);
|
||||||
this.GlobalSettingWritten = true;
|
this.GlobalSettingWritten = true;
|
||||||
this.Log.DoLogInfo("Setting '" + triggeredSetting.SettingName + "' now active!");
|
this.Log.DoLogInfo("Setting '" + triggeredSetting.SettingName + "' now active!");
|
||||||
|
|
||||||
|
|
|
@ -79,6 +79,8 @@ namespace Core.ProfitTrailer {
|
||||||
fileLines.Insert(0, "# PTMagic_ActiveSetting = " + SystemHelper.StripBadCode(ptmagicInstance.DefaultSettingName, Constants.WhiteListProperties));
|
fileLines.Insert(0, "# PTMagic_ActiveSetting = " + SystemHelper.StripBadCode(ptmagicInstance.DefaultSettingName, Constants.WhiteListProperties));
|
||||||
fileLines.Insert(0, "# ####### PTMagic Current Setting ########");
|
fileLines.Insert(0, "# ####### PTMagic Current Setting ########");
|
||||||
fileLines.Insert(0, "# ####################################");
|
fileLines.Insert(0, "# ####################################");
|
||||||
|
|
||||||
|
ptmagicInstance.GetType().GetProperty(fileType + "Lines").SetValue(ptmagicInstance, fileLines);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Dictionary<string, string> GetPropertiesAsDictionary(List<string> propertyLines) {
|
public static Dictionary<string, string> GetPropertiesAsDictionary(List<string> propertyLines) {
|
||||||
|
@ -112,26 +114,29 @@ namespace Core.ProfitTrailer {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void CompileProperties(string defaultSettingName, GlobalSetting setting, PTMagicConfiguration systemConfiguration, List<string> pairsLines, List<string> dcaLines, List<string> indicatorsLines, LogHelper log) {
|
public static void CompileProperties(PTMagic ptmagicInstance, GlobalSetting setting) {
|
||||||
SettingsHandler.BuildPropertyLines(ref pairsLines, defaultSettingName, setting, setting.PairsProperties, "pairs", systemConfiguration, log);
|
SettingsHandler.BuildPropertyLines("Pairs", ptmagicInstance, setting);
|
||||||
SettingsHandler.BuildPropertyLines(ref dcaLines, defaultSettingName, setting, setting.DCAProperties, "dca", systemConfiguration, log);
|
SettingsHandler.BuildPropertyLines("DCA", ptmagicInstance, setting);
|
||||||
SettingsHandler.BuildPropertyLines(ref indicatorsLines, defaultSettingName, setting, setting.IndicatorsProperties, "indicators", systemConfiguration, log);
|
SettingsHandler.BuildPropertyLines("Indicators", ptmagicInstance, setting);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void BuildPropertyLines(ref List<string> lines, string defaultSettingName, GlobalSetting setting, Dictionary<string, object> properties, string propertiesType, PTMagicConfiguration systemConfiguration, LogHelper log) {
|
public static void BuildPropertyLines(string fileType, PTMagic ptmagicInstance, GlobalSetting setting) {
|
||||||
List<string> result = new List<string>();
|
List<string> result = new List<string>();
|
||||||
|
|
||||||
|
List<string> fileLines = (List<string>)ptmagicInstance.GetType().GetProperty(fileType + "Lines").GetValue(ptmagicInstance, null);
|
||||||
|
|
||||||
|
Dictionary<string, object> properties = (Dictionary<string, object>)setting.GetType().GetProperty(fileType + "Properties").GetValue(setting, null);
|
||||||
if (properties != null) {
|
if (properties != null) {
|
||||||
|
|
||||||
// Building Properties
|
// Building Properties
|
||||||
if (!setting.SettingName.Equals(defaultSettingName, StringComparison.InvariantCultureIgnoreCase) && systemConfiguration.GeneralSettings.Application.AlwaysLoadDefaultBeforeSwitch && !properties.ContainsKey("File")) {
|
if (!setting.SettingName.Equals(ptmagicInstance.DefaultSettingName, StringComparison.InvariantCultureIgnoreCase) && ptmagicInstance.PTMagicConfiguration.GeneralSettings.Application.AlwaysLoadDefaultBeforeSwitch && !properties.ContainsKey("File")) {
|
||||||
|
|
||||||
// Load default settings as basis for the switch
|
// Load default settings as basis for the switch
|
||||||
GlobalSetting defaultSetting = systemConfiguration.AnalyzerSettings.GlobalSettings.Find(a => a.SettingName.Equals(defaultSettingName, StringComparison.InvariantCultureIgnoreCase));
|
GlobalSetting defaultSetting = ptmagicInstance.PTMagicConfiguration.AnalyzerSettings.GlobalSettings.Find(a => a.SettingName.Equals(ptmagicInstance.DefaultSettingName, StringComparison.InvariantCultureIgnoreCase));
|
||||||
if (defaultSetting != null) {
|
if (defaultSetting != null) {
|
||||||
|
|
||||||
Dictionary<string, object> defaultProperties = new Dictionary<string, object>();
|
Dictionary<string, object> defaultProperties = new Dictionary<string, object>();
|
||||||
switch (propertiesType) {
|
switch (fileType.ToLower()) {
|
||||||
case "pairs":
|
case "pairs":
|
||||||
defaultProperties = defaultSetting.PairsProperties;
|
defaultProperties = defaultSetting.PairsProperties;
|
||||||
break;
|
break;
|
||||||
|
@ -144,18 +149,18 @@ namespace Core.ProfitTrailer {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (defaultProperties.ContainsKey("File")) {
|
if (defaultProperties.ContainsKey("File")) {
|
||||||
lines = SettingsFiles.GetPresetFileLinesAsList(defaultSetting.SettingName, defaultProperties["File"].ToString(), systemConfiguration);
|
fileLines = SettingsFiles.GetPresetFileLinesAsList(defaultSetting.SettingName, defaultProperties["File"].ToString(), ptmagicInstance.PTMagicConfiguration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Check if settings are configured in a seperate file
|
// Check if settings are configured in a seperate file
|
||||||
if (properties.ContainsKey("File")) {
|
if (properties.ContainsKey("File")) {
|
||||||
lines = SettingsFiles.GetPresetFileLinesAsList(setting.SettingName, properties["File"].ToString(), systemConfiguration);
|
fileLines = SettingsFiles.GetPresetFileLinesAsList(setting.SettingName, properties["File"].ToString(), ptmagicInstance.PTMagicConfiguration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (string line in lines) {
|
foreach (string line in fileLines) {
|
||||||
if (line.IndexOf("PTMagic_ActiveSetting", StringComparison.InvariantCultureIgnoreCase) > -1) {
|
if (line.IndexOf("PTMagic_ActiveSetting", StringComparison.InvariantCultureIgnoreCase) > -1) {
|
||||||
|
|
||||||
// Setting current active setting
|
// Setting current active setting
|
||||||
|
@ -184,7 +189,7 @@ namespace Core.ProfitTrailer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lines = result;
|
ptmagicInstance.GetType().GetProperty(fileType + "Lines").SetValue(ptmagicInstance, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<string> BuildPropertyLine(List<string> result, string settingName, string line, Dictionary<string, object> properties, string settingProperty) {
|
public static List<string> BuildPropertyLine(List<string> result, string settingName, string line, Dictionary<string, object> properties, string settingProperty) {
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
# ####################################
|
||||||
|
# ####### PTMagic Current Setting ########
|
||||||
|
# PTMagic_ActiveSetting = Default
|
||||||
|
# PTMagic_LastChanged = 23.05.2018 07:27
|
||||||
|
# ####################################
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
market = USDT
|
market = USDT
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue