[chore:] logging for CsvBuilder.cs
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -64,6 +65,8 @@ public class CsvBuilder
|
|||||||
}
|
}
|
||||||
|
|
||||||
private string EscapeCsvField(string? value)
|
private string EscapeCsvField(string? value)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
var field = value ?? string.Empty;
|
var field = value ?? string.Empty;
|
||||||
var mustQuote = field.Contains(Separator) || field.Contains('"') || field.Contains('\r') || field.Contains('\n');
|
var mustQuote = field.Contains(Separator) || field.Contains('"') || field.Contains('\r') || field.Contains('\n');
|
||||||
@@ -72,4 +75,12 @@ public class CsvBuilder
|
|||||||
|
|
||||||
return "\"" + field.Replace("\"", "\"\"") + "\"";
|
return "\"" + field.Replace("\"", "\"\"") + "\"";
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.Log($"Error while escapting csv field: {ex.Message}",Logger.LogType.Warning);
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user