public List <WorkoutPlaylist> LoadAllWorkoutPlaylistsFromDisk() { List <WorkoutPlaylist> workoutPlaylistList = new List <WorkoutPlaylist>(); if (Directory.Exists(this.playlistsPath)) { foreach (string visibleFile in Tools.IO.GetVisibleFiles(this.playlistsPath, "*.workoutplaylist.txt")) { WorkoutPlaylist workoutPlaylist = new WorkoutPlaylist(); string jsonString = File.ReadAllText(visibleFile); workoutPlaylist.LoadFromJSON(jsonString); workoutPlaylistList.Add(workoutPlaylist); } } return(workoutPlaylistList); }
private void LoadFromDataPath() { if (Directory.Exists(this.currentpath)) { foreach (FileSystemInfo file in new DirectoryInfo(this.currentpath).GetFiles("*.txt")) { WorkoutPlaylist workoutPlaylist = new WorkoutPlaylist(); string jsonString = File.ReadAllText(file.FullName); workoutPlaylist.LoadFromJSON(jsonString); if (!this.workoutList.Contains(workoutPlaylist)) { this.workoutList.Add(workoutPlaylist); } } this.workoutList.Sort((Comparison <WorkoutPlaylist>)((p1, p2) => p1.definition.duration.CompareTo(p2.definition.duration))); } this.workoutsLoaded = true; }