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