protected override void UpdateAppInternal(AppEntry appEntry, Feed feed)
{
#region Sanity checks
if (appEntry == null) throw new ArgumentNullException(nameof(appEntry));
if (feed == null) throw new ArgumentNullException(nameof(feed));
#endregion
// Temporarily remove capability-based access points but remember them for later reapplication
var toReapply = new List<AccessPoint>();
if (appEntry.AccessPoints != null)
toReapply.AddRange(appEntry.AccessPoints.Entries.Where(accessPoint => accessPoint is DefaultAccessPoint || accessPoint is CapabilityRegistration));
RemoveAccessPointsInternal(appEntry, toReapply);
// Update metadata and capabilities
appEntry.Name = feed.Name;
appEntry.CapabilityLists.Clear();
appEntry.CapabilityLists.AddRange(feed.CapabilityLists.CloneElements());
// Reapply removed access points dumping any that have become incompatible
foreach (var accessPoint in toReapply)
{
try
{
AddAccessPointsInternal(appEntry, feed, new[] {accessPoint});
}
#region Error handling
catch (KeyNotFoundException)
{
Log.Warn($"Access point '{accessPoint}' no longer compatible with interface '{appEntry.InterfaceUri}'.");
}
#endregion
}
WriteAppDir(appEntry);
appEntry.Timestamp = DateTime.UtcNow;
}
#endregion