Ejemplo n.º 1
0
        public void Initialize(DownloadManagerConfiguration configuration)
        {
            _configuration = configuration;

            DownloadDetailsCache.Instance.Configure(configuration);
            DownloadDetailsCache.Instance.Restore();
        }
Ejemplo n.º 2
0
 private DocumentFile RequestStoragePermission(DownloadManagerConfiguration configuration, string rootDirectory)
 {
     lock (PermissionRequestSynchronizer)
     {
         return(configuration.StoragePermissionsHandler.RequestStoragePermission(rootDirectory));
     }
 }
Ejemplo n.º 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 });
        }
Ejemplo n.º 4
0
 internal void Configure(DownloadManagerConfiguration configuration)
 {
     _configuration = configuration;
 }
Ejemplo n.º 5
0
 public static DocumentFileStream Create(DownloadManagerConfiguration configuration, DocumentFile file)
 {
     return(new DocumentFileStream(configuration, file));
 }
Ejemplo n.º 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"));
 }
Ejemplo n.º 7
0
 private DocumentFileStream(DownloadManagerConfiguration configuration, DocumentFile file)
 {
     _stream = CreateStream(configuration, file);
 }