private static void setProgId() { using (RegistryKey key = Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Classes\NexDirect.Url")) { key.SetValue("", "NexDirect http passthrough"); string appLocation = WinTools.GetExecLocation(); using (RegistryKey shellOpenKey = key.CreateSubKey(@"shell\open\command")) shellOpenKey.SetValue("", $"\"{appLocation}\" \"/link:%1\""); } }
private void button_Click(object sender, RoutedEventArgs e) { string url = $"https://osu.ppy.sh/s/{set.Id}"; Process proc; if (String.IsNullOrEmpty(Properties.Settings.Default.linkerDefaultBrowser)) { proc = Process.Start(url); } else { proc = Process.Start(new ProcessStartInfo(Properties.Settings.Default.linkerDefaultBrowser, url)); } WinTools.SetHandleForeground(proc.Handle); }
private void button_Click(object sender, RoutedEventArgs e) { string url = $"https://osu.ppy.sh/beatmapsets/{set.Id}"; Process proc; if (String.IsNullOrEmpty(SettingManager.Get("linkerDefaultBrowser"))) { proc = Process.Start(url); } else { proc = Process.Start(new ProcessStartInfo(SettingManager.Get("linkerDefaultBrowser"), url)); } WinTools.SetHandleForeground(proc.Handle); }
private void Update() { if (_run) { _timer += Time.deltaTime; if (_timer >= _interval) { SetRun(false); _timer = 0; LeftTimeTxt.text = "亲爱的,该喝水了~"; WinTools.ShowForward(); } else { RefreshLeftTimeTxt(true); } } }
private void registerUriButton_Click(object sender, RoutedEventArgs e) { string appLocation = WinTools.GetExecLocation(); try { // https://msdn.microsoft.com/en-AU/library/h5e7chcf.aspx using (RegistryKey key = Registry.CurrentUser.CreateSubKey(regUriSubKey)) { key.SetValue("", "NexDirect Handling Protocol"); // "" = (default) key.SetValue("URL Protocol", ""); using (RegistryKey iconKey = key.CreateSubKey(@"DefaultIcon")) iconKey.SetValue("", $"{appLocation},1"); using (RegistryKey shellOpenKey = key.CreateSubKey(@"shell\open\command")) shellOpenKey.SetValue("", $"\"{appLocation}\" \"%1\""); } MessageBox.Show("The URI Scheme handler was registered successfully."); } catch (Exception ex) { MessageBox.Show($"An error occured whilst registering the handler...\n\n{ex.ToString()}"); } }
private static void registerCapabilities() { string appLocation = WinTools.GetExecLocation(); using (RegistryKey key = Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Clients\StartMenuInternet\NexDirect")) { key.SetValue("", "NexDirect"); using (RegistryKey capibilitySubkey = key.CreateSubKey(@"Capabilities")) { capibilitySubkey.SetValue("ApplicationDescription", "Intercepts browser requests so that relevant ones can be sent to NexDirect."); capibilitySubkey.SetValue("ApplicationName", "NexDirect"); using (RegistryKey urlAssocKey = capibilitySubkey.CreateSubKey(@"URLAssociations")) { urlAssocKey.SetValue("http", "NexDirect.Url"); urlAssocKey.SetValue("https", "NexDirect.Url"); } } using (RegistryKey iconSubkey = key.CreateSubKey(@"DefaultIcon")) iconSubkey.SetValue("", $"{appLocation},0"); } }
/// <summary> /// Determines the path to the GPG program /// </summary> public static string GetGpgProgramPath() { Log.WriteInformationMessage("GetGpgProgramPath", "gpg", Platform.IsClientWindows ? WinTools.GetWindowsGpgExePath() : "gpg"); // for Windows return the full path, otherwise just return "gpg" return(Platform.IsClientWindows ? WinTools.GetWindowsGpgExePath() : "gpg"); }
public Settings(MainWindow mw) { InitializeComponent(); this._mw = mw; // legacy reference overlayModeCheckbox.IsChecked = SettingManager.Get("overlayMode"); audioPreviewsCheckbox.IsChecked = SettingManager.Get("audioPreviews"); mirrorTextBox.Text = SettingManager.Get("beatmapMirror"); launchOsuCheckbox.IsChecked = SettingManager.Get("launchOsu"); officialDownloadBox.IsChecked = SettingManager.Get("useOfficialOsu"); useTrayCheckbox.IsChecked = SettingManager.Get("minimizeToTray"); novidCheckbox.IsChecked = SettingManager.Get("novidDownload"); previewVolumeSlider.Value = SettingManager.Get("previewVolume") * 100; if (SettingManager.Get("fallbackActualOsu")) { officialDownloadBox.IsChecked = true; } if ((bool)officialDownloadBox.IsChecked) { officialLoggedInAs.Visibility = Visibility.Visible; officialLoggedInAs.Content = "Currently logged in as: " + SettingManager.Get("officialOsuUsername"); if (SettingManager.Get("fallbackActualOsu")) { officialLoggedInAs.Content += " (falling back to Bloodcat)"; } } buildDataLabel.Content = $"running NexDirect {(BuildMeta.IsDebug ? "debug" : "v" + WinTools.GetGitStyleVersion())} - built {BuildMeta.BuildDateTime.ToString()} ({BuildMeta.BuildBranch}#{BuildMeta.BuildCommit})"; if (BuildMeta.IsDebug) { buildDataLabel.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0)); } loaded = true; }