async void SignInUser() { string samp037 = "C316560C5B925874FF30D49DCAE42478"; string samp = ""; try { if (Registry.GetValue(@"HKEY_CURRENT_USER\Software\DStories", "created", null) == null) { RegistryKey key; key = Registry.CurrentUser.CreateSubKey(@"Software\DStories"); key.SetValue("created", "1"); key.Close(); } } catch (SecurityException) { Error.ShowError("Brak permisji!\nUruchom program jako Administrator!"); } catch (ArgumentException) { Error.ShowError("Klucz nie zaczyna się od głównego prawidłowy rejestru!"); } try { if (Registry.GetValue(@"HKEY_CURRENT_USER\Software\SAMP", "gta_sa_exe", null) != null) { samp = Registry.GetValue(@"HKEY_CURRENT_USER\Software\SAMP", "gta_sa_exe", null).ToString().Replace("gta_sa.exe", "samp.exe"); if (await MD5Checksum.CalculateMD5Async(samp) == samp037) { SettingsButton.Show(); LowerPB.Show(); BiggerPB.Show(); PlayButton.Show(); PlayImage.Show(); DiscordButton.Show(); LoginDim.Hide(); } else { Error.ShowError("Posiadasz złą wersję SA-MP!\n Wymagana wersja to 0.3.7!"); System.Diagnostics.Process.Start("https://www.sa-mp.com/download.php"); Environment.Exit(0); } } else { System.Diagnostics.Process.Start("https://www.sa-mp.com/download.php"); Environment.Exit(0); } } catch (SecurityException) { Error.ShowError("Brak permisji!\nUruchom program jako Administrator!"); } catch (ArgumentException) { Error.ShowError("Klucz nie zaczyna się od głównego prawidłowego rejestru!"); } }
public Client() { Debug.WriteLine(installing_path); InitializeComponent(); CenterToScreen(); MaximizeBox = false; PanelOpacity.BackColor = Color.FromArgb(125, Color.Black); SettingsButton.BackColor = Color.FromArgb(25, Color.Gray); LoginDim.BackColor = Color.FromArgb(125, Color.Black); SettingsButton.Hide(); LowerPB.Hide(); BiggerPB.Hide(); PlayButton.Hide(); PlayImage.Hide(); StatusBar.Hide(); DiscordButton.Hide(); }
/// <summary> /// Creats a new Presence object, copying values of the Rich Presence /// </summary> /// <param name="presence">The rich presence, often received by discord.</param> public DiscordPresence(DiscordRPC.RichPresence presence) { if (presence != null) { this.state = presence.State; this.details = presence.Details; this.party = presence.HasParty() ? new DiscordParty(presence.Party) : new DiscordParty(); this.secrets = presence.HasSecrets() ? new DiscordSecrets(presence.Secrets) : new DiscordSecrets(); if (presence.HasAssets()) { this.smallAsset = new DiscordAsset() { image = presence.Assets.SmallImageKey, tooltip = presence.Assets.SmallImageText, snowflake = presence.Assets.SmallImageID.GetValueOrDefault(0) }; this.largeAsset = new DiscordAsset() { image = presence.Assets.LargeImageKey, tooltip = presence.Assets.LargeImageText, snowflake = presence.Assets.LargeImageID.GetValueOrDefault(0) }; } else { this.smallAsset = new DiscordAsset(); this.largeAsset = new DiscordAsset(); } if (presence.HasButtons()) { this.firstButton = new DiscordButton() { label = presence.Buttons[0].Label, url = presence.Buttons[0].Url, }; this.secondButton = new DiscordButton() { label = presence.Buttons[1].Label, url = presence.Buttons[1].Url, }; } else { this.firstButton = new DiscordButton(); this.secondButton = new DiscordButton(); } if (presence.HasTimestamps()) { //This could probably be made simpler this.startTime = presence.Timestamps.Start.HasValue ? new DiscordTimestamp((long)presence.Timestamps.StartUnixMilliseconds.Value) : DiscordTimestamp.Invalid; this.endTime = presence.Timestamps.End.HasValue ? new DiscordTimestamp((long)presence.Timestamps.EndUnixMilliseconds.Value) : DiscordTimestamp.Invalid; } } else { this.state = ""; this.details = ""; this.party = new DiscordParty(); this.secrets = new DiscordSecrets(); this.smallAsset = new DiscordAsset(); this.largeAsset = new DiscordAsset(); this.firstButton = new DiscordButton(); this.secondButton = new DiscordButton(); this.startTime = DiscordTimestamp.Invalid; this.endTime = DiscordTimestamp.Invalid; } }