summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrake.ApplicationServices/Collections
diff options
context:
space:
mode:
authorsr55 <[email protected]>2011-08-15 19:23:58 +0000
committersr55 <[email protected]>2011-08-15 19:23:58 +0000
commit746186658150dcbca2721d6d6fea77b4d7c09467 (patch)
treeebf2f050abe5418dbf4acf6cb1602815eb786d49 /win/CS/HandBrake.ApplicationServices/Collections
parent774af7004dd17c59fee9606273cd52a24867eb98 (diff)
WinGui: Add a service manager to maintain single instances of services & update the user settings service to import defaults from an xml file.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4177 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrake.ApplicationServices/Collections')
-rw-r--r--win/CS/HandBrake.ApplicationServices/Collections/SerializableDictionary.cs26
1 files changed, 23 insertions, 3 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Collections/SerializableDictionary.cs b/win/CS/HandBrake.ApplicationServices/Collections/SerializableDictionary.cs
index b492bc2f0..ad6a56221 100644
--- a/win/CS/HandBrake.ApplicationServices/Collections/SerializableDictionary.cs
+++ b/win/CS/HandBrake.ApplicationServices/Collections/SerializableDictionary.cs
@@ -6,6 +6,7 @@
namespace HandBrake.ApplicationServices.Collections
{
using System.Collections.Generic;
+ using System.Collections.Specialized;
using System.Runtime.Serialization;
using System.Xml.Serialization;
@@ -60,7 +61,16 @@ namespace HandBrake.ApplicationServices.Collections
reader.ReadEndElement();
reader.ReadStartElement("value");
- TValue value = (TValue)valueSerializer.Deserialize(reader);
+ TValue value;
+ if (reader.Name.Contains("ArrayOfString"))
+ {
+ XmlSerializer scSerializer = new XmlSerializer(typeof(StringCollection));
+ value = (TValue)scSerializer.Deserialize(reader);
+ }
+ else
+ {
+ value = (TValue)valueSerializer.Deserialize(reader);
+ }
reader.ReadEndElement();
this.Add(key, value);
@@ -92,8 +102,18 @@ namespace HandBrake.ApplicationServices.Collections
writer.WriteStartElement("value");
TValue value = this[key];
- valueSerializer.Serialize(writer, value);
- writer.WriteEndElement();
+
+ if (value.GetType() == typeof(StringCollection))
+ {
+ XmlSerializer scSerializer = new XmlSerializer(typeof(StringCollection));
+ scSerializer.Serialize(writer, value);
+ writer.WriteEndElement();
+ }
+ else
+ {
+ valueSerializer.Serialize(writer, value);
+ writer.WriteEndElement();
+ }
writer.WriteEndElement();
}