Add project files.

This commit is contained in:
2026-03-08 20:45:01 +01:00
commit 053a4052dd
45 changed files with 2578 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
using System.Net;
using System.Net.Http.Headers;
using System.Text;
namespace LeagueAPI;
/// <summary>
/// Repesents authentication for the League Client.
/// </summary>
/// <param name="RemotingAuthToken"></param>
public class RiotAuthentication(string RemotingAuthToken)
{
/// <summary>
/// Username component of the authentication;
/// </summary>
public string Username { get; } = "riot";
/// <summary>
/// Password component of the authentication.
/// </summary>
public string Password { get; } = RemotingAuthToken;
/// <summary>
/// Authentication value before Base64 conversion.
/// </summary>
public string RawValue => Username + ":" + Password;
/// <summary>
/// Authentication value in Base64 format.
/// </summary>
public string Value => Convert.ToBase64String(Encoding.UTF8.GetBytes(RawValue));
/// <summary>
/// Get an AuthenticationHeaderValue instance.
/// </summary>
public AuthenticationHeaderValue ToAuthenticationHeaderValue()
{
return new AuthenticationHeaderValue("Basic", Value);
}
/// <summary>
/// Get an NetworkCredential instance.
/// </summary>
public NetworkCredential ToNetworkCredential()
{
return new NetworkCredential(Username, Password);
}
}