C
C#7d ago
Pavaris

✅ .ini file does not save the intended value

I've tried to save but it still does not save my value. File path is correct because when I click save the value became empty even though it had value before. I use Salaros Configuration package hense the configparser. For the full source code, it is right here at Github: https://github.com/PavarisP/FPS-Creator-Game-Launcher I'm new to C# and programming in general. Trying to make a launcher for my own game to let players to customize the settings in launcher instead of manually set in the ini file.
GitHub
GitHub - PavarisP/FPS-Creator-Game-Launcher
Contribute to PavarisP/FPS-Creator-Game-Launcher development by creating an account on GitHub.
No description
8 Replies
JakenVeina
JakenVeina7d ago
it still does not save my value.
You're gonna have to be more specific here. What exactly are you seeing in the output file? What value isn't being saved? All of them? Are they being written with empty values, or are the keys not even being written at all? looking at the API and source code for this library, I'd recommend breakpointing before the .Save() and inspecting .Lines on the parser. That should contain all the key/value pairs that will get written by .Save()
Pavaris
PavarisOP6d ago
The program works like this: 1) I have a dictionary like {"A":12,"B":48} 2) A dropdown menu with option A/B 3) When the player select A, the variable lets say Forward Ket is set to the definition of A in the dictionary as 12 4) when the player click save > save the definition (12) to the "key1" in the ini file. But instead of saving the value, it just remove the old one and replace with a blank. Seems like I can't pass the string into the ini file.
Jimmacle
Jimmacle6d ago
have you used the debugger to check that your variables have the values that you think they do?
Pavaris
PavarisOP6d ago
Yeah. I debugged and the value is still null.
JakenVeina
JakenVeina6d ago
what value?
Unknown User
Unknown User6d ago
Message Not Public
Sign In & Join Server To View
Pavaris
PavarisOP6d ago
I fixed it. Instead of set the value immediately when the combobox value changes. I set the variable "key" value to equal to the combobox when the button saved is clicked. Problem solved. Thank you guys.
MODiX
MODiX6d ago
If you have no further questions, please use /close to mark the forum thread as answered

Did you find this page helpful?