Skip to content
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
5 changes: 2 additions & 3 deletions .github/workflows/build-status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ on:
push:
branches:
- master
env:
DOTNET_VERSION: '6.0.x'

jobs:
build-and-test:
name: Build And Test ${{matrix.os}}
Expand All @@ -18,7 +17,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
global-json-file: global.json

- name: Restore nHapi (Windows)
if: matrix.os == 'windows-latest'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ jobs:
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
category: "/language:${{matrix.language}}"
5 changes: 2 additions & 3 deletions .github/workflows/receive-pr.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
name: Receive Pull Request

on: [pull_request]
env:
DOTNET_VERSION: '6.0.x'

jobs:
build-and-test:
name: Build And Test ${{matrix.os}}
Expand All @@ -16,7 +15,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
global-json-file: global.json

- name: Restore nHapi (Windows)
if: matrix.os == 'windows-latest'
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "6.0.101",
"version": "6.0.404",
"rollForward": "latestFeature"
},
"projects": []
Expand Down
9 changes: 2 additions & 7 deletions src/NHapi.Base/Model/AbstractGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,11 @@ namespace NHapi.Base.Model
/// </author>
public abstract class AbstractGroup : IGroup
{
private static readonly IHapiLog Log;
private static readonly IHapiLog Log = HapiLogFactory.GetHapiLog(typeof(AbstractGroup));

private readonly IModelClassFactory myFactory;
private List<AbstractGroupItem> items;

static AbstractGroup()
{
Log = HapiLogFactory.GetHapiLog(typeof(AbstractGroup));
}

/// <summary> This constructor should be used by implementing classes that do not
/// also implement Message.
///
Expand Down Expand Up @@ -527,7 +522,7 @@ private IStructure TryToInstantiateStructure(Type c, string name)
var argClasses = new[] { typeof(IGroup), typeof(IModelClassFactory) };
var argObjects = new object[] { this, myFactory };
var con = c.GetConstructor(argClasses);
o = con.Invoke(argObjects);
o = con!.Invoke(argObjects);
}
catch (MethodAccessException)
{
Expand Down
8 changes: 4 additions & 4 deletions src/NHapi.Base/Model/AbstractPrimitive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ public AbstractPrimitive(IMessage message, string description)
{
}

/// <summary> Sets the value of this Primitive, first performing validation as specified
/// by. <code>getMessage().getValidationContext()</code>. No validation is performed
/// if getMessage() returns null.
///
/// <summary>
/// Sets the value of this Primitive, first performing validation as specified
/// by. <see cref="AbstractMessage.ValidationContext">Message.ValidationContext</see>
/// No validation is performed if <see cref="AbstractType.Message"/> returns null.
/// </summary>
public virtual string Value
{
Expand Down
21 changes: 5 additions & 16 deletions src/NHapi.Base/Model/GenericComposite.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace NHapi.Base.Model
{
using System.Collections;
using System.Collections.Generic;

/// <summary>
/// An unspecified Composite datatype that has an undefined number of components, each
Expand All @@ -11,7 +12,7 @@ namespace NHapi.Base.Model
/// <author>Bryan Tripp.</author>
public class GenericComposite : AbstractType, IComposite
{
private readonly ArrayList components;
private readonly List<IType> components;

/// <summary>
/// Creates a new instance of GenericComposite.
Expand All @@ -30,25 +31,13 @@ public GenericComposite(IMessage theMessage)
public GenericComposite(IMessage theMessage, string description)
: base(theMessage, description)
{
components = new ArrayList(20);
components = new List<IType>(20);
}

/// <summary>
/// Returns an array containing the components of this field.
/// </summary>
public virtual IType[] Components
{
get
{
var ret = new IType[components.Count];
for (var i = 0; i < ret.Length; i++)
{
ret[i] = (IType)components[i];
}

return ret;
}
}
public virtual IType[] Components => components.ToArray();

/// <summary>
/// Returns the name of the type (used in XML encoding and profile checking).
Expand All @@ -68,7 +57,7 @@ public virtual IType this[int index]
components.Add(new Varies(Message));
}

return (IType)components[index];
return components[index];
}
}
}
Expand Down
18 changes: 7 additions & 11 deletions src/NHapi.Base/Model/Primitive/CommonTM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,11 @@ public virtual string Value
{
// check to see if any of the following characters exist: "." or "+/-"
// this will help us determine the acceptable lengths
var d = value.IndexOf(".");
var sp = value.IndexOf("+");
var sm = value.IndexOf("-");
var d = value.IndexOf(".", StringComparison.Ordinal);
var sp = value.IndexOf("+", StringComparison.Ordinal);
var sm = value.IndexOf("-", StringComparison.Ordinal);
var indexOfSign = -1;
var offsetExists = false;
if ((sp != -1) || (sm != -1))
{
offsetExists = true;
}
var offsetExists = (sp != -1) || (sm != -1);

if (sp != -1)
{
Expand Down Expand Up @@ -189,7 +185,7 @@ public virtual string Value
{
// The length of the GMT offset must be 5 characters (including the sign)
var msg = "The length of the TM datatype value does not conform to an allowable" +
" format. Format should conform to HH[MM[SS[.S[S[S[S]]]]]][+/-ZZZZ]";
" format. Format should conform to HH[MM[SS[.S[S[S[S]]]]]][+/-ZZZZ]";
var e = new DataTypeException(msg);
throw e;
}
Expand All @@ -201,7 +197,7 @@ public virtual string Value
if ((timeVal.Length < 8) || (timeVal.Length > 11))
{
var msg = "The length of the TM datatype value does not conform to an allowable" +
" format. Format should conform to HH[MM[SS[.S[S[S[S]]]]]][+/-ZZZZ]";
" format. Format should conform to HH[MM[SS[.S[S[S[S]]]]]][+/-ZZZZ]";
var e = new DataTypeException(msg);
throw e;
}
Expand All @@ -214,7 +210,7 @@ public virtual string Value
if ((timeVal.Length != 2) && (timeVal.Length != 4) && (timeVal.Length != 6))
{
var msg = "The length of the TM datatype value does not conform to an allowable" +
" format. Format should conform to HH[MM[SS[.S[S[S[S]]]]]][+/-ZZZZ]";
" format. Format should conform to HH[MM[SS[.S[S[S[S]]]]]][+/-ZZZZ]";
var e = new DataTypeException(msg);
throw e;
}
Expand Down
6 changes: 3 additions & 3 deletions src/NHapi.Base/Model/Primitive/CommonTS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ public virtual string Value
string dateVal = null;
string timeVal = null;
string timeValLessOffset = null;
var sp = value.IndexOf("+");
var sm = value.IndexOf("-");
var sp = value.IndexOf("+", StringComparison.Ordinal);
var sm = value.IndexOf("-", StringComparison.Ordinal);
var indexOfSign = -1;
var offsetExists = false;
var timeValIsOffsetOnly = false;
Expand Down Expand Up @@ -310,7 +310,7 @@ public virtual string Value
tm = new CommonTM();

// first extract the + sign from the offset value string if it exists
if (timeVal.IndexOf("+") == 0)
if (timeVal.IndexOf("+", StringComparison.Ordinal) == 0)
{
timeVal = timeVal.Substring(1);
} // end if
Expand Down
3 changes: 2 additions & 1 deletion src/NHapi.Base/NHapi.Base.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

<ItemGroup>
<InternalsVisibleTo Include="$(AssemblyName).NUnit" />
<InternalsVisibleTo Include="NHapi.NUnit" />
<InternalsVisibleTo Include="NHapi.SourceGeneration" />
</ItemGroup>

Expand Down Expand Up @@ -43,4 +44,4 @@
</PackageReference>
</ItemGroup>

</Project>
</Project>
7 changes: 1 addition & 6 deletions src/NHapi.Base/Parser/DefaultModelClassFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,10 @@ namespace NHapi.Base.Parser
public class DefaultModelClassFactory : IModelClassFactory
{
private static readonly object LockObject = new object();
private static readonly IHapiLog Log;
private static readonly IHapiLog Log = HapiLogFactory.GetHapiLog(typeof(DefaultModelClassFactory));
private static Hashtable packages = null;
private static bool isLoadingPackages = false;

static DefaultModelClassFactory()
{
Log = HapiLogFactory.GetHapiLog(typeof(DefaultModelClassFactory));
}

/// <summary>
/// <para>Lists all the packages (user-definable) where classes for standard and custom
/// messages may be found. Each package has sub-packages called "message",
Expand Down
Loading