static public LevelFile deserializeFromFile(string filename) { string text = System.IO.File.ReadAllText(filename); LevelFile result = JsonConvert.DeserializeObject <LevelFile>(text); return(result); }
private void buttonLevelEditor_Click(object sender, EventArgs e) { LevelFile level = new LevelFile(); level.serializeToFile("test.json"); LevelFile levelCopy = LevelFile.deserializeFromFile("test.json"); levelCopy.serializeToFile("test2.json"); }