private void Disconnect() { DiscordRpc.Shutdown(); SetStatus("Disconnected"); _tickTimer.Dispose(); _tickTimer = null; }
private void pictureBox2_Click(object sender, EventArgs e) { // [DISCORD RICH PRESENCE] DiscordRpc.Shutdown(); Application.Exit(); //this code is for the x button to close the entire application, including other open forms }
/// <summary> /// Shutdown discord controller. /// </summary> public static void Shutdown(bool dontSaveAnything) { //Debug.Log($"JEMDiscordController.Shutdown isInitialized:{IsInitialized} dontSaveAnything:{dontSaveAnything}"); if (!IsInitialized) { return; } IsInitialized = false; // Disconnect update. EditorApplication.update -= Update; // Save timestamp. SaveTimestamp(dontSaveAnything); if (IsConnected) { Debug.Log("Discord: shutdown"); DiscordRpc.Shutdown(); } // Save last discord initialization time. EditorPrefs.SetString("jem.discordRPC.lastInitialization", DateTime.Now.ToString(CultureInfo.InvariantCulture)); IsConnected = false; }
void OnApplicationQuit() { debug("shutdown"); #if UNITY_STANDALONE_WIN DiscordRpc.Shutdown(); #endif }
public static void OnApplicationQuit() { if (!running) { return; } DiscordRpc.Shutdown(); }
private void OnDisable() { DiscordRpc.Shutdown(); // ReSharper disable DelegateSubtraction _gameInfo.OnStateChange -= StateChange; _bombInfo.OnBombExploded -= BombExploded; // ReSharper restore DelegateSubtraction }
private static void OnGameExit() { if (DiscordRpc.Initialize == null) { return; } DiscordRpc.Shutdown(); }
private static void Disable() { if (EditorPrefs.GetBool("enabled")) { //If "enabled" is true that means we need to shut it down EditorPrefs.SetBool("enabled", false); DiscordRpc.Shutdown(); Debug.Log("Unity Editor Rich Presence has been disabled"); } }
public void Dispose() { try { DiscordRpc.Shutdown(); } catch (Exception ex) { Trace.TraceWarning("Exception shutting down discord-RPC: {0}", ex); } }
private static void Exit(string message = "") { DiscordRpc.Shutdown(); #if !asdf MemoryHandler.Instance.UnsetProcess(); #endif if (message != "") { MessageBox.Show(message); } Application.Exit(); }
public static void Discord_RPC_Shutdown() { DiscordRpc.RichPresence discordPresence = new DiscordRpc.RichPresence(); discordPresence.details = ""; discordPresence.state = ""; discordPresence.largeImageKey = ""; DiscordRpc.UpdatePresence(ref discordPresence); DiscordRpc.Shutdown(); bEnable = false; bInitialized = false; }
private void Application_Exit(object sender, ExitEventArgs e) { Debug.WriteLine("Application_Exit"); if (bEnable) { DiscordRpc.RichPresence discordPresence = new DiscordRpc.RichPresence(); discordPresence.details = ""; discordPresence.state = ""; discordPresence.largeImageKey = ""; DiscordRpc.UpdatePresence(ref discordPresence); DiscordRpc.Shutdown(); } }
private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { if (e.CloseReason == CloseReason.UserClosing) { this.WindowState = FormWindowState.Minimized; e.Cancel = true; } else { NotifyIcon.Visible = false; DiscordRpc.Shutdown(); SaveSettings(); } }
private static void ClearPresence() { if (global.presence == null) { // uninitialized return; } global.presence.FreeMem(); global.presence = null; DiscordRpc.ClearPresence(); DiscordRpc.Shutdown(); }
private void Main_FormClosing(object sender, FormClosingEventArgs e) { Properties.Settings.Default.Lanuguage = language.SelectedIndex; Properties.Settings.Default.Username = userNameTextbox.Text; Properties.Settings.Default.Password = userPassTextbox.Text; Properties.Settings.Default.DiscordRPC_Active = DiscordRPC_Active.Checked; Properties.Settings.Default.DiscordRPC_Description = DiscordRPC_Description.Text; Properties.Settings.Default.Save(); DiscordRpc.Shutdown(); Application.Exit(); }
private void button3_Click_1(object sender, EventArgs e) { if (textBox1.Text.Length == 0 || textBox2.Text.Length == 0 || textBox3.Text.Length == 0 || textBox4.Text.Length == 0 || textBox5.Text.Length == 0 || textBox6.Text.Length == 0) { MessageBox.Show("Put a valid informations!"); richTextBox1.Text = "[ERROR] Failed to shutdown, reason : No valid information"; } else { DiscordRpc.Shutdown(); richTextBox1.Text = "[LOGS] RichPresence has been disconnected!"; MessageBox.Show("RichPresence is disconnected"); } }
public void OnClick(bool disconnect) { if (disconnect) { Debug.Log("Discord: on click - shutdown"); DiscordRpc.Shutdown(); } else { Debug.Log("Discord: on click!"); clickCounter++; presence.details = string.Format("Button clicked {0} times", clickCounter); DiscordRpc.UpdatePresence(ref presence); } }
private void updateButton_Click(object sender, EventArgs e) { if (CurrentApplication == null) { return; } DiscordRpc.Shutdown(); DiscordRpc.Initialize(CurrentApplication.appId, ref handlers, false, string.Empty); DiscordRpc.RichPresence richPresence = new DiscordRpc.RichPresence(); richPresence.details = detailsTextBox.Text; richPresence.state = stateTextBox.Text; if (largeIconBox.SelectedIndex > 0) { richPresence.largeImageKey = (string)largeIconBox.SelectedItem; richPresence.largeImageText = CurrentApplication.GetLargeIconText(largeIconBox.SelectedIndex); } if (smallIconBox.SelectedIndex > 0) { richPresence.smallImageKey = (string)smallIconBox.SelectedItem; richPresence.smallImageText = CurrentApplication.GetSmallIconText(smallIconBox.SelectedIndex); } if (partyCheckBox.Checked) { richPresence.partySize = (int)partySizeNumeric.Value; richPresence.partyMax = (int)partyMaxNumeric.Value; } if (timeCheckBox.Checked) { if (startTimeRadioButton.Checked) { richPresence.startTimestamp = (long)dateTimePicker.Value.ToUniversalTime().Subtract(unixDateTimeStart).TotalSeconds; } else if (endTimeRadioButton.Checked) { richPresence.endTimestamp = (long)dateTimePicker.Value.ToUniversalTime().Subtract(unixDateTimeStart).TotalSeconds; } } DiscordRpc.UpdatePresence(richPresence); }
void UpdatePresence() { if (DiscordRPC_Active.Checked) { DiscordRpc.EventHandlers handlers = new DiscordRpc.EventHandlers(); DiscordRpc.RichPresence presence = new DiscordRpc.RichPresence(); DiscordRpc.Initialize("738137354589437972", ref handlers, true, null); presence.details = DiscordRPC_Description.Text; presence.largeImageKey = Properties.Settings.Default.DiscordRPC_Image; presence.largeImageText = "Seafight"; presence.startTimestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds(); DiscordRpc.UpdatePresence(ref presence); } else { DiscordRpc.Shutdown(); } }
public void TogglePresence(Vegas vegas) { if (PresenceEnabled) { RichPresenceToggle rpct = new RichPresenceToggle(false); rpct.ShowDialog(vegas.MainWindow); idleTimer.Stop(); PresenceEnabled = false; DiscordRpc.Shutdown(); } else { RichPresenceToggle rpct = new RichPresenceToggle(true); rpct.ShowDialog(vegas.MainWindow); idleTimer.Start(); PresenceEnabled = true; resetPresence(ref presence, vegas); DiscordRpc.Initialize("434711433112977427", ref callbacks, true, string.Empty); UpdateTrackNumber(vegas); } }
static void Main(string[] args) { // Register callbacks var Callbacks = new DiscordRpc.EventHandlers(); Callbacks.readyCallback = ReadyCallback; Callbacks.disconnectedCallback += DisconnectedCallback; Callbacks.errorCallback += ErrorCallback; Task.Run((Action) delegate { // Connect (Using the 'send-presence.c' id for demo MAKE_YOUR_OWN) DiscordRpc.Initialize("345229890980937739", ref Callbacks, true, null); // Register status var Status = new DiscordRpc.RichPresence(); Status.details = "Doing a thing!"; // Update status DiscordRpc.UpdatePresence(ref Status); while (Continue) { // Callbacks DiscordRpc.RunCallbacks(); System.Threading.Thread.Sleep(100); } }); while (Continue) { System.Threading.Thread.Sleep(100); } // Clean up DiscordRpc.Shutdown(); }
void OnDisable() { Debug.Log("Discord: shutdown"); DiscordRpc.Shutdown(); }
/// <summary> /// Stop RPC. /// </summary> public void Shutdown() { DiscordRpc.Shutdown(); this.SetStatusBarMessage("Shuted down."); }
public void OnDisable() { Debug.Log("Discord: shutdown"); DiscordRpc.ClearPresence(); DiscordRpc.Shutdown(); }
private static void OnGameExit() { DiscordRpc.Shutdown(); }
private static void WorkerLoop() { string lib = null; if (!string.IsNullOrEmpty(CoreModule.Settings.DiscordLib)) { lib = CoreModule.Settings.DiscordLib; } else if (Environment.OSVersion.Platform == PlatformID.Win32NT) { lib = "discord-rpc.dll"; } else if (Environment.OSVersion.Platform == PlatformID.MacOSX) { lib = "libdiscord-rpc.dylib"; // FIXME: macOS doesn't see libdiscord-rpc.dylib wherever Celeste.exe is. } else if (Environment.OSVersion.Platform == PlatformID.Unix) { lib = "libdiscord-rpc.so"; } if (!string.IsNullOrEmpty(lib)) { DynDll.Mappings["discord-rpc"] = new DynDllMapping() { ResolveAs = lib } } ; string discordID = "430794114037055489"; if (!string.IsNullOrEmpty(CoreModule.Settings.DiscordID)) { discordID = CoreModule.Settings.DiscordID; } try { typeof(DiscordRpc).ResolveDynDllImports(); } catch { } if (DiscordRpc.Initialize == null) { Logger.Log(LogLevel.Info, "discord", "Discord_Initialize not found - skipping Discord Rich Presence."); return; } Logger.Log(LogLevel.Verbose, "discord", $"Discord_Initialize found - initializing Discord Rich Presence, app ID {discordID}"); DiscordHandlers.readyCallback += OnDiscordReady; DiscordHandlers.disconnectedCallback += OnDiscordDisconnect; DiscordHandlers.errorCallback += OnDiscordError; DiscordRpc.Initialize.Invoke(discordID, ref DiscordHandlers, true, "504230"); DiscordRpc.UpdatePresence(DiscordPresence); while (Worker != null) { if (Queue.Count == 0) { Thread.Yield(); continue; } Action cb; lock (Queue) cb = Queue.Dequeue(); cb?.Invoke(); } DiscordRpc.Shutdown(); }
public void Shutdown() { dummyDocker.Dispose(); DiscordRpc.Shutdown(); }
void OnDestroy() { DiscordRpc.Shutdown(); }
public void Shutdown() { Debug.Log("Shutting down Discord Rich Presence"); DiscordRpc.Shutdown(); }
static void TerminateProgram() { notifyIcon.Visible = false; DiscordRpc.Shutdown(); Application.Exit(); }