19556f2d26
Adds a new `AppPaths` helper and moves runtime/user-generated files (`init.config`, `custom_set.txt`, cache, WebView2 data) into `%LocalAppData%\Lithium` with readable fallback to portable files. WebView2 initialization now sets a loader DLL path, uses an explicit user data folder, and surfaces runtime-missing errors. The build/publish pipeline is updated to emit a clean `Build\` layout with dependencies under `lib\`, remove duplicate root DLL/docs, and align probing/runtime settings for net48 x64 output. Supporting updates include ignore rules for build/runtime artifacts, refreshed agent build/release docs, and endpoint URL/domain updates.
143 lines
5.0 KiB
C#
143 lines
5.0 KiB
C#
using System;
|
|
using System.IO;
|
|
|
|
namespace Lua
|
|
{
|
|
public class QuickSwapBinding
|
|
{
|
|
public int[] Keys { get; set; }
|
|
public string TargetOperator { get; set; }
|
|
public bool IsHeld { get; set; }
|
|
}
|
|
|
|
internal static class ConfigLoader
|
|
{
|
|
public static System.Collections.Generic.List<QuickSwapBinding> quickSwaps = new System.Collections.Generic.List<QuickSwapBinding>();
|
|
|
|
// AA0001
|
|
public static bool debitFlag1 = false;
|
|
// AA0002
|
|
public static bool betaTest = false;
|
|
// AA0003
|
|
public static bool ttsEnabled = true;
|
|
|
|
// AA0004
|
|
public static int nextSetKey = 0x05;
|
|
// AA0005
|
|
public static int prevSetKey = 0x06;
|
|
// AA0006
|
|
public static int refreshKey = 0x50;
|
|
// AA0007
|
|
public static int switchSideKey = 0x4D;
|
|
// AA0008
|
|
public static int shootKey = 0x01;
|
|
// AA0009
|
|
public static int altShootKey = 0x02;
|
|
|
|
// AA0010
|
|
public static string favoriteAttackers = null;
|
|
// AA0011
|
|
public static string favoriteDefenders = null;
|
|
// AA0012
|
|
public static string userName = null;
|
|
|
|
// AA0013
|
|
public static bool randomOffsetEnabled = false;
|
|
// AA0014
|
|
public static double randomOffsetMin = 0.0001;
|
|
// AA0015
|
|
public static double randomOffsetMax = 0.001;
|
|
|
|
// AA0016
|
|
public static ConsoleColor textColor = ConsoleColor.Magenta;
|
|
|
|
/// <summary>
|
|
// AA0017
|
|
/// </summary>
|
|
public static void LoadInitConfig()
|
|
{
|
|
// AA0018
|
|
debitFlag1 = false;
|
|
betaTest = false;
|
|
ttsEnabled = true;
|
|
favoriteAttackers = null;
|
|
favoriteDefenders = null;
|
|
userName = null;
|
|
randomOffsetEnabled = false;
|
|
randomOffsetMin = 0.0001;
|
|
randomOffsetMax = 0.001;
|
|
textColor = ConsoleColor.Magenta;
|
|
quickSwaps.Clear();
|
|
|
|
SetConsoleColor();
|
|
|
|
// AA0019
|
|
string configPath = AppPaths.GetReadableFilePath("init.config");
|
|
if (configPath == null) return;
|
|
|
|
var lines = Helper.ReadLinesSafe(configPath);
|
|
|
|
// AA0020
|
|
foreach (var raw in lines)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(raw)) continue;
|
|
var line = raw.Trim();
|
|
|
|
// AA0021
|
|
if (line.StartsWith("--") || line.StartsWith("#")) continue;
|
|
|
|
// AA0022
|
|
if (Helper.ParseBoolFromAssignment(line, "debitFlag1", out var b1))
|
|
debitFlag1 = b1;
|
|
else if (Helper.ParseBoolFromAssignment(line, "betaTest", out var b2))
|
|
betaTest = b2;
|
|
else if (Helper.ParseBoolFromAssignment(line, "ttsEnabled", out var b3))
|
|
ttsEnabled = b3;
|
|
// AA0023
|
|
else if (Helper.ParseIntFromAssignment(line, "nextSetKey", out var i1))
|
|
nextSetKey = i1;
|
|
else if (Helper.ParseIntFromAssignment(line, "prevSetKey", out var i2))
|
|
prevSetKey = i2;
|
|
else if (Helper.ParseIntFromAssignment(line, "refreshKey", out var i3))
|
|
refreshKey = i3;
|
|
else if (Helper.ParseIntFromAssignment(line, "switchSideKey", out var i4))
|
|
switchSideKey = i4;
|
|
// AA0024
|
|
else if (Helper.ParseStringFromAssignment(line, "favoriteAttackers", out var s1))
|
|
favoriteAttackers = s1;
|
|
else if (Helper.ParseStringFromAssignment(line, "favoriteDefenders", out var s2))
|
|
favoriteDefenders = s2;
|
|
else if (Helper.ParseStringFromAssignment(line, "userName", out var s3))
|
|
userName = s3;
|
|
// AA0025 - Random Offset Settings
|
|
else if (Helper.ParseBoolFromAssignment(line, "randomOffsetEnabled", out var roe))
|
|
randomOffsetEnabled = roe;
|
|
else if (Helper.ParseDoubleFromAssignment(line, "randomOffsetMin", out var rom))
|
|
randomOffsetMin = rom;
|
|
else if (Helper.ParseDoubleFromAssignment(line, "randomOffsetMax", out var roM))
|
|
randomOffsetMax = roM;
|
|
// AA0026
|
|
else if (Helper.ParseConsoleColorFromAssignment(line, "textColor", out var col))
|
|
textColor = col;
|
|
else if (Helper.ParseQuickSwap(line, out var qsKeys, out var qsOp))
|
|
quickSwaps.Add(new QuickSwapBinding { Keys = qsKeys, TargetOperator = qsOp });
|
|
}
|
|
|
|
// AA0027
|
|
SetConsoleColor();
|
|
}
|
|
|
|
// AA0028
|
|
private static void SetConsoleColor()
|
|
{
|
|
try
|
|
{
|
|
Console.ForegroundColor = textColor;
|
|
}
|
|
catch
|
|
{
|
|
// AA0029
|
|
}
|
|
}
|
|
}
|
|
} |