这是我的代码:
private void Instalarbtn_Click(object sender, RoutedEventArgs e)
{
string MinecraftFolder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/.minecraft";
string destinationFile = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "system.zip");
FastZip FastZip = null;
if (Directory.Exists(MinecraftFolder + "/temp"))
{
Directory.Delete(MinecraftFolder + "/temp", true);
}
FastZip.ExtractZip(MinecraftFolder + "/bin/minecraft.jar", MinecraftFolder + "/temp/Minecraft", String.Empty);
try
{
Directory.Delete(MinecraftFolder + "/temp/Minecraft/META-INF", true);
}
catch (DirectoryNotFoundException e1)
{
}
FastZip.ExtractZip(destinationFile, MinecraftFolder + "/temp", String.Empty);
FastZip.CreateZip(MinecraftFolder + "/bin/minecraft.jar", MinecraftFolder + "/temp/Minecraft", true, String.Empty);
if (Directory.Exists(MinecraftFolder + "/temp"))
{
Directory.Delete(MinecraftFolder + "/temp", true);
MessageBox.Show("Instalado correctamente", "Instalador");
}
}
(对不起,长代码)
如果有助于我尝试提取 .jar,请在同一文件夹中添加内容并重新打包。
它不起作用
任何人都知道,因为不工作?
如果知道解决方案,请告诉我
谢谢
编辑:使用此代码,我想从 minecraft.jar 中解压缩所有文件夹,然后添加一些文件并覆盖文件并再次重新打包