Enable Net 7 and Net 8 style rules.

This commit is contained in:
RoosterDragon
2024-11-25 20:15:58 +00:00
committed by Gustas Kažukauskas
parent 71ae0aedfb
commit cfde11556f
31 changed files with 74 additions and 94 deletions

View File

@@ -23,8 +23,7 @@ namespace OpenRA.Primitives
public void Add(Action a, long desiredTime)
{
if (a == null)
throw new ArgumentNullException(nameof(a));
ArgumentNullException.ThrowIfNull(a);
lock (actions)
{

View File

@@ -21,8 +21,7 @@ namespace OpenRA
public ActorInfoDictionary(IReadOnlyDictionary<string, ActorInfo> dict)
{
if (dict == null)
throw new ArgumentNullException(nameof(dict));
ArgumentNullException.ThrowIfNull(dict);
this.dict = new Dictionary<string, ActorInfo>(dict);
}

View File

@@ -21,8 +21,7 @@ namespace OpenRA.Primitives
public Cache(Func<T, U> loader, IEqualityComparer<T> c)
{
if (loader == null)
throw new ArgumentNullException(nameof(loader));
ArgumentNullException.ThrowIfNull(loader);
this.loader = loader;
cache = new Dictionary<T, U>(c);

View File

@@ -22,8 +22,7 @@ namespace OpenRA.Primitives
public ConcurrentCache(Func<T, U> loader, IEqualityComparer<T> c)
{
if (loader == null)
throw new ArgumentNullException(nameof(loader));
ArgumentNullException.ThrowIfNull(loader);
this.loader = loader;
cache = new ConcurrentDictionary<T, U>(c);

View File

@@ -27,8 +27,7 @@ namespace OpenRA.Primitives
protected ReadOnlyAdapterStream(Stream stream)
{
if (stream == null)
throw new ArgumentNullException(nameof(stream));
ArgumentNullException.ThrowIfNull(stream);
if (!stream.CanRead)
throw new ArgumentException("stream must be readable.", nameof(stream));

View File

@@ -65,8 +65,7 @@ namespace OpenRA.Primitives
public void CopyTo(T[] array, int arrayIndex)
{
if (array == null)
throw new ArgumentNullException(nameof(array));
ArgumentNullException.ThrowIfNull(array);
if (arrayIndex < 0)
throw new ArgumentNullException(nameof(arrayIndex));

View File

@@ -32,8 +32,7 @@ namespace OpenRA.Primitives
/// <param name="count">The length of the segment.</param>
public SegmentStream(Stream stream, long offset, long count)
{
if (stream == null)
throw new ArgumentNullException(nameof(stream));
ArgumentNullException.ThrowIfNull(stream);
if (!stream.CanSeek)
throw new ArgumentException("stream must be seekable.", nameof(stream));
if (offset < 0)