private static void smethod_3(FileInfo[] fileInfo_0, string string_0, string string_1, object object_0) { string s = null; string str2 = null; int index = 0; string path = null; string str4 = null; GZipFileInfo info = null; FileStream stream = null; FileStream stream2 = null; if ((fileInfo_0 != null) && (fileInfo_0.Length > 0)) { try { object_0.Files = new GZipFileInfo[fileInfo_0.Length]; stream = new FileStream(string_1, FileMode.Create, FileAccess.Write, FileShare.None); foreach (FileInfo info2 in fileInfo_0) { string text1 = info2.DirectoryName + @"\"; try { info = new GZipFileInfo { Index = index }; path = info2.FullName; info.LocalPath = path; str4 = path.Replace(string_0, string.Empty).Replace(@"\", "/"); info.RelativePath = str4; stream2 = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read); byte[] buffer = new byte[stream2.Length]; stream2.Read(buffer, 0, buffer.Length); stream2.Close(); stream2 = null; str2 = info2.LastWriteTimeUtc.ToString(); info.ModifiedDate = info2.LastWriteTimeUtc; info.Length = buffer.Length; string[] strArray = new string[] { index.ToString(), ",", str4, ",", str2, ",", buffer.Length.ToString(), "\n" }; s = string.Concat(strArray); byte[] bytes = Encoding.Default.GetBytes(s); stream.Write(bytes, 0, bytes.Length); stream.Write(buffer, 0, buffer.Length); stream.WriteByte(10); info.AddedToTempFile = true; object_0.Files[index] = info; index++; } catch { object_0.Errors = true; } finally { if (stream2 != null) { stream2.Close(); stream2 = null; } } if (stream != null) { object_0.TempFileSize = stream.Length; } } } catch { object_0.Errors = true; } finally { if (stream != null) { stream.Close(); stream = null; } } } object_0.FileCount = index; }
public static GZipResult Decompress(string lpSrcFolder, string lpDestFolder, string zipFileName, bool deleteTempFile, bool writeFiles, string addExtension, Hashtable htFiles, int bufferSize) { // This item is obfuscated and can not be translated. GZipResult result = new GZipResult(); if (!lpSrcFolder.EndsWith(@"\")) { lpSrcFolder = lpSrcFolder + @"\"; } if (!lpDestFolder.EndsWith(@"\")) { lpDestFolder = lpDestFolder + @"\"; } string str = lpSrcFolder + zipFileName + ".tmp"; string str2 = lpSrcFolder + zipFileName; result.TempFile = str; result.ZipFile = str2; string str3 = null; string str4 = null; string path = null; GZipFileInfo info = null; FileStream stream = null; ArrayList list = new ArrayList(); bool flag = false; if (string.IsNullOrEmpty(addExtension)) { addExtension = string.Empty; } else if (!addExtension.StartsWith(".")) { addExtension = "." + addExtension; } try { stream = smethod_7(str2, str, result); if (stream != null) { while (stream.Position != stream.Length) { str3 = null; while (!string.IsNullOrEmpty(str3)) { if (0 == 0) { goto Label_00EF; } str3 = smethod_4(stream); } goto Label_00C4; Label_00EF: if (!string.IsNullOrEmpty(str3)) { info = new GZipFileInfo(); if (!info.ParseFileInfo(str3) || (info.Length <= 0)) { continue; } list.Add(info); str4 = lpDestFolder + info.RelativePath; path = smethod_6(str4); info.LocalPath = str4; flag = false; if ((htFiles == null) || htFiles.ContainsKey(info.RelativePath)) { info.RestoreRequested = true; flag = writeFiles; } if (flag) { if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } info.Restored = smethod_5(stream, info.Length, str4 + addExtension, bufferSize); continue; } stream.Position += info.Length; } } } } catch { result.Errors = true; } finally { if (stream != null) { stream.Close(); stream = null; } } try { if (deleteTempFile) { File.Delete(str); result.TempFileDeleted = true; } } catch { result.Errors = true; } result.FileCount = list.Count; result.Files = new GZipFileInfo[list.Count]; list.CopyTo(result.Files); return(result); }