private void btnFavorites_Click(object sender, RoutedEventArgs e) { if (Explorer.GetSelectedItemsCount() == 1) { ShellLink link = new ShellLink(); link.DisplayMode = ShellLink.LinkDisplayMode.edmNormal; link.Target = Explorer.SelectedItems[0].ParsingName; link.Save(KnownFolders.Links.ParsingName + @"\" + Explorer.SelectedItems[0].GetDisplayName(DisplayNameType.Default) + ".lnk"); link.Dispose(); } if (Explorer.GetSelectedItemsCount() == 0) { ShellLink link = new ShellLink(); link.DisplayMode = ShellLink.LinkDisplayMode.edmNormal; link.Target = Explorer.NavigationLog.CurrentLocation.ParsingName; link.Save(KnownFolders.Links.ParsingName + @"\" + Explorer.NavigationLog.CurrentLocation.GetDisplayName(DisplayNameType.Default) + ".lnk"); link.Dispose(); } }
private void btnPasetShC_Click(object sender, RoutedEventArgs e) { StringCollection DropList = System.Windows.Forms.Clipboard.GetFileDropList(); string PathForDrop = Explorer.NavigationLog.CurrentLocation.ParsingName; foreach (string item in DropList) { using (ShellLink shortcut = new ShellLink()) { ShellObject o = ShellObject.FromParsingName(item); shortcut.Target = item; shortcut.WorkingDirectory = System.IO.Path.GetDirectoryName(item); shortcut.Description = o.GetDisplayName(DisplayNameType.Default); shortcut.DisplayMode = ShellLink.LinkDisplayMode.edmNormal; shortcut.Save(PathForDrop + "\\" + o.GetDisplayName(DisplayNameType.Default) + ".lnk"); AddToLog("Shortcut Created at " + PathForDrop + "\\" + o.GetDisplayName(DisplayNameType.Default) + " from source " + item); o.Dispose(); } } }