/// <summary> /// Handles a mod add via URL. /// Validates the URL, gets ModInfos, downloads mod archive, adds it to the ModSelection and installs the mod if selected. /// </summary> /// <param name="url">The URL to the mod.</param> /// <param name="modName">The name for the mod.</param> /// <param name="install">Flag to determine if the mod should be installed after adding.</param> /// <param name="downloadProgressCallback">Callback function for download progress.</param> /// <returns>The root node of the added mod, or null.</returns> public ModNode HandleAdd(string url, string modName, bool install, DownloadProgressCallback downloadProgressCallback = null) { url = ReduceToPlainUrl(url); ModInfo modInfo = GetModInfo(url); if (modInfo == null) { return(null); } if (!string.IsNullOrEmpty(modName)) { modInfo.Name = modName; } ModNode newMod = null; if (DownloadMod(ref modInfo, downloadProgressCallback)) { newMod = ModSelectionController.HandleModAddViaModInfo(modInfo, install); } return(newMod); }