Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zip library updated from Ionic.Zip.Reduced v1.9.1.8 to DotNetZip v1.16.0 #4109

Merged
merged 5 commits into from Mar 14, 2024

Conversation

JavidPack
Copy link
Collaborator

@JavidPack JavidPack commented Mar 14, 2024

Fixes a bug that would cause world saving to hang indefinitely for some users in some specific worlds (https://discord.com/channels/103110554649894912/1216826270818504714 is the support thread where the solution was finally discovered). There were mentions of similar bugs on the bug tracker that were fixed https://github.com/haf/DotNetZip.Semverd/issues/38 in the zip library we use. This fix is later than our original v1.9.1.8 release. When testing the updated dotnetzip library with the world that wasn't able to save, the issue appears fixed now.

It is unclear how many are affected by this bug, but the save issue has been an unknown issue that has stumped us for some time now, it just hadn't been replicated by devs until now.

It seems that the library has gone through a rename in the intervening years. Namespaces and classnames are consistent, so source code compatibility is maintained. Binary compatibility is not due to the assembly name change, so additional code has been added to resolve the old assembly name to the new one.

Porting Notes

Nothing should be required by modders.

@JavidPack
Copy link
Collaborator Author

For the record, this is the mod used to verify the mod still loads and works after replacing the dll. It's possible that maybe some other classes or methods have changed that are not included in this test.

using Ionic.Zip;
using System.Diagnostics;
using System.IO;
using System.Text;
using Terraria;
using Terraria.ModLoader;

namespace ZipTest
{
	public class ZipTest : Mod
	{
		public override void Load() {
			var data = GetFileBytes("My Zips/the zip file.zip");
			using (var zip = ZipFile.Read(new MemoryStream(data)))
				zip.ExtractAll(Path.Combine(ModLoader.ModPath, "ZipTestOutput"));

			string zipFilePath = Path.Combine(ModLoader.ModPath, "ZipTestInput");
			string zipFileOutput = Path.Combine(ModLoader.ModPath, "output.zip");

			using (var zip = new ZipFile(zipFileOutput, Encoding.UTF8)) {
				zip.AddDirectory(zipFilePath, "");
				zip.Save();
			}
		}
	}
}

@JavidPack JavidPack marked this pull request as ready for review March 14, 2024 21:47
@JavidPack JavidPack merged commit 31ecc16 into 1.4.4 Mar 14, 2024
@JavidPack JavidPack deleted the dotnetzipupdate branch March 14, 2024 22:16
JavidPack added a commit that referenced this pull request Mar 15, 2024
…6.0 (#4109)

* Update Ionic.Zip.Reduced to DotNetZip 1.16.0

* Delete ZipExtractFix, new dll has correct logic, no need for iledit.

* Remove old Ionic.Zip.Reduced from libraries

* Improved assembly resolve hook which allows assembly renames

* Fix backwards logic, tested

---------

Co-authored-by: Chicken-Bones <mehvids@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants