コード例 #1
0
ファイル: Shell.cs プロジェクト: out3lunch/DeskDrive
        static public void MinimizeAll()
        {
            Shell32        shell         = null;
            IShellDispatch shellDispatch = null;

            try
            {
                shell         = new Shell32();
                shellDispatch = (IShellDispatch)shell;
                shellDispatch.MinimizeAll();
            }

            finally
            {
                Release(shellDispatch);
                Release(shell);
            }
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
            public void Dispose()
            {
                try
                {
                    if (shellDispatch != null)
                        Marshal.ReleaseComObject(shellDispatch);

                    if (shell != null)
                        Marshal.ReleaseComObject(shell);
                }

                finally
                {
                    shell = null;
                    shellDispatch = null;
                    GC.SuppressFinalize(this);
                }
            }
コード例 #5
0
 public Shell()
 {
     shell = new Shell32();
     shellDispatch = (IShellDispatch)shell;
 }