-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
92 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ packages/ | |
custom.targets | ||
obj/ | ||
Install/ | ||
OpenContent/OpenContent920.csproj.user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
using DotNetNuke.Common.Utilities; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.Web; | ||
|
||
namespace Satrabel.OpenContent.Components | ||
{ | ||
public class ZipUtils | ||
{ | ||
private Type ZipInputStreamType; | ||
private Type ZipOutputStreamType; | ||
public ZipUtils() | ||
{ | ||
ZipInputStreamType = Type.GetType("ICSharpCode.SharpZipLib.Zip.ZipInputStream, ICSharpCode.SharpZipLib"); | ||
if (ZipInputStreamType == null) | ||
{ | ||
ZipInputStreamType = Type.GetType("ICSharpCode.SharpZipLib.Zip.ZipInputStream, SharpZipLib"); | ||
} | ||
ZipOutputStreamType = Type.GetType("ICSharpCode.SharpZipLib.Zip.ZipInputStream, ICSharpCode.SharpZipLib"); | ||
if (ZipOutputStreamType == null) | ||
{ | ||
ZipOutputStreamType = Type.GetType("ICSharpCode.SharpZipLib.Zip.ZipOutputStream, SharpZipLib"); | ||
} | ||
} | ||
|
||
public void ZipFiles(int CompressionLevel, FileStream strmZipFile, string[] files) | ||
{ | ||
//ICSharpCode.SharpZipLib.Zip.ZipOutputStream strmZipStream = null; | ||
object strmZipStream = null; | ||
try | ||
{ | ||
//strmZipStream = new ZipOutputStream(strmZipFile); | ||
strmZipStream = ZipOutputStreamType.InvokeMember("", BindingFlags.CreateInstance, null, null, new object[] { strmZipFile }, null); | ||
//strmZipStream.SetLevel(CompressionLevel); | ||
ZipOutputStreamType.InvokeMember("SetLevel", BindingFlags.InvokeMethod, null, strmZipStream, new object[] { CompressionLevel }); | ||
foreach (var item in files) | ||
{ | ||
//FileSystemUtils.AddToZip(ref strmZipStream, Path.GetFullPath(item), Path.GetFileName(item), ""); | ||
typeof(FileSystemUtils).InvokeMember("AddToZip", BindingFlags.InvokeMethod, null, null, new object[] { strmZipStream, Path.GetFullPath(item), Path.GetFileName(item), "" }); | ||
} | ||
} | ||
finally | ||
{ | ||
if (strmZipStream != null) | ||
{ | ||
//strmZipStream.Finish(); | ||
ZipOutputStreamType.InvokeMember("Finish", BindingFlags.InvokeMethod, null, strmZipStream, null); | ||
//strmZipStream.Close(); | ||
ZipOutputStreamType.InvokeMember("Close", BindingFlags.InvokeMethod, null, strmZipStream, null); | ||
} | ||
} | ||
} | ||
|
||
public void UnzipFiles(Stream stream, string PhysicalPath) | ||
{ | ||
//ICSharpCode.SharpZipLib.Zip.ZipOutputStream strmZipStream = null; | ||
object strmZipStream = null; | ||
strmZipStream = ZipInputStreamType.InvokeMember("", BindingFlags.CreateInstance, null, null, new object[] { stream }, null); | ||
//FileSystemUtils.UnzipResources(new ZipInputStream(fuFile.FileContent), folder.PhysicalPath); | ||
typeof(FileSystemUtils).InvokeMember("UnzipResources", BindingFlags.InvokeMethod, null, null, new object[] { strmZipStream, PhysicalPath }); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
"%programfiles(x86)%\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe" OpenContent\OpenContent92.csproj /p:Configuration=Debug,Platform=AnyCPU,SolutionDir=Solution,ReferencePath="ref;ref\dnn920" /t:Rebuild >build-local-dnn920.log | ||
pause |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.