This commit is contained in:
JJ
2025-12-05 23:50:24 -05:00
parent a83a7009ac
commit 5a9e23147b
9 changed files with 68 additions and 19 deletions
+7 -1
View File
@@ -1,20 +1,26 @@
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17 # Visual Studio Version 17
VisualStudioVersion = 17.14.36408.4 d17.14 VisualStudioVersion = 17.14.36408.4
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lithium", "Lithium\Lithium.csproj", "{71516142-7D3E-46A1-A6EC-E242CD128DB1}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lithium", "Lithium\Lithium.csproj", "{71516142-7D3E-46A1-A6EC-E242CD128DB1}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{71516142-7D3E-46A1-A6EC-E242CD128DB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {71516142-7D3E-46A1-A6EC-E242CD128DB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{71516142-7D3E-46A1-A6EC-E242CD128DB1}.Debug|Any CPU.Build.0 = Debug|Any CPU {71516142-7D3E-46A1-A6EC-E242CD128DB1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{71516142-7D3E-46A1-A6EC-E242CD128DB1}.Debug|x64.ActiveCfg = Debug|x64
{71516142-7D3E-46A1-A6EC-E242CD128DB1}.Debug|x64.Build.0 = Debug|x64
{71516142-7D3E-46A1-A6EC-E242CD128DB1}.Release|Any CPU.ActiveCfg = Release|Any CPU {71516142-7D3E-46A1-A6EC-E242CD128DB1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{71516142-7D3E-46A1-A6EC-E242CD128DB1}.Release|Any CPU.Build.0 = Release|Any CPU {71516142-7D3E-46A1-A6EC-E242CD128DB1}.Release|Any CPU.Build.0 = Release|Any CPU
{71516142-7D3E-46A1-A6EC-E242CD128DB1}.Release|x64.ActiveCfg = Release|x64
{71516142-7D3E-46A1-A6EC-E242CD128DB1}.Release|x64.Build.0 = Release|x64
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
+1 -7
View File
@@ -1,10 +1,4 @@
using System; using System.Windows;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace Lithium namespace Lithium
{ {
-1
View File
@@ -1,5 +1,4 @@
using System; using System;
using System.Globalization;
using System.IO; using System.IO;
namespace Lua namespace Lua
-1
View File
@@ -1,5 +1,4 @@
using Lua; using Lua;
using System;
using System.Threading; using System.Threading;
namespace Lithium namespace Lithium
+20
View File
@@ -54,6 +54,26 @@
<PropertyGroup> <PropertyGroup>
<ApplicationIcon>A1\a23ae8c4c6863364165637fb70679eb3.ico</ApplicationIcon> <ApplicationIcon>A1\a23ae8c4c6863364165637fb70679eb3.ico</ApplicationIcon>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> <Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.10.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath> <HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.10.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
+39 -5
View File
@@ -31,6 +31,16 @@ namespace Lua
// AA0058 // AA0058
public static bool onAttackers = true; public static bool onAttackers = true;
private static string CacheDirectory =>
System.IO.Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
"coax"
);
private static string CacheFile =>
System.IO.Path.Combine(CacheDirectory, "config_cache.txt");
// AA0059 // AA0059
private static string OnlineConfigUrl => private static string OnlineConfigUrl =>
string.IsNullOrEmpty(ConfigLoader.userName) string.IsNullOrEmpty(ConfigLoader.userName)
@@ -96,8 +106,12 @@ namespace Lua
defenderNames.Clear(); defenderNames.Clear();
var allLines = new List<string>(); var allLines = new List<string>();
bool loadedOnline = false;
// AA0066 // Ensure coax folder exists
try { System.IO.Directory.CreateDirectory(CacheDirectory); } catch { }
// Try loading from online source
if (allowOnlineFetch && !string.IsNullOrEmpty(OnlineConfigUrl)) if (allowOnlineFetch && !string.IsNullOrEmpty(OnlineConfigUrl))
{ {
try try
@@ -105,14 +119,33 @@ namespace Lua
using (var client = new HttpClient()) using (var client = new HttpClient())
{ {
string txt = client.GetStringAsync(OnlineConfigUrl).Result; string txt = client.GetStringAsync(OnlineConfigUrl).Result;
if (!string.IsNullOrWhiteSpace(txt)) if (!string.IsNullOrWhiteSpace(txt))
{
allLines.AddRange(txt.Split('\n')); allLines.AddRange(txt.Split('\n'));
// Save cache file in per-user coax folder
System.IO.File.WriteAllText(CacheFile, txt);
loadedOnline = true;
} }
} }
catch { /* AA0067 */ } }
catch
{
// Ignore; fallback handled below
}
} }
// AA0068 // If online fetch failed → fallback to cached file
if (!loadedOnline && System.IO.File.Exists(CacheFile))
{
var cached = System.IO.File.ReadAllLines(CacheFile);
if (cached.Length > 0)
allLines.AddRange(cached);
}
// Also load config.txt (local overrides)
var local = Helper.ReadLinesSafe("config.txt"); var local = Helper.ReadLinesSafe("config.txt");
if (local != null && local.Length > 0) if (local != null && local.Length > 0)
allLines.AddRange(local); allLines.AddRange(local);
@@ -120,13 +153,13 @@ namespace Lua
bool inAttackers = false; bool inAttackers = false;
bool inDefenders = false; bool inDefenders = false;
// AA0069
foreach (var raw in allLines) foreach (var raw in allLines)
{ {
if (string.IsNullOrWhiteSpace(raw)) continue; if (string.IsNullOrWhiteSpace(raw)) continue;
var line = raw.Trim(); var line = raw.Trim();
if (line.StartsWith("--") || line.StartsWith("#")) continue; if (line.StartsWith("--") || line.StartsWith("#"))
continue;
if (line.StartsWith("attackers", StringComparison.OrdinalIgnoreCase)) if (line.StartsWith("attackers", StringComparison.OrdinalIgnoreCase))
{ {
@@ -171,6 +204,7 @@ namespace Lua
CurrentOperator = CurrentSet; CurrentOperator = CurrentSet;
} }
// AA0070 // AA0070
public static void MergeSets() public static void MergeSets()
{ {
-2
View File
@@ -1,6 +1,4 @@
using System.Reflection; using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Windows; using System.Windows;
-1
View File
@@ -1,7 +1,6 @@
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Speech.Synthesis; using System.Speech.Synthesis;
using System.Threading;
namespace Lua namespace Lua
{ {
+1 -1
View File
@@ -1,6 +1,6 @@
using System; using System;
using System.IO;
using System.Globalization; using System.Globalization;
using System.IO;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
namespace Lua namespace Lua