nesrak1 / UABEA

c# uabe for newer versions of unity
MIT License
1.05k stars 135 forks source link

Save overwrite doesn't check if other processes lock the file for modification #265

Open theman12222 opened 1 year ago

theman12222 commented 1 year ago

Whenever i try saving a file, it saves to around 300 kilobytes then the Message box says There was a problem while writing the file: System.ObjectDisposedException: Cannot access a closed Stream. at System.IO.Strategies.BufferedFileStreamStrategy.Seek(Int64 offset, SeekOrigin origin) at System.IO.FileStream.set_Position(Int64 value) at AssetsTools.NET.AssetsFileReader.set_Position(Int64 value) at AssetsTools.NET.AssetsFile.Write(AssetsFileWriter writer, Int64 filePos, List`1 replacers, ClassDatabaseFile typeMeta) at UABEAvalonia.InfoWindow.SaveFile(Boolean saveAs) in D:\a\UABEA\UABEA\UABEAvalonia\InfoWindow.axaml.cs:line 576 If it helps i'm attempting to edit one of the textures for yandere simulator, but it loads the files just fine so i don't see why it shouldn't be able to save them. Please help. sorry the video is low quality

https://github.com/nesrak1/UABEA/assets/112595465/7fa70b38-f010-43cb-86ec-1c324c2d0358

nesrak1 commented 1 year ago

I can't tell because the recording is so low res, but is this a bundle or assets file you opened? (Looks like assets file but not sure.) Did you close the starting window? I only see a preview of the asset info window open.

theman12222 commented 1 year ago

I have a higher quality recording. It's an asset file, i didn't close the starting window.

https://github.com/nesrak1/UABEA/assets/112595465/d3b146df-b9c7-444c-a8f2-e0078b9afd71

nesrak1 commented 1 year ago

You've tried restarting and this still happens? Can you list the steps you did?

theman12222 commented 1 year ago

Yes, i've restarted and it still does it. I open a sharedassets file, edit one of the textures, then attempt to save it and every time it does that. I tried installing the nightly version before opening this and it still did the same thing

nesrak1 commented 1 year ago

Are you using save or save as initially?

I'm trying to reproduce this with save and save as, even with the files being in a separate folder like in the video, but I can't get that closed stream error.

theman12222 commented 1 year ago

I tried save initially but then it just said There was a problem while writing the file: System.IO.IOException: The process cannot access the file 'C:\Users\Pcadm\Downloads\latest\YandereSimulator_Data\resources.assets' because it is being used by another process. at System.IO.FileSystem.DeleteFile(String fullPath) at System.IO.File.Delete(String path) at UABEAvalonia.InfoWindow.SaveFile(Boolean saveAs) in D:\a\UABEA\UABEA\UABEAvalonia\Forms\InfoWindow.axaml.cs:line 587

nesrak1 commented 1 year ago

The regular save option will try to delete and replace the file. It sounds like there's another program that has it open still. Sometimes if you delete it yourself it will say This file can't be deleted because it's still open in XXX, where XXX is hopefully the name of the program and not "another application".

theman12222 commented 1 year ago

Oh yeah i'm just dumb, i had AssetStudio open while i was trying to save it lol. Thanks

nesrak1 commented 1 year ago

I'll still want to fix this so I'm reopening it.

theman12222 commented 1 year ago

Alright i gotchu