public AddMod ( string p_strPath, ConfirmOverwriteCallback p_cocConfirmOverwrite ) : IBackgroundTask | ||
p_strPath | string | The path to the mod to install. |
p_cocConfirmOverwrite | ConfirmOverwriteCallback | The delegate to call to resolve conflicts with existing files. |
return | IBackgroundTask |
/// <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 = "Starting missing mods download..."; OverallProgress = 0; OverallProgressStepSize = 1; ShowItemProgress = false; OverallProgressMaximum = MissingMods.Count(); Status = TaskStatus.Running; int i = 1; if (MissingMods.Count > 0) { foreach (string URI in MissingMods) { if (m_booCancel) { break; } OverallMessage = "Adding the Mods to download: " + i + "/" + MissingMods.Count(); StepOverallProgress(); i++; ModManager.AddMod(URI, ConfirmOverwriteCallback); Thread.Sleep(100); } } } catch (Exception ex) { this.Status = TaskStatus.Error; this.ItemMessage = ("There was a problem communicating with the Nexus server: " + Environment.NewLine + ex.Message); return(null); } return(null); }