Esempio n. 1
0
        //
        /// <summary>
        /// Inits the upload and download transfer services.
        /// </summary>
        protected void InitTransferServices()
        {
            // ReSharper disable UseObjectOrCollectionInitializer
            var config = new LocalTransferConfig
                         // ReSharper restore UseObjectOrCollectionInitializer
            {
                Provider = this,
                FileSystemConfiguration  = FileSystemConfiguration,
                FileResolverFunc         = ResolveFileResourcePathInternal2,
                ClaimsResolverFunc       = fi => Security.GetFileClaims(fi),
                FolderClaimsResolverFunc = fi => Security.GetFolderClaims(fi),
                LockResolverFunc         = (fi, lockType) => RequestChainedLockGuard(fi, lockType)
            };

            config.FileParentResolverFunc = (fi, context) => {
                //delegate resolving of the parent path
                string parentFolderPath = fi.ResourceInfo.ParentFolderPath;

                //get the parent info
                return(ResolveFolderResourcePathInternal2(parentFolderPath, true, context));
            };

            //init stores
            downloadHandler = new LocalDownloadHandler(FileSystemConfiguration.DownloadStore, config);
            uploadHandler   = new LocalUploadHandler(FileSystemConfiguration.UploadStore, config);
        }
Esempio n. 2
0
        public void Run_Test()
        {
            var file = new MemoryFileInfo("Hello from uploader...");
            var uploadItem = new UploadItem(file);
            var handler = new LocalUploadHandler();

            var completed = false;

            var task = new Task(handler, uploadItem);
            task.Run(() =>
                {
                    completed = true;
                });

            Assert.IsTrue(completed);
        }
        //
        /// <summary>
        /// Inits the upload and download transfer services.
        /// </summary>
        protected void InitTransferServices() {
            // ReSharper disable UseObjectOrCollectionInitializer
            var config = new LocalTransferConfig
                // ReSharper restore UseObjectOrCollectionInitializer
                           {
                               Provider = this,
                               FileSystemConfiguration = FileSystemConfiguration,
                               FileResolverFunc = ResolveFileResourcePathInternal2,
                               ClaimsResolverFunc = fi => Security.GetFileClaims(fi),
                               FolderClaimsResolverFunc = fi => Security.GetFolderClaims(fi),
                               LockResolverFunc = (fi, lockType) => RequestChainedLockGuard(fi, lockType)
                           };

            config.FileParentResolverFunc = (fi, context) => {
                //delegate resolving of the parent path
                string parentFolderPath = fi.ResourceInfo.ParentFolderPath;

                //get the parent info
                return ResolveFolderResourcePathInternal2(parentFolderPath, true, context);
            };

            //init stores
            downloadHandler = new LocalDownloadHandler(FileSystemConfiguration.DownloadStore, config);
            uploadHandler = new LocalUploadHandler(FileSystemConfiguration.UploadStore, config);
        }