private static void DownloadDependencies(string unityVersion) { Logger.Log("Downloading Il2CppDumper"); DownloaderAndUnpacker.Run(ExternalToolVersions.Il2CppDumperUrl, ExternalToolVersions.Il2CppDumperVersion, localConfig.DumperVersion, Il2CppDumper.BaseFolder); localConfig.DumperVersion = ExternalToolVersions.Il2CppDumperVersion; localConfig.Save(localConfigPath); Logger.Log("Downloading Il2CppAssemblyUnhollower"); DownloaderAndUnpacker.Run(ExternalToolVersions.Il2CppAssemblyUnhollowerUrl, ExternalToolVersions.Il2CppAssemblyUnhollowerVersion, localConfig.UnhollowerVersion, Il2CppAssemblyUnhollower.BaseFolder); localConfig.UnhollowerVersion = ExternalToolVersions.Il2CppAssemblyUnhollowerVersion; localConfig.Save(localConfigPath); Logger.Log("Downloading Unity Dependencies"); try { DownloaderAndUnpacker.Run($"{ExternalToolVersions.UnityDependenciesBaseUrl}{unityVersion}.zip", unityVersion, localConfig.UnityVersion, UnityDependencies.BaseFolder); localConfig.UnityVersion = unityVersion; localConfig.Save(localConfigPath); } catch (Exception ex) { Logger.LogError("Can't download Unity Dependencies, Unstripping will NOT be done!"); Logger.Log(ex.ToString()); } }
private static void DownloadDependencies(string unityVersion) { Logger.Log("Downloading Il2CppDumper"); DownloaderAndUnpacker.Run(ExternalToolVersions.Il2CppDumperUrl, ExternalToolVersions.Il2CppDumperVersion, localConfig.DumperVersion, Il2CppDumper.BaseFolder, TempFileCache.CreateFile()); localConfig.DumperVersion = ExternalToolVersions.Il2CppDumperVersion; localConfig.Save(localConfigPath); Logger.Log("Downloading Il2CppAssemblyUnhollower"); DownloaderAndUnpacker.Run(ExternalToolVersions.Il2CppAssemblyUnhollowerUrl, ExternalToolVersions.Il2CppAssemblyUnhollowerVersion, localConfig.UnhollowerVersion, Il2CppAssemblyUnhollower.BaseFolder, TempFileCache.CreateFile()); localConfig.UnhollowerVersion = ExternalToolVersions.Il2CppAssemblyUnhollowerVersion; localConfig.Save(localConfigPath); Logger.Log("Downloading Unity Dependencies"); string tempfile = TempFileCache.CreateFile(); bool run_fallback = false; try { DownloaderAndUnpacker.Run($"{ExternalToolVersions.UnityDependenciesBaseUrl}{unityVersion}.zip", unityVersion, localConfig.UnityVersion, UnityDependencies.BaseFolder, tempfile); localConfig.UnityVersion = unityVersion; localConfig.Save(localConfigPath); } catch (Exception ex) { run_fallback = true; Logger.LogError(ex.ToString()); Logger.Log("Can't download Unity Dependencies for " + unityVersion + ", downloading Fallback..."); } if (run_fallback) { string subver = unityVersion.Substring(0, unityVersion.LastIndexOf(".")); try { JsonArray data = (JsonArray)JsonValue.Parse(Program.webClient.DownloadString("https://api.github.com/repos/HerpDerpinstine/MelonLoader/contents/BaseLibs/UnityDependencies")).AsJsonArray; if (data.Count > 0) { List <string> versionlist = new List <string>(); foreach (var x in data) { string version = Path.GetFileNameWithoutExtension(x["name"].AsString); if (version.StartsWith(subver)) { versionlist.Add(version); string[] semvertbl = version.Split(new char[] { '.' }); } } if (versionlist.Count > 0) { versionlist = versionlist.OrderBy(x => int.Parse(x.Split(new char[] { '.' })[2])).ToList(); string latest_version = versionlist.Last(); Logger.Log("Fallback Unity Version: " + latest_version); DownloaderAndUnpacker.Run($"{ExternalToolVersions.UnityDependenciesBaseUrl}{latest_version}.zip", latest_version, localConfig.UnityVersion, UnityDependencies.BaseFolder, tempfile); localConfig.UnityVersion = unityVersion; localConfig.Save(localConfigPath); } } } catch (Exception ex) { Logger.LogError("Can't download Unity Dependencies, Unstripping will NOT be done!"); Logger.LogError(ex.ToString()); } } }