public List <SHORTCUT> GetStartupList()
        {
            List <SHORTCUT> StartupItems = new List <SHORTCUT>();

            string[] StartupFolders =
            {
                System.Environment.GetFolderPath(Environment.SpecialFolder.CommonStartup),
                System.Environment.GetFolderPath(Environment.SpecialFolder.Startup)
            };
            string[] StartupRegistrys =
            {
                @"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run",
                @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run",
                @"HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Run",
            };
            foreach (string path in StartupFolders)
            {
                string[] lnks = fileutils.searchFile(path, "*.lnk", null, false);
                foreach (string lnk in lnks)
                {
                    SHORTCUT item = new SHORTCUT();
                    item.name   = System.IO.Path.GetFileName(lnk);
                    item.target = fileutils.GetShortcutTargetFile(lnk);
                    item.type   = "lnk";
                    item.path   = lnk;
                    StartupItems.Add(item);
                }
            }
            registry regedit = new registry();

            foreach (string reg in StartupRegistrys)
            {
                RegistryKey OurKey = regedit.open(reg);
                foreach (string Keyname in OurKey.GetValueNames())
                {
                    string   Keyvalue = OurKey.GetValue(Keyname).ToString();
                    SHORTCUT item     = new SHORTCUT();
                    item.name   = Keyname;
                    item.target = Keyvalue;
                    item.type   = "reg";
                    item.path   = OurKey + @"\" + Keyname;
                    StartupItems.Add(item);
                }
            }
            return(StartupItems);
        }
예제 #2
0
        private void delstartmenu_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            int limit = 10;

            if (e.Action == NotifyCollectionChangedAction.Add)
            {
                // scroll the new item into view
                //listView.ScrollIntoView(e.NewItems[0]);
                //Console.WriteLine(((INSTALLED)e.NewItems[0]).name);
                SHORTCUT lv_delstartmenu_item = ((SHORTCUT)e.NewItems[0]);
                STARTMENUS.Remove(lv_delstartmenu_item);
            }
            else if (e.Action == NotifyCollectionChangedAction.Remove)
            {
                SHORTCUT lv_uninstalled_item = ((SHORTCUT)e.OldItems[0]);
                STARTMENUS.Add(lv_uninstalled_item);
            }
        }
예제 #3
0
        public List <SHORTCUT> GetStartMenu()
        {
            List <SHORTCUT> shortcuts = new List <SHORTCUT>();

            string[] startmenus =
            {
                System.Environment.GetFolderPath(Environment.SpecialFolder.CommonStartMenu) + @"\Programs",
                System.Environment.GetFolderPath(Environment.SpecialFolder.StartMenu) + @"\Programs"
            };
            foreach (string path in startmenus)
            {
                DirectoryInfo   directory   = new DirectoryInfo(path);
                DirectoryInfo[] directories = directory.GetDirectories();
                String[]        sysMenu     = { "Accessories", "Administrative Tools", "Maintenance", "Startup", "Games" };
                String[]        sysLnk      = { "Media Center.lnk", "Sidebar.lnk", "Windows DVD Maker.lnk", "Windows Fax and Scan.lnk", "Windows Media Player.lnk", "XPS Viewer.lnk", "Internet Explorer.lnk", "Internet Explorer(64 bit).lnk" };
                foreach (DirectoryInfo folder in directories)
                {
                    if (!sysMenu.Contains(folder.Name))
                    {
                        SHORTCUT item = new SHORTCUT();
                        item.name = folder.Name;
                        item.path = folder.FullName;
                        shortcuts.Add(item);
                    }
                }
                string[] lnks = fileutils.searchFile(path, "*.lnk", null, false);
                foreach (string lnk in lnks)
                {
                    SHORTCUT item = new SHORTCUT();
                    item.name = Path.GetFileName(lnk);
                    //item.target = fileutils.GetShortcutTargetFile(lnk);
                    if (!sysLnk.Contains(item.name))
                    {
                        shortcuts.Add(item);
                    }
                }
            }
            return(shortcuts);
        }
예제 #4
0
        public List <SHORTCUT> GetDesktopShortcut()
        {
            List <SHORTCUT> shortcuts = new List <SHORTCUT>();

            string[] desktops =
            {
                System.Environment.GetFolderPath(Environment.SpecialFolder.CommonDesktopDirectory),
                System.Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
            };
            foreach (string path in desktops)
            {
                string[] lnks = fileutils.searchFile(path, "*.lnk");
                foreach (string lnk in lnks)
                {
                    SHORTCUT item = new SHORTCUT();
                    item.name   = Path.GetFileName(lnk);
                    item.target = fileutils.GetShortcutTargetFile(lnk);
                    item.path   = lnk;
                    shortcuts.Add(item);
                }
            }
            return(shortcuts);
        }