Index: ActiviteitenOpvolging/ActiviteitenOpvolging/configs/ConfigsTextmapper.vb =================================================================== diff -u -r1667 -r1668 --- ActiviteitenOpvolging/ActiviteitenOpvolging/configs/ConfigsTextmapper.vb (.../ConfigsTextmapper.vb) (revision 1667) +++ ActiviteitenOpvolging/ActiviteitenOpvolging/configs/ConfigsTextmapper.vb (.../ConfigsTextmapper.vb) (revision 1668) @@ -1,4 +1,5 @@ Imports System.IO +Imports System.Text.RegularExpressions Namespace configs @@ -12,7 +13,7 @@ ''' ''' List of every line from the config. Public Function GetAllValues(configFilePath As String) As List(Of String) - If configFilePath Is Nothing orelse configFilePath.Equals(String.Empty) Then + If configFilePath Is Nothing OrElse configFilePath.Equals(String.Empty) Then 'Empty path is not allowed. Throw New InternalException("The path to the config file can't be empty for fetching all the lines of the config file.") End If @@ -25,6 +26,10 @@ Try 'File exists, read all text. Dim allText As String = My.Computer.FileSystem.ReadAllText(configFilePath) + + 'Text between two 'µ' gets converted to one line. + allText = ConvertMultiLineToSingleLine(allText) + 'Seperate into lines. Dim lines As String() = allText.Split(New String() {Environment.NewLine}, StringSplitOptions.None) @@ -41,5 +46,29 @@ End Try End Function + ''' + ''' Text between two 'µ' gets converted to one line. + ''' + ''' + ''' + Private Function ConvertMultiLineToSingleLine(allText As String) As String + 'Invoke the Match method, all text between and including the 'µ'. + Dim m As Match = Regex.Match(allText, "µ.*µ") + + If (m.Success) Then + 'If successful, overwrite each multiline from the groups as one line, without the seperator symbols 'µ'. + For Each group In m.Groups + 'Remove newLines. + Dim onelineString = group.Value.Replace(vbCr, String.Empty).Replace(vbLf, String.Empty) + 'Remove special characters. + onelineString = onelineString.Replace("µ", String.Empty) + 'Overwrite multiline entry in text. + allText = allText.Replace(m.Value, onelineString) + Next + End If + + 'Return the probably changed text. + Return allText + End Function End Class -End NameSpace \ No newline at end of file +End Namespace \ No newline at end of file