Corrected things and added KeepInnerslothRegions bool
This commit is contained in:
1 parent
b42928114e
commit
f6b2f3c69c
5 files changed
+284
-100
No files matched your search
@@ -6,9 +6,19 @@ on:
|
|||||||
- nightly
|
- nightly
|
||||||
tags:
|
tags:
|
||||||
- 'v*'
|
- 'v*'
|
||||||
|
paths:
|
||||||
|
- '**/*.cs'
|
||||||
|
- '**/*.csproj'
|
||||||
|
- '**/*.yml'
|
||||||
|
- '**/*.yaml'
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- nightly
|
- nightly
|
||||||
|
paths:
|
||||||
|
- '**/*.cs'
|
||||||
|
- '**/*.csproj'
|
||||||
|
- '**/*.yml'
|
||||||
|
- '**/*.yaml'
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|||||||
+232
-100
@@ -18,7 +18,7 @@ namespace AUModdedRegions
|
|||||||
{
|
{
|
||||||
public const string Id = "com.nb1x.aumoddedregions";
|
public const string Id = "com.nb1x.aumoddedregions";
|
||||||
public const string Name = "AUModdedRegions";
|
public const string Name = "AUModdedRegions";
|
||||||
public const string Version = "1.3.0";
|
public const string Version = "1.1.0";
|
||||||
|
|
||||||
public static string ConfigPath => Path.Combine(Paths.ConfigPath, "CustomRegions.cfg");
|
public static string ConfigPath => Path.Combine(Paths.ConfigPath, "CustomRegions.cfg");
|
||||||
public Harmony Harmony { get; } = new Harmony(Id);
|
public Harmony Harmony { get; } = new Harmony(Id);
|
||||||
@@ -34,12 +34,18 @@ namespace AUModdedRegions
|
|||||||
|
|
||||||
public override void Load()
|
public override void Load()
|
||||||
{
|
{
|
||||||
Log.LogInfo($"[AUModdedRegions] Lancement de {Name} v{Version}...");
|
Log.LogInfo($"[AUModdedRegions] Loading {Name} v{Version}...");
|
||||||
|
|
||||||
EnsureConfigFileExists();
|
EnsureConfigFileExists();
|
||||||
|
|
||||||
var parsedRegions = ParseConfigRegions(ConfigPath);
|
var configData = ParseConfig(ConfigPath);
|
||||||
ProcessAndCleanRegionJson(parsedRegions);
|
|
||||||
|
if (configData.KeepInnerslothRegions)
|
||||||
|
{
|
||||||
|
AddInnerslothRegions(configData.Regions);
|
||||||
|
}
|
||||||
|
|
||||||
|
ProcessAndCleanRegionJson(configData.Regions, configData.KeepInnerslothRegions);
|
||||||
|
|
||||||
Harmony.PatchAll();
|
Harmony.PatchAll();
|
||||||
|
|
||||||
@@ -47,68 +53,99 @@ namespace AUModdedRegions
|
|||||||
{
|
{
|
||||||
if (scene.name == "MainMenu")
|
if (scene.name == "MainMenu")
|
||||||
{
|
{
|
||||||
Log.LogInfo("[AUModdedRegions] Scène MainMenu détectée, injection des régions...");
|
Log.LogInfo("[AUModdedRegions] MainMenu scene detected, injecting regions...");
|
||||||
InjectRegions(parsedRegions);
|
InjectRegions(configData.Regions);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void AddInnerslothRegions(List<ParsedRegion> regions)
|
||||||
|
{
|
||||||
|
bool hasEu = regions.Exists(r => r.Address.Equals("matchmaker-eu.among.us", StringComparison.OrdinalIgnoreCase));
|
||||||
|
bool hasAs = regions.Exists(r => r.Address.Equals("matchmaker-as.among.us", StringComparison.OrdinalIgnoreCase));
|
||||||
|
bool hasNa = regions.Exists(r => r.Address.Equals("matchmaker.among.us", StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
|
int insertIndex = regions.FindIndex(r => string.Equals(r.Name, "Default", StringComparison.OrdinalIgnoreCase));
|
||||||
|
if (insertIndex < 0) insertIndex = regions.Count;
|
||||||
|
|
||||||
|
if (!hasEu)
|
||||||
|
{
|
||||||
|
regions.Insert(insertIndex, new ParsedRegion { Name = "Europe", Address = "matchmaker-eu.among.us", Https = true, Dtls = true, Port1 = 443, Port2 = 22023 });
|
||||||
|
insertIndex++;
|
||||||
|
}
|
||||||
|
if (!hasAs)
|
||||||
|
{
|
||||||
|
regions.Insert(insertIndex, new ParsedRegion { Name = "Asia", Address = "matchmaker-as.among.us", Https = true, Dtls = true, Port1 = 443, Port2 = 22023 });
|
||||||
|
insertIndex++;
|
||||||
|
}
|
||||||
|
if (!hasNa)
|
||||||
|
{
|
||||||
|
regions.Insert(insertIndex, new ParsedRegion { Name = "North America", Address = "matchmaker.among.us", Https = true, Dtls = true, Port1 = 443, Port2 = 22023 });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void EnsureConfigFileExists()
|
private static void EnsureConfigFileExists()
|
||||||
{
|
{
|
||||||
if (File.Exists(ConfigPath)) return;
|
if (File.Exists(ConfigPath))
|
||||||
|
{
|
||||||
|
EnsureSettingExistsInConfig(ConfigPath);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
string defaultConfig = @"[Region 1]
|
string defaultConfig = @"KeepInnerslothRegions = false
|
||||||
Name = Niko_NA
|
|
||||||
Adress = au-us.niko233.top
|
[Region 1]
|
||||||
|
Name = Skeld.net
|
||||||
|
Address = play.skeld.net
|
||||||
Https = true
|
Https = true
|
||||||
Dtls = false
|
Dtls = false
|
||||||
Port = 443, 22023
|
Port = 443, 22023
|
||||||
|
|
||||||
[Region 2]
|
[Region 2]
|
||||||
Name = Niko_EU
|
Name = Niko_NA
|
||||||
Adress = au-eu.niko233.top
|
Address = au-us.niko233.top
|
||||||
Https = true
|
Https = true
|
||||||
Dtls = false
|
Dtls = false
|
||||||
Port = 443, 22023
|
Port = 443, 22023
|
||||||
|
|
||||||
[Region 3]
|
[Region 3]
|
||||||
Name = Niko_AS
|
Name = Niko_EU
|
||||||
Adress = au-as.niko233.top
|
Address = au-eu.niko233.top
|
||||||
Https = true
|
Https = true
|
||||||
Dtls = false
|
Dtls = false
|
||||||
Port = 443, 22023
|
Port = 443, 22023
|
||||||
|
|
||||||
[Region 4]
|
[Region 4]
|
||||||
Name = Niko_CN
|
Name = Niko_AS
|
||||||
Adress = au-cn.niko233.top
|
Address = au-as.niko233.top
|
||||||
Https = true
|
Https = true
|
||||||
Dtls = false
|
Dtls = false
|
||||||
Port = 443, 22023
|
Port = 443, 22023
|
||||||
|
|
||||||
[Region 5]
|
[Region 5]
|
||||||
Name = Modded NA
|
Name = Modded NA
|
||||||
Adress = aumods.org
|
Address = aumods.org
|
||||||
Https = true
|
Https = true
|
||||||
Dtls = false
|
Dtls = false
|
||||||
Port = 443, 22023
|
Port = 443, 22023
|
||||||
|
|
||||||
[Region 6]
|
[Region 6]
|
||||||
Name = Modded EU
|
Name = Modded EU
|
||||||
Adress = au-eu.duikbo.at
|
Address = au-eu.duikbo.at
|
||||||
Https = true
|
Https = true
|
||||||
Dtls = false
|
Dtls = false
|
||||||
Port = 443, 22023
|
Port = 443, 22023
|
||||||
|
|
||||||
[Region 7]
|
[Region 7]
|
||||||
Name = Modded AS
|
Name = Modded AS
|
||||||
Adress = au-as.duikbo.at
|
Address = au-as.duikbo.at
|
||||||
Https = true
|
Https = true
|
||||||
Dtls = false
|
Dtls = false
|
||||||
Port = 443, 22023
|
Port = 443, 22023
|
||||||
|
|
||||||
[Region 8]
|
[Region 8]
|
||||||
Name = Default
|
Name = Default
|
||||||
Adress =
|
Address =
|
||||||
Https =
|
Https =
|
||||||
Dtls =
|
Dtls =
|
||||||
Port = 443, 22023
|
Port = 443, 22023
|
||||||
@@ -116,65 +153,150 @@ Port = 443, 22023
|
|||||||
File.WriteAllText(ConfigPath, defaultConfig);
|
File.WriteAllText(ConfigPath, defaultConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ProcessAndCleanRegionJson(List<ParsedRegion> parsedRegions)
|
private static void EnsureSettingExistsInConfig(string filePath)
|
||||||
|
{
|
||||||
|
var lines = File.ReadAllLines(filePath);
|
||||||
|
bool found = false;
|
||||||
|
|
||||||
|
foreach (var line in lines)
|
||||||
|
{
|
||||||
|
if (line.Trim().StartsWith("KeepInnerslothRegions", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!found)
|
||||||
|
{
|
||||||
|
var newLines = new List<string> { "KeepInnerslothRegions = false" };
|
||||||
|
newLines.AddRange(lines);
|
||||||
|
File.WriteAllLines(filePath, newLines);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProcessAndCleanRegionJson(List<ParsedRegion> parsedRegions, bool keepInnersloth)
|
||||||
{
|
{
|
||||||
string regionFilePath = Path.Combine(Application.persistentDataPath, "regionInfo.json");
|
string regionFilePath = Path.Combine(Application.persistentDataPath, "regionInfo.json");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
JsonNode rootNode;
|
bool needsRewrite = false;
|
||||||
|
JsonNode? rootNode = null;
|
||||||
|
|
||||||
if (File.Exists(regionFilePath) && new FileInfo(regionFilePath).Length > 0)
|
if (!File.Exists(regionFilePath) || new FileInfo(regionFilePath).Length == 0)
|
||||||
{
|
{
|
||||||
string content = File.ReadAllText(regionFilePath);
|
needsRewrite = true;
|
||||||
rootNode = JsonNode.Parse(content) ?? CreateEmptyRegionStructure();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rootNode = CreateEmptyRegionStructure();
|
string content = File.ReadAllText(regionFilePath);
|
||||||
}
|
rootNode = JsonNode.Parse(content);
|
||||||
|
if (rootNode == null)
|
||||||
JsonArray regionsArray = rootNode["Regions"]?.AsArray() ?? new JsonArray();
|
|
||||||
|
|
||||||
for (int i = regionsArray.Count - 1; i >= 0; i--)
|
|
||||||
{
|
|
||||||
string regionJson = regionsArray[i]?.ToJsonString() ?? "";
|
|
||||||
if (IsOfficialInnersloth(regionJson))
|
|
||||||
{
|
{
|
||||||
regionsArray.RemoveAt(i);
|
needsRewrite = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
JsonArray existingRegions = rootNode["Regions"]?.AsArray() ?? new JsonArray();
|
||||||
|
if (!AreRegionsMatching(existingRegions, parsedRegions, keepInnersloth))
|
||||||
|
{
|
||||||
|
needsRewrite = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var reg in parsedRegions)
|
if (needsRewrite)
|
||||||
{
|
{
|
||||||
if (string.Equals(reg.Name, "Default", StringComparison.OrdinalIgnoreCase) && string.IsNullOrWhiteSpace(reg.Adress))
|
Log.LogInfo("[AUModdedRegions] Differences detected in regionInfo.json (or file missing/empty). Rewriting completely...");
|
||||||
continue;
|
rootNode = CreateEmptyRegionStructure();
|
||||||
|
JsonArray regionsArray = rootNode["Regions"]?.AsArray() ?? new JsonArray();
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(reg.Name) || string.IsNullOrWhiteSpace(reg.Adress))
|
foreach (var reg in parsedRegions)
|
||||||
continue;
|
|
||||||
|
|
||||||
string protocol = reg.Https ? "https://" : "http://";
|
|
||||||
string host = $"{protocol}{reg.Adress}";
|
|
||||||
|
|
||||||
if (!HasRegion(regionsArray, host))
|
|
||||||
{
|
{
|
||||||
|
if (string.Equals(reg.Name, "Default", StringComparison.OrdinalIgnoreCase) && string.IsNullOrWhiteSpace(reg.Address))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(reg.Name) || string.IsNullOrWhiteSpace(reg.Address))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
string protocol = reg.Https ? "https://" : "http://";
|
||||||
|
string host = $"{protocol}{reg.Address}";
|
||||||
|
|
||||||
regionsArray.Add(BuildRegionNode(reg.Name, host, reg.Https ? reg.Port1 : reg.Port2, reg.Dtls));
|
regionsArray.Add(BuildRegionNode(reg.Name, host, reg.Https ? reg.Port1 : reg.Port2, reg.Dtls));
|
||||||
}
|
}
|
||||||
|
rootNode["Regions"] = regionsArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
rootNode["Regions"] = regionsArray;
|
if (rootNode != null && rootNode["Regions"] is JsonArray currentRegionsArray)
|
||||||
|
{
|
||||||
|
if (!keepInnersloth)
|
||||||
|
{
|
||||||
|
for (int i = currentRegionsArray.Count - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
string regionJson = currentRegionsArray[i]?.ToJsonString() ?? "";
|
||||||
|
if (IsOfficialInnersloth(regionJson))
|
||||||
|
{
|
||||||
|
currentRegionsArray.RemoveAt(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rootNode["Regions"] = currentRegionsArray;
|
||||||
|
}
|
||||||
|
|
||||||
var options = new JsonSerializerOptions { WriteIndented = true };
|
var options = new JsonSerializerOptions { WriteIndented = true };
|
||||||
File.WriteAllText(regionFilePath, rootNode.ToJsonString(options));
|
File.WriteAllText(regionFilePath, rootNode.ToJsonString(options));
|
||||||
|
|
||||||
Log.LogInfo("[AUModdedRegions] Fichier regionInfo.json nettoyé et mis à jour !");
|
Log.LogInfo("[AUModdedRegions] regionInfo.json successfully verified and updated!");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Log.LogError($"[AUModdedRegions] Erreur lors du traitement du fichier regionInfo.json : {ex.Message}");
|
Log.LogError($"[AUModdedRegions] Error while processing regionInfo.json: {ex.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool AreRegionsMatching(JsonArray existingRegions, List<ParsedRegion> parsedRegions, bool keepInnersloth)
|
||||||
|
{
|
||||||
|
var validCfgRegions = parsedRegions.FindAll(r => !(string.Equals(r.Name, "Default", StringComparison.OrdinalIgnoreCase) && string.IsNullOrWhiteSpace(r.Address)) && !string.IsNullOrWhiteSpace(r.Name));
|
||||||
|
|
||||||
|
int totalExpected = validCfgRegions.Count;
|
||||||
|
int totalExisting = 0;
|
||||||
|
|
||||||
|
foreach (var node in existingRegions)
|
||||||
|
{
|
||||||
|
if (node != null)
|
||||||
|
{
|
||||||
|
bool isOfficial = IsOfficialInnersloth(node.ToJsonString());
|
||||||
|
if (!isOfficial || keepInnersloth)
|
||||||
|
{
|
||||||
|
totalExisting++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (totalExisting != totalExpected) return false;
|
||||||
|
|
||||||
|
foreach (var reg in validCfgRegions)
|
||||||
|
{
|
||||||
|
string protocol = reg.Https ? "https://" : "http://";
|
||||||
|
string host = $"{protocol}{reg.Address}";
|
||||||
|
bool found = false;
|
||||||
|
|
||||||
|
foreach (var node in existingRegions)
|
||||||
|
{
|
||||||
|
if (node != null && node.ToJsonString().Contains(host, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!found) return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private bool IsOfficialInnersloth(string json)
|
private bool IsOfficialInnersloth(string json)
|
||||||
{
|
{
|
||||||
foreach (var domain in OfficialDomains)
|
foreach (var domain in OfficialDomains)
|
||||||
@@ -185,18 +307,6 @@ Port = 443, 22023
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool HasRegion(JsonArray regionsArray, string host)
|
|
||||||
{
|
|
||||||
foreach (var node in regionsArray)
|
|
||||||
{
|
|
||||||
if (node != null && node.ToJsonString().Contains(host, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private JsonNode CreateEmptyRegionStructure()
|
private JsonNode CreateEmptyRegionStructure()
|
||||||
{
|
{
|
||||||
return new JsonObject
|
return new JsonObject
|
||||||
@@ -237,15 +347,15 @@ Port = 443, 22023
|
|||||||
|
|
||||||
foreach (var reg in parsedRegions)
|
foreach (var reg in parsedRegions)
|
||||||
{
|
{
|
||||||
if (string.Equals(reg.Name, "Default", StringComparison.OrdinalIgnoreCase) && string.IsNullOrWhiteSpace(reg.Adress))
|
if (string.Equals(reg.Name, "Default", StringComparison.OrdinalIgnoreCase) && string.IsNullOrWhiteSpace(reg.Address))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(reg.Name) || string.IsNullOrWhiteSpace(reg.Adress))
|
if (string.IsNullOrWhiteSpace(reg.Name) || string.IsNullOrWhiteSpace(reg.Address))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ushort selectedPort = reg.Https ? reg.Port1 : reg.Port2;
|
ushort selectedPort = reg.Https ? reg.Port1 : reg.Port2;
|
||||||
string protocol = reg.Https ? "https://" : "http://";
|
string protocol = reg.Https ? "https://" : "http://";
|
||||||
string fullUrl = $"{protocol}{reg.Adress}";
|
string fullUrl = $"{protocol}{reg.Address}";
|
||||||
|
|
||||||
var serverInfo = new ServerInfo("http-1", fullUrl, selectedPort, reg.Dtls);
|
var serverInfo = new ServerInfo("http-1", fullUrl, selectedPort, reg.Dtls);
|
||||||
var serversArray = new Il2CppReferenceArray<ServerInfo>(new ServerInfo[] { serverInfo });
|
var serversArray = new Il2CppReferenceArray<ServerInfo>(new ServerInfo[] { serverInfo });
|
||||||
@@ -253,14 +363,14 @@ Port = 443, 22023
|
|||||||
var regionInfo = new StaticHttpRegionInfo(reg.Name, (StringNames)1003, fullUrl, serversArray);
|
var regionInfo = new StaticHttpRegionInfo(reg.Name, (StringNames)1003, fullUrl, serversArray);
|
||||||
|
|
||||||
serverMngr.AddOrUpdateRegion(regionInfo.Cast<IRegionInfo>());
|
serverMngr.AddOrUpdateRegion(regionInfo.Cast<IRegionInfo>());
|
||||||
Log.LogInfo($"[AUModdedRegions] Région '{reg.Name}' injectée en mémoire.");
|
Log.LogInfo($"[AUModdedRegions] Region '{reg.Name}' injected into memory.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<ParsedRegion> ParseConfigRegions(string filePath)
|
private static ConfigData ParseConfig(string filePath)
|
||||||
{
|
{
|
||||||
var result = new List<ParsedRegion>();
|
var configData = new ConfigData();
|
||||||
if (!File.Exists(filePath)) return result;
|
if (!File.Exists(filePath)) return configData;
|
||||||
|
|
||||||
ParsedRegion? current = null;
|
ParsedRegion? current = null;
|
||||||
|
|
||||||
@@ -268,55 +378,77 @@ Port = 443, 22023
|
|||||||
{
|
{
|
||||||
string trimmed = line.Trim();
|
string trimmed = line.Trim();
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(trimmed) || trimmed.StartsWith("#")) continue;
|
||||||
|
|
||||||
if (trimmed.StartsWith("[") && trimmed.EndsWith("]"))
|
if (trimmed.StartsWith("[") && trimmed.EndsWith("]"))
|
||||||
{
|
{
|
||||||
if (current != null) result.Add(current);
|
if (current != null) configData.Regions.Add(current);
|
||||||
current = new ParsedRegion();
|
current = new ParsedRegion();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current == null || !trimmed.Contains('=')) continue;
|
if (trimmed.Contains('='))
|
||||||
|
|
||||||
var parts = trimmed.Split(new[] { '=' }, 2);
|
|
||||||
string key = parts[0].Trim().ToLowerInvariant();
|
|
||||||
string val = parts[1].Trim();
|
|
||||||
|
|
||||||
switch (key)
|
|
||||||
{
|
{
|
||||||
case "name":
|
var parts = trimmed.Split(new[] { '=' }, 2);
|
||||||
current.Name = val;
|
string key = parts[0].Trim().ToLowerInvariant();
|
||||||
break;
|
string val = parts[1].Trim();
|
||||||
case "adress":
|
|
||||||
case "address":
|
if (current == null)
|
||||||
current.Adress = val;
|
{
|
||||||
break;
|
if (key == "keepinnerslothregions")
|
||||||
case "https":
|
{
|
||||||
bool.TryParse(val, out bool https);
|
if (bool.TryParse(val, out bool keep))
|
||||||
current.Https = https;
|
{
|
||||||
break;
|
configData.KeepInnerslothRegions = keep;
|
||||||
case "dtls":
|
}
|
||||||
bool.TryParse(val, out bool dtls);
|
}
|
||||||
current.Dtls = dtls;
|
}
|
||||||
break;
|
else
|
||||||
case "port":
|
{
|
||||||
var ports = val.Split(',');
|
switch (key)
|
||||||
if (ports.Length > 0 && ushort.TryParse(ports[0].Trim(), out ushort p1))
|
{
|
||||||
current.Port1 = p1;
|
case "name":
|
||||||
if (ports.Length > 1 && ushort.TryParse(ports[1].Trim(), out ushort p2))
|
current.Name = val;
|
||||||
current.Port2 = p2;
|
break;
|
||||||
break;
|
case "address":
|
||||||
|
case "adress":
|
||||||
|
current.Address = val;
|
||||||
|
break;
|
||||||
|
case "https":
|
||||||
|
bool.TryParse(val, out bool https);
|
||||||
|
current.Https = https;
|
||||||
|
break;
|
||||||
|
case "dtls":
|
||||||
|
bool.TryParse(val, out bool dtls);
|
||||||
|
current.Dtls = dtls;
|
||||||
|
break;
|
||||||
|
case "port":
|
||||||
|
var ports = val.Split(',');
|
||||||
|
if (ports.Length > 0 && ushort.TryParse(ports[0].Trim(), out ushort p1))
|
||||||
|
current.Port1 = p1;
|
||||||
|
if (ports.Length > 1 && ushort.TryParse(ports[1].Trim(), out ushort p2))
|
||||||
|
current.Port2 = p2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current != null) result.Add(current);
|
if (current != null) configData.Regions.Add(current);
|
||||||
|
|
||||||
return result;
|
return configData;
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ConfigData
|
||||||
|
{
|
||||||
|
public bool KeepInnerslothRegions { get; set; } = false;
|
||||||
|
public List<ParsedRegion> Regions { get; set; } = new List<ParsedRegion>();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ParsedRegion
|
private class ParsedRegion
|
||||||
{
|
{
|
||||||
public string Name { get; set; } = "";
|
public string Name { get; set; } = "";
|
||||||
public string Adress { get; set; } = "";
|
public string Address { get; set; } = "";
|
||||||
public bool Https { get; set; } = true;
|
public bool Https { get; set; } = true;
|
||||||
public bool Dtls { get; set; } = false;
|
public bool Dtls { get; set; } = false;
|
||||||
public ushort Port1 { get; set; } = 443;
|
public ushort Port1 { get; set; } = 443;
|
||||||
|
|||||||
+34
@@ -0,0 +1,34 @@
|
|||||||
|
# Install Instructions
|
||||||
|
To install AUModdedRegions, there are multiple methods.
|
||||||
|
|
||||||
|
---
|
||||||
|
**Easy install**
|
||||||
|
|
||||||
|
1. Go to the [releases](https://github.com/BetterUsProject/AUModdedRegions/releases) of this project.
|
||||||
|
2. Download the latest .zip file for your game version (Steam, Epic Games...)
|
||||||
|
3. Open your Among Us folder and unzip the file you downloaded.
|
||||||
|
4. Now, launch Among Us to generate the config file.
|
||||||
|
5. AUModdedRegions is now installed!
|
||||||
|
|
||||||
|
**Updating an existing install**
|
||||||
|
|
||||||
|
> We're planning on adding a built-in updater to the plugin.
|
||||||
|
|
||||||
|
1. Go to the [releases](https://github.com/BetterUsProject/AUModdedRegions/releases) of this project.
|
||||||
|
2. Download the latest .dll available.
|
||||||
|
3. Go to your Among Us folder and open BepInEx/plugins.
|
||||||
|
4. Delete the existing AUModdedRegions.dll file from the folder and replace it with the new one.
|
||||||
|
5. AUModdedRegions is now updated to the latest version!
|
||||||
|
|
||||||
|
**Manual install**
|
||||||
|
|
||||||
|
1. Go to the BepInEx [Bleeding Edge builds page](https://builds.bepinex.dev/projects/bepinex_be).
|
||||||
|
2. Scroll down until you see "Artifacts" and press on the latest artifact available.
|
||||||
|
3. Download the .zip for your game version:
|
||||||
|
- Steam/Itch.io: BepInEx-Unity.IL2CPP-win-x86-6.0.0-be.*...*+*...*.zip
|
||||||
|
- Epic Games/Windows Store: BepInEx-Unity.IL2CPP-win-x64-6.0.0-be.*...*+*...*.zip
|
||||||
|
4. Unzip the file in your Among Us folder.
|
||||||
|
5. Go to the [releases](https://github.com/BetterUsProject/AUModdedRegions/releases) of this project.
|
||||||
|
6. Download the latest .dll file available.
|
||||||
|
7. In your Among Us folder, put the .dll you downloaded in BepInEx/plugins.
|
||||||
|
8. AUModdedRegions is now installed!
|
||||||
Reference in new issue
Block a user