V
vishruth
This code works fine in Windows Application.
In Windows Application, I am able to zip the image files properly and it
totally contains 900MB
My problem is the same code which I used in my Windows Application,
does not work while I run it with Windows services.
In my Windows application I am able to zip the whole 900Mb without any
problems,
but in my windows services I am not able to zip the whole 900Mb.
In Windows Services it throws an error :SystemOutOfMemoryException
I am trying to zip all image files, example: idx,fim,rim
Below is the code I am using:
Please help me to find the solution to run this code properly in windows
services as well.
using Xceed.Compression;
using Xceed.FileSystem;
using Xceed.Zip;
Xceed.Zip.Licenser.LicenseKey = "ZINxx-xxxxx-xxxxx-xxxx";
public int MakeZipFile(string zipFileName, string[] filesToComp)
{
int retVal = 0;
DiskFolder tempFolder = new DiskFolder();
try
{
ZipArchive zip = new ZipArchive( new DiskFile( zipFileName ) );
zip.TempFolder = tempFolder;
try
{
zip.BeginUpdate();
foreach( string file in filesToComp )
{
DiskFile fileToZip = new DiskFile( file );
fileToZip.CopyTo( zip, true );
++retVal;
}
}
finally
{
zip.EndUpdate();
}
}
catch(Exception exec)
{
throw new ZipException(exec.Message);
}
finally
{
}
return retVal;
}
}
}
// Windows Services --- main part of execution
string zipfilepath="C:\\temp\\pollNew.zip"; // all my image files will be
zipped in pollnew.zip
string[] pFiles=new string[7]; // pFiles contains all files
that I want to zip
pFiles[0]="D:\\New\\121807\\00007069.FCI";
pFiles[1]="D:\\New\\121807\\00007069.FI2";
pFiles[2]="D:\\New\\121807\\00007069.FIM";
pFiles[3]="D:\\New\\121807\\00007069.IDX";
pFiles[4]="D:\\New\\121807\\00007069.RCI";
pFiles[5]="D:\\New\\121807\\00007069.RI2";
pFiles[6]="D:\\New\\121807\\00007069.RIM";
MakeZipFile(string zipfilepath, string[] pFiles) // calling MakeZipFile
Function Here
In Windows Application, I am able to zip the image files properly and it
totally contains 900MB
My problem is the same code which I used in my Windows Application,
does not work while I run it with Windows services.
In my Windows application I am able to zip the whole 900Mb without any
problems,
but in my windows services I am not able to zip the whole 900Mb.
In Windows Services it throws an error :SystemOutOfMemoryException
I am trying to zip all image files, example: idx,fim,rim
Below is the code I am using:
Please help me to find the solution to run this code properly in windows
services as well.
using Xceed.Compression;
using Xceed.FileSystem;
using Xceed.Zip;
Xceed.Zip.Licenser.LicenseKey = "ZINxx-xxxxx-xxxxx-xxxx";
public int MakeZipFile(string zipFileName, string[] filesToComp)
{
int retVal = 0;
DiskFolder tempFolder = new DiskFolder();
try
{
ZipArchive zip = new ZipArchive( new DiskFile( zipFileName ) );
zip.TempFolder = tempFolder;
try
{
zip.BeginUpdate();
foreach( string file in filesToComp )
{
DiskFile fileToZip = new DiskFile( file );
fileToZip.CopyTo( zip, true );
++retVal;
}
}
finally
{
zip.EndUpdate();
}
}
catch(Exception exec)
{
throw new ZipException(exec.Message);
}
finally
{
}
return retVal;
}
}
}
// Windows Services --- main part of execution
string zipfilepath="C:\\temp\\pollNew.zip"; // all my image files will be
zipped in pollnew.zip
string[] pFiles=new string[7]; // pFiles contains all files
that I want to zip
pFiles[0]="D:\\New\\121807\\00007069.FCI";
pFiles[1]="D:\\New\\121807\\00007069.FI2";
pFiles[2]="D:\\New\\121807\\00007069.FIM";
pFiles[3]="D:\\New\\121807\\00007069.IDX";
pFiles[4]="D:\\New\\121807\\00007069.RCI";
pFiles[5]="D:\\New\\121807\\00007069.RI2";
pFiles[6]="D:\\New\\121807\\00007069.RIM";
MakeZipFile(string zipfilepath, string[] pFiles) // calling MakeZipFile
Function Here