Guest Posted June 2, 2016 Share Posted June 2, 2016 Hello everyone! I'm wondering how I'd load AND write to config files. I've loaded the up before, but I need to be able to write certain values, and create new config files. Thanks. Link to comment Share on other sites More sharing options...
Crzyrndm Posted June 3, 2016 Share Posted June 3, 2016 (edited) Loading assuming nodes are in GameData but not PluginData (ie. preloaded by KSP): https://github.com/Crzyrndm/Pilot-Assistant/blob/master/PilotAssistant/PresetManager.cs#L99 Loading direct from file (eg. files inside PluginData that aren't preloaded): https://github.com/Crzyrndm/FilterExtension/blob/master/FilterExtension/Settings.cs#L58-L60 Saving: https://github.com/Crzyrndm/FilterExtension/blob/master/FilterExtension/Settings.cs#L89-L91 Or: https://github.com/Crzyrndm/Pilot-Assistant/blob/master/PilotAssistant/PresetManager.cs#L157 Edited June 3, 2016 by Crzyrndm Link to comment Share on other sites More sharing options...
Warezcrawler Posted June 11, 2016 Share Posted June 11, 2016 On 3/6/2016 at 2:22 AM, Crzyrndm said: Loading assuming nodes are in GameData but not PluginData (ie. preloaded by KSP): https://github.com/Crzyrndm/Pilot-Assistant/blob/master/PilotAssistant/PresetManager.cs#L99 Loading direct from file (eg. files inside PluginData that aren't preloaded): https://github.com/Crzyrndm/FilterExtension/blob/master/FilterExtension/Settings.cs#L58-L60 Saving: https://github.com/Crzyrndm/FilterExtension/blob/master/FilterExtension/Settings.cs#L89-L91 Or: https://github.com/Crzyrndm/Pilot-Assistant/blob/master/PilotAssistant/PresetManager.cs#L157 This is great. But why are the methods "static"? public static void LoadSettings() public static void LoadSettings() What does that add here I'm wondering? I'm sure it has it reasons, just want to understand it's significans Link to comment Share on other sites More sharing options...
Diazo Posted June 11, 2016 Share Posted June 11, 2016 static is a C# keyword meaning that only one instance of that class can exist. https://msdn.microsoft.com/en-CA/library/79b3xss3.aspx In this case it's being used so other classes can call the LoadSettings method without having to get a reference to the Settings class instance first. D. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now