public static void WriteList <TType>(ImmutableList <TType> list, ActorBinaryWriter writer)
     where TType : IInternalSerializable
 {
     writer.Write(list.Count);
     foreach (var writeable in list)
     {
         writeable.Write(writer);
     }
 }
 public static void WriteDic <TKey>(ImmutableDictionary <TKey, string> dic, ActorBinaryWriter writer)
     where TKey : IInternalSerializable
 {
     writer.Write(dic.Count);
     foreach (var(key, value) in dic)
     {
         key.Write(writer);
         writer.Write(value);
     }
 }
        public override byte[] ToBinary(object obj)
        {
            if (obj is IInternalSerializable serializable)
            {
                using var mem    = new MemoryStream();
                using var writer = new ActorBinaryWriter(mem, system);
                serializable.Write(writer);
                writer.Flush();
                mem.Position = 0;
                return(mem.ToArray());
            }

            throw new NotSupportedException("no IInternalSerializable");
        }
 public static void WriteRef(ActorBinaryWriter writer, IActorRef actor)
 => writer.Write(Serialization.SerializedActorPath(actor));
Exemplo n.º 5
0
 protected virtual void WriteInternal(ActorBinaryWriter writer)
 {
 }
Exemplo n.º 6
0
 public void Write(ActorBinaryWriter writer)
 {
     BinaryManifest.Write(writer, GetType().Name, Version);
     WriteInternal(writer);
 }