ZeroInstall.DesktopIntegration.SyncIntegrationManager.MergeData C# (CSharp) Method

MergeData() private method

Merges a new IntegrationManagerBase.AppList with the existing data.
Performs a three-way merge using _appListLastSync as base.
The user canceled the task. An reference to a is invalid. One of the s or s is invalid. A problem occurs while writing to the filesystem or registry. One or more new would cause a conflict with the existing s in . A problem occured while downloading additional data (such as icons). Write access to the filesystem or registry is not permitted.
private MergeData ( [ remoteAppList, bool resetClient ) : void
remoteAppList [ The remote to merge in.
resetClient bool Set to true to completly replace the contents of with instead of merging the two.
return void
        private void MergeData([NotNull] AppList remoteAppList, bool resetClient)
        {
            #region Sanity checks
            if (remoteAppList == null) throw new ArgumentNullException(nameof(remoteAppList));
            #endregion

            var toAdd = new List<AppEntry>();
            var toRemove = new List<AppEntry>();

            if (resetClient)
            {
                Merge.TwoWay(
                    theirs: remoteAppList.Entries,
                    mine: AppList.Entries,
                    added: toAdd, removed: toRemove);
            }
            else
            {
                Merge.ThreeWay(
                    reference: _appListLastSync.Entries,
                    theirs: remoteAppList.Entries,
                    mine: AppList.Entries,
                    added: toAdd, removed: toRemove);
            }

            Handler.RunTask(new SimpleTask(Resources.ApplyingChanges, () =>
            {
                toRemove.ApplyWithRollback(RemoveAppInternal, AddAppHelper);
                toAdd.ApplyWithRollback(AddAppHelper, RemoveAppInternal);
            }));
        }