private void listBoxFile_DragDrop(object sender, DragEventArgs e) { string[] s = (string[])e.Data.GetData(DataFormats.FileDrop, false); foreach (string o in s) { //搜索拖入的路径,是目录,扫描视频文件 if (System.IO.File.Exists(o)) { if (CodeAll.isVideo(o)) { this.listBoxFile.Items.Add(o); } } else if (System.IO.Directory.Exists(o)) { List <string> lst = CodeAll.ScanVideo(o, "*", SearchOption.AllDirectories); foreach (var item in lst) { this.listBoxFile.Items.Add(item); } } } }
private void Form_DragDrop(object sender, DragEventArgs e) { string[] s = (string[])e.Data.GetData(DataFormats.FileDrop, false); foreach (string o in s) { //搜索拖入的路径,是目录,扫描视频文件 string Str = ""; if (CodeAll.isVideo(o)) { if (radioButton1.Checked) { Str = getSerialName(o); } } if (Str != "") { DLL.SystemCMD.RunCmd("cmd.exe", setting.EverythingPath + " -s \"" + Str + "\""); } } }
private void listBoxNameSet_DragDrop(object sender, DragEventArgs e) { string[] s = (string[])e.Data.GetData(DataFormats.FileDrop, false); foreach (string o in s) { //如果是文件,只导入视频,如果是文件夹,直接导入 if (System.IO.File.Exists(o)) { if (checkBox1.Checked) { this.listBoxNameSet.Items.Add(o); } else if (CodeAll.isVideo(o)) { this.listBoxNameSet.Items.Add(o); } } else if (System.IO.Directory.Exists(o)) { this.listBoxNameSet.Items.Add(o); } } }