From cbb704bc99aee60987cdd00910322620fdb137e9 Mon Sep 17 00:00:00 2001 From: Deyan Nenov Date: Tue, 9 Apr 2024 14:55:54 +0100 Subject: [PATCH] revert rebased changes --- src/Libraries/DSOffice/CSVNodes.cs | 27 ++++++++++++++++++-------- src/Libraries/DSOffice/DSOffice.csproj | 14 +++++++++++++ 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/src/Libraries/DSOffice/CSVNodes.cs b/src/Libraries/DSOffice/CSVNodes.cs index 45b22ff930b..4f4e8c31f52 100644 --- a/src/Libraries/DSOffice/CSVNodes.cs +++ b/src/Libraries/DSOffice/CSVNodes.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using DSOffice.Properties; namespace DSOffice { @@ -20,20 +21,30 @@ public static partial class Data /// write,text,file public static void ExportCSV(string filePath, object[][] data) { - using (var writer = new StreamWriter(DSCore.IO.FileSystem.AbsolutePath(filePath))) + try { - foreach (var line in data) + using (var writer = new StreamWriter(DSCore.IO.FileSystem.AbsolutePath(filePath))) { - int count = 0; - foreach (var entry in line) + foreach (var line in data) { - writer.Write(entry); - if (++count < line.Length) - writer.Write(","); + int count = 0; + foreach (var entry in line) + { + writer.Write(entry); + if (++count < line.Length) + writer.Write(","); + } + writer.WriteLine(); } - writer.WriteLine(); } } + catch (Exception ex) + { + if (ex is DirectoryNotFoundException) + throw new Exception(Resources.StreamWriterNotFoundException); + else + throw; + } } /// diff --git a/src/Libraries/DSOffice/DSOffice.csproj b/src/Libraries/DSOffice/DSOffice.csproj index d01d11d7444..3041e7addb3 100644 --- a/src/Libraries/DSOffice/DSOffice.csproj +++ b/src/Libraries/DSOffice/DSOffice.csproj @@ -26,6 +26,11 @@ + + True + True + Resources.resx + @@ -53,6 +58,15 @@ CoreNodes + + + ResXFileCodeGenerator + + + ResXFileCodeGenerator + Resources.Designer.cs + +