bbepis / XUnity.AutoTranslator

MIT License
1.74k stars 271 forks source link

problem with config ini parameters #78

Open TokcDK opened 4 years ago

TokcDK commented 4 years ago

Randomly found some problem when XUAT creating duplicates of parameters in ini.

For exaple I changed parameter Endpoint=GoogleTranslate to Endpoint = GoogleTranslate and with this spaces it still will be valid ini but XUAT when will be executed in game will not chane but will create Endpoint=GoogleTranslate right after Endpoint = GoogleTranslate and section will be looking like this:

[Service]
Endpoint = GoogleTranslate
Endpoint=GoogleTranslate
gravydevsupreme commented 4 years ago

The configuration file in this plugin has always been a bit pedantic. The library used for .ini file handling considers all characters significant, even white space. This is true for both key and value, which means that in your example case:

Which is why it creates a new valid configuration line, as though the line you changed did not exist.

So why this library? Well primarily because when I initially made the first version of the plugin available (1.0.0), back when Koikatsu chara maker was first released, I thought UnityInjector was far superior to IPA, so I aligned this library more closely to UnityInjector by using its configuration library (ExIni.dll). This was easy because the library was not tightly coupled to the plugin manager (UnityInjector) itself, whereas the configuration system in IPA was.

Fast-forward a couple of years and who cares about UnityInjector and IPA now that we have BepInEx? Well, the BepInEx configuration system is certainly a whole lot better, but like IPA, it is tightly coupled to BepInEx itself, which is really a shame, as it really doesn't need to be. But that is kind of a problem for this plugin as it can be and indeed is used with many different plugin managers.

I could of course just toss ExIni.dll and find a better library that is compatible with Unity's old Mono to handle this, but I am not sure effort required to do this is worth the hassle. ^_^

As such, a fix for this particular problem is probably not right around the corner, but thanks for the report. :)

TokcDK commented 4 years ago

Understood. As I known ExIni has git repository and can be edited for XUA if need. I also used Exini some time but found there several problems when was impossible to read some parameters and other issues and after just started use stable version of iniparser.