private static void Install_Legacy_01(string dirpath) { SetDisplayText("Downloading CumLoader..."); string tempfilepath = TempFileCache.CreateFile(); webClient.DownloadFileAsync(new Uri("https://github.com/Goatxz/CumLoader/releases/download/v0.1.0/CumLoader.zip"), tempfilepath); while (webClient.IsBusy) { } SetDisplayText("Downloading Dependencies..."); string tempfilepath2 = TempFileCache.CreateFile(); webClient.DownloadFileAsync(new Uri("https://github.com/Goatxz/CumLoader/releases/download/v0.1.0/MonoDependencies.zip"), tempfilepath2); while (webClient.IsBusy) { } SetDisplayText("Extracting CumLoader..."); Cleanup(dirpath); ExtractZip(dirpath, tempfilepath); SetDisplayText("Extracting Dependencies..."); ExtractZip(dirpath, tempfilepath2); CreateDirectories(dirpath, "v0.1.0", true); }
private void MainForm_FormClosed(object sender, FormClosedEventArgs e) { if ((e.CloseReason == CloseReason.WindowsShutDown) || (e.CloseReason == CloseReason.UserClosing) || (e.CloseReason == CloseReason.TaskManagerClosing)) { TempFileCache.ClearCache(); Process.GetCurrentProcess().Kill(); } }
private static void Install_Silent(string dirpath, string selectedVersion) { string tempfilepath = TempFileCache.CreateFile(); webClient.DownloadFileAsync(new Uri("https://github.com/Goatxz/CumLoader/releases/download/" + selectedVersion + "/CumLoader.zip"), tempfilepath); while (webClient.IsBusy) { } Cleanup(dirpath); ExtractZip(dirpath, tempfilepath); CreateDirectories(dirpath, selectedVersion, false); }
internal static void Install(string dirpath, string selectedVersion, bool legacy_install, bool silent_install) { if (File.Exists(ManualZipPath) && selectedVersion.Equals("Manual Zip")) { Install_ManualZip(dirpath); } else if (legacy_install) { Install_Legacy(dirpath, selectedVersion); } else if (silent_install) { Install_Silent(dirpath, selectedVersion); } else { Install_Normal(dirpath, selectedVersion); } TempFileCache.ClearCache(); }
private void btnInstall_Click(object sender, EventArgs e) { cbVersions.Hide(); tbPath.Hide(); btnSelect.Hide(); btnInstall.Hide(); btnUninstall.Hide(); progressBar.Show(); lblProgressInfo.Show(); lblProgressPer.Show(); new Thread(() => { try { string dirpath = Path.GetDirectoryName(tbPath.Text); string selectedVersion = ((((string)cbVersions.Items[cbVersions.SelectedIndex]).StartsWith("Latest")) ? (string)cbVersions.Items[cbVersions.SelectedIndex + 1] : (string)cbVersions.Items[cbVersions.SelectedIndex]); bool legacy_install = (selectedVersion.Equals("v0.2.1") || selectedVersion.Equals("v0.2") || selectedVersion.Equals("v0.1.0")); Program.Install(dirpath, selectedVersion, legacy_install, false); Program.SetDisplayText("SUCCESS!"); MessageBox.Show("Installation Successful!", Program.Title, MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly); Close(); Application.Exit(); } catch (Exception ex) { TempFileCache.ClearCache(); Program.SetDisplayText("ERROR!"); MessageBox.Show("Installation failed; upload the created log to #cumloader-support on discord", Program.Title); File.WriteAllText(Directory.GetCurrentDirectory() + $@"\MLInstaller_{DateTime.Now:yy-M-dd_HH-mm-ss.fff}.log", ex.ToString()); Close(); Application.Exit(); } }).Start(); }
private void btnUninstall_Click_1(object sender, EventArgs e) { cbVersions.Hide(); tbPath.Hide(); btnSelect.Hide(); btnInstall.Hide(); btnUninstall.Hide(); progressBar.Show(); lblProgressInfo.Show(); lblProgressPer.Show(); new Thread(() => { try { string dirpath = Path.GetDirectoryName(tbPath.Text); Program.Cleanup(dirpath); Program.SetDisplayText("SUCCESS!"); Program.SetPercentage(100); MessageBox.Show("Uninstall Successful!", Program.Title, MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly); Close(); Application.Exit(); } catch (Exception ex) { TempFileCache.ClearCache(); Program.SetDisplayText("ERROR!"); MessageBox.Show("Uninstall failed; upload the created log to #cumloader-support on discord", Program.Title); File.WriteAllText(Directory.GetCurrentDirectory() + $@"\MLInstaller_{DateTime.Now:yy-M-dd_HH-mm-ss.fff}.log", ex.ToString()); Close(); Application.Exit(); } }).Start(); }
private static void Install_Legacy_02(string dirpath, string selectedVersion) { SetDisplayText("Downloading CumLoader..."); bool is_02 = selectedVersion.Equals("v0.2"); string tempfilepath = TempFileCache.CreateFile(); webClient.DownloadFileAsync(new Uri("https://github.com/Goatxz/CumLoader/releases/download/" + selectedVersion + "/CumLoader" + (is_02 ? "_" : ".") + (File.Exists(Path.Combine(dirpath, "GameAssembly.dll")) ? "Il2Cpp" : "Mono") + ".zip"), tempfilepath); while (webClient.IsBusy) { } SetDisplayText("Extracting CumLoader..."); Cleanup(dirpath); ExtractZip(dirpath, tempfilepath); if (is_02) { string AssemblyGenerator_Folder = Path.Combine(Path.Combine(dirpath, "CumLoader"), "AssemblyGenerator"); string Il2CppDumper_Folder = Path.Combine(AssemblyGenerator_Folder, "Il2CppDumper"); string Il2CppAssemblyUnhollower_Folder = Path.Combine(AssemblyGenerator_Folder, "Il2CppAssemblyUnhollower"); string UnityDependencies_Folder = Path.Combine(Il2CppAssemblyUnhollower_Folder, "UnityDependencies"); SetDisplayText("Downloading Il2CppDumper..."); string tempfilepath2 = TempFileCache.CreateFile(); webClient.DownloadFileAsync(new Uri("https://github.com/Perfare/Il2CppDumper/releases/download/v6.2.1/Il2CppDumper-v6.2.1.zip"), tempfilepath2); while (webClient.IsBusy) { } SetDisplayText("Downloading Il2CppUnhollower..."); string tempfilepath3 = TempFileCache.CreateFile(); webClient.DownloadFileAsync(new Uri("https://github.com/knah/Il2CppAssemblyUnhollower/releases/download/v0.4.3.0/Il2CppAssemblyUnhollower.0.4.3.0.zip"), tempfilepath3); while (webClient.IsBusy) { } SetDisplayText("Downloading Dependencies..."); string tempfilepath4 = TempFileCache.CreateFile(); bool run_fallback = false; try { webClient.DownloadFileAsync(new Uri("https://github.com/Goatxz/CumLoader/raw/master/BaseLibs/UnityDependencies/" + mainForm.UnityVersion + ".zip"), tempfilepath4); while (webClient.IsBusy) { } } catch (Exception ex) { run_fallback = true; } if (run_fallback) { string subver = mainForm.UnityVersion.Substring(0, mainForm.UnityVersion.LastIndexOf(".")); JsonArray data = (JsonArray)JsonValue.Parse(Program.webClient.DownloadString("https://api.github.com/repos/Goatxz/CumLoader/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); } } if (versionlist.Count > 0) { versionlist = versionlist.OrderBy(x => int.Parse(x.Split(new char[] { '.' })[2])).ToList(); string latest_version = versionlist.Last(); webClient.DownloadFileAsync(new Uri("https://github.com/Goatxz/CumLoader/raw/master/BaseLibs/UnityDependencies/" + latest_version + ".zip"), tempfilepath4); while (webClient.IsBusy) { } } } } SetDisplayText("Extracting Il2CppDumper..."); ExtractZip(Il2CppDumper_Folder, tempfilepath2); SetDisplayText("Extracting Il2CppUnhollower..."); ExtractZip(Il2CppAssemblyUnhollower_Folder, tempfilepath3); SetDisplayText("Extracting Dependencies..."); ExtractZip(UnityDependencies_Folder, tempfilepath4); } CreateDirectories(dirpath, selectedVersion, true); }