Added gittignore and deleted unused folders
This commit is contained in:
@@ -1,6 +1,39 @@
|
||||
using System.Text.Json;
|
||||
using SzLib.DataObjects;
|
||||
|
||||
namespace SzLib;
|
||||
|
||||
public class SzParser(ISzFileManager szFileManager)
|
||||
public class SzParser
|
||||
{
|
||||
public readonly ISzFileManager FileManager = szFileManager;
|
||||
public readonly ISzFileManager FileManager;
|
||||
|
||||
private JsonSerializerOptions _jsonOptions = new()
|
||||
{
|
||||
WriteIndented = true,
|
||||
};
|
||||
|
||||
public SzParser(ISzFileManager szFileManager)
|
||||
{
|
||||
FileManager = szFileManager;
|
||||
}
|
||||
|
||||
public (string result, SzParseError error) SerializeDatasetToJson(SzDataset dataset)
|
||||
{
|
||||
try
|
||||
{
|
||||
var jsonString = JsonSerializer.Serialize(dataset, _jsonOptions);
|
||||
return (jsonString, SzParseError.None);
|
||||
}
|
||||
catch (JsonException e)
|
||||
{
|
||||
return ("", SzParseError.CouldNotSerialize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum SzParseError
|
||||
{
|
||||
None,
|
||||
CouldNotSerialize,
|
||||
GenericError,
|
||||
}
|
||||
Reference in New Issue
Block a user