Пример #1
0
        private List <Shortcut> GetShortcuts()
        {
            List <Shortcut> shortcuts = new List <Shortcut>();

            string        shortcutsFolder     = CraftSynth.BuildingBlocks.WindowsNT.Misc.GetStartMenuFolderPathForAllUsers();
            List <string> shortcutsFilesPaths = CraftSynth.BuildingBlocks.IO.FileSystem.GetFilePaths(shortcutsFolder, true);

            foreach (var shortcutFilePath in shortcutsFilesPaths)
            {
                Shortcut shortcut = Shortcuts.ReadShortcutFile(shortcutFilePath);
                if (shortcut != null)
                {
                    shortcuts.Add(shortcut);
                }
            }

            shortcutsFolder     = CraftSynth.BuildingBlocks.WindowsNT.Misc.GetStartMenuFolderPathForCurrentUser();
            shortcutsFilesPaths = CraftSynth.BuildingBlocks.IO.FileSystem.GetFilePaths(shortcutsFolder, true);
            foreach (var shortcutFilePath in shortcutsFilesPaths)
            {
                if (!shortcuts.Exists(s => string.Compare(s.shortcutFilePath, shortcutFilePath, StringComparison.OrdinalIgnoreCase) == 0))
                {
                    Shortcut shortcut = Shortcuts.ReadShortcutFile(shortcutFilePath);
                    if (shortcut != null)
                    {
                        shortcuts.Add(shortcut);
                    }
                }
            }

            return(shortcuts);
        }
Пример #2
0
        private List <Shortcut> GetShortcuts()
        {
            List <Shortcut> shortcuts       = new List <Shortcut>();
            string          shortcutsFolder = Settings.Current.EnsoLearnAsOpenCommandsFolder;

            CraftSynth.BuildingBlocks.IO.FileSystem.CreateFolderIfItDoesNotExist(shortcutsFolder);

            List <string> shortcutsFilesPaths = CraftSynth.BuildingBlocks.IO.FileSystem.GetFilePaths(shortcutsFolder);

            foreach (var shortcutFilePath in shortcutsFilesPaths)
            {
                Shortcut shortcut = Shortcuts.ReadShortcutFile(shortcutFilePath);
                if (shortcut != null)
                {
                    shortcuts.Add(shortcut);
                }
            }
            return(shortcuts);
        }