//Program does nothing. Just a compile test private void UnZipFiles(string zipFilePath, string unzipFilePath) { Shell32.ShellClass shApp = new Shell32.ShellClass(); Shell32.Folder3 destFolder = (Shell32.Folder3)shApp.NameSpace(unzipFilePath); Shell32.FolderItems3 zippedItems = (Shell32.FolderItems3)shApp.NameSpace(zipFilePath).Items(); destFolder.CopyHere(zippedItems, 0); }
/// <summary> /// Uses Shell32 /// </summary> /// <param name="siteUrl"></param> /// <param name="filePathPattern">For example, to make a wildcard search ".doc" use the following /// reg expression: Regex regex = new Regex(@".*\.doc", RegexOptions.Compiled | RegexOptions.IgnoreCase); /// to exclude word template documents assigned to a SharePoint workspace, use the following reg /// expression: new Regex(@"(?<!.*/Forms/[^/]+)\.doc$", RegexOptions.Compiled | RegexOptions.IgnoreCase)</param> /// <returns></returns> public static StringCollection CopyFilesFromWebFolderToLocal(Uri siteUrl, string localFolder, bool copySubFolders) { StringCollection ret = new StringCollection(); string mapFolderPath; try { if (!Directory.Exists(localFolder)) { Directory.CreateDirectory(localFolder); } mapFolderPath = CreateWebFolderLink(siteUrl); } catch (Exception e) { return(ret); } Shell32.ShellClass shell = new Shell32.ShellClass(); Shell32.Folder mapFolder = shell.NameSpace(mapFolderPath); Shell32.Folder dsFolder = shell.NameSpace(localFolder); // shell.Explore(mapFolder); // For Debugging (opens up folder in explorer) CopyToFolder(mapFolder, dsFolder, copySubFolders, ref ret); File.Delete(mapFolderPath); return(ret); }
/// <summary> /// Helper method for performing uncompression /// </summary> /// <param name="compressedFileName">Compressed file name</param> /// <param name="destination">destination to be extracted</param> public static void UnCompressZip(string compressedFileName, string destination) { Shell32.ShellClass sc = new Shell32.ShellClass(); Shell32.Folder SrcFlder = sc.NameSpace(compressedFileName); Shell32.Folder DestFlder = sc.NameSpace(destination); Shell32.FolderItems items = SrcFlder.Items(); DestFlder.CopyHere(items, 10); }
/// <summary> /// 解压zip包 /// </summary> /// <param name="zipFile">压缩包目录</param> /// <param name="destFolder">解压文件的目标存放目录</param> private void UnZip(string zipFile, string destFolder) { Shell32.ShellClass sc = new Shell32.ShellClass(); Shell32.Folder SrcFolder = sc.NameSpace(zipFile); Shell32.Folder DestFolder = sc.NameSpace(destFolder); Shell32.FolderItems items = SrcFolder.Items(); DestFolder.CopyHere(items, 20); }
/// <summary> /// Helper method for performing uncompression /// </summary> /// <param name="compressedFileName">Compressed file name</param> /// <param name="destination">destination to be extracted</param> public static void UnCompressZip(string compressedFileName, string destination) { Shell32.ShellClass sc = new Shell32.ShellClass(); Shell32.Folder SrcFlder = sc.NameSpace(compressedFileName); Shell32.Folder DestFlder = sc.NameSpace(destination); Shell32.FolderItems items = SrcFlder.Items(); DestFlder.CopyHere(items, 10); }
static void UnZip(string zipFile, string destFolder) { Shell32.ShellClass sc = new Shell32.ShellClass(); Shell32.Folder SrcFolder = sc.NameSpace(zipFile); Shell32.Folder DestFolder = sc.NameSpace(destFolder); Shell32.FolderItems items = SrcFolder.Items(); DestFolder.CopyHere(items, 20); }
static void UnzipUpdateTo(string targerFolder) { try { Shell32.ShellClass sc = new Shell32.ShellClass(); Shell32.Folder SrcFolder = sc.NameSpace(System.IO.Path.Combine(Application.StartupPath, "Update.zip")); Shell32.Folder DestFolder = sc.NameSpace(targerFolder); Shell32.FolderItems items = SrcFolder.Items(); DestFolder.CopyHere(items, 20); } catch { return; } }
private void applyWallpaperWin7(string path) { Shell32.Shell shell = new Shell32.ShellClass(); Shell32.Folder folder = shell.NameSpace(Path.GetDirectoryName(path)) as Shell32.Folder; Shell32.FolderItem folderItem = folder.ParseName(System.IO.Path.GetFileName(path)); Shell32.FolderItemVerbs vs = folderItem.Verbs(); bool wallpaperSet = false; for (int i = 0; i < vs.Count; i++) { Shell32.FolderItemVerb ib = vs.Item(i); if (ib.Name.Contains("&b") || ib.Name.Contains("&B")) { if (ib.Name.ToLower().Contains("background") || ib.Name.ToLower().Contains("背景")) { wallpaperSet = true; ib.DoIt(); } } } if (wallpaperSet == false) { applyWallpaperXP(path); } else { downloadAndApplyWallpaperSucceeded(); } }
static void CreateShortcut(string FullFolderPath) { string FolderName = Path.GetFileNameWithoutExtension(FullFolderPath); string FolderDir = Path.GetDirectoryName(FullFolderPath); string FolderRoot = Path.GetPathRoot(FullFolderPath); string lnkPath = Path.Combine(FolderDir, FolderName) + ".lnk"; File.WriteAllBytes(lnkPath, new byte[] { }); Shell32.Shell shl = new Shell32.ShellClass(); Shell32.Folder dir = shl.NameSpace(FolderDir); Shell32.FolderItem itm = dir.Items().Item(FolderName + ".lnk"); Shell32.ShellLinkObject lnk = (Shell32.ShellLinkObject)itm.GetLink; lnk.Path = FolderRoot + "\\execute.bat"; lnk.Description = FolderName; lnk.Arguments = "\"" + FullFolderPath + "\""; lnk.WorkingDirectory = FolderDir; SHFILEINFO shinfo = new SHFILEINFO(); Win32.SHGetFileInfo(FullFolderPath, 0, ref shinfo, (uint)Marshal.SizeOf(shinfo), (int)0x1000); lnk.SetIconLocation(shinfo.szDisplayName, shinfo.iIcon); lnk.Save(lnkPath); }
private void applyWallpaperWin7(string path) { Shell32.Shell shell = new Shell32.ShellClass(); Shell32.Folder folder = shell.NameSpace(Path.GetDirectoryName(path)) as Shell32.Folder; Shell32.FolderItem folderItem = folder.ParseName(System.IO.Path.GetFileName(path)); Shell32.FolderItemVerbs vs = folderItem.Verbs(); bool wallpaperSet = false; for (int i = 0; i < vs.Count; i++) { Shell32.FolderItemVerb ib = vs.Item(i); if (ib.Name.Contains("&b") || ib.Name.Contains("&B")) { if (ib.Name.ToLower().Contains("background") || ib.Name.ToLower().Contains("背景")) { wallpaperSet = true; ib.DoIt(); } } } if (wallpaperSet == false) { applyWallpaperXP(path); } else { downloadAndApplyWallpaperSucceeded(); } }
private void OnClick_LoadFiles(object sender, RoutedEventArgs e) { string p = ZS_TXT_FolderPath.Text; if (!Directory.Exists(p)) { System.Windows.MessageBox.Show("目录不存在!"); return; } Shell32.ShellClass sh = new Shell32.ShellClass(); Shell32.Folder dir = sh.NameSpace(p); foreach (Shell32.FolderItem item in dir.Items()) { txtTest.Text += "\r\n" + dir.GetDetailsOf(item, 0); txtTest.Text += "\r\n" + dir.GetDetailsOf(item, 1); txtTest.Text += "\r\n" + dir.GetDetailsOf(item, 21); txtTest.Text += "\r\n" + dir.GetDetailsOf(item, 27); } //string[] files = Directory.GetFiles(ZS_TXT_FolderPath.Text); //foreach (string f in files) //{ // Shell32.FolderItem item = dir.ParseName(f); //} sh = null; }
private string GetFileInfo() { // TODO: Add exception-handling. What if file can't be found or is invalid? string dirname; string filename; string header; string data; string info = ""; Shell32.Shell shell = new Shell32.ShellClass(); dirname = Path.GetDirectoryName(trackPath); filename = Path.GetFileName(trackPath); Shell32.Folder folder = shell.NameSpace(dirname); Shell32.FolderItem folderitem = folder.ParseName(filename); info = filename; for (int i = 0; i <= 315; i++) { header = folder.GetDetailsOf(null, i); data = folder.GetDetailsOf(folderitem, i); if (!(String.IsNullOrEmpty(header)) && !(String.IsNullOrEmpty(data))) { info += $"{header}: {data}\r"; } } return(info); }
private static ProcessStartInfo LaunchShortcut(string shortcutPath) { Shell32.Shell shell = new Shell32.ShellClass(); Shell32.Folder folder = shell.NameSpace(Path.GetDirectoryName(shortcutPath)); bool runAs = IsMarkedRunAs(shortcutPath); string filenameOnly = System.IO.Path.GetFileName(shortcutPath); Shell32.FolderItem folderItem = folder.ParseName(filenameOnly); if (folderItem != null) { Shell32.ShellLinkObject link = (Shell32.ShellLinkObject)folderItem.GetLink; ProcessStartInfo info = new ProcessStartInfo(link.Path, link.Arguments) { WorkingDirectory = link.WorkingDirectory, }; if (runAs) { info.Verb = "runas"; } return(info); } return(null); }
private static ProcessStartInfo LaunchShortcut(string shortcutPath) { Shell32.Shell shell = new Shell32.ShellClass(); Shell32.Folder folder = shell.NameSpace(Path.GetDirectoryName(shortcutPath)); bool runAs = IsMarkedRunAs(shortcutPath); string filenameOnly = System.IO.Path.GetFileName(shortcutPath); Shell32.FolderItem folderItem = folder.ParseName(filenameOnly); if (folderItem != null) { Shell32.ShellLinkObject link = (Shell32.ShellLinkObject)folderItem.GetLink; ProcessStartInfo info = new ProcessStartInfo(link.Path, link.Arguments) { WorkingDirectory = link.WorkingDirectory, }; if (runAs) info.Verb = "runas"; return info; } return null; }
/// <summary> /// example: /// NetWork("无线网络连接","禁用") /// NetWork("无线网络连接","启用") /// </summary> /// <param name="netWorkName"></param> /// <param name="operation"></param> static void NetWork(string netWorkName, string operation) { Shell32.Shell shell = new Shell32.ShellClass(); Shell32.Folder folder = shell.NameSpace(49); foreach (Shell32.FolderItem fi in folder.Items()) { if (fi.Name != netWorkName) { continue; } Shell32.ShellFolderItem folderItem = (Shell32.ShellFolderItem)fi; foreach (Shell32.FolderItemVerb fiv in folderItem.Verbs()) { if (!fiv.Name.Contains(operation)) { continue; } else { fiv.DoIt(); Thread.Sleep(1000); break; } } } }
// File processing private void ShowInfo() { string dirname; string filename; string header; string data; Shell32.Shell shell = new Shell32.ShellClass(); dirname = Path.GetDirectoryName(trackPath); filename = Path.GetFileName(trackPath); Shell32.Folder folder = shell.NameSpace(dirname); Shell32.FolderItem folderitem = folder.ParseName(filename); infoBox.Text = dirname + "\n" + filename; for (int i = 0; i <= 315; i++) { header = folder.GetDetailsOf(null, i); data = folder.GetDetailsOf(folderitem, i); if (String.IsNullOrEmpty(header)) { header = "[Unknown header]"; } if (String.IsNullOrEmpty(data)) { data = "[No data]"; } infoBox.AppendText($"\n{i} {header} {data}"); } }
private void Setup_PreviewPane() { Dispatcher.BeginInvoke(DispatcherPriority.Background, (ThreadStart)(() => { if (SelectedItem != null) { if (!Browser.SelectedItems.Any()) { return; } if (this.SelectedItem.IsFolder) { return; } //http://www.codeproject.com/Articles/7987/Retrieve-detailed-information-of-a-File var sh = new Shell32.ShellClass(); Shell32.Folder dir = sh.NameSpace(System.IO.Path.GetDirectoryName(SelectedItem.ParsingName)); Shell32.FolderItem item = dir.ParseName(System.IO.Path.GetFileName(SelectedItem.ParsingName)); // loop through the Folder Items for (int i = 0; i < 30; i++) { // read the current detail Info from the FolderItem Object //(Retrieves details about an item in a folder. For example, its size, type, or the time of its last modification.) // some examples: // 0 Retrieves the name of the item. // 1 Retrieves the size of the item. // 2 Retrieves the type of the item. // 3 Retrieves the date and time that the item was last modified. // 4 Retrieves the attributes of the item. // -1 Retrieves the info tip information for the item. string colName = dir.GetDetailsOf(String.Empty, i); string value = dir.GetDetailsOf(item, i); // Create a helper Object for holding the current Information // an put it into a ArrayList } //this.SelectedItem.Thumbnail.CurrentSize = new System.Windows.Size(this.ActualHeight - 20, this.ActualHeight - 20); //this.SelectedItem.Thumbnail.FormatOption = BExplorer.Shell.Interop.ShellThumbnailFormatOption.Default; //this.SelectedItem.Thumbnail.RetrievalOption = BExplorer.Shell.Interop.ShellThumbnailRetrievalOption.Default; //icon.Source = this.SelectedItem.Thumbnail.BitmapSource; //txtDisplayName.Text = SelectedItem.DisplayName; //txtFileType.Text = "Extension: " + SelectedItem.Extension; //txtPath.Text = "Location : " + SelectedItem.FileSystemPath; //var OpenWirgList = SelectedItem.GetAssocList(); //if (OpenWirgList.Any()) { // txtOpenWith.Text = "Opens With: " + OpenWirgList.First().DisplayName; //} var File = new System.IO.FileInfo(Browser.SelectedItems[0].ParsingName); txtFileSize.Text = "Size: " + File.Length.ToString(); txtFileCreated.Text = "Created: " + File.CreationTime.ToLongDateString(); txtFileModified.Text = "Modified: " + File.LastWriteTime.ToLongDateString(); } })); }
/// <summary> /// 功能:解压zip格式的文件。 /// </summary> /// <param name="zipFilePath">压缩文件路径</param> /// <param name="unZipDir">解压文件存放路径,为空时默认与压缩文件同一级目录下,跟压缩文件同名的文件夹</param> /// <param name="err">出错信息</param> /// <returns>解压是否成功</returns> public bool UnZipFile(string zipFilePath, string unZipDir, out string err) { err = ""; if (zipFilePath.Length == 0) { err = "压缩文件不能为空!"; return(false); } else if (!zipFilePath.EndsWith(".zip")) { err = "文件格式不正确!"; return(false); } else if (!File.Exists(zipFilePath)) { err = "压缩文件不存在!"; return(false); } //解压文件夹为空时默认与压缩文件同一级目录下,跟压缩文件同名的文件夹 if (unZipDir.Length == 0) { unZipDir = zipFilePath.Replace(Path.GetFileName(zipFilePath), Path.GetFileNameWithoutExtension(zipFilePath)); } if (!unZipDir.EndsWith("\\")) { unZipDir += "\\"; } if (!Directory.Exists(unZipDir)) { Directory.CreateDirectory(unZipDir); } try { Shell32.ShellClass sc = new Shell32.ShellClass(); Shell32.Folder SrcFolder = sc.NameSpace(zipFilePath); Shell32.Folder DestFolder = sc.NameSpace(unZipDir); Shell32.FolderItems items = SrcFolder.Items(); DestFolder.CopyHere(items, 20); } catch (Exception ex) { err = ex.Message; return(false); } return(true); }//解压结束
/// <summary> /// Zip function calls Shell32, Interop.Shell32.dll is needed /// </summary> /// <param name="filesInFolder">Specify a folder containing the zip source files</param> /// <param name="zipFile">Specify the final zip file name, with ".zip" extension</param> public static void Compress(string filesInFolder, string zipFile) { if (filesInFolder == null || filesInFolder.Trim() == "") { return; } if (zipFile == null || zipFile.Trim() == "") { return; } if (!Directory.Exists(filesInFolder)) { return; } DirectoryEx.DeleteEmptyDirectory(filesInFolder); Shell32.ShellClass sh = new Shell32.ShellClass(); try { if (File.Exists(zipFile)) { File.Delete(zipFile); } //Create an empty zip file byte[] emptyzip = new byte[] { 80, 75, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; FileStream fs = File.Create(zipFile); fs.Write(emptyzip, 0, emptyzip.Length); fs.Flush(); fs.Close(); Shell32.Folder srcFolder = sh.NameSpace(filesInFolder); Shell32.Folder destFolder = sh.NameSpace(zipFile); Shell32.FolderItems items = srcFolder.Items(); destFolder.CopyHere(items, SHFILEOPSTRUCT.FOF_SILENT | SHFILEOPSTRUCT.FOF_NOCONFIRMATION); while (items.Count != destFolder.Items().Count) { Thread.Sleep(50); } } finally { System.Runtime.InteropServices.Marshal.FinalReleaseComObject(sh); } }
public static string ToZip(this DirectoryInfo d, string zipName = null, string zipExt = "zip", string basepath = null) { if (d == null) { throw new ArgumentNullException("Target Directory was null"); } if (zipName == null) { zipName = d.Name; } if (basepath == null) { basepath = Environment.CurrentDirectory; } /// Inbuilt ZIP functions don't give a Dynamics CRM readable archive, but System ZIP function does // https://www.codeproject.com/Articles/12064/Compress-Zip-files-with-Windows-Shell-API-and-C byte[] emptyzip = new byte[] { 80, 75, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; var path = Path.Combine(basepath, zipName + ".zip"); FileStream fs = File.Create(path); fs.Write(emptyzip, 0, emptyzip.Length); fs.Flush(); fs.Close(); fs = null; Shell32.ShellClass sc = new Shell32.ShellClass(); Shell32.Folder SrcFlder = sc.NameSpace(d.FullName); Shell32.Folder DestFlder = sc.NameSpace(path); Shell32.FolderItems items = SrcFlder.Items(); DestFlder.CopyHere(items, 20); // TODO: FIXME: stop waiting for explorer to finish zipping do { System.Threading.Thread.Sleep(260); } while (new FileInfo(path).Length < 2 * 1024); if (zipExt != "zip") { File.Copy(path, Path.Combine(basepath, zipName + zipExt)); File.Delete(path); } return(Path.Combine(basepath, zipName + zipExt)); }
/// <summary> /// Modifies a shortcut to point to a new path. /// </summary> /// <param name="ShortcutPath">Full path to shortcut.</param> /// <param name="NewPath">New path of shortcut.</param> public static void ModifyShortcut(string ShortcutPath, string NewPath) { Shell32.Shell Shl = new Shell32.ShellClass(); Shell32.Folder Folder = Shl.NameSpace(Path.GetFullPath(ShortcutPath)); Shell32.FolderItem Item = Folder.Items().Item(Path.GetFileName(ShortcutPath)); Shell32.ShellLinkObject Link = (Shell32.ShellLinkObject)Item.GetLink; Link.Path = NewPath; }
public void unzip() { listbox_info.Items.Add(" "); listbox_info.Items.Add("正在解压文件..."); try { Shell32.ShellClass sc = new Shell32.ShellClass(); Shell32.Folder SrcFolder = sc.NameSpace(filename); Shell32.Folder DestFolder = sc.NameSpace(Application.StartupPath + "\\"); Shell32.FolderItems items = SrcFolder.Items(); DestFolder.CopyHere(items, 20); listbox_info.Items.Add("解压完成..."); } catch (Exception) { listbox_info.Items.Add("解压失败..."); } }
/// <summary> /// Modifies a shortcut to point to a new path. /// </summary> /// <param name="ShortcutPath">Full path to shortcut.</param> /// <param name="NewPath">New path of shortcut.</param> public static void ModifyShortcut(string ShortcutPath, string NewPath) { Shell32.Shell Shl = new Shell32.ShellClass(); Shell32.Folder Folder = Shl.NameSpace(Path.GetFullPath(ShortcutPath)); Shell32.FolderItem Item = Folder.Items().Item(Path.GetFileName(ShortcutPath)); Shell32.ShellLinkObject Link = (Shell32.ShellLinkObject)Item.GetLink; Link.Path = NewPath; }
private void FolderExplorerTreeView_Initialized(object sender, EventArgs e) { Shell32.Shell shell32 = new Shell32.ShellClass(); Shell32.Folder folderDesktop = shell32.NameSpace(ShellFolder.Desktop); Shell32.Folder folderMyComputer = shell32.NameSpace(ShellFolder.MyComputer); // find my computer folder item Shell32.FolderItem folderItemMyComputer = null; foreach (Shell32.FolderItem fi in folderDesktop.Items()) { if (fi.Name == folderMyComputer.Title) { folderItemMyComputer = fi; break; } } if (folderItemMyComputer == null) { throw new ApplicationException("Error finding \"My Computer\" folder item."); } // add my computer TreeViewItem root = CreateTreeItem(folderItemMyComputer); Items.Add(root); // iterate through the "My Computer" namespace and populate the first level nodes foreach (Shell32.FolderItem item in folderMyComputer.Items()) { if (item.IsFileSystem) { TreeViewItem tvi = CreateTreeItem(item); tvi.Items.Add(dummyNode); tvi.Expanded += new RoutedEventHandler(folder_Expanded); tvi.PreviewMouseDown += new MouseButtonEventHandler(folder_PreviewMouseDown); root.Items.Add(tvi); } } // expand "My Computer" root.IsExpanded = true; }
private static IEnumerable <JumpListLink> ShortcutsToLinks(string folderName) { Shell32.Shell shell = new Shell32.ShellClass(); Shell32.Folder folder = shell.NameSpace(folderName); foreach (string filename in Directory.GetFiles(folderName, "*.lnk", SearchOption.TopDirectoryOnly).OrderBy(x => x, new StringLogicalComparer())) { string filenameOnly = System.IO.Path.GetFileName(filename); if (filenameOnly.StartsWith("-")) { continue; } bool runAs = Program.IsMarkedRunAs(filename); Shell32.FolderItem folderItem = folder.ParseName(filenameOnly); if (folderItem != null) { Shell32.ShellLinkObject link = (Shell32.ShellLinkObject)folderItem.GetLink; string iconPath; int iconId = link.GetIconLocation(out iconPath); if (String.IsNullOrEmpty(iconPath)) { iconPath = link.Path; iconId = 0; } JumpListLink jumpLink; if (runAs) { jumpLink = new JumpListLink(Application.ExecutablePath, GetDisplayName(filenameOnly)) { Arguments = BuildCommand("--launch", filename), WorkingDirectory = Directory.GetCurrentDirectory(), }; } else { jumpLink = new JumpListLink(link.Path, GetDisplayName(filenameOnly)) { Arguments = link.Arguments, WorkingDirectory = link.WorkingDirectory, ShowCommand = Enum.IsDefined(typeof(WindowShowCommand), link.ShowCommand) ? (WindowShowCommand)link.ShowCommand : WindowShowCommand.Default, }; } jumpLink.IconReference = new IconReference(iconPath, iconId); yield return(jumpLink); } } }
/// <summary> /// 功能:解压zip格式的文件。 /// </summary> /// <param name="zipFilePath">压缩文件路径</param> /// <param name="unZipDir">解压文件存放路径,为空时默认与压缩文件同一级目录下,跟压缩文件同名的文件夹</param> /// <param name="err">出错信息</param> /// <returns>解压是否成功</returns> public bool UnZipFile(string zipFilePath, string unZipDir, out string err) { err = ""; if (zipFilePath.Length == 0) { err = "压缩文件不能为空!"; return false; } else if (!zipFilePath.EndsWith(".zip")) { err = "文件格式不正确!"; return false; } else if (!File.Exists(zipFilePath)) { err = "压缩文件不存在!"; return false; } //解压文件夹为空时默认与压缩文件同一级目录下,跟压缩文件同名的文件夹 if (unZipDir.Length == 0) unZipDir = zipFilePath.Replace(Path.GetFileName(zipFilePath), Path.GetFileNameWithoutExtension(zipFilePath)); if (!unZipDir.EndsWith("\\")) unZipDir += "\\"; if (!Directory.Exists(unZipDir)) Directory.CreateDirectory(unZipDir); try { Shell32.ShellClass sc = new Shell32.ShellClass(); Shell32.Folder SrcFolder = sc.NameSpace(zipFilePath); Shell32.Folder DestFolder = sc.NameSpace(unZipDir); Shell32.FolderItems items = SrcFolder.Items(); DestFolder.CopyHere(items, 20); } catch (Exception ex) { err = ex.Message; return false; } return true; }
public static MP3File ReadID3Tags(string FileFullPath) { MP3File mp3File = new MP3File(); //parse file name string fileName = FileFullPath.Substring(FileFullPath.LastIndexOf("\\") + 1); //parse file path string filePath = FileFullPath.Substring(0, FileFullPath.LastIndexOf("\\")); //create shell instance Shell32.Shell shell = new Shell32.ShellClass(); //set the namespace to file path Shell32.Folder folder = shell.NameSpace(filePath); //get ahandle to the file Shell32.FolderItem folderItem = folder.ParseName(fileName); //did we get a handle ? if (folderItem != null) { mp3File.FileName = fileName.Trim(); //query information from shell regarding file mp3File.ArtistName = folder.GetDetailsOf(folderItem, 9).Trim(); mp3File.AlbumName = folder.GetDetailsOf(folderItem, 17).Trim(); mp3File.SongTitle = folder.GetDetailsOf(folderItem, 10).Trim(); mp3File.Genre = folder.GetDetailsOf(folderItem, 20).Trim(); mp3File.Time = folder.GetDetailsOf(folderItem, 21).Trim(); string[] tags = new string[25]; for (int i = 0; i < 25; i++) { try { tags[i] = folder.GetDetailsOf(folderItem, i); } catch { } } mp3File.FileFullPath = FileFullPath.Trim(); try { mp3File.TrackNumber = Int32.Parse(folder.GetDetailsOf(folderItem, 19)); } catch { } } //clean ip folderItem = null; folder = null; shell = null; //return mp3File instance return(mp3File); }
/// <summary> /// Uses Shell32 /// </summary> /// <param name="siteUrl"></param> /// <param name="filePathPattern">For example, to make a wildcard search ".doc" use the following /// reg expression: Regex regex = new Regex(@".*\.doc", RegexOptions.Compiled | RegexOptions.IgnoreCase); /// to exclude word template documents assigned to a SharePoint workspace, use the following reg /// expression: new Regex(@"(?<!.*/Forms/[^/]+)\.doc$", RegexOptions.Compiled | RegexOptions.IgnoreCase)</param> /// <returns></returns> public static StringCollection SearchFilesInWebFolder(Uri siteUrl, Regex filePathPattern, bool searchSubFolders) { string mapFolderPath = CreateWebFolderLink(siteUrl); StringCollection ret = new StringCollection(); Shell32.ShellClass shell = new Shell32.ShellClass(); Shell32.Folder mapFolder = shell.NameSpace(mapFolderPath); SearchInFolder(mapFolder, filePathPattern, searchSubFolders, ret); return(ret); }
private static void AddRootNode(TreeView tree, ref int imageCount, ImageList imageList, ShellFolder shellFolder, bool getIcons) { Shell32.Shell shell32 = new Shell32.ShellClass(); Shell32.Folder shell32Folder = shell32.NameSpace(shellFolder); Shell32.FolderItems items = shell32Folder.Items(); tree.Nodes.Clear(); TreeNode desktop = new TreeNode("Desktop", 0, 0); // Added in version 1.11 // add a FolderItem object to the root (Desktop) node tag that corresponds to the DesktopDirectory namespace // This ensures that the GetSelectedNodePath will return the actual Desktop folder path when queried. // There's possibly a better way to create a Shell32.FolderItem instance for this purpose, // but I surely don't know it Shell32.Folder dfolder = shell32.NameSpace(ShellFolder.DesktopDirectory); foreach (Shell32.FolderItem fi in dfolder.ParentFolder.Items()) { if (fi.Name == dfolder.Title) { desktop.Tag = fi; break; } } // Add the Desktop root node to the tree tree.Nodes.Add(desktop); // iterate through the Desktop namespace and populate the first level nodes foreach (Shell32.FolderItem item in items) { if (item.IsFolder) // this ensures that desktop shortcuts etc are not displayed { TreeNode tn = AddTreeNode(item, ref imageCount, imageList, getIcons); desktop.Nodes.Add(tn); CheckForSubDirs(tn, imageList); } } }
private static void ExtractFireBirdFiles(string zipFile) { string zipFileExtractionPath = Path.Combine(Application.StartupPath, Path.GetFileNameWithoutExtension(zipFile)); Utility.EnsureDirectory(zipFileExtractionPath); Shell32.ShellClass shellClass = new Shell32.ShellClass(); Shell32.Folder srcFolder = shellClass.NameSpace(zipFile); Shell32.Folder destFolder = shellClass.NameSpace(zipFileExtractionPath); destFolder.CopyHere(srcFolder.Items(), 16 | 256 | 512); File.Delete(zipFile); string destinationPath = Path.Combine(Application.StartupPath, "FirebirdSql.Data.FirebirdClient.dll"); File.Delete(destinationPath); File.Move(Path.Combine(zipFileExtractionPath, "FirebirdSql.Data.FirebirdClient.dll"), destinationPath); string basePath = Path.Combine(zipFileExtractionPath, "x86"); if (IntPtr.Size == 8) { basePath = Path.Combine(zipFileExtractionPath, "x64"); } string[] remainingFiles = new string[] { "fbembed.dll", "icudt30.dll", "icuin30.dll", "icuuc30.dll", "ib_util.dll", "firebird.conf", "firebird.msg" }; foreach (string file in remainingFiles) { string fileToMove = Path.Combine(basePath, file); destinationPath = Path.Combine(Application.StartupPath, file); File.Delete(destinationPath); File.Move(fileToMove, destinationPath); } Utility.DeleteDirectory(new DirectoryInfo(zipFileExtractionPath)); }
/// <summary> /// Returns whether the given path/file is a link /// </summary> /// <param name="shortcutFilename"></param> /// <returns></returns> public static bool IsLink(string shortcutFilename) { string pathOnly = System.IO.Path.GetDirectoryName(shortcutFilename); string filenameOnly = System.IO.Path.GetFileName(shortcutFilename); Shell32.Shell shell = new Shell32.ShellClass(); Shell32.Folder folder = shell.NameSpace(pathOnly); Shell32.FolderItem folderItem = folder.ParseName(filenameOnly); if (folderItem != null) { return(folderItem.IsLink); } return(false); // not found }
internal static string GetShortcutTargetFile(string shortcutFilename) { string pathOnly = System.IO.Path.GetDirectoryName(shortcutFilename); string filenameOnly = System.IO.Path.GetFileName(shortcutFilename); Shell32.Shell shell = new Shell32.ShellClass(); Shell32.Folder folder = shell.NameSpace(pathOnly); Shell32.FolderItem folderItem = folder.ParseName(filenameOnly); if (folderItem != null) { Shell32.ShellLinkObject link = (Shell32.ShellLinkObject)folderItem.GetLink; return(link.Path); } return(""); // not found }
private void ExpandTreeItem(TreeViewItem tvi) { Shell32.Shell shell32 = new Shell32.ShellClass(); // don't expand my computer if (((Shell32.FolderItem)tvi.Tag).Name == shell32.NameSpace(ShellFolder.MyComputer).Title) { return; } if (tvi.Items.Count == 1 && tvi.Items[0] == dummyNode) { tvi.Items.Clear(); Shell32.FolderItem folderItem = (Shell32.FolderItem)tvi.Tag; Shell32.Folder folder = (Shell32.Folder)folderItem.GetFolder; String[] strFolders = Directory.GetDirectories(folderItem.Path); foreach (String s in strFolders) { Shell32.Shell shell = new Shell32.ShellClass(); Shell32.Folder folderTemp = shell.NameSpace(folderItem.Path); Shell32.FolderItem folderItemTemp = (Shell32.FolderItem)folderTemp.ParseName(s.Substring(s.LastIndexOf('\\') + 1)); if (folderItemTemp == null) { // Folder is inaccessible. continue; } TreeViewItem newItem = CreateTreeItem(folderItemTemp); newItem.Items.Add(dummyNode); newItem.Expanded += new RoutedEventHandler(folder_Expanded); newItem.Collapsed += new RoutedEventHandler(folder_Collapsed); newItem.PreviewMouseDown += new MouseButtonEventHandler(folder_PreviewMouseDown); tvi.Items.Add(newItem); } if (tvi.Items.Count > 0) { // change to opened icon ChangeIcon(tvi, true); } } }
//actually read the meta data and fill in the appropriate strings. public void ReadMetaData(String fullFilePath) { Shell32.Shell shell = new Shell32.ShellClass(); Shell32.Folder folder = shell.NameSpace(Path.GetDirectoryName(fullFilePath)); Shell32.FolderItem folderItem = folder.ParseName(Path.GetFileName(fullFilePath)); if (folderItem != null) { FileName = Path.GetFileName(fullFilePath); AlbumName = folder.GetDetailsOf(folderItem, (int)FileInfo.Album); ArtistName = folder.GetDetailsOf(folderItem, (int)FileInfo.Artists); Title = folder.GetDetailsOf(folderItem, (int)FileInfo.Title); FrameRate = folder.GetDetailsOf(folderItem, (int)FileInfo.Frame_rate); } folderItem = null; folder = null; shell = null; }
/** * resolve shortcut file (.lnk), return corresponding weblink resource */ private IResource ProcessShortcut(FileInfo fileInfo, IResource parent) { Shell32.Shell shell = new Shell32.ShellClass(); if (shell != null) { Shell32.Folder folder = shell.NameSpace(fileInfo.DirectoryName); if (folder != null) { Shell32.FolderItem item = folder.ParseName(fileInfo.Name); if (item != null && item.IsLink) { Shell32.IShellLinkDual2 link = (Shell32.IShellLinkDual2)item.GetLink; if (link != null && File.Exists(link.Path)) { return(CreateFavoriteResource("file:///" + link.Path, fileInfo, parent)); } } } } return(null); }
private void CreateShortcut(object sender, RoutedEventArgs e) { var desktopFolder = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); var lnkName = "FL Studio (skinned)"; string lnkPath = System.IO.Path.Combine(desktopFolder, lnkName) + ".lnk"; System.IO.File.WriteAllBytes(lnkPath, new byte[] { }); Shell32.Shell shl = new Shell32.ShellClass(); Shell32.Folder dir = shl.NameSpace(desktopFolder); Shell32.FolderItem itm = dir.Items().Item(lnkName + ".lnk"); Shell32.ShellLinkObject lnk = (Shell32.ShellLinkObject)itm.GetLink; lnk.Path = System.Reflection.Assembly.GetExecutingAssembly().Location; lnk.Arguments = "-nogui"; lnk.WorkingDirectory = System.IO.Path.GetDirectoryName(lnk.Path); lnk.SetIconLocation(string.Format(@"{0}\FL64.exe", Config.current.flStudioPath), 0); lnk.Save(lnkPath); }
private static void AddRootNode( TreeView tree, ref int imageCount, ImageList imageList, ShellFolder shellFolder, bool getIcons ) { Shell32.Shell shell32 = new Shell32.ShellClass(); Shell32.Folder shell32Folder = shell32.NameSpace( shellFolder ); Shell32.FolderItems items = shell32Folder.Items(); tree.Nodes.Clear(); TreeNode desktop = new TreeNode( "Desktop", 0, 0 ); // Added in version 1.11 // add a FolderItem object to the root (Desktop) node tag that corresponds to the DesktopDirectory namespace // This ensures that the GetSelectedNodePath will return the actual Desktop folder path when queried. // There's possibly a better way to create a Shell32.FolderItem instance for this purpose, // but I surely don't know it Shell32.Folder dfolder = shell32.NameSpace( ShellFolder.DesktopDirectory ); foreach( Shell32.FolderItem fi in dfolder.ParentFolder.Items() ) { if( fi.Name == dfolder.Title ) { desktop.Tag = fi; break; } } // Add the Desktop root node to the tree tree.Nodes.Add( desktop ); // [xiperware] Get FolderItem that represents Recycle Bin Shell32.Folder recFolder = shell32.NameSpace( ShellFolder.RecycleBin ); Shell32.FolderItem recycle = null; foreach( Shell32.FolderItem fi in recFolder.ParentFolder.Items() ) { if( fi.Name == recFolder.Title ) { recycle = fi; break; } } // [xiperware] Get FolderItem that represents My Network Places Shell32.Folder netFolder = shell32.NameSpace( ShellFolder.NetworkNeighborhood ); Shell32.FolderItem mynetwork = null; foreach( Shell32.FolderItem fi in netFolder.ParentFolder.Items() ) { if( fi.Name == netFolder.Title ) { mynetwork = fi; break; } } // iterate through the Desktop namespace and populate the first level nodes foreach( Shell32.FolderItem item in items ) { if( !item.IsFolder ) continue; // this ensures that desktop shortcuts etc are not displayed if( item.IsBrowsable ) continue; // [xiperware] exclude zip files if( recycle != null && item.Path == recycle.Path ) continue; // [xiperware] skip recycle bin TreeNode tn = AddTreeNode( item, ref imageCount, imageList, getIcons ); desktop.Nodes.Add( tn ); if( mynetwork != null && item.Path == mynetwork.Path ) // [xiperware] skip my network places subdirs { tree.Tag = tn; // store node in tag continue; } CheckForSubDirs( tn, imageList ); } }
private static void ExtractFireBirdFiles(string zipFile) { string zipFileExtractionPath = Path.Combine(Application.StartupPath, Path.GetFileNameWithoutExtension(zipFile)); Utility.EnsureDirectory(zipFileExtractionPath); Shell32.ShellClass shellClass = new Shell32.ShellClass(); Shell32.Folder srcFolder = shellClass.NameSpace(zipFile); Shell32.Folder destFolder = shellClass.NameSpace(zipFileExtractionPath); destFolder.CopyHere(srcFolder.Items(), 16 | 256 | 512); File.Delete(zipFile); string destinationPath = Path.Combine(Application.StartupPath, "FirebirdSql.Data.FirebirdClient.dll"); File.Delete(destinationPath); File.Move(Path.Combine(zipFileExtractionPath, "FirebirdSql.Data.FirebirdClient.dll"), destinationPath); string basePath = Path.Combine(zipFileExtractionPath, "x86"); if (IntPtr.Size == 8) { basePath = Path.Combine(zipFileExtractionPath, "x64"); } string[] remainingFiles = new string[] { "fbembed.dll", "icudt30.dll", "icuin30.dll", "icuuc30.dll", "ib_util.dll", "firebird.conf", "firebird.msg" }; foreach (string file in remainingFiles) { string fileToMove = Path.Combine(basePath, file); destinationPath = Path.Combine(Application.StartupPath, file); File.Delete(destinationPath); File.Move(fileToMove, destinationPath); } Utility.DeleteDirectory(new DirectoryInfo(zipFileExtractionPath)); }
private void ExpandTreeItem(TreeViewItem tvi) { Shell32.Shell shell32 = new Shell32.ShellClass(); // don't expand my computer if (((Shell32.FolderItem)tvi.Tag).Name == shell32.NameSpace(ShellFolder.MyComputer).Title) { return; } if (tvi.Items.Count == 1 && tvi.Items[0] == dummyNode) { tvi.Items.Clear(); Shell32.FolderItem folderItem = (Shell32.FolderItem)tvi.Tag; Shell32.Folder folder = (Shell32.Folder)folderItem.GetFolder; String[] strFolders = Directory.GetDirectories(folderItem.Path); foreach (String s in strFolders) { Shell32.Shell shell = new Shell32.ShellClass(); Shell32.Folder folderTemp = shell.NameSpace(folderItem.Path); Shell32.FolderItem folderItemTemp = (Shell32.FolderItem)folderTemp.ParseName(s.Substring(s.LastIndexOf('\\') + 1)); if (folderItemTemp == null) { // Folder is inaccessible. continue; } TreeViewItem newItem = CreateTreeItem(folderItemTemp); newItem.Items.Add(dummyNode); newItem.Expanded += new RoutedEventHandler(folder_Expanded); newItem.Collapsed += new RoutedEventHandler(folder_Collapsed); newItem.PreviewMouseDown += new MouseButtonEventHandler(folder_PreviewMouseDown); tvi.Items.Add(newItem); } if (tvi.Items.Count > 0) { // change to opened icon ChangeIcon(tvi, true); } } }
static void UnzipUpdateTo(string targerFolder) { try { Shell32.ShellClass sc = new Shell32.ShellClass(); Shell32.Folder SrcFolder = sc.NameSpace(System.IO.Path.Combine(Application.StartupPath,"Update.zip")); Shell32.Folder DestFolder = sc.NameSpace(targerFolder); Shell32.FolderItems items = SrcFolder.Items(); DestFolder.CopyHere(items, 20); } catch { return; } }
private void FolderExplorerTreeView_Initialized(object sender, EventArgs e) { Shell32.Shell shell32 = new Shell32.ShellClass(); Shell32.Folder folderDesktop = shell32.NameSpace(ShellFolder.Desktop); Shell32.Folder folderMyComputer = shell32.NameSpace(ShellFolder.MyComputer); // find my computer folder item Shell32.FolderItem folderItemMyComputer = null; foreach (Shell32.FolderItem fi in folderDesktop.Items()) { if (fi.Name == folderMyComputer.Title) { folderItemMyComputer = fi; break; } } if (folderItemMyComputer == null) { throw new ApplicationException("Error finding \"My Computer\" folder item."); } // add my computer TreeViewItem root = CreateTreeItem(folderItemMyComputer); Items.Add(root); // iterate through the "My Computer" namespace and populate the first level nodes foreach (Shell32.FolderItem item in folderMyComputer.Items()) { if (item.IsFileSystem) { TreeViewItem tvi = CreateTreeItem(item); tvi.Items.Add(dummyNode); tvi.Expanded += new RoutedEventHandler(folder_Expanded); tvi.PreviewMouseDown += new MouseButtonEventHandler(folder_PreviewMouseDown); root.Items.Add(tvi); } } // expand "My Computer" root.IsExpanded = true; }
private static IEnumerable<JumpListLink> ShortcutsToLinks(string folderName) { Shell32.Shell shell = new Shell32.ShellClass(); Shell32.Folder folder = shell.NameSpace(folderName); foreach (string filename in Directory.GetFiles(folderName, "*.lnk", SearchOption.TopDirectoryOnly).OrderBy(x => x, new StringLogicalComparer())) { string filenameOnly = System.IO.Path.GetFileName(filename); if (filenameOnly.StartsWith("-")) continue; bool runAs = Program.IsMarkedRunAs(filename); Shell32.FolderItem folderItem = folder.ParseName(filenameOnly); if (folderItem != null) { Shell32.ShellLinkObject link = (Shell32.ShellLinkObject)folderItem.GetLink; string iconPath; int iconId = link.GetIconLocation(out iconPath); if (String.IsNullOrEmpty(iconPath)) { iconPath = link.Path; iconId = 0; } JumpListLink jumpLink; if (runAs) { jumpLink = new JumpListLink(Application.ExecutablePath, GetDisplayName(filenameOnly)) { Arguments = BuildCommand("--launch", filename), WorkingDirectory = Directory.GetCurrentDirectory(), }; } else { jumpLink = new JumpListLink(link.Path, GetDisplayName(filenameOnly)) { Arguments = link.Arguments, WorkingDirectory = link.WorkingDirectory, ShowCommand = Enum.IsDefined(typeof(WindowShowCommand), link.ShowCommand) ? (WindowShowCommand)link.ShowCommand : WindowShowCommand.Default, }; } jumpLink.IconReference = new IconReference(iconPath, iconId); yield return jumpLink; } } }
private static void AddRootNode(TreeView tree, ref int imageCount, ImageList imageList, ShellFolder shellFolder, bool getIcons) { Shell32.Shell shell32 = new Shell32.ShellClass(); Shell32.Folder shell32Folder = shell32.NameSpace(shellFolder); Shell32.FolderItems items = shell32Folder.Items(); tree.Nodes.Clear(); TreeNode desktop = new TreeNode("Desktop", 0, 0); // Added in version 1.11 // add a FolderItem object to the root (Desktop) node tag that corresponds to the DesktopDirectory namespace // This ensures that the GetSelectedNodePath will return the actual Desktop folder path when queried. // There's possibly a better way to create a Shell32.FolderItem instance for this purpose, // but I surely don't know it Shell32.Folder dfolder = shell32.NameSpace(ShellFolder.DesktopDirectory); foreach(Shell32.FolderItem fi in dfolder.ParentFolder.Items()) { if(fi.Name == dfolder.Title) { desktop.Tag = fi; break; } } // Add the Desktop root node to the tree tree.Nodes.Add(desktop); // iterate through the Desktop namespace and populate the first level nodes foreach(Shell32.FolderItem item in items) { if(item.IsFolder) // this ensures that desktop shortcuts etc are not displayed { TreeNode tn = AddTreeNode(item, ref imageCount, imageList, getIcons); desktop.Nodes.Add(tn); CheckForSubDirs(tn, imageList); } } }
public static string GetShortcutTargetFile(string shortcutFilename) { string pathOnly = Path.GetDirectoryName(shortcutFilename); string filenameOnly = Path.GetFileName(shortcutFilename); Shell32.Shell shell = new Shell32.ShellClass(); Shell32.Folder folder = shell.NameSpace(pathOnly); Shell32.FolderItem folderItem = folder.ParseName(filenameOnly); if (folderItem != null) { Shell32.ShellLinkObject link = (Shell32.ShellLinkObject)folderItem.GetLink; return link.Path; } return string.Empty; // Not found }
static void Main(string[] args) { System.Console.WriteLine("The program has started."); if (args.Length == 3) { url = args[0]; username = args[1]; password = args[2]; } else if (debug == false) { url = "http://www.stuntyleeg.com/"; username = "******"; password = "******"; uploadzip uploadZip1 = new uploadzip(); uploadZip1.Filename = "C:\\Documents and Settings\\username\\My Documents\\BloodBowl\\Match_2010-07-13_20-12-45.zip"; uploadZip1.Password = password; uploadZip1.Url = url; uploadZip1.Username = username; uploadZip1.Page = page; uploadZip1.start(); Console.ReadKey(true); Environment.Exit(1); } else { System.Console.WriteLine("This program accepts 3 arguments: url, username, and password."); System.Console.WriteLine("Please use the following example and follow it as closely as possible."); System.Console.WriteLine("OBBLMCyUploader.exe http://www.example.com/ \"user name\" \"this ismy_password\""); Console.WriteLine("Press any key to continue..."); Console.ReadKey(true); Environment.Exit(1); } string mydocs = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); string bbdir = (Directory.Exists(mydocs + "\\BloodBowlLegendary\\")) ? mydocs + "\\BloodBowlLegendary\\" : mydocs + "\\BloodBowl\\"; string matchreport = bbdir; string replay = bbdir + "Saves\\Replays\\"; string zipfile = bbdir; FileSystemWatcher sw_replay = new FileSystemWatcher(); Console.WriteLine("The replay folder is being monitored."); sw_replay.Path = replay; sw_replay.Filter = "Replay_*.db"; sw_replay.Created += new FileSystemEventHandler(OnChanged); sw_replay.EnableRaisingEvents = true; while (newfile == null) { } sw_replay.EnableRaisingEvents = false; replay = newfile.FullPath; zipfile += "Match_" + newfile.Name.Substring(7,newfile.Name.Length-7-3)+".zip";//-7 for Replay_ and -3 for .db //Replay_2010-07-03_17-47-21.db newfile = null; FileSystemWatcher sw_matchreport = new FileSystemWatcher(); System.Console.WriteLine("The match report folder is being monitored."); sw_matchreport.Path = matchreport; sw_matchreport.Filter = "MatchReport.sqlite"; sw_matchreport.Changed += new FileSystemEventHandler(OnChanged); sw_matchreport.EnableRaisingEvents = true; while (newfile == null) { } sw_matchreport.EnableRaisingEvents = false; matchreport += "MatchReport.sqlite"; Shell32.ShellClass sc = new Shell32.ShellClass(); if (createzip(zipfile)) { Shell32.Folder DestFlder = sc.NameSpace(zipfile); DestFlder.CopyHere(matchreport); checkStatus(1, DestFlder); DestFlder.CopyHere(replay); checkStatus(2, DestFlder); } uploadzip uploadZip = new uploadzip(); uploadZip.Filename = zipfile; uploadZip.Password = password; uploadZip.Url = url; uploadZip.Page = page; uploadZip.Username = username; uploadZip.start(); Console.WriteLine("The program has finished."); Console.WriteLine("Press any key to continue..."); Console.ReadKey(true); }
//Program does nothing. Just a compile test private void UnZipFiles(string zipFilePath, string unzipFilePath) { Shell32.ShellClass shApp = new Shell32.ShellClass(); Shell32.Folder3 destFolder = (Shell32.Folder3)shApp.NameSpace(unzipFilePath); Shell32.FolderItems3 zippedItems = (Shell32.FolderItems3)shApp.NameSpace(zipFilePath).Items(); destFolder.CopyHere(zippedItems, 0); }