Ejemplo n.º 1
0
        /// <summary>
        ///  Create a new uSyncAction from a SyncAttempt
        /// </summary>
        public static uSyncAction SetAction(SyncAttempt <T> attempt, string filename, Guid key, string handlerAlias, bool requirePostProcessing = true)
        {
            var action = new uSyncAction(attempt.Success, attempt.Name, attempt.ItemType, attempt.Change, attempt.Message, attempt.Exception, filename, handlerAlias, requirePostProcessing);

            action.key = key;
            if (attempt.Details != null && attempt.Details.Any())
            {
                action.Details = attempt.Details;
            }
            return(action);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///  Import a single item based on a uSyncAction item
        /// </summary>
        /// <remarks>
        ///  Importing a single item based on an action, the action will
        ///  detail what handler to use and the filename of the item to import
        /// </remarks>
        /// <param name="action">Action item, to use as basis for import</param>
        /// <returns>Action detailing change or not</returns>
        public uSyncAction ImportSingleAction(uSyncAction action)
        {
            var handlerConfig = _handlerFactory.GetValidHandler(action.HandlerAlias);

            if (handlerConfig != null)
            {
                return(handlerConfig.Handler
                       .Import(action.FileName, handlerConfig.Settings, true)
                       .FirstOrDefault());
            }

            return(new uSyncAction());
        }