// Token: 0x0600051D RID: 1309 RVA: 0x00025244 File Offset: 0x00023444 private static byte[] GenCentralDirectoryFooter(long StartOfCentralDirectory, long EndOfCentralDirectory, Zip64Option zip64, int entryCount, string comment, ZipContainer container) { Encoding encoding = ZipOutput.GetEncoding(container, comment); int num = 22; byte[] array = null; short num2 = 0; if (comment != null && comment.Length != 0) { array = encoding.GetBytes(comment); num2 = (short)array.Length; } num += (int)num2; byte[] array2 = new byte[num]; int num3 = 0; byte[] bytes = BitConverter.GetBytes(101010256u); Array.Copy(bytes, 0, array2, num3, 4); num3 += 4; array2[num3++] = 0; array2[num3++] = 0; array2[num3++] = 0; array2[num3++] = 0; if (entryCount >= 65535 || zip64 == Zip64Option.Always) { for (int i = 0; i < 4; i++) { array2[num3++] = byte.MaxValue; } } else { array2[num3++] = (byte)(entryCount & 255); array2[num3++] = (byte)((entryCount & 65280) >> 8); array2[num3++] = (byte)(entryCount & 255); array2[num3++] = (byte)((entryCount & 65280) >> 8); } long num4 = EndOfCentralDirectory - StartOfCentralDirectory; if (num4 >= (long)((ulong)-1) || StartOfCentralDirectory >= (long)((ulong)-1)) { for (int i = 0; i < 8; i++) { array2[num3++] = byte.MaxValue; } } else { array2[num3++] = (byte)(num4 & 255L); array2[num3++] = (byte)((num4 & 65280L) >> 8); array2[num3++] = (byte)((num4 & 16711680L) >> 16); array2[num3++] = (byte)((num4 & (long)((ulong)-16777216)) >> 24); array2[num3++] = (byte)(StartOfCentralDirectory & 255L); array2[num3++] = (byte)((StartOfCentralDirectory & 65280L) >> 8); array2[num3++] = (byte)((StartOfCentralDirectory & 16711680L) >> 16); array2[num3++] = (byte)((StartOfCentralDirectory & (long)((ulong)-16777216)) >> 24); } if (comment == null || comment.Length == 0) { array2[num3++] = 0; array2[num3++] = 0; } else { if ((int)num2 + num3 + 2 > array2.Length) { num2 = (short)(array2.Length - num3 - 2); } array2[num3++] = (byte)(num2 & 255); array2[num3++] = (byte)(((int)num2 & 65280) >> 8); if (num2 != 0) { int i = 0; while (i < (int)num2 && num3 + i < array2.Length) { array2[num3 + i] = array[i]; i++; } num3 += i; } } return(array2); }
// Token: 0x060005F6 RID: 1526 RVA: 0x00039A20 File Offset: 0x00037C20 private static byte[] GenCentralDirectoryFooter(long StartOfCentralDirectory, long EndOfCentralDirectory, Zip64Option zip64, int entryCount, string comment, ZipContainer container) { Encoding encoding = ZipOutput.GetEncoding(container, comment); int num = 22; byte[] array = null; short num2 = 0; if (comment != null && comment.Length != 0) { array = encoding.GetBytes(comment); num2 = (short)array.Length; } num += (int)num2; byte[] array2 = new byte[num]; byte[] bytes = BitConverter.GetBytes(101010256U); Array.Copy(bytes, 0, array2, 0, 4); array2[4] = 0; array2[5] = 0; array2[6] = 0; byte[] array3 = array2; int num3 = 7; int num4 = 8; array3[num3] = 0; if (entryCount < 65535) { if (zip64 != Zip64Option.Always) { array2[num4++] = (byte)(entryCount & 255); array2[num4++] = (byte)((entryCount & 65280) >> 8); array2[num4++] = (byte)(entryCount & 255); array2[num4++] = (byte)((entryCount & 65280) >> 8); goto IL_F2; } } for (int i = 0; i < 4; i++) { array2[num4++] = byte.MaxValue; } IL_F2: long num5 = EndOfCentralDirectory - StartOfCentralDirectory; if (num5 < 4294967295L && StartOfCentralDirectory < 4294967295L) { array2[num4++] = (byte)(num5 & 255L); array2[num4++] = (byte)((num5 & 65280L) >> 8); array2[num4++] = (byte)((num5 & 16711680L) >> 16); array2[num4++] = (byte)((num5 & 4278190080L) >> 24); array2[num4++] = (byte)(StartOfCentralDirectory & 255L); array2[num4++] = (byte)((StartOfCentralDirectory & 65280L) >> 8); array2[num4++] = (byte)((StartOfCentralDirectory & 16711680L) >> 16); array2[num4++] = (byte)((StartOfCentralDirectory & 4278190080L) >> 24); } else { for (int i = 0; i < 8; i++) { array2[num4++] = byte.MaxValue; } } if (comment != null && comment.Length != 0) { if ((int)num2 + num4 + 2 > array2.Length) { num2 = (short)(array2.Length - num4 - 2); } array2[num4++] = (byte)(num2 & 255); array2[num4++] = (byte)(((int)num2 & 65280) >> 8); if (num2 != 0) { int i = 0; while (i < (int)num2 && num4 + i < array2.Length) { array2[num4 + i] = array[i]; i++; } num4 += i; } } else { array2[num4++] = 0; array2[num4++] = 0; } return(array2); }