public void Init() { store = new InMemoryTransferStore<DownloadTransfer<FileItem>>(); transfers = new List<DownloadTransfer<FileItem>>(); for (int i = 0; i < 10; i++) { FileItem item = new FileItem {LocalFile = new FileInfo(i.ToString())}; var token = new DownloadToken {TransferId = i.ToString()}; transfers.Add(new DownloadTransfer<FileItem>(token, item)); } }
public void Init() { //init temp folder TempDirectory = TestUtil.CreateTestDirectory(); //create copy of test ZIP file within temp folder string path = Path.Combine(TempDirectory.FullName, "TestFile.zip"); File.WriteAllBytes(path, Resources.TestFile); TestZipFile = new FileInfo(path); //init transfer stores InMemoryTransferStore <ZipDownloadTransfer> DownloadTransferStore = new InMemoryTransferStore <ZipDownloadTransfer>(); InMemoryTransferStore <ZipUploadTransfer> UploadTransferStore = new InMemoryTransferStore <ZipUploadTransfer>(); //init configuration var tempFactory = new TempFileStreamFactory(TempDirectory.FullName); var configuration = new ZipFileSystemConfiguration(TestZipFile, tempFactory); configuration.RootName = "Test Root"; configuration.DownloadStore = DownloadTransferStore; configuration.UploadStore = UploadTransferStore; configuration.DownloadTokenExpirationTime = TimeSpan.FromHours(24); configuration.UploadTokenExpirationTime = TimeSpan.FromHours(24); configuration.DefaultDownloadBlockSize = 32768; configuration.MaxDownloadBlockSize = 32768 * 2; configuration.MaxUploadBlockSize = 32768 * 4; AdjustFileSystemConfiguration(configuration); FileSystemConfiguration = configuration; //create provider Provider = new ZipFileProvider(FileSystemConfiguration); InitInternal(); }