diff --git a/exporter.cs b/exporter.cs new file mode 100644 index 0000000..6f03c50 --- /dev/null +++ b/exporter.cs @@ -0,0 +1,19 @@ +using System.IO; + +namespace spplus; + +public static class ExportUtility +{ + public static void ExportToCSV(string filepath) + { + char separator = ','; + string header = $"SchuelerID{separator}Sem1{separator}Sem2{separator}Sem3{separator}Sem4"; + string output = header + "\n"; + foreach (var student in Settings.Instance.Students) + { + output += $"{student.ID}{separator}{student.Result[0]}{separator}{student.Result[1]}{separator}{student.Result[2]}{separator}{student.Result[3]}\n"; + } + + File.WriteAllText(filepath, output); + } +} \ No newline at end of file