Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
oureveryday committed Jun 30, 2024
1 parent ec775d7 commit 91fb1ed
Show file tree
Hide file tree
Showing 225 changed files with 51,964 additions and 69,359 deletions.
28 changes: 11 additions & 17 deletions DepotDownloaderMod/AccountSettingsStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,25 @@ namespace DepotDownloader
[ProtoContract]
class AccountSettingsStore
{
[ProtoMember(1, IsRequired = false)]
public Dictionary<string, byte[]> SentryData { get; private set; }
// Member 1 was a Dictionary<string, byte[]> for SentryData.

[ProtoMember(2, IsRequired = false)]
public ConcurrentDictionary<string, int> ContentServerPenalty { get; private set; }

[ProtoMember(3, IsRequired = false)]
public Dictionary<string, string> LoginKeys { get; private set; }

// Member 3 was a Dictionary<string, string> for LoginKeys.

[ProtoMember(4, IsRequired = false)]
public Dictionary<string, string> LoginTokens { get; private set; }

[ProtoMember(5, IsRequired = false)]
public Dictionary<string, string> GuardData { get; private set; }
string FileName;

AccountSettingsStore()
{
SentryData = new Dictionary<string, byte[]>();
ContentServerPenalty = new ConcurrentDictionary<string, int>();
LoginTokens = new Dictionary<string, string>();
LoginTokens = [];
GuardData = [];
}

static bool Loaded
Expand All @@ -51,11 +49,9 @@ public static void LoadFromFile(string filename)
{
try
{
using (var fs = IsolatedStorage.OpenFile(filename, FileMode.Open, FileAccess.Read))
using (var ds = new DeflateStream(fs, CompressionMode.Decompress))
{
Instance = Serializer.Deserialize<AccountSettingsStore>(ds);
}
using var fs = IsolatedStorage.OpenFile(filename, FileMode.Open, FileAccess.Read);
using var ds = new DeflateStream(fs, CompressionMode.Decompress);
Instance = Serializer.Deserialize<AccountSettingsStore>(ds);
}
catch (IOException ex)
{
Expand All @@ -78,11 +74,9 @@ public static void Save()

try
{
using (var fs = IsolatedStorage.OpenFile(Instance.FileName, FileMode.Create, FileAccess.Write))
using (var ds = new DeflateStream(fs, CompressionMode.Compress))
{
Serializer.Serialize(ds, Instance);
}
using var fs = IsolatedStorage.OpenFile(Instance.FileName, FileMode.Create, FileAccess.Write);
using var ds = new DeflateStream(fs, CompressionMode.Compress);
Serializer.Serialize(ds, Instance);
}
catch (IOException ex)
{
Expand Down
14 changes: 4 additions & 10 deletions DepotDownloaderMod/CDNClientPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ class CDNClientPool
public Client CDNClient { get; }
public Server ProxyServer { get; private set; }

private readonly ConcurrentStack<Server> activeConnectionPool;
private readonly BlockingCollection<Server> availableServerEndpoints;
private readonly ConcurrentStack<Server> activeConnectionPool = [];
private readonly BlockingCollection<Server> availableServerEndpoints = [];

private readonly AutoResetEvent populatePoolEvent;
private readonly AutoResetEvent populatePoolEvent = new(true);
private readonly Task monitorTask;
private readonly CancellationTokenSource shutdownToken;
private readonly CancellationTokenSource shutdownToken = new();
public CancellationTokenSource ExhaustedToken { get; set; }

public CDNClientPool(Steam3Session steamSession, uint appId)
Expand All @@ -34,12 +34,6 @@ public CDNClientPool(Steam3Session steamSession, uint appId)
this.appId = appId;
CDNClient = new Client(steamSession.steamClient);

activeConnectionPool = new ConcurrentStack<Server>();
availableServerEndpoints = new BlockingCollection<Server>();

populatePoolEvent = new AutoResetEvent(true);
shutdownToken = new CancellationTokenSource();

monitorTask = Task.Factory.StartNew(ConnectionPoolMonitorAsync).Unwrap();
}

Expand Down
Loading

0 comments on commit 91fb1ed

Please sign in to comment.