nesrak1 / UABEA

c# uabe for newer versions of unity
MIT License
1.1k stars 143 forks source link

Unable to save, throw System.IO.IOException: Stream was too long. #244

Closed ob2code closed 1 year ago

ob2code commented 1 year ago

Hello. When I try to save after importing or editing data with data.unity3d file (decompressed file nearly 6GB), the application throw this message below and the file doesn't update anything.

screenshot_1683390239

File link: https://1drv.ms/u/s!Ah9obHc_yBz_gQsln9Ac3tQkbEQD?e=M3xrr5

There was a problem while writing the file: System.IO.IOException: Stream was too long. at System.IO.MemoryStream.Write(Byte[] buffer, Int32 offset, Int32 count) at AssetsTools.NET.Extra.Net35Polyfill.CopyToCompat(Stream input, Stream output, Int64 bytes, Int32 bufferSize) at AssetsTools.NET.AssetsFile.Write(AssetsFileWriter writer, Int64 filePos, List1 replacers, ClassDatabaseFile typeMeta) at UABEAvalonia.InfoWindow.SaveFile(Boolean saveAs) in D:\a\UABEA\UABEA\UABEAvalonia\InfoWindow.axaml.cs:line 509`

nesrak1 commented 1 year ago

This is a limitation of .NET's byte arrays and memory streams having a 2GB limit. You can avoid this by clicking "export all" in the bundle window, opening the files on disk and making changes there, then clicking "import all" and selecting the folder. This avoids ever having to keep the entire file in memory at once.

ob2code commented 1 year ago

It works. Thank you very much!