Merge branch 'SteamRE:master' into patch-1

pull/554/head
Ethan 1 year ago committed by GitHub
commit e81c37d665
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -307,6 +307,8 @@ namespace DepotDownloader
return false; return false;
} }
Task.Run(steam3.TickCallbacks);
return true; return true;
} }

@ -26,6 +26,6 @@
</PackageReference> </PackageReference>
<PackageReference Include="protobuf-net" Version="3.2.30" /> <PackageReference Include="protobuf-net" Version="3.2.30" />
<PackageReference Include="QRCoder" Version="1.6.0" /> <PackageReference Include="QRCoder" Version="1.6.0" />
<PackageReference Include="SteamKit2" Version="3.0.0-Beta.4" /> <PackageReference Include="SteamKit2" Version="3.0.0-Beta.5" />
</ItemGroup> </ItemGroup>
</Project> </Project>

@ -39,7 +39,7 @@ namespace DepotDownloader
public SteamContent steamContent; public SteamContent steamContent;
readonly SteamApps steamApps; readonly SteamApps steamApps;
readonly SteamCloud steamCloud; readonly SteamCloud steamCloud;
readonly SteamUnifiedMessages.UnifiedService<IPublishedFile> steamPublishedFile; readonly PublishedFile steamPublishedFile;
readonly CallbackManager callbacks; readonly CallbackManager callbacks;
@ -52,6 +52,7 @@ namespace DepotDownloader
int connectionBackoff; int connectionBackoff;
int seq; // more hack fixes int seq; // more hack fixes
AuthSession authSession; AuthSession authSession;
readonly CancellationTokenSource abortedToken = new();
// input // input
readonly SteamUser.LogOnDetails logonDetails; readonly SteamUser.LogOnDetails logonDetails;
@ -72,7 +73,7 @@ namespace DepotDownloader
this.steamApps = this.steamClient.GetHandler<SteamApps>(); this.steamApps = this.steamClient.GetHandler<SteamApps>();
this.steamCloud = this.steamClient.GetHandler<SteamCloud>(); this.steamCloud = this.steamClient.GetHandler<SteamCloud>();
var steamUnifiedMessages = this.steamClient.GetHandler<SteamUnifiedMessages>(); var steamUnifiedMessages = this.steamClient.GetHandler<SteamUnifiedMessages>();
this.steamPublishedFile = steamUnifiedMessages.CreateService<IPublishedFile>(); this.steamPublishedFile = steamUnifiedMessages.CreateService<PublishedFile>();
this.steamContent = this.steamClient.GetHandler<SteamContent>(); this.steamContent = this.steamClient.GetHandler<SteamContent>();
this.callbacks = new CallbackManager(this.steamClient); this.callbacks = new CallbackManager(this.steamClient);
@ -122,6 +123,23 @@ namespace DepotDownloader
return IsLoggedOn; return IsLoggedOn;
} }
public async Task TickCallbacks()
{
var token = abortedToken.Token;
try
{
while (!token.IsCancellationRequested)
{
await callbacks.RunWaitCallbackAsync(token);
}
}
catch (OperationCanceledException)
{
//
}
}
public async Task RequestAppInfo(uint appId, bool bForce = false) public async Task RequestAppInfo(uint appId, bool bForce = false)
{ {
if ((AppInfo.ContainsKey(appId) && !bForce) || bAborted) if ((AppInfo.ContainsKey(appId) && !bForce) || bAborted)
@ -285,15 +303,14 @@ namespace DepotDownloader
var pubFileRequest = new CPublishedFile_GetDetails_Request { appid = appId }; var pubFileRequest = new CPublishedFile_GetDetails_Request { appid = appId };
pubFileRequest.publishedfileids.Add(pubFile); pubFileRequest.publishedfileids.Add(pubFile);
var callback = await steamPublishedFile.SendMessage(api => api.GetDetails(pubFileRequest)); var details = await steamPublishedFile.GetDetails(pubFileRequest);
if (callback.Result == EResult.OK) if (details.Result == EResult.OK)
{ {
var response = callback.GetDeserializedResponse<CPublishedFile_GetDetails_Response>(); return details.Body.publishedfiledetails.FirstOrDefault();
return response.publishedfiledetails.FirstOrDefault();
} }
throw new Exception($"EResult {(int)callback.Result} ({callback.Result}) while retrieving file details for pubfile {pubFile}."); throw new Exception($"EResult {(int)details.Result} ({details.Result}) while retrieving file details for pubfile {pubFile}.");
} }
@ -346,6 +363,7 @@ namespace DepotDownloader
bAborted = true; bAborted = true;
bConnecting = false; bConnecting = false;
bIsConnectionRecovery = false; bIsConnectionRecovery = false;
abortedToken.Cancel();
steamClient.Disconnect(); steamClient.Disconnect();
Ansi.Progress(Ansi.ProgressState.Hidden); Ansi.Progress(Ansi.ProgressState.Hidden);

Loading…
Cancel
Save