Highly Performant & Scalable Ultima Online Server Emulator https://www.modernuo.com
Find a file
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
.github feat: Source generated Serialization/Deserialization (#550) 2021-05-23 21:06:23 -07:00
Distribution/Data fix(admin): Fixes Tokuno Go Locations (#602) 2021-05-15 19:07:28 -07:00
docs fix(docs): Fixes UI (#527) 2021-02-27 20:02:44 -08:00
Projects feat: Source generated Serialization/Deserialization (#550) 2021-05-23 21:06:23 -07:00
.editorconfig Adds ModernUO docs skeleton (#243) 2020-09-13 15:21:28 -07:00
.gitattributes fix(git): Updates git attributes (#477) 2021-02-06 21:15:29 -08:00
.gitignore feat: Source generated Serialization/Deserialization (#550) 2021-05-23 21:06:23 -07:00
azure-pipelines.yml feat: Source generated Serialization/Deserialization (#550) 2021-05-23 21:06:23 -07:00
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md 2020-05-05 08:51:39 -07:00
CONTRIBUTING.md chore: Updates discord links (#394) 2021-01-07 01:04:05 -08:00
Directory.Build.props feat: Source generated Serialization/Deserialization (#550) 2021-05-23 21:06:23 -07:00
FAQ.md Fixes more line ending issues (#267) 2020-09-27 13:54:56 -07:00
GOALS.md Updates to .NET Core 3.1 & Cleanup (#79) 2020-01-19 12:47:34 -08:00
LICENSE Fixes more line ending issues (#267) 2020-09-27 13:54:56 -07:00
mkdocs.yml Creates quick start (#254) 2020-09-15 19:46:10 -07:00
ModernUO.sln feat: Source generated Serialization/Deserialization (#550) 2021-05-23 21:06:23 -07:00
publish.cmd fix(releases): Updates release flow. Fixes windows builds (#482) 2021-02-07 23:30:11 -08:00
publish.sh Release Version 0.6.1 (#205) 2020-08-30 23:15:47 -07:00
README.md fix(core): Adds Fedora 32/33 & RHEL 7/8 support. (#601) 2021-05-14 00:32:22 -07:00
rider-settings.zip Cleanup/Housekeeping (#242) 2020-09-12 15:31:21 -07:00
Rules.ruleset Cleanup & Fixes for .NET 5 (#309) 2020-11-15 10:03:50 -08:00
RUNUO_MIGRATIONS.md Fixes more line ending issues (#267) 2020-09-27 13:54:56 -07:00
SPONSORS.md fix(docs): Adds sponsor page (#420) 2021-01-18 14:54:58 -08:00
stylecop.json Updates formatting rules (#199) 2020-08-25 18:00:51 -07:00
THIRD-PARTY-NOTICES chore: Updates 3rd party notices (#393) 2021-01-07 00:58:34 -08:00
version.json fix(core): Fixes map issues at New Haven (#509) 2021-02-14 16:06:49 -08:00

ModernUO Discord Subreddit subscribers Twitter Follow Gitter

Ultima Online Server Emulator for the modern era!

.NET
Windows OSX Debian Ubuntu CentOS Fedora RedHat
GitHub license GitHub stars GitHub issues
GitHub build AzurePipelines build

Building the server

Requirements

Publishing Builds

  • Using terminal or powershell: ./publish.cmd [release|debug (default: release)] [os]
    • os - Supported operating systems
      • win - Windows 8.1/10/2016/2019
      • osx - MacOS 10.13+/11.0 (High Sierra, Mojave, Catalina, & Big Sur)
      • ubuntu.16.04, ubuntu.18.04 ubuntu.20.04 - Ubuntu LTS
      • debian.9, debian.10 - Debian
      • centos.7, centos.8 - CentOS
      • fedora.32, fedora.33 - Fedora
      • rhel.7, rhel.8 - Redhat
      • If blank, the operating system running the build is used

Deploying / Running Server

  • Follow the publish instructions
  • Copy Distribution directory to the production server

Requirements

Running

  • dotnet ModernUO.dll

Cleaning

  • dotnet clean

Thanks

  • RunUO Team & Community
  • ServUO Team & Community
  • Karasho, Jaedan and the ClassicUO Community

Troubleshooting / FAQ

Want to sponsor?

Thank you for supporting us! You can find out how by visiting the sponsors page.



Development Tools provided with ♥ by