Browse Source

Added command line override values to config

pull/32/head
Anairkoen Schno 5 years ago
parent
commit
d98a986782
2 changed files with 16 additions and 9 deletions
  1. +11
    -6
      IPA.Loader/Config/SelfConfig.cs
  2. +5
    -3
      docs/build.ps1

+ 11
- 6
IPA.Loader/Config/SelfConfig.cs View File

@ -39,8 +39,11 @@ namespace IPA.Config
} }
internal const string IPAName = "Beat Saber IPA"; 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 // END: section ignore
public bool Regenerate = true; public bool Regenerate = true;
@ -52,8 +55,9 @@ namespace IPA.Config
public static bool AutoUpdate_ => SelfConfigRef.Value.Updates.AutoUpdate; public static bool AutoUpdate_ => SelfConfigRef.Value.Updates.AutoUpdate;
public bool AutoCheckUpdates = true; 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_(); public Updates_ Updates = new Updates_();
@ -84,8 +88,9 @@ namespace IPA.Config
public Debug_ Debug = new Debug_(); public Debug_ Debug = new Debug_();
public bool YeetMods = true; 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)] [JsonProperty(Required = Required.Default)]
public string LastGameVersion = null; public string LastGameVersion = null;


+ 5
- 3
docs/build.ps1 View File

@ -24,21 +24,23 @@ if ((Test-Path $newtonsoftLoc -PathType Leaf) -and (Test-Path $selfConfigLoc -Pa
$ignoreNext = 0 $ignoreNext = 0
} }
process { 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") $Begin = ($Matches[1] -eq "BEGIN")
$End = ($Matches[1] -eq "END") $End = ($Matches[1] -eq "END")
$Line = ($Matches[1] -eq "LINE") $Line = ($Matches[1] -eq "LINE")
$Num = if ($Matches[3].length -gt 0) { [int]($Matches[3]) } else { 1 }
switch ($Matches[2]) { switch ($Matches[2]) {
"ignore" { "ignore" {
if ($Begin) { $inIgnoreSection = $true } if ($Begin) { $inIgnoreSection = $true }
if ($End) { $inIgnoreSection = $false } if ($End) { $inIgnoreSection = $false }
if ($Line) { $ignoreNext = 2 }
if ($Line) { $ignoreNext = $Num + 1 }
} }
} }
} }
if ($inIgnoreSection) { "" } if ($inIgnoreSection) { "" }
elseif ($ignoreNext -gt 0) { $ignoreNext = $ignoreNext - 1; "" }
elseif ($ignoreNext -gt 0) { $ignoreNext = $ignoreNext - 1; return "" }
else { $_ } else { $_ }
} }
} }


Loading…
Cancel
Save