/// <summary> /// Extracts the resource. /// </summary> /// <param name="type">The type.</param> /// <param name="resourceName">Name of the resource.</param> /// <param name="destinationPath">The destination path.</param> public static void ExtractResource ( Type type, string resourceName, string destinationPath) { ArgumentUtility.NotNull ( type, "type"); ArgumentUtility.NotNullOrEmpty ( resourceName, "resourceName"); ArgumentUtility.NotNullOrEmpty ( destinationPath, "destinationPath"); Stream resourceStream = type.Assembly.GetManifestResourceStream ( type, resourceName); using (Stream fileStream = new FileStream ( destinationPath, FileMode.Create)) { StreamUtility.Copy ( resourceStream, fileStream); } }
/// <summary> /// Decompress data. /// </summary> /// <param name="data">The data.</param> /// <returns>Decomressed data.</returns> public static byte[] Decompress(byte[] data) { ArgumentUtility.NotNull ( data, "data"); MemoryStream ms = new MemoryStream(data); using (DeflateStream zip = new DeflateStream ( ms, CompressionMode.Decompress)) { MemoryStream result = new MemoryStream(); StreamUtility.Copy ( zip, result); return(result.ToArray()); } }