I am trying to get an image from a .zip archive and show it in a PictureBox.
I have a method to get text from a file inside the archive, but now I just need to get the image. I ve tried different things on this site, but none seem to work for me.
我的守则如下:
using System.Text;
using System.IO.Compression;
using System.Windows.Forms;
public partial class Form1 : Form
{
private void Form1_Load(object sender, EventArgs e)
{
string zipFileFullPath = "C:\Tester\adv.jar";
string targetFileName = "pack.mcmeta";
string text = new string(
(new System.IO.StreamReader(
ZipFile.OpenRead(zipFileFullPath)
.Entries.Where(x => x.Name.Equals(targetFileName,
StringComparison.InvariantCulture))
.FirstOrDefault()
.Open(), Encoding.UTF8)
.ReadToEnd())
.ToArray());
}
}
基本上,我想使用同样的方法,但不是案文,而是想把它作为蓝图。