public void create_json_file() // If there is no settings.json (example First Start) it will create a new Json file { appSettings json = new appSettings(); json.gamepath = @"C:\Program Files (x86)\Steam\steamapps\common\Arma 3\arma3.exe"; // Standard Path json.param = "-YourParamsHere"; // Standard Params json.checkBoxParams = ""; json.mode = "dark"; string jsonString = JsonConvert.SerializeObject(json); // Converts the "appSettings" Class to string File.WriteAllText(path, jsonString); }
public void save_json_file(string param, string gamepath, string extra, string Mode) // Saves the Json { appSettings json = new appSettings(); json.gamepath = gamepath; json.param = param; json.checkBoxParams = extra; json.mode = Mode; string jsonString = JsonConvert.SerializeObject(json); File.WriteAllText(path, jsonString); }
public jsonparser(string pfad) { path = pfad; if (!check()) { create_json_file(); settingsJSON = load_json_file(); } else { settingsJSON = load_json_file(); } settings = JsonConvert.DeserializeObject <appSettings>(settingsJSON); }