public void Write(TilesetModel tilesetModel, Stream stream) { TilesetJson json = new TilesetJson(tilesetModel); JsonSerializer serializer = new JsonSerializer(); serializer.Formatting = Formatting.Indented; serializer.NullValueHandling = NullValueHandling.Ignore; using (StreamWriter streamWriter = new StreamWriter(stream)) using (JsonWriter jsonWriter = new JsonTextWriter(streamWriter)) { serializer.Serialize(jsonWriter, json); } }
public TilesetModel Read(string path) { TilesetJson json = JsonConvert.DeserializeObject <TilesetJson>(File.ReadAllText(path)); return(json.Generate()); }