or
MemoryStream compressedStream;
ZipPackage package;
MemoryStream sourcestream =
new
MemoryStream();
RadDocument document =
this
.CreateDocument(TileViewmodel);
this
.PrepareDocument(document);
PdfFormatProvider provider =
new
PdfFormatProvider();
provider.Export(document, sourcestream);
compressedStream =
new
MemoryStream();
package = ZipPackage.Create(compressedStream);
package.AddStream(sourcestream,
"WindowPeristedData"
);
MemoryStream ms =
new
MemoryStream();
byte
[] zip =
null
;
using
( ZipPackage zipfile = ZipPackage.Create(ms) ) {
foreach
( var kvp
in
files ) {
zipfile.AddStream(
new
MemoryStream(kvp.Value), kvp.Key, ZipCompression.Default, DateTime.Now);
}
zip =
new
byte
[(
int
) ms.Length];
ms.Seek(0, SeekOrigin.Begin);
ms.Read(zip, 0, (
int
) ms.Length);
ms.Dispose();
}
return
zip;
Dim fname As String = System.IO.Path.Combine(System.Configuration.ConfigurationManager.AppSettings("GlobalUploadPath"), Filename)
Dim fs As New FileStream(fname, FileMode.Open, FileAccess.Read)
Try
Using package = ZipPackage.Open(fs)
Dim allEntries As List(Of ZipPackageEntry) = package.ZipPackageEntries
For Each entry As ZipPackageEntry In allEntries
Dim filename As String = System.IO.Path.GetFileNameWithoutExtension(entry.FileNameInZip.ToLower)
-->> wrong filenames in entry.FileNameInZip
If tableList.Contains(filename) Then
' Reading the Data
End If
Next
End Using
busyIndicator.IsBusy =
true
;
if
(ListPic.Count > 0)
{
//Save zip File
SaveFileDialog dialog =
new
SaveFileDialog();
dialog.Filter =
"Zip File | *.zip"
;
bool
? dialogResult = dialog.ShowDialog();
if
(dialogResult ==
true
)
{
using
(ZipPackage zipPackage = ZipPackage.Create(dialog.OpenFile()))
{
foreach
(PictureFile pic
in
ListPic)
{
Stream picStream =
new
MemoryStream(pic.PictureStream);
zipPackage.AddStream(picStream, System.IO.Path.GetFileName(pic.PictureName),ZipCompression.Deflated,DateTime.Now);
}
}
}
busyIndicator.IsBusy =
false
;
this
.DialogResult =
false
;
}
else
{
busyIndicator.IsBusy =
false
;
this
.DialogResult =
false
;
}