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 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;


+ 5
- 3
docs/build.ps1 View File

@ -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 { $_ }
}
}


Loading…
Cancel
Save