[smuxi/experiments/gtk2_builder_pref_dialog: 6/25] Engine: (de)serialize MessageModel.ID



commit b19662693f28a14a9f9bc7a74f6d288906eb005a
Author: Mirco Bauer <meebey meebey net>
Date:   Wed May 4 18:54:56 2016 +0200

    Engine: (de)serialize MessageModel.ID
    
    The new ID property introduced in 0cd96084e775ee13f4e83310bfe77b611aca189f needs
    to be serialized and de-serialized, else it won't be passed for remote engines.

 src/Engine/Messages/MessageModel.cs |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/src/Engine/Messages/MessageModel.cs b/src/Engine/Messages/MessageModel.cs
index e5e93cd..2ef8d1c 100644
--- a/src/Engine/Messages/MessageModel.cs
+++ b/src/Engine/Messages/MessageModel.cs
@@ -132,6 +132,11 @@ namespace Smuxi.Engine
             f_TimeStamp    = sr.ReadDateTime();
             f_MessageParts = sr.ReadList<MessagePartModel>();
             f_MessageType  = (MessageType) sr.ReadInt32();
+
+            // backward compatibility with engines < 1.1
+            if (sr.PeekChar() != -1) {
+                ID = sr.ReadString();
+            }
         }
 
         protected virtual void GetObjectData(SerializationWriter sw)
@@ -144,6 +149,7 @@ namespace Smuxi.Engine
             sw.Write(f_TimeStamp);
             sw.Write(f_MessageParts);
             sw.Write((Int32) f_MessageType);
+            sw.Write(ID);
         }
 
         public virtual void GetObjectData(SerializationInfo info, StreamingContext ctx) 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]