From 3fa7e6588c04d7c9cd7041f55f7a5315d9c992de Mon Sep 17 00:00:00 2001 From: Anairkoen Schno Date: Fri, 16 Aug 2019 18:05:10 -0500 Subject: [PATCH] Added command line override values to config --- IPA.Loader/Config/SelfConfig.cs | 17 +++++++++++------ docs/build.ps1 | 8 +++++--- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/IPA.Loader/Config/SelfConfig.cs b/IPA.Loader/Config/SelfConfig.cs index 758f8339..2071f016 100644 --- a/IPA.Loader/Config/SelfConfig.cs +++ b/IPA.Loader/Config/SelfConfig.cs @@ -39,8 +39,11 @@ namespace IPA.Config } internal const string IPAName = "Beat Saber IPA"; - internal const string IPAVersion = "3.12.25"; - + internal const string IPAVersion = "3.12.25"; + + // uses Updates.AutoCheckUpdates, YeetMods + internal static SelfConfig CommandLineValues = new SelfConfig(); + // END: section ignore public bool Regenerate = true; @@ -52,8 +55,9 @@ namespace IPA.Config public static bool AutoUpdate_ => SelfConfigRef.Value.Updates.AutoUpdate; public bool AutoCheckUpdates = true; - // LINE: ignore - public static bool AutoCheckUpdates_ => SelfConfigRef.Value.Updates.AutoCheckUpdates; + // LINE: ignore 2 + public static bool AutoCheckUpdates_ => SelfConfigRef.Value.Updates.AutoCheckUpdates + && CommandLineValues.Updates.AutoCheckUpdates; } public Updates_ Updates = new Updates_(); @@ -84,8 +88,9 @@ namespace IPA.Config public Debug_ Debug = new Debug_(); public bool YeetMods = true; - // LINE: ignore - public static bool YeetMods_ => SelfConfigRef.Value.YeetMods; + // LINE: ignore 2 + public static bool YeetMods_ => SelfConfigRef.Value.YeetMods + && CommandLineValues.YeetMods; [JsonProperty(Required = Required.Default)] public string LastGameVersion = null; diff --git a/docs/build.ps1 b/docs/build.ps1 index ad57f815..7159427d 100644 --- a/docs/build.ps1 +++ b/docs/build.ps1 @@ -24,21 +24,23 @@ if ((Test-Path $newtonsoftLoc -PathType Leaf) -and (Test-Path $selfConfigLoc -Pa $ignoreNext = 0 } process { - if ( $_ -match "^\s*//\s+([A-Z]+):\s*(?:section)?\s+(.+)\s*$" ) { + if ( $_ -match "^\s*//\s+([A-Z]+):\s*(?:section)?\s+([a-zA-Z]+)(?:\s+(\d+))?\s*$" ) { $Begin = ($Matches[1] -eq "BEGIN") $End = ($Matches[1] -eq "END") $Line = ($Matches[1] -eq "LINE") + $Num = if ($Matches[3].length -gt 0) { [int]($Matches[3]) } else { 1 } + switch ($Matches[2]) { "ignore" { if ($Begin) { $inIgnoreSection = $true } if ($End) { $inIgnoreSection = $false } - if ($Line) { $ignoreNext = 2 } + if ($Line) { $ignoreNext = $Num + 1 } } } } if ($inIgnoreSection) { "" } - elseif ($ignoreNext -gt 0) { $ignoreNext = $ignoreNext - 1; "" } + elseif ($ignoreNext -gt 0) { $ignoreNext = $ignoreNext - 1; return "" } else { $_ } } }