Esempio n. 1
0
        public void SaveApp(RemoteApp remoteApp)
        {
            _baseKeyWrite.CreateSubKey(remoteApp.Name);
            var AppKey = _baseKey.OpenSubKey(remoteApp.Name, true);

            AppKey.SetValue("Name", remoteApp.FullName, RegistryValueKind.String);
            AppKey.SetValue("Path", remoteApp.Path, RegistryValueKind.String);
            AppKey.SetValue("VPath", remoteApp.VPath, RegistryValueKind.String);
            AppKey.SetValue("RequiredCommandLine", remoteApp.CommandLine, RegistryValueKind.String);
            AppKey.SetValue("CommandLineSetting", remoteApp.CommandLineOption, RegistryValueKind.DWord);
            AppKey.SetValue("IconPath", remoteApp.IconPath, RegistryValueKind.String);
            AppKey.SetValue("IconIndex", remoteApp.IconIndex, RegistryValueKind.DWord);
            AppKey.SetValue("ShowInTSWA", remoteApp.TSWA, RegistryValueKind.DWord);
            if (remoteApp.FileTypeAssociations == null)
            {
                return;
            }
            if (AppKey.OpenSubKey("Filetypes") != null)
            {
                AppKey.DeleteSubKeyTree("Filetypes");
            }
            AppKey.CreateSubKey("Filetypes");
            var ftaKey = AppKey.OpenSubKey("Filetypes", true);

            foreach (FileTypeAssociation fta in remoteApp.FileTypeAssociations)
            {
                ftaKey.SetValue(fta.Extension, $"{fta.IconPath},{fta.IconIndex}", RegistryValueKind.String);
            }
        }
Esempio n. 2
0
 public RemoteAppLib.New.RemoteApp EditRemoteApp(RemoteAppLib.New.RemoteApp selectedRemoteApp)
 {
     HelpSystem.SetupTips(this);
     _remoteApp = selectedRemoteApp;
     Text       = "Properties of " + _remoteApp.Name;
     Size       = MinimumSize;
     HelpSystem.SetupTips(this);
     LoadValues();
     _ = ShowDialog();
     Forms.RemoteAppMainWindow.ReloadApps();
     //Dispose();
     return(_remoteApp);
 }
Esempio n. 3
0
        public RemoteApp GetApp(string name)
        {
            var App    = new RemoteApp();
            var AppKey = _baseKey.OpenSubKey(name);

            App.Name              = name;
            App.FullName          = (string)AppKey.GetValue("Name", string.Empty);
            App.Path              = (string)AppKey.GetValue("Path", string.Empty);
            App.VPath             = (string)AppKey.GetValue("VPath", string.Empty);
            App.CommandLine       = (string)AppKey.GetValue("RequiredCommandLine", string.Empty);
            App.CommandLineOption = int.Parse(AppKey.GetValue("CommandLineSetting", "1").ToString());
            App.IconPath          = (string)AppKey.GetValue("IconPath", string.Empty);
            App.IconIndex         = int.Parse(AppKey.GetValue("IconIndex", 0).ToString());
            App.TSWA              = AppKey.GetValue("ShowInTSWA", 0) != null && int.Parse(AppKey.GetValue("ShowInTSWA", 0).ToString()) == 1;

            var ftaKey = AppKey.OpenSubKey("Filetypes");

            if (ftaKey == null)
            {
                return(App);
            }
            var ftaCol = new FileTypeAssociationCollection();

            foreach (var ftaValueName in ftaKey.GetValueNames())
            {
                var ftaValue = ftaKey.GetValue(ftaValueName).ToString().Split(',');
                var fta      = new FileTypeAssociation
                {
                    Extension = ftaValueName,
                    IconPath  = ftaValue[0],
                    IconIndex = ftaValue[1]
                };
                ftaCol.Add(fta);
            }

            App.FileTypeAssociations = ftaCol;

            return(App);
        }