Ejemplo n.º 1
0
        /// <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)
        {
            ISiteHandler curseForge = SiteHandlerManager.GetSiteHandlerByName("CurseForge");
            ModNode      modNode    = curseForge.HandleAdd(GetDownloadURL(url), modName, install, downloadProgressCallback);

            ////modNode.VersionControllerName = Name;

            return(modNode);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns the plain url to the mod, where the ModInfos would be get from.
        /// </summary>
        /// <param name="url">The url to reduce.</param>
        /// <returns>The plain url to the mod, where the ModInfos would be get from.</returns>
        public string ReduceToPlainUrl(string url)
        {
            ISiteHandler curseForge = SiteHandlerManager.GetSiteHandlerByName("CurseForge");

            return(curseForge.ReduceToPlainUrl(GetDownloadURL(url)));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Gets the content of the site of the passed URL and parses it for ModInfos.
        /// </summary>
        /// <param name="url">The URL of the site to parse the ModInfos from.</param>
        /// <returns>The ModInfos parsed from the site of the passed URL.</returns>
        public ModInfo GetModInfo(string url)
        {
            ISiteHandler curseForge = SiteHandlerManager.GetSiteHandlerByName("CurseForge");

            return(curseForge.GetModInfo(GetDownloadURL(url)));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Downloads the mod.
        /// </summary>
        /// <param name="modInfo">The infos of the mod. Must have at least ModURL and LocalPath</param>
        /// <param name="downloadProgressCallback">Callback function for download progress.</param>
        /// <returns>True if the mod was downloaded.</returns>
        public bool DownloadMod(ref ModInfo modInfo, DownloadProgressCallback downloadProgressCallback = null)
        {
            ISiteHandler curseForge = SiteHandlerManager.GetSiteHandlerByName("CurseForge");

            return(curseForge.DownloadMod(ref modInfo, downloadProgressCallback));
        }