public IEnumerable<Relationship> GetRelationships(IEnumerable<string> names) { return from name in Relationship.RelationshipNames where names.HasWildcardMatch(name) select Relationship.Load(name); }
private IEnumerable<SyncOrchestrator> CreateOrchestrators(IEnumerable<string> nameMask) { var syncs = from name in Relationship.RelationshipNames let relationship = Relationship.Load(name) where nameMask.HasWildcardMatch(name) && relationship.Enabled select new { LocalProvider = new FileSyncProvider(relationship.Guid(), relationship.LocalPath, new FileSyncScopeFilter(), FileSyncOptions.RecycleDeletedFiles | FileSyncOptions.RecyclePreviousFileOnUpdates, relationship.LocalMetadataDirectory, "filesync.metadata", relationship.TempDirectory, relationship.ConflictsDirectory), RemoteProvider = new AzureBlobSyncProvider(relationship.Account, relationship.Container, relationship.Key, relationship.RemoteMetadataDirectory) }; foreach( var sync in syncs ) { if (!IsRunAsService) { sync.LocalProvider.ApplyingChange += ApplyinLocalChange; sync.RemoteProvider.ApplyingChange += ApplyinRemoteChange; } else { sync.LocalProvider.ApplyingChange += (x, y) => { }; sync.RemoteProvider.ApplyingChange += (x, y) => { }; } yield return new SyncOrchestrator() { LocalProvider = sync.LocalProvider, RemoteProvider = sync.RemoteProvider }; } }