fix: Adds BitArray support with codegen (#888)

* Adds a custom BitArray class with the following added features:
  * ctor for creating BitArray against read only span
  * ctor for creating BitArray against BinaryReader
  * CopyTo to copy a BitArray to a Span
* Adds BitArray to UO Primitive serialization so it can be codegenned.
This commit is contained in:
Kamron Batman 2021-12-13 09:31:02 -08:00 • committed by GitHub
parent 61e2177011
commit b125146b27
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 1489 additions and 19 deletions

View file

@ -13,33 +13,43 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*************************************************************************/
namespace Server.Collections
namespace Server.Collections;
public static class CollectionThrowStrings
{
public static class CollectionThrowStrings
{
public const string ArgumentOutOfRange_Index =
"Index was out of range. Must be non-negative and less than the size of the collection.";
public const string ArgumentOutOfRange_Index =
"Index was out of range. Must be non-negative and less than the size of the collection.";
public const string ArgumentOutOfRange_NeedNonNegNum = "Non-negative number required.";
public const string ArgumentOutOfRange_NeedNonNegNum = "Non-negative number required.";
public const string Argument_InvalidOffLen =
"Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.";
public const string Argument_InvalidOffLen =
"Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.";
public const string Argument_AddingDuplicate = "An item with the same value has already been added. Value: {0}";
public const string Argument_AddingDuplicate = "An item with the same value has already been added. Value: {0}";
public const string Arg_ArrayPlusOffTooSmall =
"Destination array is not long enough to copy all the items in the collection. Check array index and length.";
public const string Arg_ArrayPlusOffTooSmall =
"Destination array is not long enough to copy all the items in the collection. Check array index and length.";
public const string InvalidOperation_ConcurrentOperationsNotSupported =
"Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.";
public const string InvalidOperation_ConcurrentOperationsNotSupported =
"Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.";
public const string InvalidOperation_EnumFailedVersion =
"Collection was modified after the enumerator was instantiated.";
public const string InvalidOperation_EnumFailedVersion =
"Collection was modified after the enumerator was instantiated.";
public const string InvalidOperation_EmptyQueue = "Queue empty.";
public const string InvalidOperation_EmptyQueue = "Queue empty.";
public const string InvalidOperation_EnumNotStarted = "Enumeration has not started. Call MoveNext.";
public const string InvalidOperation_EnumNotStarted = "Enumeration has not started. Call MoveNext.";
public const string InvalidOperation_EnumEnded = "Enumeration already finished.";
}
public const string InvalidOperation_EnumEnded = "Enumeration already finished.";
public const string Argument_ArrayTooLarge =
"The input array length must not exceed Int32.MaxValue / {0}. Otherwise BitArray.Length would exceed Int32.MaxValue.";
public const string Arg_ArrayLengthsDiffer = "Array lengths must be the same.";
public const string Arg_RankMultiDimNotSupported =
"Only single dimensional arrays are supported for the requested action.";
public const string Arg_BitArrayTypeUnsupported =
"Only supported array types for CopyTo on BitArrays are Boolean[], Int32[] and Byte[].";
}