1 | using System;
|
---|
2 | using System.IO;
|
---|
3 | using HEAL.Attic;
|
---|
4 |
|
---|
5 | namespace HeuristicLab.PluginInfrastructure {
|
---|
6 |
|
---|
7 | [StorableType(StorableMemberSelection.MarkedOnly, "081DC79E-1E57-49A2-AB25-D9AC42A40911")]
|
---|
8 | public class RunnerMessage {
|
---|
9 | private static ProtoBufSerializer serializer = new ProtoBufSerializer();
|
---|
10 | public static RunnerMessage ReadMessageFromStream(Stream stream) {
|
---|
11 | byte[] buf = new byte[4];
|
---|
12 | stream.Read(buf, 0, buf.Length);
|
---|
13 | int bufSize = BitConverter.ToInt32(buf, 0);
|
---|
14 | buf = new byte[bufSize];
|
---|
15 | stream.Read(buf, 0, buf.Length);
|
---|
16 | return (RunnerMessage)serializer.Deserialize(buf);
|
---|
17 | }
|
---|
18 |
|
---|
19 | /// <summary>
|
---|
20 | /// This will get set from the RunnerHost and helps to identify the correct message flow.
|
---|
21 | /// </summary>
|
---|
22 | [Storable]
|
---|
23 | public DateTime SendTime { get; set; }
|
---|
24 | }
|
---|
25 |
|
---|
26 |
|
---|
27 | [StorableType(StorableMemberSelection.AllProperties, "84771CF3-46CA-4D0B-96D1-7F2E8EAC50B7")]
|
---|
28 | public class PauseRunnerMessage : RunnerMessage { }
|
---|
29 |
|
---|
30 |
|
---|
31 | [StorableType(StorableMemberSelection.AllProperties, "FE2AEE66-E2A2-4DE1-8E60-C116F084D2AA")]
|
---|
32 | public class ResumeRunnerMessage : RunnerMessage { }
|
---|
33 |
|
---|
34 |
|
---|
35 | [StorableType(StorableMemberSelection.AllProperties, "2C836B74-C28B-4F4A-9645-E1ED5F4415A7")]
|
---|
36 | public class CancelRunnerMessage : RunnerMessage { }
|
---|
37 |
|
---|
38 |
|
---|
39 | [StorableType(StorableMemberSelection.AllProperties, "2D8D1D8F-58D4-4D92-BB15-62DF55DC0459")]
|
---|
40 | public class TransportRunnerMessage : RunnerMessage {
|
---|
41 | public IRunner Runner { get; set; }
|
---|
42 | public TransportRunnerMessage(IRunner runner) => Runner = runner;
|
---|
43 |
|
---|
44 | [StorableConstructor]
|
---|
45 | private TransportRunnerMessage(StorableConstructorFlag _) { }
|
---|
46 | }
|
---|
47 |
|
---|
48 | }
|
---|