Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc updates #22

Merged
merged 3 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions PCAxis.Core.UnitTest/PCAxis.Core.UnitTest.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

<PropertyGroup>
<RootNamespace>PCAxis.Core.UnitTest</RootNamespace>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net8.0</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.2" />
<PackageReference Include="MSTest.TestAdapter" Version="3.0.4" />
<PackageReference Include="MSTest.TestFramework" Version="3.0.4" />
<PackageReference Include="coverlet.collector" Version="6.0.0">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.3.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.3.1" />
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion PCAxis.Core.UnitTest/PXFileParserTest.vb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Namespace PCAxis.PX.Core.UnitTest
<TestMethod>
Sub ShouldReturnDescription()
'Arrange
Dim e As PXFileParser = New PXFileParser()
Dim e As New PXFileParser()

'Act
Dim testDesc As String = e.Description
Expand Down
53 changes: 29 additions & 24 deletions PCAxis.Core/Grouping/GroupRegistry.vb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))

''' <summary>
''' Contains loaded valuesets. Used to determine if a valueset file has been loaded into the registry or not.
Expand Down Expand Up @@ -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")

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions PCAxis.Core/Localization/PxResourceReader.vb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""
Expand Down
8 changes: 4 additions & 4 deletions PCAxis.Core/PCAxis.Core.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="log4net" Version="2.0.15" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<PackageReference Include="log4net" Version="2.0.17" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="MinVer" Version="4.3.0">
<PackageReference Include="MinVer" Version="5.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Configuration.ConfigurationManager" Version="7.0.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.0" />
<PackageReference Include="Ude.NetStandard" Version="1.2.0" />
</ItemGroup>

Expand Down