I configured a valid empty plugin project, and added ICSharpCode.SharpZipLib (for .Net 6.0, 7.0 compatible) as adding
options.ScriptingAPI.FileReferences.Add(Path.Combine(FolderPath, “..”, “..”, “Content”, “ICSharpCode.SharpZipLib.dll”));
to plugin’s Build.cs.
With barebone plugin code editor loaded fine, but after adding
ZipFile archive
Engine could not load the editor and crashed with messagebox
Error
Unhandled exception: 0xe0434352
and log of KERNELBASE crash of
[ 00:00:04.095 ]: [Error] Critical error! Reason: Unhandled exception: 0xe0434352
[ 00:00:04.101 ]: [Error] Stack trace:
[ 00:00:04.101 ]: [Error] at KERNELBASE.dll 0x7ffed0f44fd9
[ 00:00:04.101 ]: [Error] at 0x7ffe906f2f4c
[ 00:00:04.101 ]: [Error] at 0x276b3c15cb0
[ 00:00:04.101 ]: [Error] at 0xbec70fb930
[ 00:00:04.101 ]: [Error] at 0x17f
Interestingly, when I loaded project “before adding code of ZipFile” and edited the plugin source code, hot reloader compiled fine and did not crash on the go. Editor only crashed when ‘starting’ with already added code.
I tested that lib and it works fine for me on the latest master build - maybe we fixed it for Flax 1.7 update (which will be out this week).
I used .NET 6.0 version of that lib from Release v1.4.2 · icsharpcode/SharpZipLib · GitHub.
using System;
using FlaxEngine;
using ICSharpCode.SharpZipLib.Zip;
public class TestScript : Script
{
[AssetReference(".zip"), CustomEditorAlias("FlaxEditor.CustomEditors.Editors.AssetRefEditor")]
public string ZipPath = "";
public override void OnStart()
{
Debug.Log(ZipPath);
}
public override void OnUpdate()
{
if (Input.GetKeyDown(KeyboardKeys.G))
{
using (ZipFile zFile = new ZipFile(ZipPath))
{
Debug.Log("Listing of : " + zFile.Name);
Debug.Log("");
Debug.Log("Raw Size Size Date Time Name");
Debug.Log("-------- -------- -------- ------ ---------");
foreach (ZipEntry e in zFile)
{
if (e.IsFile)
{
DateTime d = e.DateTime;
Debug.Log(string.Format("{0, -10}{1, -10}{2} {3} {4}", e.Size, e.CompressedSize,
d.ToString("dd-MM-yy"), d.ToString("HH:mm"),
e.Name));
}
}
}
}
}
}
Thanks, looking forward to it.