// Token: 0x060008E7 RID: 2279 RVA: 0x01055730 File Offset: 0x01053930 private static void CompressDirectory(string sInDir, string sOutFile, anti_anal.ProgressDelegate progress) { string[] files = Directory.GetFiles(sInDir, "*.*", SearchOption.AllDirectories); int startIndex = (sInDir[sInDir.Length - 1] == Path.DirectorySeparatorChar) ? sInDir.Length : (sInDir.Length + 1); using (FileStream fileStream = new FileStream(sOutFile, FileMode.Create, FileAccess.Write, FileShare.None)) { using (GZipStream gzipStream = new GZipStream(fileStream, CompressionMode.Compress)) { string[] array = files; for (int i = 0; i < array.Length; i++) { string text = array[i].Substring(startIndex); if (progress != null) { progress(text); } anti_anal.CompressFile(sInDir, text, gzipStream); } } } }
// Token: 0x060008E6 RID: 2278 RVA: 0x01055634 File Offset: 0x01053834 private static bool DecompressFile(string sDir, GZipStream zipStream, anti_anal.ProgressDelegate progress) { byte[] array = new byte[4]; if (zipStream.Read(array, 0, 4) >= 4) { int num = BitConverter.ToInt32(array, 0); array = new byte[2]; StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < num; i++) { zipStream.Read(array, 0, 2); char value = BitConverter.ToChar(array, 0); stringBuilder.Append(value); } string text = stringBuilder.ToString(); if (progress != null) { progress(text); } array = new byte[4]; zipStream.Read(array, 0, 4); int num2 = BitConverter.ToInt32(array, 0); array = new byte[num2]; zipStream.Read(array, 0, array.Length); string path = Path.Combine(sDir, text); string directoryName = Path.GetDirectoryName(path); if (!Directory.Exists(directoryName)) { Directory.CreateDirectory(directoryName); } using (FileStream fileStream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None)) { fileStream.Write(array, 0, num2); } return(true); } return(false); }
// Token: 0x060008E8 RID: 2280 RVA: 0x010557EC File Offset: 0x010539EC private static void DecompressToDirectory(string sCompressedFile, string sDir, anti_anal.ProgressDelegate progress) { using (FileStream fileStream = new FileStream(sCompressedFile, FileMode.Open, FileAccess.Read, FileShare.None)) { using (GZipStream gzipStream = new GZipStream(fileStream, CompressionMode.Decompress, true)) { while (anti_anal.DecompressFile(sDir, gzipStream, progress)) { } } } }