returnnewProcessorResult<long>(0,false,$"Cannot delete the temporary file: '{e.Message}'. Hint: Is the ransomware protection enabled in your Windows system? If so, please make sure that the I18N Commander has write permission.");
// Happens, e.g. when the ransomware protection on Windows is active and
// the I18N commander is not on the exclusion list.
returnnewProcessorResult<long>(0,false,$"Cannot write the generator's result file: '{e.Message}'. Hint: Is the ransomware protection enabled in your Windows system? If so, please make sure that the I18N Commander has write permission.");
}
finally
{
if(File.Exists(pathTemp))
{
destBytesWritten=newFileInfo(pathTemp).Length;
if(destBytesWritten>0)
{
try
{
if(File.Exists(pathFinal))
File.Delete(pathFinal);
File.Move(pathTemp,pathFinal);
}
catch(IOExceptione)
{
// Happens when the file is still in use by the compiler, the IDE, etc.
// Depends on the timing, this happens sometimes. We ignore it, though.
returnnewProcessorResult<long>(0,false,$"Cannot move the generator's result file to the destination: '{issueFinal}'. Hint: Is the ransomware protection enabled in your Windows system? If so, please make sure that the I18N Commander has write permission.");
}
privatestaticstringEscape4CSV(stringtext)
{
if(string.IsNullOrWhiteSpace(text))
returnstring.Empty;
varsb=newStringBuilder(text.Length);
foreach(varcintext)
{
if(c=='"')
sb.Append(@"""""");// quoted double quote, i.e. prints ""