Exemplo n.º 1
0
        private bool DoesAppExist(string appName)
        {
            var AppExists = false;
            var sra       = new SystemRemoteApps();

            foreach (RemoteAppLib.New.RemoteApp App in sra.GetAll())
            {
                if ((App.Name ?? "") == (appName ?? ""))
                {
                    AppExists = true;
                }
            }

            return(AppExists);
        }
Exemplo n.º 2
0
        public static void RemoveUnusedFtAs()
        {
            var KeyNames    = Registry.ClassesRoot.GetSubKeyNames();
            var RemoveCount = 0;

            foreach (var KeyName in KeyNames)
            {
                var ftaKey  = Registry.ClassesRoot.OpenSubKey(KeyName);
                var raValue = (string)ftaKey.GetValue("RemoteApp", "");
                if (string.IsNullOrEmpty(raValue))
                {
                    continue;
                }
                foreach (var KeyName2 in KeyNames)
                {
                    try
                    {
                        var ftKey   = Registry.ClassesRoot.OpenSubKey(KeyName2);
                        var ftValue = (string)ftKey.GetValue("", "");
                        if ((ftValue ?? "") != (KeyName ?? ""))
                        {
                            continue;
                        }
                        var sra       = new SystemRemoteApps();
                        var AppExists = false;
                        foreach (RemoteAppLib.New.RemoteApp app in sra.GetAll())
                        {
                            if ((app.Name ?? "") == (GetAppForFta(KeyName2) ?? ""))
                            {
                                AppExists = true;
                            }
                        }

                        if (AppExists)
                        {
                            continue;
                        }
                        DeleteFta(KeyName2);
                        RemoveCount++;
                    }
                    catch (Exception)
                    {
                    }
                }
            }

            MessageBox.Show("Unused file type associations removed: " + RemoveCount, "File Type Association", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }