private void ProfilesListBox_DragDrop(object sender, DragEventArgs e) { string[] droppedFilenames = (string[])e.Data.GetData(DataFormats.FileDrop, false); foreach (string filename in droppedFilenames) { string filePathToAdd = filename; string arguments = string.Empty; string fileExt = Path.GetExtension(filePathToAdd); if (fileExt.Equals(".lnk", StringComparison.OrdinalIgnoreCase)) { filePathToAdd = ShortcutCreator.GetShortcutTarget(filename); arguments = ShortcutCreator.GetShortcutArguments(filename).Trim(); } if (arguments == string.Empty) { AddCopy(filePathToAdd); } else { AddCopy(filePathToAdd, arguments); } } }
private void AutomodeButton_Click(object sender, EventArgs e) { if (ShortcutCreator.CreateMasterShortcut()) { MessageBox.Show("Master shortcut created!", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private static bool CreateMasterShortcut() { if (ShortcutCreator.CreateMasterShortcut()) { MessageBox.Show("Master shortcut created!", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); return(true); } return(false); }
private void ShortcutButton_Click(object sender, EventArgs e) { int nShortcutsCreated = 0; string gwArgs = string.Empty; foreach (string gwPath in profilesListBox.SelectedItems) { gwArgs = mSettings.GetArguments(gwPath); if (ShortcutCreator.CreateSingleLaunchShortcut(gwPath, gwArgs)) { nShortcutsCreated++; } } MessageBox.Show(nShortcutsCreated.ToString() + " Desktop shortcuts were created!", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private bool AddCopy(string pathToAdd) { string gwPath = pathToAdd; string arguments = string.Empty; string fileExt = Path.GetExtension(pathToAdd); if (fileExt.Equals(".lnk", StringComparison.OrdinalIgnoreCase)) { gwPath = ShortcutCreator.GetShortcutTarget(pathToAdd); arguments = ShortcutCreator.GetShortcutArguments(pathToAdd).Trim(); } if (arguments == string.Empty) { return(AddCopy(gwPath, Program.DEFAULT_ARGUMENT)); } return(AddCopy(gwPath, arguments)); }
private static int CreateShortcut(int[] selectedInstalls) { int nShortcutsCreated = 0; string gwPath = string.Empty; string gwArgs = string.Empty; foreach (int index in selectedInstalls) { gwPath = Program.settings.GetPath(index); gwArgs = Program.settings.GetArguments(index); if (ShortcutCreator.CreateSingleLaunchShortcut(gwPath, gwArgs)) { nShortcutsCreated++; } } MessageBox.Show(nShortcutsCreated.ToString() + " Desktop shortcuts were created!", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); return(nShortcutsCreated); }