/// <summary> /// /// </summary> /// <param name="text"></param> /// <returns></returns> public static void UnpackFromBase64ToStream(string text, Stream output) { byte[] data = ItsZip.FromBase64(text); MemoryStream ms = new MemoryStream(data); ms.Position = 0; using (ZipInputStream zis = new ZipInputStream(ms)) { ZipEntry ze = zis.GetNextEntry(); if (ze.Size > 0) { int size = 2048; byte[] data2 = new byte[size]; while (true) { size = zis.Read(data2, 0, size); if (size > 0) { output.Write(data2, 0, size); } else { break; } } } }// using ( ZipInputStream }
/// <summary> /// /// </summary> /// <param name="text"></param> /// <returns></returns> public static byte[] UnpackFromBase64ToByteArray(string text) { byte[] data = ItsZip.FromBase64(text); MemoryStream ms = new MemoryStream(data); ms.Position = 0; using (ZipInputStream zis = new ZipInputStream(ms)) { ZipEntry ze = zis.GetNextEntry(); if (ze.Size > 0) { MemoryStream msResult = new MemoryStream(); int size = 2048; byte[] data2 = new byte[size]; while (true) { size = zis.Read(data2, 0, size); if (size > 0) { msResult.Write(data2, 0, size); } else { break; } } msResult.Position = 0; byte[] textBytes = new byte[msResult.Length]; msResult.Read(textBytes, 0, Convert.ToInt32(msResult.Length)); return(textBytes); //StringBuilder sb = new StringBuilder(); //sb.Append(Encoding.Unicode.GetChars(textBytes)); //return sb.ToString(); } }// using ( ZipInputStream return(null); }