Skip to content

Commit 6b80d1e

Browse files
authored
fixed unexpected login error
1 parent de09c08 commit 6b80d1e

File tree

2 files changed

+41
-31
lines changed

2 files changed

+41
-31
lines changed

LeaguePatchCollection/LeaguePatchCollection.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
<Nullable>enable</Nullable>
88
<UseWindowsForms>true</UseWindowsForms>
99
<ImplicitUsings>enable</ImplicitUsings>
10-
<Version>5.3.9</Version>
11-
<VersionPrefix>5.3.9</VersionPrefix>
10+
<Version>5.4.0</Version>
11+
<VersionPrefix>5.4.0</VersionPrefix>
1212
<ApplicationIcon>Resources\LPC.ico</ApplicationIcon>
1313
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
1414
<DebugType>none</DebugType>
@@ -22,6 +22,7 @@
2222

2323
<ItemGroup>
2424
<PackageReference Include="Guna.UI2.WinForms" Version="2.0.4.6" />
25+
<PackageReference Include="mtanksl.ActionMessageFormat" Version="1.0.4" />
2526
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
2627
<PackageReference Include="Unosquare.Swan.Lite" Version="3.1.0" />
2728
<PackageReference Include="YamlDotNet" Version="16.3.0" />

LeaguePatchCollection/SystemYaml.cs

Lines changed: 38 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -98,41 +98,49 @@ public static void ModifySystemYaml(string configFilePath)
9898
yamlContent = modification.Key.Replace(yamlContent, modification.Value);
9999
}
100100

101-
var match = defaultRegion().Match(yamlContent);
102-
if (match.Success)
101+
string riotConfigPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Riot Games", "Riot Client", "Config");
102+
string riotConfigFile = Path.Combine(riotConfigPath, "RiotClientSettings.yaml");
103+
104+
if (File.Exists(riotConfigFile))
103105
{
104-
string region = match.Value.Trim().ToUpper(); // Normalize to uppercase and trim spaces
105-
Trace.WriteLine($"[INFO] rtmp default region found: {region}");
106+
string riotConfigContent = File.ReadAllText(riotConfigFile);
106107

107-
RtmpServer = region switch
108-
{
109-
"BR" => "feapp.br1.lol.pvp.net",
110-
"EUNE" => "feapp.eun1.lol.pvp.net",
111-
"EUW" => "feapp.euw1.lol.pvp.net",
112-
"JP" => "feapp.jp1.lol.pvp.net",
113-
"LA1" => "feapp.la1.lol.pvp.net",
114-
"LA2" => "feapp.la2.lol.pvp.net",
115-
"ME1" => "feapp.me1.lol.pvp.net",
116-
"NA" => "feapp.na1.lol.pvp.net",
117-
"OC1" => "feapp.oc1.lol.pvp.net",
118-
"RU" => "feapp.ru.lol.pvp.net",
119-
"TR" => "tr1.chat.si.riotgames.com",
120-
_ => null,
121-
};
122-
123-
if (RtmpServer != null)
108+
var match = regionKey().Match(riotConfigContent);
109+
if (match.Success)
124110
{
125-
Trace.WriteLine($"[INFO] RtmpServer set to: {RtmpServer}");
111+
string region = match.Value.Trim().Trim('"').ToUpper(); // Remove potential quotes
112+
Trace.WriteLine($"[INFO] rtmp default region found: {region}");
113+
114+
RtmpServer = region switch
115+
{
116+
"BR" => "feapp.br1.lol.pvp.net",
117+
"EUNE" => "feapp.eun1.lol.pvp.net",
118+
"EUW" => "feapp.euw1.lol.pvp.net",
119+
"JP" => "feapp.jp1.lol.pvp.net",
120+
"LA1" => "feapp.la1.lol.pvp.net",
121+
"LA2" => "feapp.la2.lol.pvp.net",
122+
"ME1" => "feapp.me1.lol.pvp.net",
123+
"NA" => "feapp.na1.lol.pvp.net",
124+
"OC1" => "feapp.oc1.lol.pvp.net",
125+
"RU" => "feapp.ru.lol.pvp.net",
126+
"TR" => "tr1.chat.si.riotgames.com",
127+
_ => null,
128+
};
129+
130+
if (RtmpServer != null)
131+
{
132+
Trace.WriteLine($"[INFO] RtmpServer set to: {RtmpServer}");
133+
}
134+
else
135+
{
136+
Trace.WriteLine("[WARN] No matching RtmpServer for the found region.");
137+
}
126138
}
127139
else
128140
{
129-
Trace.WriteLine("[WARN] No matching RtmpServer for the found region.");
141+
Trace.WriteLine("[WARN] region not found in Riot Games config yaml.");
130142
}
131143
}
132-
else
133-
{
134-
Trace.WriteLine("[WARN] default_region not found in system.yaml.");
135-
}
136144

137145
File.WriteAllText(configFilePath, yamlContent);
138146
}
@@ -155,6 +163,7 @@ public static void ModifySystemYaml(string configFilePath)
155163

156164
[GeneratedRegex(@"(?<=league_edge_url\s*:\s*)\S+")]
157165
private static partial Regex ledgeUrl();
158-
[GeneratedRegex(@"(?<=default_region\s*:\s*)\S+")]
159-
private static partial Regex defaultRegion();
166+
[GeneratedRegex(@"(?<=region\s*:\s*)\S+")]
167+
private static partial Regex regionKey();
168+
160169
}

0 commit comments

Comments
 (0)