Esempio n. 1
0
        public IEnumerable <uSyncAction> ExportHandler(string handler, uSyncImportOptions options)
        {
            var handlerPair = handlerFactory.GetValidHandler(handler, new SyncHandlerOptions
            {
                Set    = options.HandlerSet,
                Action = HandlerActions.Export
            });

            if (handlerPair == null)
            {
                return(Enumerable.Empty <uSyncAction>());
            }
            var folder = GetHandlerFolder(options.RootFolder, handlerPair.Handler);

            return(handlerPair.Handler.ExportAll(folder, handlerPair.Settings, options.Callbacks?.Update));
        }
Esempio n. 2
0
        public IEnumerable <uSyncAction> ImportHandler(string handlerAlias, uSyncImportOptions options)
        {
            lock (_importLock)
            {
                using (var pause = new uSyncImportPause())
                {
                    var handlerPair = handlerFactory.GetValidHandler(handlerAlias, new SyncHandlerOptions
                    {
                        Set    = options.HandlerSet,
                        Action = HandlerActions.Import
                    });

                    if (handlerPair == null)
                    {
                        return(Enumerable.Empty <uSyncAction>());
                    }
                    var folder = GetHandlerFolder(options.RootFolder, handlerPair.Handler);

                    return(handlerPair.Handler.ImportAll(folder, handlerPair.Settings,
                                                         options.Flags.HasFlag(SerializerFlags.Force),
                                                         options.Callbacks?.Update));
                }
            }
        }