Skip to content

Commit

Permalink
Misc
Browse files Browse the repository at this point in the history
  • Loading branch information
JustArchi committed Oct 6, 2024
1 parent 500a148 commit c7524af
Showing 1 changed file with 14 additions and 20 deletions.
34 changes: 14 additions & 20 deletions ArchiSteamFarm/Steam/Bot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -408,16 +408,7 @@ private Bot(string botName, BotConfig botConfig, BotDatabase botDatabase) {
}

public void Dispose() {
// Those are objects that are always being created if constructor doesn't throw exception
ArchiWebHandler.Dispose();
BotDatabase.Dispose();
GamesRedeemerInBackgroundSemaphore.Dispose();
InitializationSemaphore.Dispose();
MessagingSemaphore.Dispose();
RefreshWebSessionSemaphore.Dispose();
SendCompleteTypesSemaphore.Dispose();
Trading.Dispose();
UnpackBoosterPacksSemaphore.Dispose();
DisposeShared();

Actions.Dispose();
CardsFarmer.Dispose();
Expand All @@ -436,16 +427,7 @@ public void Dispose() {
}

public async ValueTask DisposeAsync() {
// Those are objects that are always being created if constructor doesn't throw exception
ArchiWebHandler.Dispose();
BotDatabase.Dispose();
GamesRedeemerInBackgroundSemaphore.Dispose();
InitializationSemaphore.Dispose();
MessagingSemaphore.Dispose();
RefreshWebSessionSemaphore.Dispose();
SendCompleteTypesSemaphore.Dispose();
Trading.Dispose();
UnpackBoosterPacksSemaphore.Dispose();
DisposeShared();

await Actions.DisposeAsync().ConfigureAwait(false);
await CardsFarmer.DisposeAsync().ConfigureAwait(false);
Expand Down Expand Up @@ -2092,6 +2074,18 @@ private void Disconnect(bool reconnect = false) {
SteamClient.Disconnect();
}

private void DisposeShared() {
ArchiWebHandler.Dispose();
BotDatabase.Dispose();
GamesRedeemerInBackgroundSemaphore.Dispose();
InitializationSemaphore.Dispose();
MessagingSemaphore.Dispose();
RefreshWebSessionSemaphore.Dispose();
SendCompleteTypesSemaphore.Dispose();
Trading.Dispose();
UnpackBoosterPacksSemaphore.Dispose();
}

private async Task<Dictionary<string, string>?> GetKeysFromFile(string filePath) {
ArgumentException.ThrowIfNullOrEmpty(filePath);

Expand Down

0 comments on commit c7524af

Please sign in to comment.