nesrak1 / UABEA

c# uabe for newer versions of unity
MIT License
1.19k stars 151 forks source link

Crashes when I load an emip and then try to import a file that was modified #140

Closed ibaios closed 2 years ago

ibaios commented 2 years ago

I have created an emip with some text file modifications, and it works perfectly and I can apply the emip without problems, but when I open the emip to continue modifying the resource assets, if I want to update a text file that was already modified in the emip, and I use the import plugin, UABEA crashes with this error:

Unhandled exception. System.IO.EndOfStreamException: Unable to read beyond the end of the stream. at System.IO.BinaryReader.InternalRead(Int32 numBytes) at System.IO.BinaryReader.ReadInt32() at AssetsTools.NET.AssetsFileReader.ReadInt32() at AssetsTools.NET.AssetTypeTemplateField.ReadType(AssetsFileReader reader, AssetTypeValueField valueField) at AssetsTools.NET.AssetTypeTemplateField.ReadType(AssetsFileReader reader, AssetTypeValueField valueField) at AssetsTools.NET.AssetTypeTemplateField.MakeValue(AssetsFileReader reader) at AssetsTools.NET.AssetTypeInstance..ctor(AssetTypeTemplateField[] baseFields, AssetsFileReader reader, Int64 filePos) at AssetsTools.NET.AssetTypeInstance..ctor(AssetTypeTemplateField baseField, AssetsFileReader reader, Int64 filePos) at UABEAvalonia.AssetWorkspace.GetAssetContainer(AssetsFileInstance fileInst, Int32 fileId, Int64 pathId, Boolean onlyInfo) in D:\a\UABEA\UABEA\UABEAvalonia\AssetWorkspace.cs:line 161 at UABEAvalonia.AssetWorkspace.GetBaseField(AssetContainer cont) in D:\a\UABEA\UABEA\UABEAvalonia\AssetWorkspace.cs:line 205 at TexturePlugin.ImportTextAssetOption.SingleImport(Window win, AssetWorkspace workspace, List1 selection) at TexturePlugin.ImportTextAssetOption.ExecutePlugin(Window win, AssetWorkspace workspace, List1 selection) at UABEAvalonia.PluginWindow.BtnOk_Click(Object sender, RoutedEventArgs e) in D:\a\UABEA\UABEA\UABEAvalonia\PluginWindow.axaml.cs:line 59 at System.Threading.Tasks.Task.<>c.b140_0(Object state) at Avalonia.Threading.AvaloniaSynchronizationContext.<>c__DisplayClass5_0.b0() in //src/Avalonia.Base/Threading/AvaloniaSynchronizationContext.cs:line 33 at Avalonia.Threading.JobRunner.RunJobs(Nullable`1 priority) in //src/Avalonia.Base/Threading/JobRunner.cs:line 37 at Avalonia.Win32.Win32Platform.WndProc(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam) in //src/Windows/Avalonia.Win32/Win32Platform.cs:line 271 at Avalonia.Win32.Interop.UnmanagedMethods.DispatchMessage(MSG& lpmsg) at Avalonia.Win32.Win32Platform.RunLoop(CancellationToken cancellationToken) in //src/Windows/Avalonia.Win32/Win32Platform.cs:line 198 at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken) in //src/Avalonia.Base/Threading/Dispatcher.cs:line 61 at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args) in //src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 126 at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime[T](T builder, String[] args, ShutdownMode shutdownMode) in /_/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 175 at UABEAvalonia.Program.Main(String[] args) in D:\a\UABEA\UABEA\UABEAvalonia\Program.cs:line 47

I include the emip in case it helps.

Thank you in advance, and great work!!! hk-eu-es-202112261247.zip

ibaios commented 2 years ago

I forgot to mention that I am using the nightly build (but the same happened with the latest release)

nesrak1 commented 2 years ago

I made a dumb mistake in loading the emip file which has just been fixed in AssetsTools.NET (I don't use emips at all myself so they haven't gotten much testing). Any emip you've made so far should still work fine so you shouldn't need to redo it.

ibaios commented 2 years ago

Thank you! Now it works smoothly!