static public void MinimizeAll() { Shell32 shell = null; IShellDispatch shellDispatch = null; try { shell = new Shell32(); shellDispatch = (IShellDispatch)shell; shellDispatch.MinimizeAll(); } finally { Release(shellDispatch); Release(shell); } }
public static void Unzip(string inputZipFilename, string outputFolderName) { if (!File.Exists(inputZipFilename)) { throw new InvalidOperationException("Source Zip File '" + inputZipFilename + "' does not exist."); } if (Directory.Exists(outputFolderName)) { Directory.Delete(outputFolderName, true); } Directory.CreateDirectory(outputFolderName); //ShellClass sc = new ShellClass(); IShellDispatch sc = createShellClass(); Folder input = sc.NameSpace(inputZipFilename); Folder output = sc.NameSpace(outputFolderName); FolderItems items = input.Items(); output.CopyHere(items, 20); }
public static void Zip(string inputFolderName, string outputZipFileName) { if (!Directory.Exists(inputFolderName)) { throw new InvalidOperationException("Source Folder '" + inputFolderName + "' does not exist."); } if (File.Exists(outputZipFileName)) { File.Delete(outputZipFileName); } initZipFile(outputZipFileName); //Copy a folder and its contents into the newly created zip file IShellDispatch sc = createShellClass(); Folder input = sc.NameSpace(inputFolderName); Folder output = sc.NameSpace(outputZipFileName); FolderItems items = input.Items(); output.CopyHere(items, 20); }
public void Dispose() { try { if (shellDispatch != null) Marshal.ReleaseComObject(shellDispatch); if (shell != null) Marshal.ReleaseComObject(shell); } finally { shell = null; shellDispatch = null; GC.SuppressFinalize(this); } }
public Shell() { shell = new Shell32(); shellDispatch = (IShellDispatch)shell; }