ModernUO/Projects/Server
Kamron Batman 9afa4e4cab
feat: Source generated Serialization/Deserialization (#550)
### Features
* Fully abstracts serialization by using compile-time attributes.
* Supports serializing the following:
  - Primitives (integers, strings, etc)
  - IP Addresses
  - BigDecimal
  - DateTime, Delta DateTimes
  - TimeSpan
  - Server.Race
  - Server.Map
  - Point2D, Point3D, Rect2D, Rect3D
  - Existing/New `ISerializable` references
  - Lists/Sets of serializable types
  - Type with a `Serialize` method and constructor that takes an `IGenericReader`
* Supports forward-only migration
* Supports existing RunUO deserialization for older versions by changing to the following signature:
  - `public void OldDeserialize(IGenericReader reader, int version)`
  - Must remove deserializing the version since this is already done
* Supports serializing from private fields or custom made properties.
* Types do not require inheriting Item/Mobile. Code gen will fully create `ISerializable` information.
  - This is not recommended yet, since it requires wiring to `Persistence` which will cause lots of unresolved symbol errors until code gen is built.

### Example
```cs
using System.Collections.Generic;

namespace Server.Items
{
    [Serializable(1)]
    public partial class TestItem1 : Item
    {
        [SerializableField(1)]
        [SerializableFieldAttr("[CommandProperty(AccessLevel.Administrator)]")]
        private List<Item> _someProperty;

        private void Deserialize(IGenericReader reader, int version)
        {
        }
    }
}
```

Generates this:
```cs
namespace Server.Items
{
    public partial class TestItem1
    {
#pragma warning disable 0414
        private const int _version = 1;
#pragma warning restore 0414

        [CommandProperty(AccessLevel.Administrator)]
        public System.Collections.Generic.List<Server.Item> SomeProperty
        {
            get => _someProperty;
            set
            {
                if (value != _someProperty)
                {
                    ((ISerializable)this).MarkDirty();
                    _someProperty = value;
                }
            }
        }

        public TestItem1(Serial serial) : base(serial)
        {
        }

        public override void Serialize(IGenericWriter writer)
        {
            var savePosition = ((Server.ISerializable)this).SavePosition;
            if (savePosition > -1)
            {
                writer.Seek(savePosition, System.IO.SeekOrigin.Begin);
                return;
            }
            writer.WriteEncodedInt(_version);
            writer.Write(_someProperty);
        }

        public override void Deserialize(IGenericReader reader)
        {
            var version = reader.ReadEncodedInt();
            if (version < 1)
            {
                OldDeserialize(reader, version);
                ((Server.ISerializable)this).MarkDirty();
                return;
            }
            SomeProperty = reader.ReadEntityList<Server.Item>();
        }
    }
}
```

And this:
```json
{
  "version": 1,
  "type": "TestItem1",
  "properties": [
    {
      "name": "SomeProperty",
      "type": "System.Collections.Generic.List\u003CServer.Item\u003E",
      "rule": "ListMigrationRule",
      "ruleArguments": [
        "Server.Item",
        "SerializableInterfaceMigrationRule"
      ]
    }
  ]
}
```
2021-05-23 21:06:23 -07:00
..
Buffers fix(core): Updates to serialization (#590) 2021-05-09 00:10:39 -07:00
Collections fix(core): Fixes nullables being disabled (#466) 2021-02-05 14:09:57 -08:00
Comparers Splits up mobile (#296) 2020-10-31 23:30:51 -07:00
Configuration feat(logging): Adds support for Serilog (#573) 2021-04-19 23:43:54 -07:00
ContextMenus fix(core): Removes some uses of Linq (#421) 2021-01-18 21:05:11 -08:00
Diagnostics fix(core): Tightens the network stack (#479) 2021-02-07 23:30:56 -08:00
Events fix(core): Fixes flow for saves, adds logging and configurations (#513) 2021-02-20 19:32:08 -08:00
Exceptions fix(core): Changes invalid gump response to write to network errors. (#510) 2021-02-15 08:31:53 -08:00
Geometry chore: Code cleanup (#399) 2021-01-10 09:14:03 -08:00
Gumps fix(core): Changes invalid gump response to write to network errors. (#510) 2021-02-15 08:31:53 -08:00
Items feat: Source generated Serialization/Deserialization (#550) 2021-05-23 21:06:23 -07:00
Json feat: Source generated Serialization/Deserialization (#550) 2021-05-23 21:06:23 -07:00
Logging feat(logging): Adds support for Serilog (#573) 2021-04-19 23:43:54 -07:00
Maps chore(logging): Logging cleanup (#580) 2021-04-23 18:57:42 -07:00
Menus Updates menu packets (#320) 2020-11-17 21:47:00 -08:00
Mobiles feat: Source generated Serialization/Deserialization (#550) 2021-05-23 21:06:23 -07:00
Network Fixes awaiting seed for < v6 clients (#589) 2021-05-05 11:47:54 -07:00
Random fix(core): Changes random source to use debut assert (#603) 2021-05-15 20:15:22 -07:00
Regions feat(logging): Adds support for Serilog (#573) 2021-04-19 23:43:54 -07:00
Serialization feat: Source generated Serialization/Deserialization (#550) 2021-05-23 21:06:23 -07:00
Targeting fix(core): Caches DateTime.NowUtc (#548) 2021-03-13 01:32:04 -08:00
Text fix(core): Updates to serialization (#590) 2021-05-09 00:10:39 -07:00
TileMatrix chore(logging): Logging cleanup (#580) 2021-04-23 18:57:42 -07:00
Timer fix(core): Handles a rare NPE with LoginTimer (#508) 2021-02-11 23:47:02 -08:00
Utilities fix(core): Updates to serialization (#590) 2021-05-09 00:10:39 -07:00
World feat: Source generated Serialization/Deserialization (#550) 2021-05-23 21:06:23 -07:00
AssemblyHandler.cs fix(content): Fixes duplicate alias type (#588) 2021-04-30 00:59:53 -07:00
Attributes.cs fix(core): Fixes some properties that cannot be modified ingame (#604) 2021-05-15 23:47:33 -07:00
CityInfo.cs Cleanup/Housekeeping (#242) 2020-09-12 15:31:21 -07:00
ClientVersion.cs fix(core): Updates slice with range selectors (#583) 2021-04-23 20:57:24 -07:00
Commands.cs fix(core): Updates slice with range selectors (#583) 2021-04-23 20:57:24 -07:00
Effects.cs fix(core): Cleans up uninitialized packets (#397) 2021-01-09 14:10:29 -08:00
EventLoopTasks.cs fix(core): Core cleanup, adds event loop synchronization, and fixes gumps (#429) 2021-01-25 21:06:46 -08:00
ExpansionInfo.cs fix(core): Fixes map issues at New Haven (#509) 2021-02-14 16:06:49 -08:00
Guild.cs feat: Source generated Serialization/Deserialization (#550) 2021-05-23 21:06:23 -07:00
HuePicker.cs fix(core): Converts remaining player packets (#374) 2020-12-30 16:09:51 -08:00
IAccount.cs fix(core): Updates expansion and map configurations (fixes map issues) (#570) 2021-04-14 01:45:18 -07:00
IEntity.cs feat: Source generated Serialization/Deserialization (#550) 2021-05-23 21:06:23 -07:00
Interfaces.cs Cleanup/Housekeeping (#242) 2020-09-12 15:31:21 -07:00
KeywordList.cs Cleanup/Housekeeping (#242) 2020-09-12 15:31:21 -07:00
Main.cs fix(core): Cleans up serialization (#606) 2021-05-16 13:45:32 -07:00
MultiData.cs fix(core): Moves map definitions and cleans up loading maps, regions, and tiles (#431) 2021-01-25 11:05:52 -08:00
MUO.ico Adds MUO Logo (#52) 2019-09-12 13:13:13 -07:00
NativeReader.cs fix(core): Fixes map issues at New Haven (#509) 2021-02-14 16:06:49 -08:00
ObjectPropertyList.cs fix(core): Fixes OPL packets (#395) 2021-01-08 23:55:23 -08:00
Party.cs Cleanup/Housekeeping (#242) 2020-09-12 15:31:21 -07:00
Poison.cs C# 9 Cleanup (#325) 2020-11-27 00:29:21 -08:00
Prompt.cs Cleanup/Housekeeping (#242) 2020-09-12 15:31:21 -07:00
Race.cs fix(core): Optimizes strings / .NET 5 compatibility changes (#354) 2020-12-20 23:21:55 -08:00
Sector.cs fix(core): Adds SkipLocalsInitAttribute support, optimizes broadcasted packets (#363) 2020-12-26 12:46:06 -08:00
SecureTrade.cs fix(core): Converts mobile status packets (#368) 2020-12-28 01:13:02 -08:00
Serial.cs fix(core): Reverts change to Serial.IsValid (#596) 2021-05-12 09:59:03 -07:00
Server.csproj feat: Source generated Serialization/Deserialization (#550) 2021-05-23 21:06:23 -07:00
Skills.cs fix(core): Fixes some properties that cannot be modified ingame (#604) 2021-05-15 23:47:33 -07:00
TileData.cs fix(core): Cleans up serialization (#606) 2021-05-16 13:45:32 -07:00
TileList.cs Cleanup/Housekeeping (#242) 2020-09-12 15:31:21 -07:00
VirtueInfo.cs Cleanup/Housekeeping (#242) 2020-09-12 15:31:21 -07:00