mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-10 21:54:23 +00:00
Misc
This commit is contained in:
@@ -487,9 +487,9 @@ namespace ArchiSteamFarm {
|
||||
return (appID, DateTime.MinValue);
|
||||
}
|
||||
|
||||
string[] dlcAppIDsString = listOfDlc.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
foreach (string dlcAppIDString in dlcAppIDsString) {
|
||||
if (!uint.TryParse(dlcAppIDString, out uint dlcAppID) || (dlcAppID == 0)) {
|
||||
string[] dlcAppIDsTexts = listOfDlc.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
foreach (string dlcAppIDsText in dlcAppIDsTexts) {
|
||||
if (!uint.TryParse(dlcAppIDsText, out uint dlcAppID) || (dlcAppID == 0)) {
|
||||
ArchiLogger.LogNullError(nameof(dlcAppID));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -345,21 +345,21 @@ namespace ArchiSteamFarm {
|
||||
continue;
|
||||
}
|
||||
|
||||
string appIDString = appIDNode.GetAttributeValue("id", null);
|
||||
if (string.IsNullOrEmpty(appIDString)) {
|
||||
Bot.ArchiLogger.LogNullError(nameof(appIDString));
|
||||
string appIDText = appIDNode.GetAttributeValue("id", null);
|
||||
if (string.IsNullOrEmpty(appIDText)) {
|
||||
Bot.ArchiLogger.LogNullError(nameof(appIDText));
|
||||
continue;
|
||||
}
|
||||
|
||||
string[] appIDSplitted = appIDString.Split('_');
|
||||
string[] appIDSplitted = appIDText.Split('_');
|
||||
if (appIDSplitted.Length < 5) {
|
||||
Bot.ArchiLogger.LogNullError(nameof(appIDSplitted));
|
||||
continue;
|
||||
}
|
||||
|
||||
appIDString = appIDSplitted[4];
|
||||
appIDText = appIDSplitted[4];
|
||||
|
||||
if (!uint.TryParse(appIDString, out uint appID) || (appID == 0)) {
|
||||
if (!uint.TryParse(appIDText, out uint appID) || (appID == 0)) {
|
||||
Bot.ArchiLogger.LogNullError(nameof(appID));
|
||||
continue;
|
||||
}
|
||||
@@ -459,14 +459,14 @@ namespace ArchiSteamFarm {
|
||||
continue;
|
||||
}
|
||||
|
||||
string hoursString = timeNode.InnerText;
|
||||
if (string.IsNullOrEmpty(hoursString)) {
|
||||
Bot.ArchiLogger.LogNullError(nameof(hoursString));
|
||||
string hoursText = timeNode.InnerText;
|
||||
if (string.IsNullOrEmpty(hoursText)) {
|
||||
Bot.ArchiLogger.LogNullError(nameof(hoursText));
|
||||
continue;
|
||||
}
|
||||
|
||||
float hours = 0.0F;
|
||||
Match hoursMatch = Regex.Match(hoursString, @"[0-9\.,]+");
|
||||
Match hoursMatch = Regex.Match(hoursText, @"[0-9\.,]+");
|
||||
|
||||
// This might fail if we have exactly 0.0 hours played, as it's not printed in that case - that's fine
|
||||
if (hoursMatch.Success) {
|
||||
@@ -517,26 +517,26 @@ namespace ArchiSteamFarm {
|
||||
HtmlNode levelNode = htmlNode.SelectSingleNode(".//div[@class='badge_info_description']/div[2]");
|
||||
if (levelNode != null) {
|
||||
// There is no levelNode if we didn't craft that badge yet (level 0)
|
||||
string levelString = levelNode.InnerText;
|
||||
if (string.IsNullOrEmpty(levelString)) {
|
||||
Bot.ArchiLogger.LogNullError(nameof(levelString));
|
||||
string levelText = levelNode.InnerText;
|
||||
if (string.IsNullOrEmpty(levelText)) {
|
||||
Bot.ArchiLogger.LogNullError(nameof(levelText));
|
||||
continue;
|
||||
}
|
||||
|
||||
int levelIndex = levelString.IndexOf("Level ", StringComparison.OrdinalIgnoreCase);
|
||||
int levelIndex = levelText.IndexOf("Level ", StringComparison.OrdinalIgnoreCase);
|
||||
if (levelIndex < 0) {
|
||||
Bot.ArchiLogger.LogNullError(nameof(levelIndex));
|
||||
continue;
|
||||
}
|
||||
|
||||
levelIndex += 6;
|
||||
if (levelString.Length <= levelIndex) {
|
||||
if (levelText.Length <= levelIndex) {
|
||||
Bot.ArchiLogger.LogNullError(nameof(levelIndex));
|
||||
continue;
|
||||
}
|
||||
|
||||
levelString = levelString.Substring(levelIndex, 1);
|
||||
if (!byte.TryParse(levelString, out badgeLevel) || (badgeLevel == 0) || (badgeLevel > 5)) {
|
||||
levelText = levelText.Substring(levelIndex, 1);
|
||||
if (!byte.TryParse(levelText, out badgeLevel) || (badgeLevel == 0) || (badgeLevel > 5)) {
|
||||
Bot.ArchiLogger.LogNullError(nameof(badgeLevel));
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace ArchiSteamFarm.Json {
|
||||
internal EType Type { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "amount", Required = Required.Always)]
|
||||
private string AmountString {
|
||||
private string AmountText {
|
||||
get => Amount.ToString();
|
||||
|
||||
set {
|
||||
@@ -66,7 +66,7 @@ namespace ArchiSteamFarm.Json {
|
||||
}
|
||||
|
||||
[JsonProperty(PropertyName = "assetid", Required = Required.DisallowNull)]
|
||||
private string AssetIDString {
|
||||
private string AssetIDText {
|
||||
get => AssetID.ToString();
|
||||
|
||||
set {
|
||||
@@ -85,7 +85,7 @@ namespace ArchiSteamFarm.Json {
|
||||
}
|
||||
|
||||
[JsonProperty(PropertyName = "classid", Required = Required.DisallowNull)]
|
||||
private string ClassIDString {
|
||||
private string ClassIDText {
|
||||
get => ClassID.ToString();
|
||||
|
||||
set {
|
||||
@@ -103,7 +103,7 @@ namespace ArchiSteamFarm.Json {
|
||||
}
|
||||
|
||||
[JsonProperty(PropertyName = "contextid", Required = Required.DisallowNull)]
|
||||
private string ContextIDString {
|
||||
private string ContextIDText {
|
||||
get => ContextID.ToString();
|
||||
|
||||
set {
|
||||
@@ -122,9 +122,9 @@ namespace ArchiSteamFarm.Json {
|
||||
}
|
||||
|
||||
[JsonProperty(PropertyName = "id", Required = Required.DisallowNull)]
|
||||
private string ID {
|
||||
get => AssetIDString;
|
||||
set => AssetIDString = value;
|
||||
private string IDText {
|
||||
get => AssetIDText;
|
||||
set => AssetIDText = value;
|
||||
}
|
||||
|
||||
// Constructed from trades being received
|
||||
@@ -197,26 +197,26 @@ namespace ArchiSteamFarm.Json {
|
||||
return 0;
|
||||
}
|
||||
|
||||
string id = htmlNode.GetAttributeValue("id", null);
|
||||
if (string.IsNullOrEmpty(id)) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(id));
|
||||
string idText = htmlNode.GetAttributeValue("id", null);
|
||||
if (string.IsNullOrEmpty(idText)) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(idText));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int index = id.IndexOf('_');
|
||||
int index = idText.IndexOf('_');
|
||||
if (index < 0) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(index));
|
||||
return 0;
|
||||
}
|
||||
|
||||
index++;
|
||||
if (id.Length <= index) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(id.Length));
|
||||
if (idText.Length <= index) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(idText.Length));
|
||||
return 0;
|
||||
}
|
||||
|
||||
id = id.Substring(index);
|
||||
if (!ulong.TryParse(id, out _TradeOfferID) || (_TradeOfferID == 0)) {
|
||||
idText = idText.Substring(index);
|
||||
if (!ulong.TryParse(idText, out _TradeOfferID) || (_TradeOfferID == 0)) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(_TradeOfferID));
|
||||
return 0;
|
||||
}
|
||||
@@ -367,7 +367,7 @@ namespace ArchiSteamFarm.Json {
|
||||
internal bool MoreItems { get; private set; }
|
||||
|
||||
[JsonProperty(PropertyName = "last_assetid", Required = Required.DisallowNull)]
|
||||
private string LastAssetIDString {
|
||||
private string LastAssetIDText {
|
||||
set {
|
||||
if (string.IsNullOrEmpty(value)) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(value));
|
||||
@@ -405,7 +405,7 @@ namespace ArchiSteamFarm.Json {
|
||||
internal bool Tradable { get; private set; }
|
||||
|
||||
[JsonProperty(PropertyName = "classid", Required = Required.Always)]
|
||||
private string ClassIDString {
|
||||
private string ClassIDText {
|
||||
set {
|
||||
if (string.IsNullOrEmpty(value)) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(value));
|
||||
|
||||
Reference in New Issue
Block a user