public PlaytimeLoggingIntegration(Player player) { this.player = player; player.SongChanged += Player_SongChanged; filePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "FRESHMusicPlayer", "Tracking"); trackingFile = Read(); LoggingHandler.Log("Playtime Logging: Starting!"); }
private void Write(TrackingFile trackingFile) { if (!Directory.Exists(filePath)) { Directory.CreateDirectory(filePath); } using (StreamWriter file = File.CreateText(Path.Combine(filePath, "tracking.json"))) { new JsonSerializer().Serialize(file, trackingFile); } }