diff --git a/src/UIOMaticAddons.Export/Configuration/UIOMaticConfiguration.cs b/src/UIOMaticAddons.Export/Configuration/UIOMaticConfiguration.cs new file mode 100644 index 0000000..4da91a5 --- /dev/null +++ b/src/UIOMaticAddons.Export/Configuration/UIOMaticConfiguration.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.Linq; +using System.Web; + +namespace UIOMaticAddons.Export.Configuration +{ + public class UIOMaticConfiguration + { + public static UIOMaticConfiguration FromWebConfig(NameValueCollection nameValueCollection) + { + try + { + return new UIOMaticConfiguration + { + Delimiter = nameValueCollection["iomatic:DelimeterKey"] + }; + } + catch (Exception ex) + { + throw new ApplicationException("Invalid settings in web.config", ex); + } + } + + public string Delimiter { get; set; } + } +} \ No newline at end of file diff --git a/src/UIOMaticAddons.Export/Controllers/ExportController.cs b/src/UIOMaticAddons.Export/Controllers/ExportController.cs index b6025af..263e73f 100644 --- a/src/UIOMaticAddons.Export/Controllers/ExportController.cs +++ b/src/UIOMaticAddons.Export/Controllers/ExportController.cs @@ -7,11 +7,17 @@ using Umbraco.Core.IO; using Umbraco.Web.Editors; using System.Text; +using UIOMaticAddons.Export.Configuration; namespace UIOMaticAddons.Export.Controllers { public class ExportController: UmbracoAuthorizedJsonController { + private readonly UIOMaticConfiguration _config; + public ExportController(UIOMaticConfiguration config) + { + _config = config; + } public object GetExport(string typeAlias) { var guid = Guid.NewGuid(); @@ -27,7 +33,7 @@ public object GetExport(string typeAlias) var data = os.GetAll(UIOMatic.Helper.GetUIOMaticTypeByAlias(typeAlias)); - csv.Configuration.Delimiter = ";"; + csv.Configuration.Delimiter = _config.Delimiter; //csv.Configuration.QuoteAllFields = true; csv.Configuration.HasHeaderRecord = true; diff --git a/src/UIOMaticAddons.Export/UIOMaticAddons.Export.csproj b/src/UIOMaticAddons.Export/UIOMaticAddons.Export.csproj index add9253..fb45eaa 100644 --- a/src/UIOMaticAddons.Export/UIOMaticAddons.Export.csproj +++ b/src/UIOMaticAddons.Export/UIOMaticAddons.Export.csproj @@ -485,6 +485,7 @@ + diff --git a/src/UIOMaticAddons.Export/Web.config b/src/UIOMaticAddons.Export/Web.config index ee6285c..0911ee6 100644 --- a/src/UIOMaticAddons.Export/Web.config +++ b/src/UIOMaticAddons.Export/Web.config @@ -48,6 +48,7 @@ + diff --git a/src/UIOMaticAddons.Export/bin/UIOMaticAddons.Export.dll.config b/src/UIOMaticAddons.Export/bin/UIOMaticAddons.Export.dll.config index ee6285c..7bb0127 100644 --- a/src/UIOMaticAddons.Export/bin/UIOMaticAddons.Export.dll.config +++ b/src/UIOMaticAddons.Export/bin/UIOMaticAddons.Export.dll.config @@ -48,6 +48,7 @@ +