Last active
March 1, 2017 06:25
-
-
Save edg-l/94833ca935262888bcb85a9285d1239f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ConfigFile | |
{ | |
public int someconfig = 10; | |
public static ConfigFile Read(string path) | |
{ | |
if (!File.Exists(path)) | |
{ | |
ConfigFile config = new ConfigFile(); | |
File.WriteAllText(path, JsonConvert.SerializeObject(config, Formatting.Indented)); | |
return config; | |
} | |
return JsonConvert.DeserializeObject<ConfigFile>(File.ReadAllText(path)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment