fix(core): Fixes various issues with codegen (#646)

- [X] Fixes bad `ReadEnum` by size
- [X] Fixes array, list, and set not handling null values properly.
  - It will be up to the user (for now) to null out empty lists using `[AfterDeserialization]`. Convenience may be added later.
- [X] Fixes errors with `dotnet clean` and non-empty generation folder
- [X] Fixes bad field indexes on `Account.cs` causing `tags` to not be serialized/deserialized.
  - This was caused by a duplicate entry. Don't have protection against this _yet_.
This commit is contained in:
Kamron Batman 2021-06-06 17:03:05 -07:00 • committed by GitHub
parent 75db56edc4
commit eb4e3ac070
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 47 additions and 21 deletions

View file

@ -64,17 +64,17 @@ namespace Server.Accounting
[SerializableField(10, setter: "private")]
private List<AccountComment> _comments;
[SerializableField(10, setter: "private")]
[SerializableField(11, setter: "private")]
private List<AccountTag> _tags;
[SerializableField(11)]
[SerializableField(12)]
private IPAddress[] _loginIPs;
/// <summary>
/// List of IP addresses for restricted access. '*' wildcard supported. If the array contains zero entries, all IP addresses
/// are allowed.
/// </summary>
[SerializableField(12)]
[SerializableField(13)]
private string[] _ipRestrictions;
private TimeSpan _totalGameTime;
@ -83,7 +83,7 @@ namespace Server.Accounting
/// Gets the total game time of this account, also considering the game time of characters
/// that have been deleted.
/// </summary>
[SerializableField(13)]
[SerializableField(14)]
public TimeSpan TotalGameTime
{
get
@ -105,7 +105,7 @@ namespace Server.Accounting
}
}
[SerializableField(14)]
[SerializableField(15)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.Administrator)]")]
private string _email;
@ -345,8 +345,8 @@ namespace Server.Accounting
_totalGold = reader.ReadInt();
_totalPlat = reader.ReadInt();
_mobiles = new Mobile[7];
var length = reader.ReadInt();
_mobiles = new Mobile[length];
for (int i = 0; i < length; i++)
{
_mobiles[i] = reader.ReadEntity<Mobile>();