public void Unpack() { if (Type == ArchiveType.JDLZ) { data = Jdlz.Unpack(data); Type = ArchiveType.RAWW; preheader.UnpackedSize = data.Length; preheader.FullSize = data.Length + preheader.FullSize - Size + 16; if (id + 1 != vault.Length) { vault.Archives[id + 1].PreviousSize = preheader.FullSize; } Size = data.Length + 16; byte[] header = new byte[16]; BinaryWriter bw = new BinaryWriter(new MemoryStream(header)); bw.Write((int)Type); num1 = 4097; bw.Write(num1); bw.Write(UnpackedSize); bw.Write(Size); bw.Close(); data = header.Concat(data).ToArray(); } else { MessageBox.Show(string.Format("Archive with type \"{0}\" can't be unpacked", Type)); } }
public void Compress() { if (!Compressed) { data = Jdlz.Compress(data.Skip(16).Take(data.Length - 16).ToArray()); Type = ArchiveType.JDLZ; preheader.FullSize = data.Length + preheader.FullSize - Size; Size = data.Length; } else { MessageBox.Show("This archive is already compressed"); } }