fix: Cleans up core code (#1187)
**Only one functional change** * Fixes a bug in LogFactory where `Warning` is being logged as `Information` Non-functional changes: * Updates/Fixes copyright headers * Removes namespace scopes for core files. View with [whitespace off](https://github.com/modernuo/ModernUO/pull/1187/files?w=1).
This commit is contained in:
parent
0138d40bda
commit
f268d5d4e2
262 changed files with 28527 additions and 28646 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2021 - ModernUO Development Team *
|
||||
* Copyright 2019-2022 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: ArrayEnumerator.cs *
|
||||
* *
|
||||
|
|
@ -17,63 +17,62 @@ using System;
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Collections
|
||||
namespace Server.Collections;
|
||||
|
||||
/// <summary>
|
||||
/// Non-thread safe, non-guarded enumerator for classes that have internal arrays.
|
||||
/// Recommended to copy this and use it as a nested struct.
|
||||
/// Recommend adding version checking to properly guard against modification during enumeration.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public struct ArrayEnumerator<T> : IEnumerator<T>
|
||||
{
|
||||
/// <summary>
|
||||
/// Non-thread safe, non-guarded enumerator for classes that have internal arrays.
|
||||
/// Recommended to copy this and use it as a nested struct.
|
||||
/// Recommend adding version checking to properly guard against modification during enumeration.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public struct ArrayEnumerator<T> : IEnumerator<T>
|
||||
private readonly T[] _array;
|
||||
private int _index;
|
||||
private T? _current;
|
||||
|
||||
public ArrayEnumerator(T[] array)
|
||||
{
|
||||
private readonly T[] _array;
|
||||
private int _index;
|
||||
private T? _current;
|
||||
_array = array;
|
||||
_index = 0;
|
||||
_current = default;
|
||||
}
|
||||
|
||||
public ArrayEnumerator(T[] array)
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
public bool MoveNext()
|
||||
{
|
||||
T[] localList = _array;
|
||||
|
||||
if ((uint)_index < (uint)localList.Length)
|
||||
{
|
||||
_array = array;
|
||||
_index = 0;
|
||||
_current = default;
|
||||
_current = _array[_index++];
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool MoveNext()
|
||||
{
|
||||
T[] localList = _array;
|
||||
public T? Current => _current!;
|
||||
|
||||
if ((uint)_index < (uint)localList.Length)
|
||||
object IEnumerator.Current
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_index == 0 || _index == _array.Length + 1)
|
||||
{
|
||||
_current = _array[_index++];
|
||||
return true;
|
||||
throw new InvalidOperationException(nameof(_index));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public T? Current => _current!;
|
||||
|
||||
object IEnumerator.Current
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_index == 0 || _index == _array.Length + 1)
|
||||
{
|
||||
throw new InvalidOperationException(nameof(_index));
|
||||
}
|
||||
|
||||
return _current;
|
||||
}
|
||||
}
|
||||
|
||||
void IEnumerator.Reset()
|
||||
{
|
||||
_index = 0;
|
||||
_current = default;
|
||||
return _current;
|
||||
}
|
||||
}
|
||||
|
||||
void IEnumerator.Reset()
|
||||
{
|
||||
_index = 0;
|
||||
_current = default;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue