// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Platform; using Newtonsoft.Json.Linq; namespace osu.Desktop.LegacyIpc { /// /// An that can be used to communicate to and from legacy clients. /// /// In order to deserialise types at either end, types must be serialised as their , /// however this cannot be done since osu!stable and osu!lazer live in two different assemblies. ///
/// To get around this, this class exists which serialises a payload () as an type, /// which can be deserialised at either end because it is part of the core library (mscorlib / System.Private.CorLib). /// The payload contains the data to be sent over the IPC channel. ///
/// At either end, Json.NET deserialises the payload into a which is manually converted back into the expected type, /// which then further contains another representing the data sent over the IPC channel whose type can likewise be lazily matched through /// . ///
///
/// /// Synchronise any changes with osu-stable. /// public class LegacyIpcMessage : IpcMessage { public LegacyIpcMessage() { // Types/assemblies are not inter-compatible, so always serialise/deserialise into objects. base.Type = typeof(object).FullName; } public new string Type => base.Type; // Hide setter. public new object Value { get => base.Value; set => base.Value = new Data(value.GetType().Name, value); } public class Data { public Data(string messageType, object messageData) { MessageType = messageType; MessageData = messageData; } public string MessageType { get; set; } public object MessageData { get; set; } } } }