public bool IsAuthenticated() { if (!Globals.Offlinemode) { try { var uri = new Uri( string.Format( "http://session.minecraft.net/game/checkserver.jsp?user={0}&serverId={1}", Username, PacketCryptography.JavaHexDigest(Encoding.UTF8.GetBytes("") .Concat(Wrapper.SharedKey) .Concat(PacketCryptography.PublicKeyToAsn1(Globals.ServerKey)) .ToArray()) )); var authenticated = new WebClient().DownloadString(uri); if (authenticated.Contains("NO")) { ConsoleFunctions.WriteInfoLine("Response: " + authenticated); return(false); } } catch (Exception exc) { //client.Kick("Error while authenticating..."); //client.Logger.Log(exc); return(false); } return(true); } return(true); }
public bool IsAuthenticated() { if (Server.ServerSettings.OnlineMode) { try { var uri = new Uri( string.Format( "http://session.minecraft.net/game/checkserver.jsp?user={0}&serverId={1}", Username, PacketCryptography.JavaHexDigest(Encoding.UTF8.GetBytes("") .Concat(Wrapper.SharedKey) .Concat(PacketCryptography.PublicKeyToAsn1(Globals.ServerKey)) .ToArray()) )); var authenticated = new WebClient().DownloadString(uri); if (authenticated.Contains("NO")) { ConsoleFunctions.WriteInfoLine("Response: " + authenticated); return(false); } } catch (Exception e) { ConsoleFunctions.WriteWarningLine("Caught Exception in PlayerEntity.cs IsAuth function... {0}, {1}", true, e.StackTrace, e.Message); return(false); } } return(true); }