private byte[] GetExtraField() { byte[] block = null; //var data = new System.Collections.Generic.List<byte>(); if ((UsesEncryption) && (IsStrong(Encryption))) { // byte[] block= GetStrongEncryptionBlock(); // return block; } #if INFOZIP_UTF8 if (FileNameIsUtf8(FileNameChars)) { _FilenameIsUtf8= true; int datasize= 2+2+1+4+FileNameChars.Length; block= new byte[datasize]; int i=0, mark=0; uint d= (uint) (datasize -4); block[i++]= 0x75; block[i++]= 0x70; block[i++]= (byte)(d & 0x00FF); block[i++]= (byte)(d & 0xFF00); // version block[i++]= 1; // skip the CRC on the filenamebytes, for now mark = i; i+= 4; // UTF8 filename for (int j = 0; j < FileNameChars.Length; j++) { byte[] b = System.BitConverter.GetBytes(FileNameChars[j]); block[i++]= b[0]; } // filename field Crc32 - for the non-UTF8 filename field CRC32 Crc32= new CRC32(); Crc32.SlurpBlock(block, mark+4, FileNameChars.Length); i= mark; block[i++] = (byte)(Crc32.Crc32Result & 0x000000FF); block[i++] = (byte)((Crc32.Crc32Result & 0x0000FF00) >> 8); block[i++] = (byte)((Crc32.Crc32Result & 0x00FF0000) >> 16); block[i++] = (byte)((Crc32.Crc32Result & 0xFF000000) >> 24); } #endif // could inject other blocks here... return block; }