[feat:] csv-exporter (basic implementation)
This commit is contained in:
19
exporter.cs
Normal file
19
exporter.cs
Normal file
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user