Exemplo n.º 1
0
		public static MemoryStream CreateBlubbZip(string blubbzipPassword, string[] contentFilenames, Stream[] contentData) {
			MemoryStream saveStream = new MemoryStream();
			using (MemoryStream tempStream = new MemoryStream()) {
				using (BlubbZipOutputStream outputStream = new BlubbZipOutputStream(tempStream)) {
					try {
						outputStream.Password = blubbzipPassword;
						outputStream.SetLevel(9);

						for (int i = 0; i < contentData.Length; i++) {
							ZipStream("", contentFilenames[i], contentData[i], outputStream);
						}

					} catch (Exception e) {
						System.Diagnostics.Debug.WriteLine(e);
					} finally {
						if (outputStream != null)
							outputStream.Finish(); // don't close, will close also underlying Stream!
					}

					tempStream.WriteTo(saveStream);
				}
			}

			return saveStream;
		}
Exemplo n.º 2
0
		public static void CreateBlubbZip(Stream SaveToStream, string Password, string[] FileNames, Stream[] Entrys) {
			BlubbZipOutputStream outputStream = new BlubbZipOutputStream(SaveToStream);
			try {
				outputStream.Password = Password;
				outputStream.SetLevel(9);

				for (int i = 0; i < Entrys.Length; i++) {
					ZipStream("", FileNames[i], Entrys[i], outputStream);
				}

			} catch (Exception e) {
				System.Diagnostics.Debug.WriteLine(e);
			} finally {
				if (outputStream != null)
					outputStream.Finish(); // don't close, will close also underlying Stream!
			}

		}