Skip to content

Commit 6622d3b

Browse files
committed
Misc
1 parent 6b6d542 commit 6622d3b

File tree

5 files changed

+17
-22
lines changed

5 files changed

+17
-22
lines changed

ArchiSteamFarm/ArchiHandler.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ internal Notification(ENotificationType notificationType) {
6767
}
6868
}
6969

70-
internal readonly List<Notification> Notifications;
70+
internal readonly HashSet<Notification> Notifications;
7171

7272
internal NotificationsCallback(JobID jobID, CMsgClientUserNotifications msg) {
7373
JobID = jobID;
@@ -76,7 +76,7 @@ internal NotificationsCallback(JobID jobID, CMsgClientUserNotifications msg) {
7676
return;
7777
}
7878

79-
Notifications = new List<Notification>(msg.notifications.Count);
79+
Notifications = new HashSet<Notification>();
8080
foreach (var notification in msg.notifications) {
8181
Notifications.Add(new Notification((Notification.ENotificationType) notification.user_notification_type));
8282
}
@@ -90,7 +90,7 @@ internal NotificationsCallback(JobID jobID, CMsgClientItemAnnouncements msg) {
9090
}
9191

9292
if (msg.count_new_items > 0) {
93-
Notifications = new List<Notification>(1) {
93+
Notifications = new HashSet<Notification>() {
9494
new Notification(Notification.ENotificationType.Items)
9595
};
9696
}
@@ -99,7 +99,6 @@ internal NotificationsCallback(JobID jobID, CMsgClientItemAnnouncements msg) {
9999

100100
internal sealed class OfflineMessageCallback : CallbackMsg {
101101
internal readonly uint OfflineMessages;
102-
internal readonly List<uint> Users;
103102

104103
internal OfflineMessageCallback(JobID jobID, CMsgClientOfflineMessageNotification msg) {
105104
JobID = jobID;
@@ -109,7 +108,6 @@ internal OfflineMessageCallback(JobID jobID, CMsgClientOfflineMessageNotificatio
109108
}
110109

111110
OfflineMessages = msg.offline_messages;
112-
Users = msg.friends_with_offline_messages;
113111
}
114112
}
115113

ArchiSteamFarm/ArchiWebHandler.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -194,15 +194,13 @@ internal bool Init(SteamClient steamClient, string webAPIUserNonce, string paren
194194
}
195195

196196
internal async Task<bool> RefreshSessionIfNeeded() {
197-
DateTime now = DateTime.Now;
198-
if (now.Subtract(LastSessionRefreshCheck).TotalSeconds < MinSessionTTL) {
197+
if (DateTime.Now.Subtract(LastSessionRefreshCheck).TotalSeconds < MinSessionTTL) {
199198
return true;
200199
}
201200

202201
await SessionSemaphore.WaitAsync().ConfigureAwait(false);
203202

204-
now = DateTime.Now;
205-
if (now.Subtract(LastSessionRefreshCheck).TotalSeconds < MinSessionTTL) {
203+
if (DateTime.Now.Subtract(LastSessionRefreshCheck).TotalSeconds < MinSessionTTL) {
206204
SessionSemaphore.Release();
207205
return true;
208206
}
@@ -212,8 +210,7 @@ internal async Task<bool> RefreshSessionIfNeeded() {
212210
bool? isLoggedIn = await IsLoggedIn().ConfigureAwait(false);
213211
if (isLoggedIn.GetValueOrDefault(true)) {
214212
result = true;
215-
now = DateTime.Now;
216-
LastSessionRefreshCheck = now;
213+
LastSessionRefreshCheck = DateTime.Now;
217214
} else {
218215
Logging.LogGenericInfo("Refreshing our session!", Bot.BotName);
219216
result = await Bot.RefreshSession().ConfigureAwait(false);

ArchiSteamFarm/Bot.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1745,7 +1745,7 @@ private async void OnNotifications(ArchiHandler.NotificationsCallback callback)
17451745
}
17461746

17471747
private void OnOfflineMessage(ArchiHandler.OfflineMessageCallback callback) {
1748-
if (callback == null) {
1748+
if (callback == null || callback.OfflineMessages == 0) {
17491749
return;
17501750
}
17511751

ArchiSteamFarm/JSON/Steam.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ internal string ContextIDString {
7979
return;
8080
}
8181

82-
uint result;
83-
if (!uint.TryParse(value, out result)) {
82+
ulong result;
83+
if (!ulong.TryParse(value, out result)) {
8484
return;
8585
}
8686

@@ -100,8 +100,8 @@ internal string AssetIDString {
100100
return;
101101
}
102102

103-
uint result;
104-
if (!uint.TryParse(value, out result)) {
103+
ulong result;
104+
if (!ulong.TryParse(value, out result)) {
105105
return;
106106
}
107107

@@ -127,8 +127,8 @@ internal string ClassIDString {
127127
return;
128128
}
129129

130-
uint result;
131-
if (!uint.TryParse(value, out result)) {
130+
ulong result;
131+
if (!ulong.TryParse(value, out result)) {
132132
return;
133133
}
134134

@@ -148,8 +148,8 @@ internal string InstanceIDString {
148148
return;
149149
}
150150

151-
uint result;
152-
if (!uint.TryParse(value, out result)) {
151+
ulong result;
152+
if (!ulong.TryParse(value, out result)) {
153153
return;
154154
}
155155

@@ -337,7 +337,7 @@ internal sealed class ItemList {
337337
internal bool NewVersion { get; } = true;
338338

339339
[JsonProperty(PropertyName = "version", Required = Required.Always)]
340-
internal int Version { get; } = 2;
340+
internal byte Version { get; } = 2;
341341

342342
[JsonProperty(PropertyName = "me", Required = Required.Always)]
343343
internal ItemList ItemsToGive { get; } = new ItemList();

ArchiSteamFarm/WebBrowser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ private async Task<HttpResponseMessage> UrlRequest(string request, HttpMethod ht
213213
return null;
214214
}
215215

216-
if (request.StartsWith("https://") && Program.GlobalConfig.ForceHttp) {
216+
if (request.StartsWith("https://", StringComparison.Ordinal) && Program.GlobalConfig.ForceHttp) {
217217
return null;
218218
}
219219

0 commit comments

Comments
 (0)