public static System.Drawing.Bitmap GetAppBitmap(string remoteAppShortName) { // FIX : Potential exception. var appKey = $@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList\Applications\{remoteAppShortName}"; var registryKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(appKey); var icon = IconModule.ReturnIcon("", 0).ToBitmap(); if (registryKey is null) { return(icon); } var iconPath = registryKey.GetValue("IconPath", ""); var iconIndex = (int)registryKey.GetValue("IconIndex", ""); return(IconModule.ReturnIcon((string)iconPath, iconIndex).ToBitmap()); }
public void LoadValues() { ShortNameText.Text = _remoteApp.Name; CommandLineOptionCombo.SelectedIndex = _remoteApp.CommandLineOption; FullNameText.Text = _remoteApp.FullName; PathText.Text = _remoteApp.Path; CommandLineText.Text = _remoteApp.CommandLine; CommandLineOptionCombo.SelectedIndex = _remoteApp.CommandLineOption; IconPathText.Text = _remoteApp.IconPath; IconIndexText.Text = _remoteApp.IconIndex.ToString(); var tswa = 0; if (_remoteApp.TSWA) { tswa = 1; } TSWAbox.SelectedIndex = tswa; var TheIcon = IconModule.ReturnIcon(IconPathText.Text, (int)Math.Round(double.Parse(IconIndexText.Text)), true); Icon = TheIcon ?? Forms.RemoteAppMainWindow.Icon; }