upload
This commit is contained in:
commit
1c7a8cf25f
579 files changed
+83196
No files matched your search
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
|
||||
namespace VibranceHud.Licensing;
|
||||
|
||||
public sealed record PairingFormat(string Alphabet, int TokenLength, int TokenBits, string UrlTemplate)
|
||||
{
|
||||
public bool Withheld
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Alphabet.Length != 0 && TokenLength > 0 && TokenBits > 0)
|
||||
{
|
||||
return UrlTemplate.Length == 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static readonly PairingFormat Withholding = new PairingFormat("", 0, 0, "");
|
||||
|
||||
public string Url(string address, int port, string token)
|
||||
{
|
||||
if (Withheld || string.IsNullOrEmpty(token))
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return UrlTemplate.Replace("{address}", address, StringComparison.Ordinal).Replace("{port}", port.ToString(CultureInfo.InvariantCulture), StringComparison.Ordinal).Replace("{token}", token, StringComparison.Ordinal);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user