Skip to content

Commit

Permalink
Update experiments
Browse files Browse the repository at this point in the history
  • Loading branch information
JustArchi committed Oct 17, 2024
1 parent 70b1c6e commit 6e34cdc
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 30 deletions.
4 changes: 2 additions & 2 deletions ArchiSteamFarm/Core/Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ public static IEnumerable<T> ToEnumerable<T>(this T item) {
public static string ToHumanReadable(this TimeSpan timeSpan) => timeSpan.Humanize(3, maxUnit: TimeUnit.Year, minUnit: TimeUnit.Second);

[PublicAPI]
public static Task<T> ToLongRunningTask<T>(this AsyncJob<T> job) where T : CallbackMsg {
public static Task<T> ToLongRunningTask<T>(this AsyncJob<T> job) where T : ICallbackMsg {
ArgumentNullException.ThrowIfNull(job);

job.Timeout = TimeSpan.FromSeconds(TimeoutForLongRunningTasksInSeconds);
Expand All @@ -250,7 +250,7 @@ public static Task<T> ToLongRunningTask<T>(this AsyncJob<T> job) where T : Callb
}

[PublicAPI]
public static Task<AsyncJobMultiple<T>.ResultSet> ToLongRunningTask<T>(this AsyncJobMultiple<T> job) where T : CallbackMsg {
public static Task<AsyncJobMultiple<T>.ResultSet> ToLongRunningTask<T>(this AsyncJobMultiple<T> job) where T : ICallbackMsg {
ArgumentNullException.ThrowIfNull(job);

job.Timeout = TimeSpan.FromSeconds(TimeoutForLongRunningTasksInSeconds);
Expand Down
7 changes: 3 additions & 4 deletions ArchiSteamFarm/Steam/Bot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,6 @@ private Bot(string botName, BotConfig botConfig, BotDatabase botDatabase) {
CallbackManager.Subscribe<SteamFriends.FriendsListCallback>(OnFriendsList);
CallbackManager.Subscribe<SteamFriends.PersonaStateCallback>(OnPersonaState);

CallbackManager.Subscribe<SteamUnifiedMessages.ServiceMethodNotification<CChatRoom_IncomingChatMessage_Notification>>(OnIncomingChatMessage);
CallbackManager.Subscribe<SteamUnifiedMessages.ServiceMethodNotification<CFriendMessages_IncomingMessage_Notification>>(OnIncomingMessage);

SteamUser = SteamClient.GetHandler<SteamUser>() ?? throw new InvalidOperationException(nameof(SteamUser));
CallbackManager.Subscribe<SteamUser.LoggedOffCallback>(OnLoggedOff);
CallbackManager.Subscribe<SteamUser.LoggedOnCallback>(OnLoggedOn);
Expand All @@ -396,6 +393,9 @@ private Bot(string botName, BotConfig botConfig, BotDatabase botDatabase) {
CallbackManager.Subscribe<SharedLibraryLockStatusCallback>(OnSharedLibraryLockStatus);
CallbackManager.Subscribe<UserNotificationsCallback>(OnUserNotifications);

CallbackManager.SubscribeNotifications<ChatRoomClient, CChatRoom_IncomingChatMessage_Notification>(OnIncomingChatMessage);
CallbackManager.SubscribeNotifications<FriendMessagesClient, CFriendMessages_IncomingMessage_Notification>(OnIncomingMessage);

Actions = new Actions(this);
CardsFarmer = new CardsFarmer(this);
Commands = new Commands(this);
Expand Down Expand Up @@ -2098,7 +2098,6 @@ private void Disconnect(bool reconnect = false) {
}

private void DisposeShared() {
ArchiHandler.Dispose();
ArchiWebHandler.Dispose();
BotDatabase.Dispose();
ConnectionSemaphore.Dispose();
Expand Down
24 changes: 1 addition & 23 deletions ArchiSteamFarm/Steam/Integration/ArchiHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,11 @@

namespace ArchiSteamFarm.Steam.Integration;

public sealed class ArchiHandler : ClientMsgHandler, IDisposable {
public sealed class ArchiHandler : ClientMsgHandler {
internal const byte MaxGamesPlayedConcurrently = 32; // This is limit introduced by Steam Network

private readonly ArchiLogger ArchiLogger;

private readonly ChatRoomClient ChatRoomClient;
private readonly FriendMessagesClient FriendMessagesClient;

private readonly AccountPrivateApps UnifiedAccountPrivateApps;
private readonly ChatRoom UnifiedChatRoomService;
private readonly ClanChatRooms UnifiedClanChatRoomsService;
Expand Down Expand Up @@ -88,25 +85,6 @@ internal ArchiHandler(ArchiLogger archiLogger, SteamUnifiedMessages steamUnified
UnifiedPlayerService = steamUnifiedMessages.CreateService<Player>();
UnifiedStoreService = steamUnifiedMessages.CreateService<Store>();
UnifiedTwoFactorService = steamUnifiedMessages.CreateService<TwoFactor>();

ChatRoomClient = steamUnifiedMessages.CreateService<ChatRoomClient>();
FriendMessagesClient = steamUnifiedMessages.CreateService<FriendMessagesClient>();
}

public void Dispose() {
ChatRoomClient.Dispose();
FriendMessagesClient.Dispose();
UnifiedAccountPrivateApps.Dispose();
UnifiedChatRoomService.Dispose();
UnifiedClanChatRoomsService.Dispose();
UnifiedCredentialsService.Dispose();
UnifiedEconService.Dispose();
UnifiedFamilyGroups.Dispose();
UnifiedFriendMessagesService.Dispose();
UnifiedLoyaltyRewards.Dispose();
UnifiedPlayerService.Dispose();
UnifiedStoreService.Dispose();
UnifiedTwoFactorService.Dispose();
}

[PublicAPI]
Expand Down
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<PackageVersion Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.9.0" />
<PackageVersion Include="OpenTelemetry.Instrumentation.Http" Version="1.9.0" />
<PackageVersion Include="OpenTelemetry.Instrumentation.Runtime" Version="1.9.0" />
<PackageVersion Include="SteamKit2" Version="3.0.0-Alpha.1053" />
<PackageVersion Include="SteamKit2" Version="3.0.0-Alpha.1063" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="6.9.0" />
<PackageVersion Include="Swashbuckle.AspNetCore.Annotations" Version="6.9.0" />
<PackageVersion Include="System.Composition" Version="8.0.0" />
Expand Down
Binary file removed resources/SteamKit2.3.0.0-Alpha.1053.nupkg
Binary file not shown.
Binary file added resources/SteamKit2.3.0.0-Alpha.1063.nupkg
Binary file not shown.

0 comments on commit 6e34cdc

Please sign in to comment.