private static bool IsZipArchive(string filename) {
try {
using (var fs = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read)) {
var bytes = new byte[4];
fs.Read(bytes, 0, 4);
return BitConverter.ToInt32(bytes, 0) == ZipLeadBytes;
}
} catch (Exception e) {
Logging.Warning("IsZipArchive(): " + e);
return false;
}
}
}