Beispiel #1
0
 /// <summary>
 /// A simple constructor that initializes the object with its dependencies.
 /// </summary>
 /// <param name="p_ModManager">The current ModManager.</param>
 /// <param name="p_lstMods">The mod list.</param>
 /// <param name="p_intNewValue">The new category id.</param>
 public AddProfileTask(ModManager p_mmgModManager, IModRepository p_mrModRepository, IEnvironmentInfo p_eiEnvironmentInfo, ProfileManager p_pmProfileManager, Uri p_uUri, ConfirmActionMethod p_camConfirm, string p_strLabel)
 {
     ModManager          = p_mmgModManager;
     ModRepository       = p_mrModRepository;
     EnvironmentInfo     = p_eiEnvironmentInfo;
     ProfileManager      = p_pmProfileManager;
     m_Uri               = p_uUri;
     ConfirmActionMethod = p_camConfirm;
 }
Beispiel #2
0
        /// <summary>
        /// The method that is called to start the backgound task.
        /// </summary>
        /// <param name="p_objArgs">Arguments to for the task execution.</param>
        /// <returns>Always <c>null</c>.</returns>
        protected override object DoWork(object[] p_objArgs)
        {
            try
            {
                ConfirmActionMethod camConfirm = (ConfirmActionMethod)p_objArgs[0];
                OverallMessage          = "Checking the Profile Online Integrity...";
                OverallProgress         = 0;
                OverallProgressStepSize = 1;
                ShowItemProgress        = false;
                OverallProgressMaximum  = 1;

                List <ProfileMissingModInfo> lstMissingInfo   = null;
                Dictionary <string, string>  dctMissingMods   = new Dictionary <string, string>();
                Dictionary <string, string>  dctNewDownloadID = new Dictionary <string, string>();

                if (ModProfile != null)
                {
                    lstMissingInfo = ModRepository.GetMissingFiles(ModRepository.RemoteGameId, int.Parse(ModProfile.OnlineID));
                }

                foreach (KeyValuePair <string, string> kvp in MissingModsList)
                {
                    IVirtualModInfo Mod = ModProfile.ModList.Find(x => x.DownloadId == kvp.Value);

                    if (Mod != null)
                    {
                        ProfileMissingModInfo pmModInfo = lstMissingInfo.Find(x => x.FileId.ToString().Equals(kvp.Value));

                        if (pmModInfo != null)
                        {
                            if ((!string.IsNullOrEmpty(pmModInfo.NewFileId.ToString())) && (pmModInfo.NewFileId.ToString() != "-1"))
                            {
                                dctNewDownloadID.Add(kvp.Key, pmModInfo.NewFileId.ToString());
                                dctMissingMods.Add(kvp.Key, @"@nxm://" + GameModeID + "/mods/" + Mod.ModId + "/files/" + pmModInfo.NewFileId.ToString());
                            }
                            else if (string.IsNullOrEmpty(pmModInfo.ModName))
                            {
                                dctMissingMods.Add(kvp.Key, null);
                            }
                            else if (pmModInfo.NewFileId.ToString().Equals("-1", StringComparison.OrdinalIgnoreCase))
                            {
                                dctMissingMods.Add(kvp.Key, null);
                            }
                        }
                        else
                        {
                            dctMissingMods.Add(kvp.Key, @"nxm://" + GameModeID + "/mods/" + Mod.ModId + "/files/" + Mod.DownloadId);
                        }
                    }
                }


                ProfileManager.UpdateProfileDownloadId(ModProfile, dctNewDownloadID);

                return(dctMissingMods);
            }
            catch (Exception ex)
            {
                return("ERROR - There was a problem communicating with the Nexus server: " + Environment.NewLine + ex.Message);
            }

            return(null);
        }
        /// <summary>
        /// Starts the Automatic Download.
        /// </summary>
        /// <param name="p_strPath">The path to the mod to install.</param>
        /// <param name="p_cocConfirmOverwrite">The delegate to call to resolve conflicts with existing files.</param>
        /// <returns>A background task set allowing the caller to track the progress of the operation.</returns>
        public void AsyncAutomaticDownload(List <string> p_strMissingMods, ProfileManager p_pmProfileManager, ConfirmActionMethod p_camConfirm, ConfirmOverwriteCallback p_cocConfirmOverwrite)
        {
            AutomaticDownloadTask adtAutomaticDownload = new AutomaticDownloadTask(p_strMissingMods, this, p_pmProfileManager, p_cocConfirmOverwrite);

            AsyncAutomaticDownloadTask(adtAutomaticDownload, p_camConfirm);
        }
Beispiel #4
0
 /// <summary>
 /// A simple constructor that initializes the object with its dependencies.
 /// </summary>
 public CreateBackupTask(VirtualModActivator p_vmaActivator, ModManager p_ModManager, IEnvironmentInfo p_EnvironmentInfo, PluginManagerVM p_pmPluginManagerVM, IPluginManager p_pmPluginManager, ProfileManager p_pmProfileManager, string p_strSelectedPath, BackupManager p_bmBackupManager, ConfirmActionMethod p_camConfirm)
 {
     m_camConfirm        = p_camConfirm;
     VirtualModActivator = p_vmaActivator;
     ModManager          = p_ModManager;
     EnvironmentInfo     = p_EnvironmentInfo;
     SelectedPath        = p_strSelectedPath;
     BackupManager       = p_bmBackupManager;
     TotalFileSize       = BackupManager.TotalFileSize;
     PluginManagerVM     = p_pmPluginManagerVM;
     PluginManager       = p_pmPluginManager;
     ProfileManager      = p_pmProfileManager;
 }
 /// <summary>
 /// A simple constructor that initializes the object with its dependencies.
 /// </summary>
 /// <param name="p_ModManager">The current ModManager.</param>
 /// <param name="p_lstMods">The mod list.</param>
 /// <param name="p_intNewValue">The new category id.</param>
 public AutomaticDownloadTask(List <string> p_lstMissingMods, ModManager p_mmModManager, ProfileManager p_pmProfileManager, ConfirmOverwriteCallback p_cocConfirmOverwrite)
 {
     MissingMods              = new ThreadSafeObservableList <string>(p_lstMissingMods);
     ModManager               = p_mmModManager;
     ProfileManager           = p_pmProfileManager;
     ConfirmOverwriteCallback = p_cocConfirmOverwrite;
 }
 /// <summary>
 /// A simple constructor that initializes the object with its dependencies.
 /// </summary>
 /// <param name="p_ModManager">The current ModManager.</param>
 /// <param name="p_lstMods">The mod list.</param>
 /// <param name="p_intNewValue">The new category id.</param>
 public RemoveBackedProfileTask(IModRepository p_mrRepository, IModProfile p_impProfile, ProfileManager p_pmProfileManager)
 {
     ModRepository  = p_mrRepository;
     ModProfile     = p_impProfile;
     ProfileManager = p_pmProfileManager;
 }
 /// <summary>
 /// A simple constructor that initializes the object with its dependencies.
 /// </summary>
 /// <param name="p_ModManager">The current ModManager.</param>
 /// <param name="p_lstMods">The mod list.</param>
 /// <param name="p_intNewValue">The new category id.</param>
 public RefreshBackedProfilesTask(IModRepository p_mrRepository, ProfileManager p_pmProfileManager)
 {
     ModRepository  = p_mrRepository;
     ProfileManager = p_pmProfileManager;
 }
 /// <summary>
 /// A simple constructor that initializes the object with its dependencies.
 /// </summary>
 /// <param name="p_ModManager">The current ModManager.</param>
 /// <param name="p_lstMods">The mod list.</param>
 /// <param name="p_intNewValue">The new category id.</param>
 public ToggleSharingProfileTask(IModRepository p_mrRepository, ProfileManager p_pmProfileManager, IModProfile p_imProfile)
 {
     ModRepository  = p_mrRepository;
     ProfileManager = p_pmProfileManager;
     ModProfile     = p_imProfile;
 }
Beispiel #9
0
 /// <summary>
 /// A simple constructor that initializes the object with its dependencies.
 /// </summary>
 public RestoreBackupTask(VirtualModActivator p_vmaActivator, ModManager p_ModManager, ProfileManager p_pmProfileManager, IEnvironmentInfo p_EnvironmentInfo, string p_strBackupFile, bool p_booPurgeFolders, ConfirmActionMethod p_camConfirm)
 {
     m_camConfirm        = p_camConfirm;
     VirtualModActivator = p_vmaActivator;
     ModManager          = p_ModManager;
     EnvironmentInfo     = p_EnvironmentInfo;
     BackupFile          = p_strBackupFile;
     PurgeFolders        = p_booPurgeFolders;
     ProfileManager      = p_pmProfileManager;
 }