Ejemplo n.º 1
0
        protected virtual IFilesChanges CreateFileSystemChanges(string filesystem)
        {
            if (string.IsNullOrEmpty(Url))
            {
                throw new InvalidOperationException("Changes API requires usage of server/client");
            }

            var tenantUrl = Url + "/fs/" + filesystem;

            var commands = fileSystemCommands.GetOrAdd(filesystem, x => (IAsyncFilesCommandsImpl)this.AsyncFilesCommands.ForFileSystem(x));

            using (NoSynchronizationContext.Scope())
            {
                var client = new FilesChangesClient(tenantUrl,
                                                    ApiKey,
                                                    Credentials,
                                                    jsonRequestFactory,
                                                    Conventions,
                                                    commands.ReplicationInformer,
                                                    ((AsyncFilesServerClient)this.AsyncFilesCommands).TryResolveConflictByUsingRegisteredListenersAsync,
                                                    () =>
                {
                    fileSystemChanges.Remove(filesystem);
                    fileSystemCommands.Remove(filesystem);
                });

                return(client);
            }
        }
Ejemplo n.º 2
0
        protected virtual IFilesChanges CreateFileSystemChanges(string filesystem)
        {
            if (string.IsNullOrEmpty(Url))
                throw new InvalidOperationException("Changes API requires usage of server/client");

            var tenantUrl = Url + "/fs/" + filesystem;

            var commands = fileSystemCommands.GetOrAdd(filesystem, x => (IAsyncFilesCommandsImpl)this.AsyncFilesCommands.ForFileSystem(x));

            using (NoSynchronizationContext.Scope())
            {
                var client = new FilesChangesClient(tenantUrl,
                    ApiKey,
                    Credentials,
                    jsonRequestFactory,
                    Conventions,
                    commands.ReplicationInformer,
                    ((AsyncFilesServerClient) this.AsyncFilesCommands).TryResolveConflictByUsingRegisteredListenersAsync,
                    () =>
                    {
                        fileSystemChanges.Remove(filesystem);
                        fileSystemCommands.Remove(filesystem);
                    });

                return client;
            }
        }