Changeset 3004 for trunk/sources/HeuristicLab.Persistence/3.3/Default
- Timestamp:
- 03/11/10 12:54:14 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Persistence/3.3/Default
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/DataMemberAccessor.cs
r1938 r3004 5 5 namespace HeuristicLab.Persistence.Default.CompositeSerializers.Storable { 6 6 7 /// <summary> 8 /// Encapsulation and abstraction for access a data member of an object 9 /// regardless of it being a property or field. Addicionally a 10 /// default value and an alternate name can be specified. 11 /// </summary> 7 12 public class DataMemberAccessor { 8 13 … … 12 17 public readonly object DefaultValue; 13 18 19 20 /// <summary> 21 /// Create a DataMemberAccessor from a FieldInfo or PropertyInfo for the give object. 22 /// </summary> 14 23 public DataMemberAccessor(MemberInfo memberInfo, string name, object defaultvalue, object obj) { 15 24 Name = name; … … 33 42 } 34 43 44 /// <summary> 45 /// Wrap existing getter and setter functions. 46 /// </summary> 35 47 public DataMemberAccessor(string name, object defaultValue, 36 48 Func<object> getter, Action<object> setter) { … … 40 52 Set = setter; 41 53 } 42 54 55 /// <summary> 56 /// Create an empty accessor that just encapsulates an object 57 /// without access. 58 /// </summary> 43 59 public DataMemberAccessor(object o) { 44 60 Name = null; … … 48 64 } 49 65 66 /// <summary> 67 /// Create an empty accessor that just encapsulates an object 68 /// without access. 69 /// </summary> 50 70 public DataMemberAccessor(object o, string name) { 51 71 Name = name; … … 54 74 Set = null; 55 75 } 56 57 76 58 77 public override string ToString() { -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/System.Drawing/Bitmap2XmlSerializer.cs
r2965 r3004 11 11 12 12 namespace HeuristicLab.Persistence.Default.Xml.Primitive { 13 public class Bitmap2XmlSerializer :PrimitiveXmlSerializerBase<Bitmap>{ 14 private static Regex re = new Regex(@"<!\[CDATA\[((?:[^]]|\](?!\]>))*)\]\]>", RegexOptions.Singleline); 13 public class Bitmap2XmlSerializer : PrimitiveXmlSerializerBase<Bitmap> { 15 14 16 15 public override XmlString Format(Bitmap o) { 17 16 MemoryStream stream = new MemoryStream(); 18 o.Save(stream, ImageFormat.Png);17 o.Save(stream, ImageFormat.Png); 19 18 byte[] array = stream.ToArray(); 20 19 Byte1DArray2XmlSerializer serializer = new Byte1DArray2XmlSerializer(); … … 32 31 Bitmap bitmap = new Bitmap(stream); 33 32 return bitmap; 34 }33 } 35 34 } 36 35 } -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/XmlGenerator.cs
r2718 r3004 11 11 namespace HeuristicLab.Persistence.Default.Xml { 12 12 13 14 /// <summary> 15 /// Main entry point of persistence to XML. Use the static methods to serialize 16 /// to a file or to a stream. 17 /// </summary> 13 18 public class XmlGenerator : GeneratorBase<string> { 14 19 … … 155 160 } 156 161 162 /// <summary> 163 /// Serialize an object into a file. 164 /// 165 /// The XML configuration is obtained from the <code>ConfigurationService</code>. 166 /// The file is actually a ZIP file. 167 /// Compression level is set to 5 and needed assemblies are not included. 168 /// </summary> 157 169 public static void Serialize(object o, string filename) { 158 Serialize(o, filename, ConfigurationService.Instance.GetDefaultConfig(new XmlFormat()), false, 5); 159 } 160 170 Serialize(o, filename, ConfigurationService.Instance.GetConfiguration(new XmlFormat()), false, 5); 171 } 172 173 /// <summary> 174 /// Serialize an object into a file. 175 /// 176 /// The XML configuration is obtained from the <code>ConfigurationService</code>. 177 /// Needed assemblies are not included. 178 /// </summary> 179 /// <param name="compression">ZIP file compression level</param> 161 180 public static void Serialize(object o, string filename, int compression) { 162 181 Serialize(o, filename, ConfigurationService.Instance.GetConfiguration(new XmlFormat()), false, compression); 163 182 } 183 164 184 165 185 public static void Serialize(object obj, string filename, Configuration config) {
Note: See TracChangeset
for help on using the changeset viewer.