KnossosNET / Knossos.NET

Repository for the Knossos.NET launcher, currently in development.
GNU General Public License v3.0
21 stars 10 forks source link

Create debug filters window #170

Closed JohnAFernandez closed 3 months ago

JohnAFernandez commented 3 months ago

Ok, this is probably my most extensive use of c# yet, so please review carefully. What this does is use our general resources repo to load debug filters that adjust the fs2open.ini output. I created a new window to save and load the options and have KNet save the choices to every TC. It would be nice if this file were in Userdata so that we wouldn't have to save it over and over, but for the sake of backwards compatibility, we have to write it to each TC anyway.

This is tested and seems to work.

Fixes #165

notimaginative commented 3 months ago

FSO only uses the file from user data. There is no mod version at all. The debug filter is loaded first thing when the log file is opened and the concept of mods does not exist at that point.

So similar to the log file, the filter should only be used via Path.combine(KnUtils.GetFSODataFolderPath(), "data", "debug_filter.cfg").

JohnAFernandez commented 3 months ago

Thanks, I didn't think to check for that kind of situation. I'm testing with a change to only this folder now.

notimaginative commented 3 months ago

Looks good and works good from what I can tell. Just that compiler warning is the only real issue I noticed.

However, is it necessary to add a button to both the Settings and Debug tabs? Seems like just the Settings one should be enough.

And maybe change the name to "Adjust Debug Log Filters", or similar, as opposed to having the name of the debug log file itself on there?

JohnAFernandez commented 3 months ago

My instinct is that either place would be a natural place for a user to go when they are looking to change their debug filters. Similar to #171, it's nice to have a few different places that can access a feature so that navigating the UI can take less headspace, and it's easy to add and maintain the button in the two different places since they just open a new window, and the window is where the filters and logic are actually managed.

That name change is a good suggestion.

JohnAFernandez commented 3 months ago

Ok, at least according to this youtube video, https://www.youtube.com/watch?v=2moh18sh5p4, we can use Task.Run with a lambda expression. I think this might be the "lazy" method that Shivan mentioned when we ran into that Call stack bug a while back. Since this should be pretty simple and just needs to run the Json parser asynchronously, I think it will be fine.

notimaginative commented 3 months ago

Gave it another run-through and it's working good.