protected override void OnExit(ExitEventArgs e) { base.OnExit(e); LuaScripting.CloseScripts(); // Abort all threads if (_luaThread != null && _luaThread.IsAlive) { _luaThread.Abort(); } if (Server._clientThread != null && Server._clientThread.IsAlive) { Server._clientThread.Abort(); } if (_serverThread != null && _serverThread.IsAlive) { _serverThread.Abort(); } }
private void Uninit(object sender, EventArgs e) { LuaScripting.CloseScripts(); Debug.WriteLine(Chroma.Instance.Initialized); }
public static bool RemovePackage(Package p) { var message = MessageBox.Show("Are you sure you would like to remove the package " + p.Product.Name + "?", "Chroma Sync: " + p.Product.Name, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (message == DialogResult.No) { return(false); } LuaScripting.CloseScripts(); foreach (var step in p.Installation) { using (ZipArchive archive = ZipFile.OpenRead(p.Container)) { if (p.Product.Name != null) { foreach (ZipArchiveEntry entry in archive.Entries) { if (step.Folder != null) { if (entry.FullName.StartsWith(step.Folder, StringComparison.OrdinalIgnoreCase) && entry.Name.Length > 0) { switch (step.Action) { case "extract": var path = step.Destination.Folder; path = Environment.ExpandEnvironmentVariables(path); Console.WriteLine(entry.FullName); if (step.Destination.Type == "steamapp") { var steamFolder = GameLocator.InstallFolder(step.Destination.Folder); if (steamFolder == null) { Console.WriteLine("Could not find steam folder: " + steamFolder); return(false); } path = steamFolder; } var sp = entry.FullName.Remove(0, step.Folder.Length + 1); var pa = Path.Combine(path, sp); try { File.Delete(pa); } catch (Exception e) { App.Log.Error(e); } break; case "execute": if (!entry.Name.Equals(step.File)) { continue; } var tmp = Path.Combine("tmp", entry.Name); try { File.Delete(tmp); } catch (Exception e) { App.Log.Error(e); } break; } } } } } } } try { File.Delete(p.Container); RegistryKeeper.UpdateReg(p.Container, ""); GetPackages(); LuaScripting.ReloadScripts(); return(true); } catch (Exception e) { App.Log.Error(e); } return(false); }