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:
parent
61e2177011
commit
b125146b27
9 changed files with 1489 additions and 19 deletions
|
|
@ -47,6 +47,8 @@ namespace SerializationGenerator
|
|||
public const string SERIALIZABLE_FIELD_SAVE_FLAG_ATTRIBUTE = "Server.SerializableFieldSaveFlagAttribute";
|
||||
public const string SERIALIZABLE_FIELD_DEFAULT_ATTRIBUTE = "Server.SerializableFieldDefaultAttribute";
|
||||
public const string RAW_SERIALIZABLE_INTERFACE = "Server.IRawSerializable";
|
||||
// ModernUO modified BitArray
|
||||
public const string SERVER_BITARRAY_CLASS = "Server.Collections.BitArray";
|
||||
|
||||
public static bool IsTimerDrift(this AttributeData attr, Compilation compilation) =>
|
||||
attr?.IsAttribute(compilation.GetTypeByMetadataName(TIMER_DRIFT_ATTRIBUTE)) == true;
|
||||
|
|
@ -184,6 +186,12 @@ namespace SerializationGenerator
|
|||
SymbolEqualityComparer.Default
|
||||
);
|
||||
|
||||
public static bool IsBitArray(this ISymbol symbol, Compilation compilation) =>
|
||||
symbol.Equals(
|
||||
compilation.GetTypeByMetadataName(SERVER_BITARRAY_CLASS),
|
||||
SymbolEqualityComparer.Default
|
||||
);
|
||||
|
||||
public static AttributeData? GetAttribute(this ISymbol symbol, ISymbol attrSymbol) =>
|
||||
symbol
|
||||
.GetAttributes()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue