/// <summary>
        /// Checks for the updated information for the given mods.
        /// </summary>
        /// <param name="p_lstModList">The mods for which to check for updates.</param>
        private string CheckForModListUpdate(List <string> p_lstModList, List <IMod> p_lstModCheck)
        {
            if (m_booMissingDownloadId != false)
            {
                OverallMessage = "Updating mods info: retrieving download ids..";
            }
            else
            {
                OverallMessage = "Updating mods info: getting online updates..";
            }
            List <IModInfo> mifInfo = new List <IModInfo>();

            IMod[] ModCheckList = p_lstModCheck.ToArray();

            try
            {
                //get mod info
                for (int i = 0; i <= m_intRetries; i++)
                {
                    mifInfo = ModRepository.GetFileListInfo(p_lstModList);

                    if (mifInfo != null)
                    {
                        break;
                    }

                    Thread.Sleep(1000);
                }

                if (mifInfo != null)
                {
                    IModInfo[] mifModUpdates = mifInfo.ToArray();
                    ItemProgress        = 0;
                    ItemProgressMaximum = mifInfo.Count;

                    for (int i = 0; i < mifModUpdates.Count(); i++)
                    {
                        ModInfo modUpdate = (ModInfo)mifModUpdates[i];
                        if (m_booCancel)
                        {
                            break;
                        }
                        if (OverallProgress < OverallProgressMaximum)
                        {
                            StepOverallProgress();
                        }

                        if (modUpdate == null)
                        {
                            continue;
                        }

                        ItemMessage = modUpdate.ModName;

                        IMod modMod = null;
                        if (m_booMissingDownloadId != false)
                        {
                            modMod = m_lstModList.Where(x => x != null).Where(x => !string.IsNullOrEmpty(modUpdate.FileName) && (StripFileName(modUpdate.FileName, modUpdate.Id).Equals(StripFileName(Path.GetFileName(x.Filename).ToString(), x.Id), StringComparison.OrdinalIgnoreCase) || StripFileName(modUpdate.FileName, modUpdate.Id).Equals(StripFileName(Path.GetFileName(x.Filename.Replace("_", " ")).ToString(), x.Id), StringComparison.OrdinalIgnoreCase))).FirstOrDefault();
                        }
                        else
                        {
                            modMod = m_lstModList.Where(x => x != null).Where(x => !string.IsNullOrEmpty(modUpdate.FileName) && modUpdate.FileName.Equals(Path.GetFileName(x.Filename).ToString(), StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
                        }

                        if (modMod == null)
                        {
                            if ((!string.IsNullOrEmpty(modUpdate.DownloadId)) && (modUpdate.DownloadId != "0") && (modUpdate.DownloadId != "-1"))
                            {
                                modMod = m_lstModList.Where(x => x != null).Where(x => !string.IsNullOrEmpty(x.DownloadId) && modUpdate.DownloadId.Equals(x.DownloadId.ToString(), StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
                            }
                        }

                        if (modMod == null)
                        {
                            if (m_booMissingDownloadId != false)
                            {
                                if (ModCheckList.Count() == mifModUpdates.Count())
                                {
                                    IMod modCheck = ModCheckList[i];
                                    if ((!string.IsNullOrEmpty(modUpdate.Id) && modUpdate.Id != "0") && (!string.IsNullOrEmpty(modCheck.Id) && modCheck.Id != "0"))
                                    {
                                        if (modUpdate.Id.Equals(modCheck.Id, StringComparison.OrdinalIgnoreCase))
                                        {
                                            modMod = modCheck;
                                        }
                                    }
                                }
                            }
                        }

                        if (modMod != null)
                        {
                            if (ItemProgress < ItemProgressMaximum)
                            {
                                StepItemProgress();
                            }

                            if (modUpdate.DownloadId == "-1")
                            {
                                if (m_booMissingDownloadId != false)
                                {
                                    string Filename = Path.GetFileName(modMod.Filename);
                                    if (!string.Equals(StripFileName(Filename, modMod.Id), StripFileName(modUpdate.FileName, modUpdate.Id), StringComparison.InvariantCultureIgnoreCase))
                                    {
                                        continue;
                                    }
                                }
                            }
                            else if (!string.IsNullOrWhiteSpace(modUpdate.DownloadId) && !modUpdate.DownloadId.Equals(modMod.DownloadId))
                            {
                                if (m_booMissingDownloadId != false)
                                {
                                    string Filename = Path.GetFileName(modMod.Filename);
                                    if (string.Equals(Filename, modUpdate.FileName, StringComparison.InvariantCultureIgnoreCase))
                                    {
                                        if (!dctNewDownloadID.ContainsKey(Filename))
                                        {
                                            dctNewDownloadID.Add(Filename, modUpdate.DownloadId);
                                        }
                                    }
                                    else if (!string.IsNullOrEmpty(modMod.Id) && (modMod.Id != "0") && !string.IsNullOrEmpty(modUpdate.Id) && (modUpdate.Id != "0"))
                                    {
                                        if (string.Equals(modMod.Id, modUpdate.Id, StringComparison.InvariantCultureIgnoreCase))
                                        {
                                            if (!dctNewDownloadID.ContainsKey(Filename))
                                            {
                                                dctNewDownloadID.Add(Filename, modUpdate.DownloadId);
                                            }
                                        }
                                    }
                                }
                            }

                            if (!string.IsNullOrEmpty(modMod.DownloadId) && string.IsNullOrWhiteSpace(modUpdate.DownloadId))
                            {
                                modUpdate.DownloadId = modMod.DownloadId;
                            }

                            if (m_booMissingDownloadId != false)
                            {
                                modUpdate.HumanReadableVersion = !string.IsNullOrEmpty(modMod.HumanReadableVersion) ? modMod.HumanReadableVersion : modUpdate.HumanReadableVersion;
                                modUpdate.MachineVersion       = modMod.MachineVersion != null ? modMod.MachineVersion : modUpdate.MachineVersion;
                            }

                            if ((modMod.CustomCategoryId != 0) && (modMod.CustomCategoryId != -1))
                            {
                                modUpdate.CustomCategoryId = modMod.CustomCategoryId;
                            }

                            modUpdate.UpdateWarningEnabled = modMod.UpdateWarningEnabled;
                            AutoUpdater.AddNewVersionNumberForMod(modMod, modUpdate);

                            if (!OverrideLocalModNames)
                            {
                                modUpdate.ModName = modMod.ModName;
                            }

                            modMod.UpdateInfo(modUpdate, null);
                            ItemProgress = 0;
                        }
                    }
                }
            }
            catch (RepositoryUnavailableException e)
            {
                return("The check failed for a server-side issue:" + Environment.NewLine + Environment.NewLine + e.Message);
            }

            return(null);
        }
        /// <summary>
        /// Checks for the updated information for the given mods.
        /// </summary>
        /// <param name="modList">The mods for which to check for updates.</param>
        private string CheckForModListUpdate(List <string> modList, List <IMod> modsToCheck)
        {
            OverallMessage = _missingDownloadId != false ? "Updating mods info: retrieving download ids.." : "Updating mods info: getting online updates..";
            var fileListInfo = new List <IModInfo>();
            var modCheckList = modsToCheck.ToArray();

            //get mod info
            for (var i = 0; i <= _retries; i++)
            {
                fileListInfo = ModRepository.GetFileListInfo(modList);

                if (fileListInfo != null)
                {
                    break;
                }

                Thread.Sleep(1000);
            }

            if (fileListInfo != null)
            {
                var modUpdates = fileListInfo.ToArray();
                ItemProgress        = 0;
                ItemProgressMaximum = fileListInfo.Count;

                for (var i = 0; i < modUpdates.Count(); i++)
                {
                    var modUpdate = (ModInfo)modUpdates[i];
                    if (_cancel)
                    {
                        break;
                    }

                    if (OverallProgress < OverallProgressMaximum)
                    {
                        StepOverallProgress();
                    }

                    if (modUpdate == null)
                    {
                        continue;
                    }

                    ItemMessage = modUpdate.ModName;

                    var mod = _missingDownloadId != false?_modList.Where(x => x != null).FirstOrDefault(x => !string.IsNullOrEmpty(modUpdate.FileName) && (StripFileName(modUpdate.FileName, modUpdate.Id).Equals(StripFileName(Path.GetFileName(x.Filename).ToString(), x.Id), StringComparison.OrdinalIgnoreCase) || StripFileName(modUpdate.FileName, modUpdate.Id).Equals(StripFileName(Path.GetFileName(x.Filename.Replace("_", " ")).ToString(), x.Id), StringComparison.OrdinalIgnoreCase))) : _modList.Where(x => x != null).FirstOrDefault(x => !string.IsNullOrEmpty(modUpdate.FileName) && modUpdate.FileName.Equals(Path.GetFileName(x.Filename)?.ToString(), StringComparison.OrdinalIgnoreCase));

                    if (mod == null && !string.IsNullOrEmpty(modUpdate.DownloadId) && modUpdate.DownloadId != "0" && modUpdate.DownloadId != "-1")
                    {
                        mod = _modList.Where(x => x != null).FirstOrDefault(x => !string.IsNullOrEmpty(x.DownloadId) && modUpdate.DownloadId.Equals(x.DownloadId.ToString(), StringComparison.OrdinalIgnoreCase));
                    }

                    if (mod == null)
                    {
                        if (_missingDownloadId != false)
                        {
                            if (modCheckList.Count() == modUpdates.Count())
                            {
                                var modCheck = modCheckList[i];
                                if (!string.IsNullOrEmpty(modUpdate.Id) && modUpdate.Id != "0" && !string.IsNullOrEmpty(modCheck.Id) && modCheck.Id != "0")
                                {
                                    if (modUpdate.Id.Equals(modCheck.Id, StringComparison.OrdinalIgnoreCase))
                                    {
                                        mod = modCheck;
                                    }
                                }
                            }
                        }
                    }

                    if (mod != null)
                    {
                        if (ItemProgress < ItemProgressMaximum)
                        {
                            StepItemProgress();
                        }

                        if (modUpdate.DownloadId == "-1")
                        {
                            if (_missingDownloadId != false)
                            {
                                var filename = Path.GetFileName(mod.Filename);

                                if (!string.Equals(StripFileName(filename, mod.Id), StripFileName(modUpdate.FileName, modUpdate.Id), StringComparison.InvariantCultureIgnoreCase))
                                {
                                    continue;
                                }
                            }
                        }
                        else if (!string.IsNullOrWhiteSpace(modUpdate.DownloadId) && !modUpdate.DownloadId.Equals(mod.DownloadId))
                        {
                            if (_missingDownloadId != false)
                            {
                                var filename = Path.GetFileName(mod.Filename);

                                if (string.Equals(filename, modUpdate.FileName, StringComparison.InvariantCultureIgnoreCase))
                                {
                                    if (!_newDownloadID.ContainsKey(filename))
                                    {
                                        _newDownloadID.Add(filename, modUpdate.DownloadId);
                                    }
                                }
                                else if (!string.IsNullOrEmpty(mod.Id) && mod.Id != "0" && !string.IsNullOrEmpty(modUpdate.Id) && modUpdate.Id != "0")
                                {
                                    if (string.Equals(mod.Id, modUpdate.Id, StringComparison.InvariantCultureIgnoreCase) && !_newDownloadID.ContainsKey(filename))
                                    {
                                        _newDownloadID.Add(filename, modUpdate.DownloadId);
                                    }
                                }
                            }
                        }

                        if (!string.IsNullOrEmpty(mod.DownloadId) && string.IsNullOrWhiteSpace(modUpdate.DownloadId))
                        {
                            modUpdate.DownloadId = mod.DownloadId;
                        }

                        if (_missingDownloadId != false)
                        {
                            modUpdate.HumanReadableVersion = !string.IsNullOrEmpty(mod.HumanReadableVersion) ? mod.HumanReadableVersion : modUpdate.HumanReadableVersion;
                            modUpdate.MachineVersion       = mod.MachineVersion != null ? mod.MachineVersion : modUpdate.MachineVersion;
                        }

                        if (mod.CustomCategoryId != 0 && mod.CustomCategoryId != -1)
                        {
                            modUpdate.CustomCategoryId = mod.CustomCategoryId;
                        }

                        modUpdate.UpdateWarningEnabled = mod.UpdateWarningEnabled;
                        modUpdate.UpdateChecksEnabled  = mod.UpdateChecksEnabled;
                        AutoUpdater.AddNewVersionNumberForMod(mod, modUpdate);

                        if (!_overrideLocalModNames)
                        {
                            modUpdate.ModName = mod.ModName;
                        }

                        if (!string.IsNullOrEmpty(mod.ModName))
                        {
                            modUpdate.ModName = string.Empty;
                        }
                        mod.UpdateInfo(modUpdate, null);
                        ItemProgress = 0;
                    }
                }
            }

            return(null);
        }