示例#1
0
        public void Initialize(DownloadManagerConfiguration configuration)
        {
            _configuration = configuration;

            DownloadDetailsCache.Instance.Configure(configuration);
            DownloadDetailsCache.Instance.Restore();
        }
示例#2
0
 private DocumentFile RequestStoragePermission(DownloadManagerConfiguration configuration, string rootDirectory)
 {
     lock (PermissionRequestSynchronizer)
     {
         return(configuration.StoragePermissionsHandler.RequestStoragePermission(rootDirectory));
     }
 }
示例#3
0
        public void ResumeDownloadTask(DownloadManagerConfiguration configuration, DownloadDetails downloadDetails)
        {
            if (_downloadTasks.TryRemove(downloadDetails, out var downloadTask))
            {
                downloadTask.Abort();
            }

            downloadTask = new Thread(OnDownloadTaskStarted);
            _downloadTasks.AddOrUpdate(downloadDetails, downloadTask, (details, thread) => downloadTask);

            downloadTask.Start(new object[] { configuration, downloadDetails, true });
        }
示例#4
0
 internal void Configure(DownloadManagerConfiguration configuration)
 {
     _configuration = configuration;
 }
示例#5
0
 public static DocumentFileStream Create(DownloadManagerConfiguration configuration, DocumentFile file)
 {
     return(new DocumentFileStream(configuration, file));
 }
示例#6
0
 private Stream CreateStream(DownloadManagerConfiguration configuration, DocumentFile file)
 {
     // The file is appended thus no need to use an offset.
     return(configuration.Context.ContentResolver.OpenOutputStream(file.Uri, "wa"));
 }
示例#7
0
 private DocumentFileStream(DownloadManagerConfiguration configuration, DocumentFile file)
 {
     _stream = CreateStream(configuration, file);
 }