diff --git a/.gitignore b/.gitignore
index b96bc16f..9e3dcf0e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,4 @@ packages/
custom.targets
obj/
Install/
+OpenContent/OpenContent920.csproj.user
diff --git a/OpenContent/Components/Utils/OpenContentUtils.cs b/OpenContent/Components/Utils/OpenContentUtils.cs
index 12af520c..2ad3c003 100644
--- a/OpenContent/Components/Utils/OpenContentUtils.cs
+++ b/OpenContent/Components/Utils/OpenContentUtils.cs
@@ -3,7 +3,7 @@
using DotNetNuke.Entities.Modules;
using DotNetNuke.Entities.Portals;
using DotNetNuke.Services.FileSystem;
-using ICSharpCode.SharpZipLib.Zip;
+//using ICSharpCode.SharpZipLib.Zip;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@@ -386,8 +386,12 @@ public static string ImportFromWeb(int portalId, string fileName, string newTemp
folder = FolderManager.Instance.AddFolder(portalId, folderName);
var req = (HttpWebRequest)WebRequest.Create(fileName);
Stream stream = req.GetResponse().GetResponseStream();
+ //var file = FileManager.Instance.AddFile(folder, fileName, stream, true);
+ //FileManager.Instance.UnzipFile(file);
- FileSystemUtils.UnzipResources(new ZipInputStream(stream), folder.PhysicalPath);
+ //FileSystemUtils.UnzipResources(new ZipInputStream(stream), folder.PhysicalPath);
+ var zip = new ZipUtils();
+ zip.UnzipFiles(stream, folder.PhysicalPath);
return GetDefaultTemplate(folder.PhysicalPath);
}
}
diff --git a/OpenContent/Components/Utils/ZipUtils.cs b/OpenContent/Components/Utils/ZipUtils.cs
new file mode 100644
index 00000000..6d456497
--- /dev/null
+++ b/OpenContent/Components/Utils/ZipUtils.cs
@@ -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 });
+ }
+ }
+}
\ No newline at end of file
diff --git a/OpenContent/OpenContent.csproj b/OpenContent/OpenContent.csproj
index 8ff6d1dd..9dcfb75d 100644
--- a/OpenContent/OpenContent.csproj
+++ b/OpenContent/OpenContent.csproj
@@ -117,11 +117,6 @@
..\ref\dnn732\Newtonsoft.Json.dll
False
-
- False
- ..\ref\dnn732\SharpZipLib.dll
- False
-
@@ -370,6 +365,7 @@
+
EditNotifications.ascx
ASPXCodeBehind
diff --git a/OpenContent/OpenContent.dnn b/OpenContent/OpenContent.dnn
index 26fa0882..22175930 100644
--- a/OpenContent/OpenContent.dnn
+++ b/OpenContent/OpenContent.dnn
@@ -1,6 +1,6 @@
-
+
OpenContent
OpenContent module by Satrabel.be
~/DesktopModules/OpenContent/Images/icon_extensions.png
diff --git a/OpenContent/ShareTemplate.ascx.cs b/OpenContent/ShareTemplate.ascx.cs
index 59be29fb..cc968ea9 100644
--- a/OpenContent/ShareTemplate.ascx.cs
+++ b/OpenContent/ShareTemplate.ascx.cs
@@ -18,7 +18,7 @@
using DotNetNuke.Services.FileSystem;
using DotNetNuke.Entities.Host;
using DotNetNuke.Common.Utilities;
-using ICSharpCode.SharpZipLib.Zip;
+//using ICSharpCode.SharpZipLib.Zip;
using System.Web;
using Satrabel.OpenContent.Components.Localization;
using Satrabel.OpenContent.Components.Rss;
@@ -130,7 +130,9 @@ protected void cmdImport_Click(object sender, EventArgs e)
{
folder = FolderManager.Instance.AddFolder(PortalId, FolderName);
}
- FileSystemUtils.UnzipResources(new ZipInputStream(fuFile.FileContent), folder.PhysicalPath);
+ //FileSystemUtils.UnzipResources(new ZipInputStream(fuFile.FileContent), folder.PhysicalPath);
+ var zip = new ZipUtils();
+ zip.UnzipFiles(fuFile.FileContent, folder.PhysicalPath);
}
}
catch (PermissionsNotMetException)
@@ -238,11 +240,15 @@ private void CreateZipFile(string zipFileName, string Folder)
int CompressionLevel = 9;
var zipFile = new System.IO.FileInfo(zipFileName);
FileStream strmZipFile = null;
+
//Log.StartJob(Util.WRITER_CreatingPackage);
try
{
//Log.AddInfo(string.Format(Util.WRITER_CreateArchive, ZipFileShortName));
strmZipFile = File.Create(zipFileName);
+ var zip = new ZipUtils();
+ zip.ZipFiles(CompressionLevel, strmZipFile, Directory.GetFiles(Folder));
+ /*
ZipOutputStream strmZipStream = null;
try
{
@@ -267,6 +273,8 @@ private void CreateZipFile(string zipFileName, string Folder)
}
}
//Log.EndJob(Util.WRITER_CreatedPackage);
+
+ */
WriteFileToHttpContext(zipFileName, ContentDisposition.Attachment);
}
catch (Exception ex)
@@ -281,6 +289,11 @@ private void CreateZipFile(string zipFileName, string Folder)
strmZipFile.Close();
}
}
+
+
+
+
+
}
private void WriteFileToHttpContext(string FileName, ContentDisposition contentDisposition)
{
diff --git a/build-local92.cmd b/build-local92.cmd
new file mode 100644
index 00000000..8bd8992a
--- /dev/null
+++ b/build-local92.cmd
@@ -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
\ No newline at end of file
diff --git a/ref/dnn920/ClientDependency.Core.dll b/ref/dnn920/ClientDependency.Core.dll
new file mode 100644
index 00000000..159a8f67
Binary files /dev/null and b/ref/dnn920/ClientDependency.Core.dll differ
diff --git a/ref/dnn920/DotNetNuke.Instrumentation.dll b/ref/dnn920/DotNetNuke.Instrumentation.dll
new file mode 100644
index 00000000..f0462c77
Binary files /dev/null and b/ref/dnn920/DotNetNuke.Instrumentation.dll differ
diff --git a/ref/dnn920/DotNetNuke.Web.Client.dll b/ref/dnn920/DotNetNuke.Web.Client.dll
new file mode 100644
index 00000000..9cb466da
Binary files /dev/null and b/ref/dnn920/DotNetNuke.Web.Client.dll differ
diff --git a/ref/dnn920/DotNetNuke.Web.Razor.dll b/ref/dnn920/DotNetNuke.Web.Razor.dll
new file mode 100644
index 00000000..c75da68a
Binary files /dev/null and b/ref/dnn920/DotNetNuke.Web.Razor.dll differ
diff --git a/ref/dnn920/DotNetNuke.Web.dll b/ref/dnn920/DotNetNuke.Web.dll
new file mode 100644
index 00000000..3bca93b3
Binary files /dev/null and b/ref/dnn920/DotNetNuke.Web.dll differ
diff --git a/ref/dnn920/DotNetNuke.WebUtility.dll b/ref/dnn920/DotNetNuke.WebUtility.dll
new file mode 100644
index 00000000..b33496d9
Binary files /dev/null and b/ref/dnn920/DotNetNuke.WebUtility.dll differ
diff --git a/ref/dnn920/DotNetNuke.dll b/ref/dnn920/DotNetNuke.dll
new file mode 100644
index 00000000..aeb58e4c
Binary files /dev/null and b/ref/dnn920/DotNetNuke.dll differ
diff --git a/ref/dnn920/ICSharpCode.SharpZipLib.dll b/ref/dnn920/ICSharpCode.SharpZipLib.dll
new file mode 100644
index 00000000..fe643ebc
Binary files /dev/null and b/ref/dnn920/ICSharpCode.SharpZipLib.dll differ
diff --git a/ref/dnn920/Newtonsoft.Json.dll b/ref/dnn920/Newtonsoft.Json.dll
new file mode 100644
index 00000000..77a5d89e
Binary files /dev/null and b/ref/dnn920/Newtonsoft.Json.dll differ
diff --git a/ref/dnn920/System.Net.Http.Formatting.dll b/ref/dnn920/System.Net.Http.Formatting.dll
new file mode 100644
index 00000000..3b76acd6
Binary files /dev/null and b/ref/dnn920/System.Net.Http.Formatting.dll differ
diff --git a/ref/dnn920/System.Web.Helpers.dll b/ref/dnn920/System.Web.Helpers.dll
new file mode 100644
index 00000000..7e6cd4ed
Binary files /dev/null and b/ref/dnn920/System.Web.Helpers.dll differ
diff --git a/ref/dnn920/System.Web.Http.WebHost.dll b/ref/dnn920/System.Web.Http.WebHost.dll
new file mode 100644
index 00000000..4f2b581e
Binary files /dev/null and b/ref/dnn920/System.Web.Http.WebHost.dll differ
diff --git a/ref/dnn920/System.Web.Http.dll b/ref/dnn920/System.Web.Http.dll
new file mode 100644
index 00000000..e1dbdd18
Binary files /dev/null and b/ref/dnn920/System.Web.Http.dll differ
diff --git a/ref/dnn920/System.Web.WebPages.dll b/ref/dnn920/System.Web.WebPages.dll
new file mode 100644
index 00000000..f9464540
Binary files /dev/null and b/ref/dnn920/System.Web.WebPages.dll differ