private void buttonExecuter_Click(object sender, EventArgs e) { if (!Directory.Exists(comboBoxWorkingDirectory.Text)) { MessageBox.Show("Ce repertoire de travail n'existe pas : "******"*.lnk"); if (tabFiles.Length < 1) { MessageBox.Show("Aucun fichier .lnk trouvé dans : " + comboBoxWorkingDirectory.Text); return; } if (checkBoxAffichageSeule.Checked == true) { FormAffichage fa = new FormAffichage(); fa.textBox1.Font = new Font(fa.textBox1.Font, FontStyle.Bold); fa.textBox1.Text = "REPERTOIRE DE TRAVAIL: " + Path.GetDirectoryName(tabFiles[0]); fa.textBox1.Font = new Font(fa.textBox1.Font, FontStyle.Regular); for (int i = 0; i < tabFiles.Length; i++) { traiterSimulationFichierEnCours(tabFiles[i], fa); } fa.Show(); } else { for (int i = 0; i < tabFiles.Length; i++) { traiterFichierEnCours(tabFiles[i]); } try { System.Diagnostics.Process.Start("explorer.exe", comboBoxWorkingDirectory.Text); } catch (Exception e2) { MessageBox.Show(e2.StackTrace); } } }
private void traiterSimulationFichierEnCours(String shortcutFullPath, FormAffichage fa) { // Load the shortcut. Shell32.Shell shell = new Shell32.Shell(); Shell32.Folder folder = shell.NameSpace(Path.GetDirectoryName(shortcutFullPath)); Shell32.FolderItem folderItem = folder.Items().Item(Path.GetFileName(shortcutFullPath)); Shell32.ShellLinkObject currentLink = (Shell32.ShellLinkObject)folderItem.GetLink; if (currentLink.Path.Contains(comboBoxTxt2Change.Text)) { fa.textBox1.AppendText(Environment.NewLine); fa.textBox1.AppendText(currentLink.Path); currentLink.Save(); } }