From 66781b5de49279456c987a76b96def49c5796482 Mon Sep 17 00:00:00 2001 From: Emmanuel Mathot Date: Wed, 9 Jun 2021 11:37:48 +0200 Subject: [PATCH] asset filtered fixed in item --- .vscode/launch.json | 27 ++++++++++++++++++- src/Stars.Console/Operations/CopyOperation.cs | 2 +- src/Stars.Services/StacResourceExtensions.cs | 6 +++-- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 5aa8f1f7..86601d77 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -619,7 +619,32 @@ "moduleLoad": false } }, - + { + "name": "Copy calibrated", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build", + // If you have changed target frameworks, make sure to update the program path. + "program": "${workspaceFolder}/src/Stars.Console/bin/Debug/netcoreapp3.1/Stars.dll", + "args": [ + "copy", + "https://supervisor.charter.uat.esaportal.eu/catalog/calls/call-100/calibratedDatasets/S2A_MSIL1C_20200615T060641_N0209_R134_T45WWS_20200615T080720-calibrated/S2A_MSIL1C_20200615T060641_N0209_R134_T45WWS_20200615T080720-calibrated.json", + "-v", + "-af", + "red", + "-r", + "4", + "--output", + "/tmp/charter" + ], + "cwd": "${workspaceFolder}/src", + // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console + "console": "internalConsole", + "stopAtEntry": false, + "logging": { + "moduleLoad": false + } + }, { "name": ".NET Core Attach", "type": "coreclr", diff --git a/src/Stars.Console/Operations/CopyOperation.cs b/src/Stars.Console/Operations/CopyOperation.cs index e1f14d45..697d57c5 100644 --- a/src/Stars.Console/Operations/CopyOperation.cs +++ b/src/Stars.Console/Operations/CopyOperation.cs @@ -243,7 +243,7 @@ private async Task CopyNode(IResource node, IRouter router, object state throw new AggregateException(deliveryReport.AssetsExceptions.Values); if (deliveryReport.ImportedAssets.Count() > 0) - stacItemNode.StacItem.MergeAssets(deliveryReport); + stacItemNode.StacItem.MergeAssets(deliveryReport, true); else continue; } break; diff --git a/src/Stars.Services/StacResourceExtensions.cs b/src/Stars.Services/StacResourceExtensions.cs index f90984ba..6463e2b8 100644 --- a/src/Stars.Services/StacResourceExtensions.cs +++ b/src/Stars.Services/StacResourceExtensions.cs @@ -10,11 +10,13 @@ namespace Terradue.Stars.Services public static class StacResourceExtensions { - public static void MergeAssets(this StacItem stacItem, IAssetsContainer assetContainer) + public static void MergeAssets(this StacItem stacItem, IAssetsContainer assetContainer, bool removeIfNotInContainer = false) { + if ( removeIfNotInContainer ) + stacItem.Assets.Clear(); foreach (var asset in assetContainer.Assets) { - if (stacItem.Assets.ContainsKey(asset.Key)) + if (stacItem.Assets.ContainsKey(asset.Key) ) { stacItem.Assets.Remove(asset.Key); }