Refactor data providers and update abstractions

- Removed obsolete data providers: `AnchorCollectionDataProvider`, `ContentsDataProvider`, and others, consolidating logic into new composable providers.
- Added `ComposeDataProviders`, `SelectDataProvider`, and `RelationalDataProvider` for improved flexibility and reusability.
- Introduced `IManySelectionComposableDataProvider` interface to support multiple-node selection.
- Enhanced `UnitDownloader` with more robust progress tracking.
- Updated package references and project dependencies for consistency.
- Improved error handling in `StealthConfig` initialization for better fallback on browser drivers.
- Incremented project version to 2.4.5.
This commit is contained in:
qwsdcvghyu89
2025-11-14 03:41:13 +11:00
parent 2958a26e4f
commit 18c5ad83da
27 changed files with 510 additions and 248 deletions
+7 -1
View File
@@ -44,8 +44,14 @@ namespace Beam.Downloaders {
//Logger?.LogInformation("MoveNextAsync() \n\t -> Links.Current = {} ", LinksEnumerator.Current.Link.AbsoluteUri);
links.Add(new Ordered<string>(LinksEnumerator.Current, LastOrder++));
while (LinksEnumerator.MoveNext() && !string.IsNullOrWhiteSpace(LinksEnumerator.Current) && links.Count < idealLinkCount)
while (links.Count < idealLinkCount && LinksEnumerator.MoveNext()) {
if (string.IsNullOrWhiteSpace(LinksEnumerator.Current)) {
return false;
}
links.Add(new Ordered<string>(LinksEnumerator.Current, LastOrder++));
}
//Logger?.LogInformation("MoveNextAsync() \n\t -> links.Count = {} ", links.Count);
if (links.Count == 0) {
Logger?.LogInformation("Out of links!");
+11 -1
View File
@@ -28,12 +28,22 @@ namespace Beam.Downloaders {
byte[] buffer = new byte[bufferSize];
int inBuffer = 0;
long downloaded = 0;
long? remaining() {
try {
return stream.Length - downloaded;
}
catch {
return null;
}
}
while ((inBuffer = stream.Read(buffer)) > 0) {
downloaded += inBuffer;
await destinationStream.WriteAsync(buffer.AsMemory(0, inBuffer), ct);
progress?.Report(new DownloadReport() {
BytesDownloaded = inBuffer,
BytesRemaining = stream.Length - downloaded
BytesRemaining = remaining()
});
ct.ThrowIfCancellationRequested();