diff --git a/PCAxis.Core.UnitTest/PCAxis.Core.UnitTest.vbproj b/PCAxis.Core.UnitTest/PCAxis.Core.UnitTest.vbproj index 3fe0696..023b67a 100644 --- a/PCAxis.Core.UnitTest/PCAxis.Core.UnitTest.vbproj +++ b/PCAxis.Core.UnitTest/PCAxis.Core.UnitTest.vbproj @@ -2,16 +2,16 @@ PCAxis.Core.UnitTest - netcoreapp3.1 + net8.0 false - - - - + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/PCAxis.Core.UnitTest/PXFileParserTest.vb b/PCAxis.Core.UnitTest/PXFileParserTest.vb index fd6abff..93701c7 100644 --- a/PCAxis.Core.UnitTest/PXFileParserTest.vb +++ b/PCAxis.Core.UnitTest/PXFileParserTest.vb @@ -7,7 +7,7 @@ Namespace PCAxis.PX.Core.UnitTest Sub ShouldReturnDescription() 'Arrange - Dim e As PXFileParser = New PXFileParser() + Dim e As New PXFileParser() 'Act Dim testDesc As String = e.Description diff --git a/PCAxis.Core/Grouping/GroupRegistry.vb b/PCAxis.Core/Grouping/GroupRegistry.vb index b7a2da8..b2749be 100644 --- a/PCAxis.Core/Grouping/GroupRegistry.vb +++ b/PCAxis.Core/Grouping/GroupRegistry.vb @@ -57,7 +57,7 @@ Namespace PCAxis.Paxiom While n >= (bufferSize - 2) 'Buffer was to small. Grow buffer and read again - bufferSize = bufferSize + BUFFER_SIZE + bufferSize += BUFFER_SIZE data = New String(" "c, bufferSize) n = GetPrivateProfileString(sectionName, keyName, defaultValue, data, data.Length, path) End While @@ -116,8 +116,8 @@ Namespace PCAxis.Paxiom Private Shared _groupRegistry As GroupRegistry Private _groupingsLoaded As Boolean = False - Private _groupingDir As String - Private _logger As log4net.ILog = log4net.LogManager.GetLogger(GetType(GroupRegistry)) + Private ReadOnly _groupingDir As String + Private ReadOnly _logger As log4net.ILog = log4net.LogManager.GetLogger(GetType(GroupRegistry)) ''' ''' Contains loaded valuesets. Used to determine if a valueset file has been loaded into the registry or not. @@ -428,15 +428,15 @@ Namespace PCAxis.Paxiom Try 'Is the valueset with this path already added to the registry? If Not valuesetDict.ContainsKey(f.FullName) Then - vs = New Valueset() - '1. Set Valueset metadata + '2. Add values to valueset '-------------------------- - vs.Name = ini.Read(f.FullName, "descr", "name").ToLower() - vs.Prestext = ini.Read(f.FullName, "descr", "prestext") + vs = New Valueset With { + .Name = ini.Read(f.FullName, "descr", "name").ToLower(), + .Prestext = ini.Read(f.FullName, "descr", "prestext") + } + - '2. Add values to valueset - '--------------------------- col1 = ini.GetAllKeysInSection(f.FullName, "valuecode") col2 = ini.GetAllKeysInSection(f.FullName, "valuetext") @@ -472,16 +472,18 @@ Namespace PCAxis.Paxiom If (_strict = False) Or (valuesetName.Equals(vs.Name)) Then 'Get name from the .agg file groupingName = ini.Read(groupingPath, "aggreg", "name") - gi = New GroupingInfo(grouping) - gi.Name = groupingName 'Always use aggregated values for PX-file groupings - gi.GroupPres = GroupingIncludesType.AggregatedValues + gi = New GroupingInfo(grouping) With { + .Name = groupingName, + .GroupPres = GroupingIncludesType.AggregatedValues + } vs.Groupings.Add(gi) - giMeta = New GroupingInfoMeta - giMeta.Valueset = vs - giMeta.Path = groupingPath - giMeta.DefaultDirectory = defaultDirectory + giMeta = New GroupingInfoMeta With { + .Valueset = vs, + .Path = groupingPath, + .DefaultDirectory = defaultDirectory + } 'Add to groupingInfoMeta dictionary groupingInfoMetaDict.Add(gi, giMeta) @@ -515,8 +517,9 @@ Namespace PCAxis.Paxiom _logger.Info(domain & " already loaded for " & vsPath) End If Else - vsDict = New Dictionary(Of String, Valueset) - vsDict.Add(vsPath, vs) + vsDict = New Dictionary(Of String, Valueset) From { + {vsPath, vs} + } domainsDict.Add(domain, vsDict) End If Next @@ -569,7 +572,7 @@ Namespace PCAxis.Paxiom 'Add code and value to the valueset vs.Values.Add(code, value) - i = i + 1 + i += 1 Loop End Using Catch e As Exception @@ -711,15 +714,17 @@ Namespace PCAxis.Paxiom 'Add groups to the grouping groupCodeKeys = ini.GetAllKeysInSection(path, "aggtext") For Each groupCodeKey As String In groupCodeKeys - group = New Group - group.GroupCode = ini.Read(path, "aggreg", groupCodeKey) - group.Name = ini.Read(path, "aggtext", groupCodeKey) + group = New Group With { + .GroupCode = ini.Read(path, "aggreg", groupCodeKey), + .Name = ini.Read(path, "aggtext", groupCodeKey) + } 'Add childcodes to the group childCodeKeys = ini.GetAllKeysInSection(path, group.GroupCode) For Each childCodeKey As String In childCodeKeys - Dim child As New GroupChildValue - child.Code = ini.Read(path, group.GroupCode, childCodeKey) + Dim child As New GroupChildValue With { + .Code = ini.Read(path, group.GroupCode, childCodeKey) + } If giMeta.Valueset.Values.TryGetValue(child.Code, child.Name) Then group.ChildCodes.Add(child) End If diff --git a/PCAxis.Core/Localization/PxResourceReader.vb b/PCAxis.Core/Localization/PxResourceReader.vb index 18aab5f..ce33a91 100644 --- a/PCAxis.Core/Localization/PxResourceReader.vb +++ b/PCAxis.Core/Localization/PxResourceReader.vb @@ -15,10 +15,10 @@ Namespace PCAxis.Paxiom.Localization Implements IResourceReader - Private Shared _logger As log4net.ILog = log4net.LogManager.GetLogger(GetType(PxResourceReader)) + Private Shared ReadOnly _logger As log4net.ILog = log4net.LogManager.GetLogger(GetType(PxResourceReader)) - Private _culture As String = "" - Private _basename As String = "" + Private ReadOnly _culture As String = "" + Private ReadOnly _basename As String = "" Private _validXML As Boolean = True Private Shared _languagePath As String = "" diff --git a/PCAxis.Core/PCAxis.Core.vbproj b/PCAxis.Core/PCAxis.Core.vbproj index dd3bb26..8d834cd 100644 --- a/PCAxis.Core/PCAxis.Core.vbproj +++ b/PCAxis.Core/PCAxis.Core.vbproj @@ -34,16 +34,16 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive - +