private void ProcessSync(ProgressReporter progress)
{
foreach (var configuration in ResolveConfigurations())
{
using (new LoggingContext(progress, configuration))
{
try
{
progress.ReportSimple("Control Panel Sync: Processing Unicorn configuration " +
configuration.Name, MessageLevel.Info);
var pathResolver = configuration.Resolve<PredicateRootPathResolver>();
var retryer = configuration.Resolve<IDeserializeFailureRetryer>();
var consistencyChecker = configuration.Resolve<IConsistencyChecker>();
var loader = configuration.Resolve<SerializationLoader>();
var roots = pathResolver.GetRootSerializedItems();
int index = 1;
loader.LoadAll(roots, retryer, consistencyChecker, item =>
{
progress.ReportProgress((int)((index / (double)roots.Length) * 100));
index++;
});
progress.ReportSimple("Control Panel Sync: Completed syncing Unicorn configuration " +
configuration.Name, MessageLevel.Info);
}
catch (Exception ex)
{
progress.Error(ex);
break;
}
}
}
}