Woo hoo! Eureka!
I figured it out. Ferget about cleanName. I used Path.GetFileName to reference the full path in the zip file. I don't need to view the files in windows, I jut need to grab one file inside it and read it to a variable. Using Path.GetFileName eliminates any confusion the library has with a full pth and crossing over from a unix file system. I'm not sure that I needed to grab the substring, so if you are borrowing this code you may want to investigate that. I'll clean it up next week.
I moved a few things around and everything works. This is the gist of the change:
// Create a zip file object and open an instance of the new zip file with it
using (ZipFile zFile = new ZipFile(destination))
{
try
{
// We had trouble extracting the file because the Java applet that creates it uses the fullpath.
// To get around this we iterate through the
// entries in the zipfile and just grab the full path of the App.xml file. Path.GetFileName takes care of this for us.
foreach (ZipEntry entry in zFile)
{
if (! entry.IsFile) continue;
// Loop through all the entries. When we match App.xml, we run our extraction, then break out of the for loop.
String entryFileName = Path.GetFileName(entry.Name);
if (entryFileName.Substring(entryFileName.Length - 7) == "App.xml") {
using (Stream s = zFile.GetInputStream(entry))
{
int streamSize = (int)entry.Size;
// we create a byte array the size of the filestream.
byte[ buffer = new byte[streamSize];
streamSize = s.Read(buffer, 0, streamSize);
// "Build" the text file in memory from the array, one character at a time. Encoding is not ASCIII, it's UTF-8
textBuilder.Append(new UTF8Encoding().GetString(buffer, 0, streamSize));
// convert the in-memory text file into a character string.
xmlOut = textBuilder.ToString();
try
{
// Call the method that inserts the XML stream and zip file name into SQL
InsertXML(timeStamp, xmlOut);
}
catch (Exception ef)
{
EventLog.WriteEntry("InsertXML Failed: ", ef.Message, EventLogEntryType.Error);
}
}
break;
}
}
}