Skip to content

Commit

Permalink
asset filtered fixed in item
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuelmathot committed Jun 9, 2021
1 parent b328bba commit 66781b5
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
27 changes: 26 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/Stars.Console/Operations/CopyOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ private async Task<object> 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;
Expand Down
6 changes: 4 additions & 2 deletions src/Stars.Services/StacResourceExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 66781b5

Please sign in to comment.