- Fixed issue #527

- Removed release ZIP files from repository

Included task.json in .vscode directory
This commit is contained in:
Legedric 2018-05-23 07:44:31 +02:00
parent 1b6a05676b
commit 59d742c84e
7 changed files with 135 additions and 14 deletions

3
.gitignore vendored
View File

@ -5,11 +5,11 @@ _[Ll]ogfiles
_[Ll]og
_[Ll]ogs
_[Dd]ata
_[Rr]eleases
_backups
LocalProfitTrailer
PTMagic/settings.*.json
Monitor/appsettings.json
/.vscode/tasks.json
@ -19,6 +19,7 @@ Monitor/appsettings.json
.vscode/*
!.vscode/settings.json
!.vscode/launch.json
!.vscode/tasks.json
!.vscode/extensions.json

109
.vscode/tasks.json vendored Normal file
View File

@ -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"
}
]
}

View File

@ -1090,7 +1090,7 @@ namespace Core.Main {
// Setting not set => Change setting
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.Log.DoLogInfo("Setting '" + triggeredSetting.SettingName + "' now active!");

View File

@ -79,6 +79,8 @@ namespace Core.ProfitTrailer {
fileLines.Insert(0, "# PTMagic_ActiveSetting = " + SystemHelper.StripBadCode(ptmagicInstance.DefaultSettingName, Constants.WhiteListProperties));
fileLines.Insert(0, "# ####### PTMagic Current Setting ########");
fileLines.Insert(0, "# ####################################");
ptmagicInstance.GetType().GetProperty(fileType + "Lines").SetValue(ptmagicInstance, fileLines);
}
public static Dictionary<string, string> GetPropertiesAsDictionary(List<string> propertyLines) {
@ -112,26 +114,29 @@ namespace Core.ProfitTrailer {
return result;
}
public static void CompileProperties(string defaultSettingName, GlobalSetting setting, PTMagicConfiguration systemConfiguration, List<string> pairsLines, List<string> dcaLines, List<string> indicatorsLines, LogHelper log) {
SettingsHandler.BuildPropertyLines(ref pairsLines, defaultSettingName, setting, setting.PairsProperties, "pairs", systemConfiguration, log);
SettingsHandler.BuildPropertyLines(ref dcaLines, defaultSettingName, setting, setting.DCAProperties, "dca", systemConfiguration, log);
SettingsHandler.BuildPropertyLines(ref indicatorsLines, defaultSettingName, setting, setting.IndicatorsProperties, "indicators", systemConfiguration, log);
public static void CompileProperties(PTMagic ptmagicInstance, GlobalSetting setting) {
SettingsHandler.BuildPropertyLines("Pairs", ptmagicInstance, setting);
SettingsHandler.BuildPropertyLines("DCA", ptmagicInstance, setting);
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> 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) {
// 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
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) {
Dictionary<string, object> defaultProperties = new Dictionary<string, object>();
switch (propertiesType) {
switch (fileType.ToLower()) {
case "pairs":
defaultProperties = defaultSetting.PairsProperties;
break;
@ -144,18 +149,18 @@ namespace Core.ProfitTrailer {
}
if (defaultProperties.ContainsKey("File")) {
lines = SettingsFiles.GetPresetFileLinesAsList(defaultSetting.SettingName, defaultProperties["File"].ToString(), systemConfiguration);
fileLines = SettingsFiles.GetPresetFileLinesAsList(defaultSetting.SettingName, defaultProperties["File"].ToString(), ptmagicInstance.PTMagicConfiguration);
}
}
} else {
// Check if settings are configured in a seperate 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) {
// 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) {

View File

@ -1,3 +1,9 @@
# ####################################
# ####### PTMagic Current Setting ########
# PTMagic_ActiveSetting = Default
# PTMagic_LastChanged = 23.05.2018 07:27
# ####################################
#
market = USDT