@@ -108,28 +108,28 @@ public struct LoginResponse
108108 }
109109 }
110110
111- class XboxLive
111+ static class XboxLive
112112 {
113- private readonly string authorize = "https://login.live.com/oauth20_authorize.srf?client_id=000000004C12AE6F&redirect_uri=https://login.live.com/oauth20_desktop.srf&scope=service::user.auth.xboxlive.com::MBI_SSL&display=touch&response_type=token&locale=en" ;
114- private readonly string xbl = "https://user.auth.xboxlive.com/user/authenticate" ;
115- private readonly string xsts = "https://xsts.auth.xboxlive.com/xsts/authorize" ;
113+ private static string authorize = "https://login.live.com/oauth20_authorize.srf?client_id=000000004C12AE6F&redirect_uri=https://login.live.com/oauth20_desktop.srf&scope=service::user.auth.xboxlive.com::MBI_SSL&display=touch&response_type=token&locale=en" ;
114+ private static string xbl = "https://user.auth.xboxlive.com/user/authenticate" ;
115+ private static string xsts = "https://xsts.auth.xboxlive.com/xsts/authorize" ;
116116
117- private readonly string userAgent = "Mozilla/5.0 (XboxReplay; XboxLiveAuth/3.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36" ;
117+ private static string userAgent = "Mozilla/5.0 (XboxReplay; XboxLiveAuth/3.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36" ;
118118
119- private Regex ppft = new Regex ( "sFTTag:'.*value=\" (.*)\" \\ />'" ) ;
120- private Regex urlPost = new Regex ( "urlPost:'(.+?(?=\' ))" ) ;
121- private Regex confirm = new Regex ( "identity\\ /confirm" ) ;
122- private Regex invalidAccount = new Regex ( "Sign in to" , RegexOptions . IgnoreCase ) ;
123- private Regex twoFA = new Regex ( "Help us protect your account" , RegexOptions . IgnoreCase ) ;
119+ private static Regex ppft = new Regex ( "sFTTag:'.*value=\" (.*)\" \\ />'" ) ;
120+ private static Regex urlPost = new Regex ( "urlPost:'(.+?(?=\' ))" ) ;
121+ private static Regex confirm = new Regex ( "identity\\ /confirm" ) ;
122+ private static Regex invalidAccount = new Regex ( "Sign in to" , RegexOptions . IgnoreCase ) ;
123+ private static Regex twoFA = new Regex ( "Help us protect your account" , RegexOptions . IgnoreCase ) ;
124124
125- public string SignInUrl { get { return authorize ; } }
125+ public static string SignInUrl { get { return authorize ; } }
126126
127127 /// <summary>
128128 /// Pre-authentication
129129 /// </summary>
130130 /// <remarks>This step is to get the login page for later use</remarks>
131131 /// <returns></returns>
132- public PreAuthResponse PreAuth ( )
132+ public static PreAuthResponse PreAuth ( )
133133 {
134134 var request = new ProxiedWebRequest ( authorize ) ;
135135 request . UserAgent = userAgent ;
@@ -138,7 +138,7 @@ public PreAuthResponse PreAuth()
138138 string html = response . Body ;
139139
140140 string PPFT = ppft . Match ( html ) . Groups [ 1 ] . Value ;
141- string urlPost = this . urlPost . Match ( html ) . Groups [ 1 ] . Value ;
141+ string urlPost = XboxLive . urlPost . Match ( html ) . Groups [ 1 ] . Value ;
142142
143143 if ( string . IsNullOrEmpty ( PPFT ) || string . IsNullOrEmpty ( urlPost ) )
144144 {
@@ -164,7 +164,7 @@ public PreAuthResponse PreAuth()
164164 /// <param name="password">Account password</param>
165165 /// <param name="preAuth"></param>
166166 /// <returns></returns>
167- public Microsoft . LoginResponse UserLogin ( string email , string password , PreAuthResponse preAuth )
167+ public static Microsoft . LoginResponse UserLogin ( string email , string password , PreAuthResponse preAuth )
168168 {
169169 var request = new ProxiedWebRequest ( preAuth . UrlPost , preAuth . Cookie ) ;
170170 request . UserAgent = userAgent ;
@@ -233,7 +233,7 @@ public Microsoft.LoginResponse UserLogin(string email, string password, PreAuthR
233233 /// </summary>
234234 /// <param name="loginResponse"></param>
235235 /// <returns></returns>
236- public XblAuthenticateResponse XblAuthenticate ( Microsoft . LoginResponse loginResponse )
236+ public static XblAuthenticateResponse XblAuthenticate ( Microsoft . LoginResponse loginResponse )
237237 {
238238 var request = new ProxiedWebRequest ( xbl ) ;
239239 request . UserAgent = userAgent ;
@@ -288,7 +288,7 @@ public XblAuthenticateResponse XblAuthenticate(Microsoft.LoginResponse loginResp
288288 /// <remarks>(Don't ask me what is XSTS, I DONT KNOW)</remarks>
289289 /// <param name="xblResponse"></param>
290290 /// <returns></returns>
291- public XSTSAuthenticateResponse XSTSAuthenticate ( XblAuthenticateResponse xblResponse )
291+ public static XSTSAuthenticateResponse XSTSAuthenticate ( XblAuthenticateResponse xblResponse )
292292 {
293293 var request = new ProxiedWebRequest ( xsts ) ;
294294 request . UserAgent = userAgent ;
@@ -364,19 +364,19 @@ public struct XSTSAuthenticateResponse
364364 }
365365 }
366366
367- class MinecraftWithXbox
367+ static class MinecraftWithXbox
368368 {
369- private readonly string loginWithXbox = "https://api.minecraftservices.com/authentication/login_with_xbox" ;
370- private readonly string ownership = "https://api.minecraftservices.com/entitlements/mcstore" ;
371- private readonly string profile = "https://api.minecraftservices.com/minecraft/profile" ;
369+ private static string loginWithXbox = "https://api.minecraftservices.com/authentication/login_with_xbox" ;
370+ private static string ownership = "https://api.minecraftservices.com/entitlements/mcstore" ;
371+ private static string profile = "https://api.minecraftservices.com/minecraft/profile" ;
372372
373373 /// <summary>
374374 /// Login to Minecraft using the XSTS token and user hash obtained before
375375 /// </summary>
376376 /// <param name="userHash"></param>
377377 /// <param name="xstsToken"></param>
378378 /// <returns></returns>
379- public string LoginWithXbox ( string userHash , string xstsToken )
379+ public static string LoginWithXbox ( string userHash , string xstsToken )
380380 {
381381 var request = new ProxiedWebRequest ( loginWithXbox ) ;
382382 request . Accept = "application/json" ;
@@ -399,7 +399,7 @@ public string LoginWithXbox(string userHash, string xstsToken)
399399 /// </summary>
400400 /// <param name="accessToken"></param>
401401 /// <returns>True if the user own the game</returns>
402- public bool UserHasGame ( string accessToken )
402+ public static bool UserHasGame ( string accessToken )
403403 {
404404 var request = new ProxiedWebRequest ( ownership ) ;
405405 request . Headers . Add ( "Authorization" , string . Format ( "Bearer {0}" , accessToken ) ) ;
@@ -415,7 +415,7 @@ public bool UserHasGame(string accessToken)
415415 return json . Properties [ "items" ] . DataArray . Count > 0 ;
416416 }
417417
418- public UserProfile GetUserProfile ( string accessToken )
418+ public static UserProfile GetUserProfile ( string accessToken )
419419 {
420420 var request = new ProxiedWebRequest ( profile ) ;
421421 request . Headers . Add ( "Authorization" , string . Format ( "Bearer {0}" , accessToken ) ) ;
0 commit comments