Vereinsmeisterschaften  22aa7800eae54b428d40e835886cefe1fdefdfdf
This is a software that can be used to manage the internal competition of the swimming club Illertissen called "Vereinsmeisterschaften".
Loading...
Searching...
No Matches
IFileService.cs
1using System.Runtime.CompilerServices;
2
4
8public interface IFileService
9{
17 T Read<T>(string folderPath, string fileName);
18
26 void Save<T>(string folderPath, string fileName, T content);
27
33 void Delete(string folderPath, string fileName);
34
46 void SaveToCsv<T>(string filePath, List<T> dataList, CancellationToken cancellationToken, ProgressDelegate onProgress = null, FormatDataDelegate formatData = null, FormatDataHeaderDelegate formatDataHeader = null, char delimiter = ';');
47
59 List<T> LoadFromCsv<T>(string filePath, CancellationToken cancellationToken, SetPropertyFromStringDelegate<T> setPropertyFromStringDelegate, ProgressDelegate onProgress = null, FindPropertyFromHeaderDelegate findPropertyFromHeader = null, char delimiter = ';') where T : new();
60}
61
66[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
67public class FileServiceIgnoreAttribute : Attribute
68{
69}
70
75[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
76public class FileServiceOrderAttribute : Attribute
77{
81 public int Order { get; }
82
87 public FileServiceOrderAttribute([CallerLineNumber] int order = 0)
88 {
89 Order = order;
90 }
91}
92
Use this attribute to decorate elements that should not be saved to a file.
FileServiceOrderAttribute([CallerLineNumber] int order=0)
Constructor of the FileServiceOrderAttribute.
Interface for a service that handles file operations.
void SaveToCsv< T >(string filePath, List< T > dataList, CancellationToken cancellationToken, ProgressDelegate onProgress=null, FormatDataDelegate formatData=null, FormatDataHeaderDelegate formatDataHeader=null, char delimiter=';')
Save the given data list to a .csv file.
void Delete(string folderPath, string fileName)
Delete the given file.
T Read< T >(string folderPath, string fileName)
Read the given file and deserialize it to the given type.
void Save< T >(string folderPath, string fileName, T content)
Save the given object to a file.
List< T > LoadFromCsv< T >(string filePath, CancellationToken cancellationToken, SetPropertyFromStringDelegate< T > setPropertyFromStringDelegate, ProgressDelegate onProgress=null, FindPropertyFromHeaderDelegate findPropertyFromHeader=null, char delimiter=';')
Load the .csv file to a list of data.
delegate void SetPropertyFromStringDelegate< T >(T dataObj, string propertyName, string value)
Delegate to change a specific property in the data object.
delegate void ProgressDelegate(object sender, float progress, string currentStep="")
Delegate void for progress changes.
delegate string FormatDataHeaderDelegate(string header, Type type)
Delegate to format data headers.
delegate string FindPropertyFromHeaderDelegate(string header)
Delegate to find propety name by localized header string.
delegate string FormatDataDelegate(object data, object parentObject, PropertyInfo currentProperty)
Delegate to format data.