public Exercice getOrAddExercice(string name) { var exercice = Exercices.Find((e) => e.Name == name); if (exercice == null) { Dirty = true; exercice = new Exercice(name); Exercices.Add(exercice); } return(exercice); }
public AudioFile SetImportedName(Student s, Exercice e) { ImportedName = s.Name + "." + DateTime.Now.ToString(dateFormat) + "." + File.Name; ImportedName = Path.Combine(e.Name, ImportedName); return(this); }
public void Import(string student, string ex, USBDrive drive) { var files = drive.AudioFiles; Student s = persisted.getOrAddStudent(student); Exercice e = persisted.getOrAddExercice(ex); SavePersistedData(); files .Where((AudioFile a) => a.Selected).ToList() .Select((AudioFile a) => a.SetImportedName(s, e)).ToList() .ForEach((AudioFile a) => ImportFile(a)); drive.Refresh(); ScanImported(); }