Changeset 2589
- Timestamp:
- 3/30/2012 7:51:53 AM (14 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eraser6/XmlTaskLists/Eraser.Manager/DirectExecutor.cs
r2543 r2589 27 27 using System.Threading; 28 28 using System.IO; 29 using System.Runtime.Serialization;30 using System.Runtime.Serialization.Formatters.Binary;31 29 32 30 using Eraser.Util; … … 34 32 using Eraser.Plugins; 35 33 using Eraser.Plugins.ExtensionPoints; 34 using System.Xml.Serialization; 36 35 37 36 namespace Eraser.Manager … … 468 467 { 469 468 lock (list) 470 new BinaryFormatter().Serialize(stream, list); 469 { 470 XmlSerializer serializer = new XmlSerializer(list.GetType()); 471 serializer.Serialize(stream, list); 472 } 471 473 } 472 474 … … 474 476 { 475 477 //Load the list into the dictionary 476 StreamingContext context = new StreamingContext( 477 StreamingContextStates.All, Owner); 478 BinaryFormatter formatter = new BinaryFormatter(null, context); 478 XmlSerializer serializer = new XmlSerializer(list.GetType()); 479 479 480 480 try 481 481 { 482 List<Task> deserialised = (List<Task>) formatter.Deserialize(stream);482 List<Task> deserialised = (List<Task>)serializer.Deserialize(stream); 483 483 list.AddRange(deserialised); 484 484 485 485 foreach (Task task in deserialised) 486 486 { 487 task.Executor = Owner; 487 488 Owner.OnTaskAdded(new TaskEventArgs(task)); 488 489 if (task.Schedule == Schedule.RunNow) … … 492 493 } 493 494 } 495 catch (InvalidOperationException e) 496 { 497 throw new InvalidDataException(e.Message, e); 498 } 494 499 catch (FileLoadException e) 495 {496 throw new InvalidDataException(e.Message, e);497 }498 catch (SerializationException e)499 500 { 500 501 throw new InvalidDataException(e.Message, e);
Note: See TracChangeset
for help on using the changeset viewer.
