This project is read-only.

Possible Patch - Zip.Save( )

Dec 27, 2013 at 8:31 AM
Edited Dec 27, 2013 at 8:31 AM
This block in Zip.Save(). I believe you can change this:
public void Save()
{
    string strTemp = System.IO.Path.GetTempFileName();
    using (FileStream fs = new FileStream(strTemp, FileMode.Create))
    {
        this.SaveAs(fs);
        fs.CopyTo(this.filestream);
    }

    File.Delete(strTemp);   // Delete the temp file

}
To this:
This can avoid writing files, which is more faster than above attempt. In some environment, especially in Web Servers, IIS might not allow a website to write files into Temp directory.
public void Save()
{
    using (MemoryStream ms = new MemoryStream())
    {
        using (FileStream fs = new FileStream(ms, FileMode.Create))
        {
            this.SaveAs(fs);
            fs.CopyTo(this.filestream);
        }
    }
}
Feb 2, 2014 at 4:43 PM
Sorry for the delay, but thank you for you advice. I will look at it.