mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 14:10:53 +00:00
Add handling for one more deviceID + misc optimization
This commit is contained in:
@@ -2238,7 +2238,7 @@ namespace ArchiSteamFarm {
|
||||
|
||||
text = text.Substring(keyIndex);
|
||||
|
||||
if ((text.Length != 32) || !Utilities.IsValidHexadecimalString(text)) {
|
||||
if ((text.Length != 32) || !Utilities.IsValidHexadecimalText(text)) {
|
||||
Bot.ArchiLogger.LogNullError(nameof(text));
|
||||
|
||||
return (ESteamApiKeyState.Error, null);
|
||||
|
||||
@@ -303,7 +303,7 @@ namespace ArchiSteamFarm {
|
||||
// Dashes are optional in the ID, strip them off for comparison
|
||||
string hash = deviceID.Replace("-", "");
|
||||
|
||||
return (hash.Length > 0) && Utilities.IsValidHexadecimalString(hash);
|
||||
return (hash.Length > 0) && (Utilities.IsValidDigitsText(hash) || Utilities.IsValidHexadecimalText(hash));
|
||||
}
|
||||
|
||||
private string GenerateConfirmationHash(uint time, string tag = null) {
|
||||
@@ -398,7 +398,7 @@ namespace ArchiSteamFarm {
|
||||
uint fullCode = BitConverter.ToUInt32(bytes, 0) & 0x7fffffff;
|
||||
|
||||
// Build the alphanumeric code
|
||||
StringBuilder code = new StringBuilder();
|
||||
StringBuilder code = new StringBuilder(CodeDigits, CodeDigits);
|
||||
|
||||
for (byte i = 0; i < CodeDigits; i++) {
|
||||
code.Append(CodeCharacters[fullCode % CodeCharacters.Length]);
|
||||
|
||||
@@ -161,7 +161,18 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
|
||||
[PublicAPI]
|
||||
public static bool IsValidHexadecimalString(string text) {
|
||||
public static bool IsValidDigitsText(string text) {
|
||||
if (string.IsNullOrEmpty(text)) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(text));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return text.All(char.IsDigit);
|
||||
}
|
||||
|
||||
[PublicAPI]
|
||||
public static bool IsValidHexadecimalText(string text) {
|
||||
if (string.IsNullOrEmpty(text)) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(text));
|
||||
|
||||
@@ -178,7 +189,7 @@ namespace ArchiSteamFarm {
|
||||
string lastHex;
|
||||
|
||||
if (text.Length >= split) {
|
||||
StringBuilder hex = new StringBuilder(split);
|
||||
StringBuilder hex = new StringBuilder(split, 16);
|
||||
|
||||
foreach (char character in text) {
|
||||
hex.Append(character);
|
||||
|
||||
Reference in New Issue
Block a user