|
3 | 3 | using System;
|
4 | 4 | using System.Collections.Generic;
|
5 | 5 | using System.IO;
|
6 |
| -using System.Runtime.Serialization; |
7 |
| -using System.Runtime.Serialization.Formatters.Binary; |
8 | 6 | using System.Text;
|
9 | 7 | using NUnit.Engine.Communication.Messages;
|
10 | 8 |
|
@@ -101,43 +99,43 @@ public void Reset()
|
101 | 99 | }
|
102 | 100 | }
|
103 | 101 |
|
104 |
| - /// <summary> |
105 |
| - /// Serializes a message to a byte array to send to remote application. |
106 |
| - /// </summary> |
107 |
| - /// <param name="message">Message to be serialized</param> |
108 |
| - /// <returns> |
109 |
| - /// A byte[] containing the message itself, without a prefixed |
110 |
| - /// length, serialized according to the protocol. |
111 |
| - /// </returns> |
112 |
| - internal byte[] SerializeMessage(object message) |
113 |
| - { |
114 |
| - using (var memoryStream = new MemoryStream()) |
115 |
| - { |
116 |
| - new BinaryFormatter().Serialize(memoryStream, message); |
117 |
| - return memoryStream.ToArray(); |
118 |
| - } |
119 |
| - } |
120 |
| - |
121 |
| - /// <summary> |
122 |
| - /// Deserializes a message contained in a byte array. |
123 |
| - /// </summary> |
124 |
| - /// <param name="bytes">A byte[] containing just the message, without a length prefix</param> |
125 |
| - /// <returns>An object representing the message encoded in the byte array</returns> |
126 |
| - internal object DeserializeMessage(byte[] bytes) |
127 |
| - { |
128 |
| - using (var memoryStream = new MemoryStream(bytes)) |
129 |
| - { |
130 |
| - try |
131 |
| - { |
132 |
| - return new BinaryFormatter().Deserialize(memoryStream); |
133 |
| - } |
134 |
| - catch (Exception exception) |
135 |
| - { |
136 |
| - Reset(); // reset the received memory stream before the exception is rethrown - otherwise the same erroneous message is received again and again |
137 |
| - throw new SerializationException("error while deserializing message", exception); |
138 |
| - } |
139 |
| - } |
140 |
| - } |
| 102 | + ///// <summary> |
| 103 | + ///// Serializes a message to a byte array to send to remote application. |
| 104 | + ///// </summary> |
| 105 | + ///// <param name="message">Message to be serialized</param> |
| 106 | + ///// <returns> |
| 107 | + ///// A byte[] containing the message itself, without a prefixed |
| 108 | + ///// length, serialized according to the protocol. |
| 109 | + ///// </returns> |
| 110 | + //internal byte[] SerializeMessage(object message) |
| 111 | + //{ |
| 112 | + // using (var memoryStream = new MemoryStream()) |
| 113 | + // { |
| 114 | + // new BinaryFormatter().Serialize(memoryStream, message); |
| 115 | + // return memoryStream.ToArray(); |
| 116 | + // } |
| 117 | + //} |
| 118 | + |
| 119 | + ///// <summary> |
| 120 | + ///// Deserializes a message contained in a byte array. |
| 121 | + ///// </summary> |
| 122 | + ///// <param name="bytes">A byte[] containing just the message, without a length prefix</param> |
| 123 | + ///// <returns>An object representing the message encoded in the byte array</returns> |
| 124 | + //internal object DeserializeMessage(byte[] bytes) |
| 125 | + //{ |
| 126 | + // using (var memoryStream = new MemoryStream(bytes)) |
| 127 | + // { |
| 128 | + // try |
| 129 | + // { |
| 130 | + // return new BinaryFormatter().Deserialize(memoryStream); |
| 131 | + // } |
| 132 | + // catch (Exception exception) |
| 133 | + // { |
| 134 | + // Reset(); // reset the received memory stream before the exception is rethrown - otherwise the same erroneous message is received again and again |
| 135 | + // throw new SerializationException("error while deserializing message", exception); |
| 136 | + // } |
| 137 | + // } |
| 138 | + //} |
141 | 139 |
|
142 | 140 | /// <summary>
|
143 | 141 | /// This method tries to read a single message and add to the messages collection.
|
|
0 commit comments