CommunityDownload¶
Namespace Nfty.Core.Publish.Community in assembly Nfty.Core.
Fetches a listed Set into a cache folder and proves it is what the gallery lists before anything opens it. The download is unauthenticated: the link is a public release download that may redirect to a CDN, so no token is ever attached.
Properties¶
LinkNotOpened¶
The sentence for an entry whose link is not an https address.
Methods¶
FetchAsync(HttpClient, CommunityEntry, string, IProgress<double>?, CancellationToken)¶
public static Task<string> FetchAsync(HttpClient http, CommunityEntry entry, string cacheDir, IProgress<double>? progress, CancellationToken ct);
Downloads entry's Set into cacheDir, verified.
Parameters
http(HttpClient) - A client with no credentials on it.entry(CommunityEntry) - The listed entry; its Set file's size and hash are what the bytes must match.cacheDir(string) - The folder holding downloaded Sets; created when missing.progress(IProgress<double>?) - Receives the fraction of the listed size received, 0 to 1.ct(CancellationToken) - Stops the download.
Returns. The path <cacheDir>/<sha256>.set; a cached copy that still hashes right is returned without a request.
Exceptions
CommunityException- The download failed or did not match the listing; the message is aShareRulessentence.OperationCanceledException-ctwas canceled.