_logger.LogError("The manifest ID {LocalUUID} did not match the package info ID {PackageUUID}.",localManifest.Id,manifest.Id);
localManifest.Status=PluginStatus.Malfunctioned;
}
if(localManifest.Version!=manifest.Version)
{
_logger.LogWarning("The version of the local manifest was {LocalVersion}, but {PackageVersion} was expected. The value will be replaced.",localManifest.Version,manifest.Version);
// Correct the local version.
localManifest.Version=manifest.Version;
}
// Reconcile missing data against repository manifest.
ReconcileManifest(localManifest,manifest);
manifest=localManifest;
}
else
if(!ReconcileManifest(manifest,path))
{
_logger.LogInformation("No local manifest exists for plugin {Plugin}. Populating from repository manifest.",manifest.Name);
// An error occurred during reconciliation and saving could be undesirable.
returnfalse;
}
returnSaveManifest(manifest,path);
}
/// <summary>
/// Resolve the target plugin manifest against the source. Values are mapped onto the
/// target only if they are default values or empty strings. ID and status fields are ignored.
/// Reconciles the manifest against any properties that exist locally in a pre-packaged meta.json found at the path.
/// If no file is found, no reconciliation occurs.
/// </summary>
/// <param name="baseManifest">The base <see cref="PluginManifest"/> to be reconciled.</param>
/// <param name="projector">The <see cref="PluginManifest"/> to reconcile against.</param>
// Package information provides the version and is the source of truth. Pre-packages meta.json is assumed to be a mistake in this regard.
_logger.LogWarning("The version of the local manifest was {LocalVersion}, but {PackageVersion} was expected. The value will be replaced.",localManifest.Version,manifest.Version);
}
// Explicitly mapping properties instead of using reflection is preferred here.