Errors with first time use..

Dec 1, 2009 at 9:18 PM

Hi guys,

 

Maybe I am doing it wrong but I am getting a could not be read error. Here is the code:

 

 

namespace Fontification
{
    class FontGrabber
    {
        public void GrabFont(string inputPath, string outputPath)
        {
            //Create a directory in the users temporary folder
            string tempFolder = Path.GetTempPath();

            //Create a variable to hold the name of the file
            string folderName;

            //Grab The XPS File and remove its contents to a temp directory
            using (ZipFile XPSFile = ZipFile.Read(inputPath))
            {
                folderName = XPSFile.Name;
                XPSFile.ExtractAll(tempFolder);
            }

            
        }
        
    }
}

 

To test this I tried to read a standard Zip file  by supplying the full path plus the zip name with .zip at the end. The error happens on the Using section, what am I doing wrong?

 

 

 

namespace Fontification
{
    class FontGrabber
    {
        public void GrabFont(string inputPath, string outputPath)
        {
            //Create a directory in the users temporary folder
            string tempFolder = Path.GetTempPath();

            //Create a variable to hold the name of the file
            string folderName;

            //Grab The XPS File and remove its contents to a temp directory
            using (ZipFile XPSFile = ZipFile.Read(inputPath))
            {
                folderName = XPSFile.Name;
                XPSFile.ExtractAll(tempFolder);
            }

            
        }
        
    }
}
Coordinator
Dec 2, 2009 at 5:59 AM

The exception will give you additional information.  It could be that the file does not exist.  It could be that the file is not readable.  It could be that the file is not a zip file. It could be that it is a corrupt zip file.  There may be other reasons. The exception will give you additional information.

 

Dec 2, 2009 at 12:11 PM

Ah ok i thought my implementation was wrong. I will check the exeception when i get home. Thanks a mil!

On 2 Dec 2009 07:00, "Cheeso" <notifications@codeplex.com> wrote:

From: Cheeso

The exception will give you additional information.  It could be that the file does not exist.  It could be that the file is not readable.  It could be that the file is not a zip file. It could be that it is a corrupt zip file.  There may be other reasons. The exception will give you additional information.

 

Read the full discussion online. To add a post to this discussion, reply to this email (DotNetZip...