[longomatch] Fix Project deserialization



commit 8195aba768d01678e514db1c62f0126e06ff04b1
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Wed Dec 23 21:28:35 2009 +0100

    Fix Project deserialization

 LongoMatch/DB/Project.cs            |    2 +-
 LongoMatch/Time/SectionsTimeNode.cs |    9 +++++----
 2 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/LongoMatch/DB/Project.cs b/LongoMatch/DB/Project.cs
index da47207..5fe97be 100644
--- a/LongoMatch/DB/Project.cs
+++ b/LongoMatch/DB/Project.cs
@@ -529,7 +529,7 @@ namespace LongoMatch.DB
 		}
 		
 		public static Project Import(string file) {
-			using(Stream stream = new FileStream(file, FileMode.Create, FileAccess.Write, FileShare.None))
+			using(Stream stream = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.None))
 			{
 				try {
 					IFormatter formatter = new BinaryFormatter();
diff --git a/LongoMatch/Time/SectionsTimeNode.cs b/LongoMatch/Time/SectionsTimeNode.cs
index f260512..553404a 100644
--- a/LongoMatch/Time/SectionsTimeNode.cs
+++ b/LongoMatch/Time/SectionsTimeNode.cs
@@ -67,9 +67,11 @@ namespace LongoMatch.TimeNodes
 			Stop = (Time)info.GetValue("stop", typeof(Time));
 			HotKey = (HotKey)info.GetValue("hotkey", typeof(HotKey));
 			// read 'red', 'blue' and 'green' values and convert it to Gdk.Color
-			Color = new Color((byte)info.GetValue("red", typeof(ushort)),
-			                  (byte)info.GetValue("green", typeof(ushort)),
-			                  (byte)info.GetValue("blue", typeof(ushort)));
+			Color c = new Color();
+			c.Red = (ushort)info.GetValue("red", typeof(ushort));
+			c.Green = (ushort)info.GetValue("green", typeof(ushort));
+			c.Red = (ushort)info.GetValue("blue", typeof(ushort));
+			Color = c;
 		}
 		#endregion
 		#region  Properties
@@ -100,7 +102,6 @@ namespace LongoMatch.TimeNodes
 				
 		// this method is automatically called during serialization
 		public void GetObjectData(SerializationInfo info, StreamingContext context) {
-			Console.WriteLine("Serialize");
 			info.AddValue("name", Name);
 			info.AddValue("start", Start);
 			info.AddValue("stop", Stop);



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