Skip to content

Commit

Permalink
stuff
Browse files Browse the repository at this point in the history
depotdownloader new version and other stuff
  • Loading branch information
AKrisz2 committed May 9, 2024
1 parent b9e369e commit ef40746
Show file tree
Hide file tree
Showing 285 changed files with 257,335 additions and 985 deletions.
16 changes: 6 additions & 10 deletions R6 Downloader.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32825.248
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "R6 Downloader", "R6 Downloader\R6 Downloader.csproj", "{2E5895CB-F63B-449B-8178-3AEA9E7159E3}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "R6 Downloader", "R6 Downloader\R6 Downloader.csproj", "{2E5895CB-F63B-449B-8178-3AEA9E7159E3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -15,21 +15,17 @@ Global
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2E5895CB-F63B-449B-8178-3AEA9E7159E3}.Debug|arm64.ActiveCfg = Debug|arm64
{2E5895CB-F63B-449B-8178-3AEA9E7159E3}.Debug|arm64.Build.0 = Debug|arm64
{2E5895CB-F63B-449B-8178-3AEA9E7159E3}.Debug|arm64.Deploy.0 = Debug|arm64
{2E5895CB-F63B-449B-8178-3AEA9E7159E3}.Debug|arm64.ActiveCfg = Debug|x64
{2E5895CB-F63B-449B-8178-3AEA9E7159E3}.Debug|x64.ActiveCfg = Debug|x64
{2E5895CB-F63B-449B-8178-3AEA9E7159E3}.Debug|x64.Build.0 = Debug|x64
{2E5895CB-F63B-449B-8178-3AEA9E7159E3}.Debug|x64.Deploy.0 = Debug|x64
{2E5895CB-F63B-449B-8178-3AEA9E7159E3}.Debug|x86.ActiveCfg = Debug|x86
{2E5895CB-F63B-449B-8178-3AEA9E7159E3}.Debug|x86.Build.0 = Debug|x86
{2E5895CB-F63B-449B-8178-3AEA9E7159E3}.Debug|x86.Deploy.0 = Debug|x86
{2E5895CB-F63B-449B-8178-3AEA9E7159E3}.Release|arm64.ActiveCfg = Release|arm64
{2E5895CB-F63B-449B-8178-3AEA9E7159E3}.Release|arm64.Build.0 = Release|arm64
{2E5895CB-F63B-449B-8178-3AEA9E7159E3}.Release|arm64.Deploy.0 = Release|arm64
{2E5895CB-F63B-449B-8178-3AEA9E7159E3}.Release|x64.ActiveCfg = Release|x64
{2E5895CB-F63B-449B-8178-3AEA9E7159E3}.Release|x64.Build.0 = Release|x64
{2E5895CB-F63B-449B-8178-3AEA9E7159E3}.Release|x64.Deploy.0 = Release|x64
{2E5895CB-F63B-449B-8178-3AEA9E7159E3}.Release|arm64.ActiveCfg = Release|x64
{2E5895CB-F63B-449B-8178-3AEA9E7159E3}.Release|x64.ActiveCfg = Debug|x64
{2E5895CB-F63B-449B-8178-3AEA9E7159E3}.Release|x64.Build.0 = Debug|x64
{2E5895CB-F63B-449B-8178-3AEA9E7159E3}.Release|x64.Deploy.0 = Debug|x64
{2E5895CB-F63B-449B-8178-3AEA9E7159E3}.Release|x86.ActiveCfg = Release|x86
{2E5895CB-F63B-449B-8178-3AEA9E7159E3}.Release|x86.Build.0 = Release|x86
{2E5895CB-F63B-449B-8178-3AEA9E7159E3}.Release|x86.Deploy.0 = Release|x86
Expand Down
36 changes: 18 additions & 18 deletions R6 Downloader/DepotDownloaderLib/AccountSettingsStore.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
Expand All @@ -11,22 +11,26 @@ 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>();
LoginKeys = new Dictionary<string, string>();
LoginTokens = [];
GuardData = [];
}

static bool Loaded
Expand All @@ -40,17 +44,15 @@ static bool Loaded
public static void LoadFromFile(string filename)
{
if (Loaded)
Console.WriteLine("Reloading account details");
throw new Exception("Config already loaded");

if (IsolatedStorage.FileExists(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 @@ -73,11 +75,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 R6 Downloader/DepotDownloaderLib/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 ef40746

Please sign in to comment.