Inheritance: HttpDownloader
示例#1
0
        public JamendoDownloadManager (string remote_uri, string mimetype)
        {
            this.mimetype = mimetype;
            job = new DownloadManagerJob (this) {
                Title = AddinManager.CurrentLocalizer.GetString ("Jamendo Downloads"),
                Status = AddinManager.CurrentLocalizer.GetString ("Contacting..."),
                IconNames = new string [] { "jamendo" },
                CanCancel = true
            };
            job.Finished += delegate { ServiceManager.SourceManager.MusicLibrary.NotifyUser (); };

            ServiceManager.Get<JobScheduler> ().Add (job);

            import_manager = new LibraryImportManager (true) {
                KeepUserJobHidden = true,
                Debug = true,
                Threaded = false
            };

            var downloader = new HttpFileDownloader () {
                Uri = new Uri (remote_uri),
                TempPathRoot = Path.Combine (Path.GetTempPath (), "banshee-jamendo-downloader"),
                FileExtension = mimetype == "application/zip" ? "zip" : "mp3"
            };
            job.CancelRequested += delegate { downloader.Abort (); };
            QueueDownloader (downloader);
        }
示例#2
0
        public void CheckForUpdates (bool verbose)
        {
            this.verbose = verbose;

            HttpFileDownloader downloader = new HttpFileDownloader ();
            downloader.Uri = new Uri (download_url + doap_filename);
            downloader.TempPathRoot = Path.GetTempPath ();
            downloader.Finished += OnDoapDownloaderFinished;
            downloader.Start ();

            temp_doap_path = downloader.LocalPath;
        }
示例#3
0
        public void DisplayUpdateAvailableDialog ()
        {
            bool update;
            using (var message_dialog = new MessageDialog (ServiceManager.Get<GtkElementsService> ().PrimaryWindow, 0,
                    MessageType.Question, ButtonsType.YesNo, String.Format (
                    Catalog.GetString ("A new version of Banshee ({0}) is available.{1}Do you want to update?"), unstable_version, Environment.NewLine))) {
                message_dialog.WindowPosition = WindowPosition.CenterOnParent;
                message_dialog.Title = Catalog.GetString ("Banshee update available");
                update = (message_dialog.Run () == (int)ResponseType.Yes);
                message_dialog.Destroy ();
            }

            if (update) {
                string downloadUrl = String.Format ("{0}/Banshee-{1}.msi", installer_url, unstable_version);

                var downloader = new HttpFileDownloader () {
                    Uri = new Uri (downloadUrl),
                    TempPathRoot = Path.GetTempPath (),
                    FileExtension = "msi"
                };
                downloader.Progress += OnInstallerDownloaderProgress;
                downloader.Finished += OnInstallerDownloaderFinished;
                downloader.Start ();

                temp_installer_path = downloader.LocalPath;

                job = new DownloadManagerJob (this) {
                    // Translators: {0} is the filename, eg Banshee-1.9.5.msi
                    Title = String.Format (Catalog.GetString ("Downloading {0}"), String.Format ("Banshee-{0}.msi", unstable_version)),
                    CanCancel = false
                };

                ServiceManager.Get<JobScheduler> ().Add (job);
            }
        }