Free cookie consent management tool by TermsFeed Policy Generator

source: stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ComHelper.cs @ 12707

Last change on this file since 12707 was 12074, checked in by sraggl, 10 years ago

#2341: Added EPPlus-4.0.3 to ExtLibs

File size: 4.2 KB
Line 
1// ComHelper.cs
2// ------------------------------------------------------------------
3//
4// Copyright (c) 2009 Dino Chiesa.
5// All rights reserved.
6//
7// This code module is part of DotNetZip, a zipfile class library.
8//
9// ------------------------------------------------------------------
10//
11// This code is licensed under the Microsoft Public License.
12// See the file License.txt for the license details.
13// More info on: http://dotnetzip.codeplex.com
14//
15// ------------------------------------------------------------------
16//
17// last saved (in emacs):
18// Time-stamp: <2011-June-13 17:04:06>
19//
20// ------------------------------------------------------------------
21//
22// This module defines a COM Helper class.
23//
24// Created: Tue, 08 Sep 2009  22:03
25//
26
27using Interop=System.Runtime.InteropServices;
28
29namespace OfficeOpenXml.Packaging.Ionic.Zip
30{
31    /// <summary>
32    /// This class exposes a set of COM-accessible wrappers for static
33    /// methods available on the ZipFile class.  You don't need this
34    /// class unless you are using DotNetZip from a COM environment.
35    /// </summary>
36    [System.Runtime.InteropServices.GuidAttribute("ebc25cf6-9120-4283-b972-0e5520d0000F")]
37    [System.Runtime.InteropServices.ComVisible(true)]
38#if !NETCF
39    [System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
40#endif
41
42    internal class ComHelper
43    {
44        /// <summary>
45        ///  A wrapper for <see cref="ZipFile.IsZipFile(string)">ZipFile.IsZipFile(string)</see>
46        /// </summary>
47        /// <param name="filename">The filename to of the zip file to check.</param>
48        /// <returns>true if the file contains a valid zip file.</returns>
49        public bool IsZipFile(string filename)
50        {
51            return ZipFile.IsZipFile(filename);
52        }
53
54        /// <summary>
55        ///  A wrapper for <see cref="ZipFile.IsZipFile(string, bool)">ZipFile.IsZipFile(string, bool)</see>
56        /// </summary>
57        /// <remarks>
58        /// We cannot use "overloaded" Method names in COM interop.
59        /// So, here, we use a unique name.
60        /// </remarks>
61        /// <param name="filename">The filename to of the zip file to check.</param>
62        /// <returns>true if the file contains a valid zip file.</returns>
63        public bool IsZipFileWithExtract(string filename)
64        {
65            return ZipFile.IsZipFile(filename, true);
66        }
67
68#if !NETCF
69        /// <summary>
70        ///  A wrapper for <see cref="ZipFile.CheckZip(string)">ZipFile.CheckZip(string)</see>
71        /// </summary>
72        /// <param name="filename">The filename to of the zip file to check.</param>
73        ///
74        /// <returns>true if the named zip file checks OK. Otherwise, false. </returns>
75        public bool CheckZip(string filename)
76        {
77            return ZipFile.CheckZip(filename);
78        }
79
80        /// <summary>
81        ///  A COM-friendly wrapper for the static method <see cref="ZipFile.CheckZipPassword(string,string)"/>.
82        /// </summary>
83        ///
84        /// <param name="filename">The filename to of the zip file to check.</param>
85        ///
86        /// <param name="password">The password to check.</param>
87        ///
88        /// <returns>true if the named zip file checks OK. Otherwise, false. </returns>
89        public bool CheckZipPassword(string filename, string password)
90        {
91            return ZipFile.CheckZipPassword(filename, password);
92        }
93
94        /// <summary>
95        ///  A wrapper for <see cref="ZipFile.FixZipDirectory(string)">ZipFile.FixZipDirectory(string)</see>
96        /// </summary>
97        /// <param name="filename">The filename to of the zip file to fix.</param>
98        public void FixZipDirectory(string filename)
99        {
100            ZipFile.FixZipDirectory(filename);
101        }
102#endif
103
104        /// <summary>
105        ///  A wrapper for <see cref="ZipFile.LibraryVersion">ZipFile.LibraryVersion</see>
106        /// </summary>
107        /// <returns>
108        ///  the version number on the DotNetZip assembly, formatted as a string.
109        /// </returns>
110        public string GetZipLibraryVersion()
111        {
112            return ZipFile.LibraryVersion.ToString();
113        }
114
115    }
116}
Note: See TracBrowser for help on using the repository browser.