Multiplayer icon indicating copy to clipboard operation
Multiplayer copied to clipboard

Use more `nameof` and use Harmony to access properties rather than methods

Open SokyranTheDragon opened this issue 1 year ago • 1 comments

String constant, wherever possible (assuming I haven't missed some), were replaced by the use of nameof.

Replaced places where properties are accessed with AccessTools.PropertyGetter or AccessTools.IndexerGetter, rather than AccessTools.Method by using get_ in the method name.

Also, I've changed array initialization to use collection expressions in SyncThingFilters class, since I was already modifying it.

SokyranTheDragon avatar Aug 26 '24 00:08 SokyranTheDragon

I've reverted change for m_RevealCursor, as it seems to sometimes cause errors

Not sure why (I've tried to clear my publicizer cache, etc.). It seems that, for me, Rider is refusing to acknowledge that this field is public. It still compiles fine and without any errors, however this causes annoying errors while working on the project.

So for the sake of safety (in case anyone else is going to encounter this issue) - I've decided to just revert this specific change.

On top of that, one thing I did not consider at the time - rather than using reflection, we could have just replaced this with te.m_RevealCursor = true (if there was no issue after publicizing).

SokyranTheDragon avatar Aug 26 '24 22:08 SokyranTheDragon