mirror of
https://github.com/logos-storage/logos-storage-nim-cs-dist-tests.git
synced 2026-05-01 15:13:11 +00:00
Use local-files api instead of download-manifest to detect existing files.
This commit is contained in:
parent
9b432ded46
commit
3ab1e2ea47
@ -40,7 +40,11 @@ namespace AutoClient.Modes.FolderStore
|
||||
|
||||
private void EnsureBasicCid()
|
||||
{
|
||||
if (IsBasicCidAvailable()) return;
|
||||
if (IsBasicCidAvailable())
|
||||
{
|
||||
Log("BasicCid is available.");
|
||||
return;
|
||||
}
|
||||
UploadFile();
|
||||
}
|
||||
|
||||
@ -76,8 +80,14 @@ namespace AutoClient.Modes.FolderStore
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = instance.Node.DownloadManifestOnly(new ContentId(entry.BasicCid));
|
||||
return !string.IsNullOrEmpty(result.Cid.Id);
|
||||
var result = instance.Node.LocalFiles();
|
||||
if (result == null) return false;
|
||||
if (result.Content == null) return false;
|
||||
return result.Content.Any(c =>
|
||||
c != null &&
|
||||
c.Cid != null &&
|
||||
!string.IsNullOrEmpty(c.Cid.Id) &&
|
||||
c.Cid.Id.ToLowerInvariant() == entry.BasicCid.ToLowerInvariant());
|
||||
}
|
||||
catch
|
||||
{
|
||||
@ -88,6 +98,7 @@ namespace AutoClient.Modes.FolderStore
|
||||
|
||||
private void UploadFile()
|
||||
{
|
||||
Log("Uploading file...");
|
||||
Changes = true;
|
||||
try
|
||||
{
|
||||
@ -107,6 +118,7 @@ namespace AutoClient.Modes.FolderStore
|
||||
private void CreateNewPurchase()
|
||||
{
|
||||
if (string.IsNullOrEmpty(entry.BasicCid)) return;
|
||||
Log("Creating new purchase...");
|
||||
|
||||
Changes = true;
|
||||
try
|
||||
|
||||
@ -52,7 +52,7 @@ namespace AutoClient.Modes.FolderStore
|
||||
}
|
||||
|
||||
statusFile.Save(status);
|
||||
Thread.Sleep(2000);
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user