wzh method

dynamic wzh(
  1. List<int> d,
  2. int b,
  3. Map f,
  4. List<int> fn,
  5. bool u,
  6. int c, [
  7. int? ce,
  8. dynamic co,
])

Implementation

wzh(List<int> d, int b, Map f, List<int> fn, bool u, int c, [int? ce, dynamic co]) {
  int col = co is List? co.length: (co ?? 0);
  int fl = fn.length;
  Map? ex = f['extra'];
  //int col = co.length;//(co != 0 && co?.length != 0) ? (co?.length ?? 0) : co;//co && co.length;
  int exl = exfl(ex);
  wbytes(d, b, ce != null ? 0x2014B50 : 0x4034B50);
  b += 4;
  if (ce != null){
    d[b++] = 20;
    d[b++] = f['os'] ?? 0;
  }
  d[b] = 20;
  b += 2;
  d[b++] = ((f['flag'] ?? 0) << 1) | (c < 0 ? 8 : 0);//(c < 0 && 8);
  d[b++] = u == false? 8 : 0;//u && 8;
  d[b++] = f['compression'] & 255;
  d[b++] = f['compression'] >> 8;
  DateTime dt = DateTime.fromMillisecondsSinceEpoch(f['mtime'] == null ? DateTime.now().millisecondsSinceEpoch : f['mtime']);
  int y = dt.year - 1980;
  if (y < 0 || y > 119){
    err(10);
  }
  wbytes(d, b, (y << 25) | ((dt.month + 1) << 21) | (dt.day << 16) | (dt.hour << 11) | (dt.minute << 5) | (dt.second >> 1));
  b += 4;
  if (c != -1) {
    wbytes(d, b, f['crc']);
    wbytes(d, b + 4, c < 0 ? -c - 2 : c);
    wbytes(d, b + 8, f['size']);
  }
  wbytes(d, b + 12, fl);
  wbytes(d, b + 14, exl);
  b += 16;
  if (ce != null) {
    wbytes(d, b, col);
    wbytes(d, b + 6, f['attrs'] ?? 0);
    wbytes(d, b + 10, ce);
    b += 14;
  }
  d.setAll(b, fn);
  b += fl;
  if (exl != 0) {
    for (final k in ex?.keys ?? []) {
      var exf = ex?[k];
      int l = exf?.length ?? 0;
      wbytes(d, b, k);
      wbytes(d, b + 2, l);
      d.setAll(b+4,exf);
      b += 4 + l;
    }
  }
  if (col != 0){
    d.setAll(b, co);
    b += col;
  }
  return b;
}