Exemplo n.º 1
0
 public static Panel GetFindNewPanel(Guid pluginID, object view)
 {
     if (Provider.Exists(pluginID))
     {
         findNewPluginInst = Provider.GetFromId(pluginID).CreateInstance();
         findNewPluginInst.FindNewException += FindNewPluginInst_FindNewException;
         findNewPluginInst.FindNewViewChange += FindNewPluginInst_FindNewViewChange;
         findNewPluginInst.FoundNew += FindNewPluginInst_FoundNew;
         return findNewPluginInst.GetFindNewPanel(view);
     }
     else
     {
         return new Panel();
     }
 }
Exemplo n.º 2
0
 public static Panel GetFindNewPanel(Guid pluginID, object view)
 {
     if (Provider.Exists(pluginID))
     {
         findNewPluginInst = Provider.GetFromId(pluginID).CreateInstance();
         findNewPluginInst.FindNewException  += FindNewPluginInst_FindNewException;
         findNewPluginInst.FindNewViewChange += FindNewPluginInst_FindNewViewChange;
         findNewPluginInst.FoundNew          += FindNewPluginInst_FoundNew;
         return(findNewPluginInst.GetFindNewPanel(view));
     }
     else
     {
         return(new Panel());
     }
 }
Exemplo n.º 3
0
        private static void UpdateInfoIfRequiredAsync(int progid)
        {
            Guid   providerId  = Guid.Empty;
            string updateExtid = null;

            // Test to see if an update is required, and then free up the database
            using (SQLiteCommand command = new SQLiteCommand("select pluginid, extid, lastupdate from programmes where progid=@progid", FetchDbConn()))
            {
                command.Parameters.Add(new SQLiteParameter("@progid", progid));

                using (SQLiteMonDataReader reader = new SQLiteMonDataReader(command.ExecuteReader()))
                {
                    if (reader.Read())
                    {
                        providerId = new Guid(reader.GetString(reader.GetOrdinal("pluginid")));

                        if (Provider.Exists(providerId))
                        {
                            IRadioProvider pluginInstance = Provider.GetFromId(providerId).CreateInstance();

                            if (reader.GetDateTime(reader.GetOrdinal("lastupdate")).AddDays(pluginInstance.ProgInfoUpdateFreqDays) < DateTime.Now)
                            {
                                updateExtid = reader.GetString(reader.GetOrdinal("extid"));
                            }
                        }
                    }
                }
            }

            // Now perform the update if required
            if (updateExtid != null)
            {
                try
                {
                    UpdateInfo(providerId, updateExtid);
                }
                catch (ProviderException)
                {
                    // Suppress any provider exceptions, as the user isn't waiting for this action
                }
            }
        }
Exemplo n.º 4
0
        private static void ExamineAssembly(Assembly assembly)
        {
            // Loop through each type in the assembly
            foreach (Type thisType in assembly.GetTypes())
            {
                // Only look at public types
                if (thisType.IsPublic)
                {
                    // Ignore abstract classes
                    if (!((thisType.Attributes & TypeAttributes.Abstract) == TypeAttributes.Abstract))
                    {
                        // See if this type implements our interface
                        Type implInterface = thisType.GetInterface(typeof(IRadioProvider).Name, true);

                        if (implInterface != null)
                        {
                            Provider provider = new Provider();
                            provider.assembly  = assembly;
                            provider.fullClass = thisType.FullName;
                            provider.Class     = thisType.Name;

                            try
                            {
                                IRadioProvider instance = (IRadioProvider)assembly.CreateInstance(thisType.FullName);
                                provider.Id                 = instance.ProviderId;
                                provider.Name               = instance.ProviderName;
                                provider.Description        = instance.ProviderDescription;
                                provider.Icon               = instance.ProviderIcon;
                                provider.ShowOptionsHandler = instance.GetShowOptionsHandler();
                                availableProviders.Add(instance.ProviderId, provider);
                            }
                            catch
                            {
                                continue;
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 5
0
        private static int?UpdateInfo(int progid, string episodeExtId)
        {
            Guid          pluginId;
            string        progExtId;
            ProgrammeInfo progInfo;

            using (SQLiteCommand command = new SQLiteCommand("select pluginid, extid, name, description, singleepisode from programmes where progid=@progid", FetchDbConn()))
            {
                command.Parameters.Add(new SQLiteParameter("@progid", progid));

                using (SQLiteMonDataReader reader = new SQLiteMonDataReader(command.ExecuteReader()))
                {
                    if (!reader.Read())
                    {
                        throw new DataNotFoundException(progid, "Programme does not exist");
                    }

                    pluginId  = new Guid(reader.GetString(reader.GetOrdinal("pluginid")));
                    progExtId = reader.GetString(reader.GetOrdinal("extid"));

                    progInfo      = new ProgrammeInfo();
                    progInfo.Name = reader.GetString(reader.GetOrdinal("name"));
                    int descriptionOrdinal = reader.GetOrdinal("description");

                    if (!reader.IsDBNull(descriptionOrdinal))
                    {
                        progInfo.Description = reader.GetString(descriptionOrdinal);
                    }

                    progInfo.SingleEpisode = reader.GetBoolean(reader.GetOrdinal("singleepisode"));
                }
            }

            IRadioProvider providerInst = Provider.GetFromId(pluginId).CreateInstance();
            EpisodeInfo    episodeInfo;

            try
            {
                episodeInfo = providerInst.GetEpisodeInfo(progExtId, progInfo, episodeExtId);

                if (episodeInfo == null)
                {
                    return(null);
                }

                if (string.IsNullOrEmpty(episodeInfo.Name))
                {
                    throw new InvalidDataException("Episode name cannot be null or an empty string");
                }
            }
            catch (Exception provExp)
            {
                provExp.Data.Add("Programme", progInfo.ToString() + "\r\nExtID: " + progExtId);
                provExp.Data.Add("Episode ExtID", episodeExtId);
                throw new ProviderException("Call to GetEpisodeInfo failed", provExp, pluginId);
            }

            if (episodeInfo.Date == null)
            {
                // The date of the episode isn't known, so use the current date
                episodeInfo.Date = DateTime.Now;
            }

            lock (Database.DbUpdateLock)
            {
                using (SQLiteMonTransaction transMon = new SQLiteMonTransaction(FetchDbConn().BeginTransaction()))
                {
                    int?epid = null;

                    using (SQLiteCommand command = new SQLiteCommand("select epid from episodes where progid=@progid and extid=@extid", FetchDbConn(), transMon.Trans))
                    {
                        command.Parameters.Add(new SQLiteParameter("@progid", progid));
                        command.Parameters.Add(new SQLiteParameter("@extid", episodeExtId));

                        using (SQLiteMonDataReader reader = new SQLiteMonDataReader(command.ExecuteReader()))
                        {
                            if (reader.Read())
                            {
                                epid = reader.GetInt32(reader.GetOrdinal("epid"));
                            }
                        }
                    }

                    if (epid == null)
                    {
                        using (SQLiteCommand command = new SQLiteCommand("insert into episodes (progid, extid, name, date) values (@progid, @extid, @name, @date)", FetchDbConn(), transMon.Trans))
                        {
                            command.Parameters.Add(new SQLiteParameter("@progid", progid));
                            command.Parameters.Add(new SQLiteParameter("@extid", episodeExtId));
                            command.Parameters.Add(new SQLiteParameter("@name", episodeInfo.Name));
                            command.Parameters.Add(new SQLiteParameter("@date", episodeInfo.Date));
                            command.ExecuteNonQuery();
                        }

                        using (SQLiteCommand command = new SQLiteCommand("select last_insert_rowid()", FetchDbConn(), transMon.Trans))
                        {
                            epid = (int)(long)command.ExecuteScalar();
                        }
                    }

                    using (SQLiteCommand command = new SQLiteCommand("update episodes set name=@name, description=@description, duration=@duration, date=@date, image=@image, available=1 where epid=@epid", FetchDbConn(), transMon.Trans))
                    {
                        command.Parameters.Add(new SQLiteParameter("@name", episodeInfo.Name));
                        command.Parameters.Add(new SQLiteParameter("@description", episodeInfo.Description));
                        command.Parameters.Add(new SQLiteParameter("@duration", episodeInfo.Duration));
                        command.Parameters.Add(new SQLiteParameter("@date", episodeInfo.Date));
                        command.Parameters.Add(new SQLiteParameter("@image", StoreImage(episodeInfo.Image)));
                        command.Parameters.Add(new SQLiteParameter("@epid", epid));
                        command.ExecuteNonQuery();
                    }

                    using (SQLiteCommand command = new SQLiteCommand("insert or replace into episodeext (epid, name, value) values (@epid, @name, @value)", FetchDbConn(), transMon.Trans))
                    {
                        foreach (KeyValuePair <string, string> extItem in episodeInfo.ExtInfo)
                        {
                            command.Parameters.Add(new SQLiteParameter("@epid", epid));
                            command.Parameters.Add(new SQLiteParameter("@name", extItem.Key));
                            command.Parameters.Add(new SQLiteParameter("@value", extItem.Value));
                            command.ExecuteNonQuery();
                        }
                    }

                    transMon.Trans.Commit();
                    return(epid);
                }
            }
        }
Exemplo n.º 6
0
        private void DownloadProgThread()
        {
            if (this.Progress != null)
            {
                // Raise a progress event to give the user some feedback
                this.Progress(this.episodeInfo.Epid, 0, ProgressType.Downloading);
            }

            if (!Provider.Exists(this.pluginId))
            {
                this.DownloadError(ErrorType.LocalProblem, "The plugin provider required to download this episode is not currently available.  Please try updating the Radio Downloader providers or cancelling the download.");
                return;
            }

            lock (this.pluginInstanceLock)
            {
                this.pluginInstance           = Provider.GetFromId(this.pluginId).CreateInstance();
                this.pluginInstance.Progress += this.DownloadPluginInst_Progress;
            }

            string finalName, fileExtension;

            try
            {
                string saveLocation;

                try
                {
                    saveLocation = FileUtils.GetSaveFolder();
                }
                catch (DirectoryNotFoundException)
                {
                    this.DownloadError(ErrorType.LocalProblem, "Your chosen location for saving downloaded programmes no longer exists.  Select a new one under Options -> Main Options.");
                    return;
                }

                const int FreeMb         = 250;
                ulong     availableSpace = OsUtils.PathAvailableSpace(saveLocation);

                if (availableSpace <= FreeMb * 1024 * 1024)
                {
                    this.DownloadError(ErrorType.LocalProblem, "Your chosen location for saving downloaded programmes does not have enough free space.  Make sure that you have at least " + FreeMb.ToString(CultureInfo.CurrentCulture) + " MB free, or select a new location under Options -> Main Options.");
                    return;
                }

                try
                {
                    finalName = Model.Download.FindFreeSaveFileName(Settings.FileNameFormat, this.progInfo, this.episodeInfo, saveLocation);
                }
                catch (IOException ioExp)
                {
                    this.DownloadError(ErrorType.LocalProblem, "Encountered an error generating the download file name.  " + ioExp.Message + "  You may need to select a new location for saving downloaded programmes under Options -> Main Options.");
                    return;
                }
                catch (UnauthorizedAccessException unAuthExp)
                {
                    this.DownloadError(ErrorType.LocalProblem, "Encountered a permissions problem generating the download file name.  " + unAuthExp.Message + "  You may need to select a new location for saving downloaded programmes under Options -> Main Options.");
                    return;
                }

                fileExtension = this.pluginInstance.DownloadProgramme(this.progExtId, this.episodeExtId, this.providerProgInfo, this.providerEpisodeInfo, finalName);
            }
            catch (DownloadException downloadExp)
            {
                if (downloadExp.ErrorType == ErrorType.UnknownError)
                {
                    this.DownloadError(downloadExp);
                }
                else
                {
                    this.DownloadError(downloadExp.ErrorType, downloadExp.Message);
                }

                return;
            }
            catch (Exception unknownExp)
            {
                this.DownloadError(unknownExp);
                return;
            }

            if (this.cancelled)
            {
                this.cancelResponse = true;
            }

            finalName += "." + fileExtension;

            lock (Database.DbUpdateLock)
            {
                Model.Download.SetComplete(this.episodeInfo.Epid, finalName);
                Model.Programme.SetLatestDownload(this.progInfo.Progid, this.episodeInfo.Date);
            }

            // Remove single episode subscriptions
            if (Model.Subscription.IsSubscribed(this.progInfo.Progid))
            {
                if (this.progInfo.SingleEpisode)
                {
                    Model.Subscription.Remove(this.progInfo.Progid);
                }
            }

            if (!string.IsNullOrEmpty(Settings.RunAfterCommand))
            {
                try
                {
                    // Use VB Interaction.Shell as Process.Start doesn't give the option of a non-focused window
                    // The "comspec" environment variable gives the path to cmd.exe
                    Microsoft.VisualBasic.Interaction.Shell("\"" + Environment.GetEnvironmentVariable("comspec") + "\" /c " + Settings.RunAfterCommand.Replace("%file%", finalName), Microsoft.VisualBasic.AppWinStyle.NormalNoFocus);
                }
                catch
                {
                    // Just ignore the error, as it just means that something has gone wrong with the run after command.
                }
            }

            this.DownloadFinished();
        }
Exemplo n.º 7
0
        private static int?UpdateInfo(Guid pluginId, string progExtId)
        {
            if (!Provider.Exists(pluginId))
            {
                return(null);
            }

            IRadioProvider pluginInstance = Provider.GetFromId(pluginId).CreateInstance();
            ProgrammeInfo  progInfo;

            try
            {
                progInfo = pluginInstance.GetProgrammeInfo(progExtId);
            }
            catch (Exception provExp)
            {
                provExp.Data.Add("Programme ExtID", progExtId);
                throw new ProviderException("Call to GetProgrammeInfo failed", provExp, pluginId);
            }

            if (progInfo == null)
            {
                return(null);
            }

            int?progid = null;

            lock (Database.DbUpdateLock)
            {
                using (SQLiteCommand command = new SQLiteCommand("select progid from programmes where pluginid=@pluginid and extid=@extid", FetchDbConn()))
                {
                    command.Parameters.Add(new SQLiteParameter("@pluginid", pluginId.ToString()));
                    command.Parameters.Add(new SQLiteParameter("@extid", progExtId));

                    using (SQLiteMonDataReader reader = new SQLiteMonDataReader(command.ExecuteReader()))
                    {
                        if (reader.Read())
                        {
                            progid = reader.GetInt32(reader.GetOrdinal("progid"));
                        }
                    }
                }

                using (SQLiteMonTransaction transMon = new SQLiteMonTransaction(FetchDbConn().BeginTransaction()))
                {
                    if (progid == null)
                    {
                        using (SQLiteCommand command = new SQLiteCommand("insert into programmes (pluginid, extid, name) values (@pluginid, @extid, @name)", FetchDbConn()))
                        {
                            command.Parameters.Add(new SQLiteParameter("@pluginid", pluginId.ToString()));
                            command.Parameters.Add(new SQLiteParameter("@extid", progExtId));
                            command.Parameters.Add(new SQLiteParameter("@name", progExtId));
                            command.ExecuteNonQuery();
                        }

                        using (SQLiteCommand command = new SQLiteCommand("select last_insert_rowid()", FetchDbConn()))
                        {
                            progid = (int)(long)command.ExecuteScalar();
                        }
                    }

                    using (SQLiteCommand command = new SQLiteCommand("update programmes set name=@name, description=@description, image=@image, singleepisode=@singleepisode, lastupdate=@lastupdate where progid=@progid", FetchDbConn()))
                    {
                        command.Parameters.Add(new SQLiteParameter("@name", progInfo.Name));
                        command.Parameters.Add(new SQLiteParameter("@description", progInfo.Description));
                        command.Parameters.Add(new SQLiteParameter("@image", StoreImage(progInfo.Image)));
                        command.Parameters.Add(new SQLiteParameter("@singleepisode", progInfo.SingleEpisode));
                        command.Parameters.Add(new SQLiteParameter("@lastupdate", DateTime.Now));
                        command.Parameters.Add(new SQLiteParameter("@progid", progid));
                        command.ExecuteNonQuery();
                    }

                    transMon.Trans.Commit();
                }
            }

            if (Updated != null)
            {
                Updated(progid.Value);
            }

            return(progid);
        }
Exemplo n.º 8
0
        public static List <string> GetAvailableEpisodes(int progid, bool fetchAll)
        {
            Guid          providerId;
            string        progExtId;
            ProgrammeInfo progInfo;

            using (SQLiteCommand command = new SQLiteCommand("select pluginid, extid, name, description, singleepisode from programmes where progid=@progid", FetchDbConn()))
            {
                command.Parameters.Add(new SQLiteParameter("@progid", progid));

                using (SQLiteMonDataReader reader = new SQLiteMonDataReader(command.ExecuteReader()))
                {
                    if (!reader.Read())
                    {
                        throw new DataNotFoundException(progid, "Programme does not exist");
                    }

                    providerId = new Guid(reader.GetString(reader.GetOrdinal("pluginid")));
                    progExtId  = reader.GetString(reader.GetOrdinal("extid"));

                    progInfo      = new ProgrammeInfo();
                    progInfo.Name = reader.GetString(reader.GetOrdinal("name"));
                    int descriptionOrdinal = reader.GetOrdinal("description");

                    if (!reader.IsDBNull(descriptionOrdinal))
                    {
                        progInfo.Description = reader.GetString(descriptionOrdinal);
                    }

                    progInfo.SingleEpisode = reader.GetBoolean(reader.GetOrdinal("singleepisode"));
                }
            }

            if (!Provider.Exists(providerId))
            {
                return(null);
            }

            // Fetch a list of previously available episodes for the programme
            List <string> previousAvailable = new List <string>();

            using (SQLiteCommand command = new SQLiteCommand("select extid from episodes where progid=@progid and available=1 order by date desc", FetchDbConn()))
            {
                command.Parameters.Add(new SQLiteParameter("@progid", progid));

                using (SQLiteMonDataReader reader = new SQLiteMonDataReader(command.ExecuteReader()))
                {
                    int epidOrdinal = reader.GetOrdinal("extid");

                    while (reader.Read())
                    {
                        previousAvailable.Add(reader.GetString(epidOrdinal));
                    }
                }
            }

            List <string> allEpExtIds = new List <string>();
            int           page        = 1;

            IRadioProvider    providerInst = Provider.GetFromId(providerId).CreateInstance();
            AvailableEpisodes available;

            do
            {
                try
                {
                    available = providerInst.GetAvailableEpisodes(progExtId, progInfo, page);
                }
                catch (Exception provExp)
                {
                    provExp.Data.Add("Programme ExtID", progExtId);
                    throw new ProviderException("Call to GetAvailableEpisodeIds failed", provExp, providerId);
                }

                if (available.EpisodeIds == null || available.EpisodeIds.Length == 0)
                {
                    break;
                }

                int trackOverlap = -1;

                foreach (string epExtId in available.EpisodeIds)
                {
                    // Append the returned IDs to the list of all episodes (minus duplicates)
                    if (!allEpExtIds.Contains(epExtId))
                    {
                        allEpExtIds.Add(epExtId);
                    }

                    if (previousAvailable.Contains(epExtId))
                    {
                        // Store where the available & previously available ID lists overlap
                        trackOverlap = previousAvailable.IndexOf(epExtId);
                    }
                    else if (trackOverlap >= 0)
                    {
                        // Bump up the overlap index to show there are more after the overlap
                        trackOverlap++;
                    }
                }

                if (available.MoreAvailable && !fetchAll)
                {
                    if (trackOverlap >= 0)
                    {
                        // Remove previously available programmes before this page from the list so that they
                        // are not incorrectly un-flagged as available in the database
                        if (trackOverlap < previousAvailable.Count - 1)
                        {
                            previousAvailable.RemoveRange(trackOverlap + 1, previousAvailable.Count - (trackOverlap + 1));
                        }

                        // Stop fetching available episode pages
                        break;
                    }
                }

                page++;
            }while (available.MoreAvailable);

            // Remove the still available episodes from the previously available list
            foreach (string epExtId in allEpExtIds)
            {
                previousAvailable.Remove(epExtId);
            }

            // Unflag any no-longer available episodes in the database
            if (previousAvailable.Count > 0)
            {
                lock (Database.DbUpdateLock)
                {
                    using (SQLiteMonTransaction transMon = new SQLiteMonTransaction(FetchDbConn().BeginTransaction()))
                    {
                        using (SQLiteCommand command = new SQLiteCommand("update episodes set available=0 where progid=@progid and extid=@extid", FetchDbConn(), transMon.Trans))
                        {
                            SQLiteParameter extidParam = new SQLiteParameter("@extid");
                            command.Parameters.Add(new SQLiteParameter("@progid", progid));
                            command.Parameters.Add(extidParam);

                            foreach (string epExtId in previousAvailable)
                            {
                                extidParam.Value = epExtId;
                                command.ExecuteNonQuery();
                            }
                        }

                        transMon.Trans.Commit();
                    }
                }
            }

            return(allEpExtIds);
        }
Exemplo n.º 9
0
        private void DownloadProgThread()
        {
            if (this.Progress != null)
            {
                // Raise a progress event to give the user some feedback
                this.Progress(this.episodeInfo.Epid, 0, ProgressType.Downloading);
            }

            if (!Provider.Exists(this.pluginId))
            {
                this.DownloadError(ErrorType.LocalProblem, "The plugin provider required to download this episode is not currently available.  Please try updating the Radio Downloader providers or cancelling the download.");
                return;
            }

            lock (this.pluginInstanceLock)
            {
                this.pluginInstance = Provider.GetFromId(this.pluginId).CreateInstance();
                this.pluginInstance.Progress += this.DownloadPluginInst_Progress;
            }

            string finalName, fileExtension;

            try
            {
                string saveLocation;

                try
                {
                    saveLocation = FileUtils.GetSaveFolder();
                }
                catch (DirectoryNotFoundException)
                {
                    this.DownloadError(ErrorType.LocalProblem, "Your chosen location for saving downloaded programmes no longer exists.  Select a new one under Options -> Main Options.");
                    return;
                }

                const int FreeMb = 250;
                ulong availableSpace = OsUtils.PathAvailableSpace(saveLocation);

                if (availableSpace <= FreeMb * 1024 * 1024)
                {
                    this.DownloadError(ErrorType.LocalProblem, "Your chosen location for saving downloaded programmes does not have enough free space.  Make sure that you have at least " + FreeMb.ToString(CultureInfo.CurrentCulture) + " MB free, or select a new location under Options -> Main Options.");
                    return;
                }

                try
                {
                    finalName = Model.Download.FindFreeSaveFileName(Settings.FileNameFormat, this.progInfo, this.episodeInfo, saveLocation);
                }
                catch (IOException ioExp)
                {
                    this.DownloadError(ErrorType.LocalProblem, "Encountered an error generating the download file name.  " + ioExp.Message + "  You may need to select a new location for saving downloaded programmes under Options -> Main Options.");
                    return;
                }
                catch (UnauthorizedAccessException unAuthExp)
                {
                    this.DownloadError(ErrorType.LocalProblem, "Encountered a permissions problem generating the download file name.  " + unAuthExp.Message + "  You may need to select a new location for saving downloaded programmes under Options -> Main Options.");
                    return;
                }

                fileExtension = this.pluginInstance.DownloadProgramme(this.progExtId, this.episodeExtId, this.providerProgInfo, this.providerEpisodeInfo, finalName);
            }
            catch (ThreadAbortException)
            {
                // The download has been cancelled
                return;
            }
            catch (DownloadException downloadExp)
            {
                if (downloadExp.ErrorType == ErrorType.UnknownError)
                {
                    this.DownloadError(downloadExp);
                }
                else
                {
                    this.DownloadError(downloadExp.ErrorType, downloadExp.Message);
                }

                return;
            }
            catch (Exception unknownExp)
            {
                this.DownloadError(unknownExp);
                return;
            }

            finalName += "." + fileExtension;

            lock (Database.DbUpdateLock)
            {
                Model.Download.SetComplete(this.episodeInfo.Epid, finalName);
                Model.Programme.SetLatestDownload(this.progInfo.Progid, this.episodeInfo.Date);
            }

            // Remove single episode subscriptions
            if (Model.Subscription.IsSubscribed(this.progInfo.Progid))
            {
                if (this.progInfo.SingleEpisode)
                {
                    Model.Subscription.Remove(this.progInfo.Progid);
                }
            }

            if (!string.IsNullOrEmpty(Settings.RunAfterCommand))
            {
                try
                {
                    // Use VB Interaction.Shell as Process.Start doesn't give the option of a non-focused window
                    // The "comspec" environment variable gives the path to cmd.exe
                    Microsoft.VisualBasic.Interaction.Shell("\"" + Environment.GetEnvironmentVariable("comspec") + "\" /c " + Settings.RunAfterCommand.Replace("%file%", finalName), Microsoft.VisualBasic.AppWinStyle.NormalNoFocus);
                }
                catch
                {
                    // Just ignore the error, as it just means that something has gone wrong with the run after command.
                }
            }

            this.DownloadFinished();
        }