Changeset 4068 for trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml
- Timestamp:
- 07/22/10 00:44:01 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml
- Files:
-
- 35 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Compact/ByteArray2XmlSerializer.cs
r3742 r4068 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.Linq;25 using System.Text;26 22 27 23 namespace HeuristicLab.Persistence.Default.Xml.Compact { -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Compact/CompactXmlSerializerBase.cs
r3742 r4068 20 20 #endregion 21 21 22 using HeuristicLab.Persistence.Interfaces;23 using HeuristicLab.Persistence.Core;24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;25 22 26 23 namespace HeuristicLab.Persistence.Default.Xml.Compact { -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Compact/DoubleArray2XmlSerializer.cs
r3742 r4068 20 20 #endregion 21 21 22 using System;23 using HeuristicLab.Persistence.Core;24 22 using HeuristicLab.Persistence.Default.Xml.Primitive; 25 23 -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Compact/DoubleList2XmlSerializer.cs
r3937 r4068 20 20 #endregion 21 21 22 using System .Collections;22 using System; 23 23 using System.Collections.Generic; 24 using System ;25 using System.Linq;24 using System.Text; 25 using HeuristicLab.Persistence.Auxiliary; 26 26 using HeuristicLab.Persistence.Core; 27 27 using HeuristicLab.Persistence.Default.Xml.Primitive; 28 using System.Text;29 using HeuristicLab.Persistence.Auxiliary;30 28 31 29 namespace HeuristicLab.Persistence.Default.Xml.Compact { … … 48 46 } 49 47 return list; 50 } catch (InvalidCastException e) { 48 } 49 catch (InvalidCastException e) { 51 50 throw new PersistenceException("Invalid element data during reconstruction of List<double>.", e); 52 } catch (OverflowException e) { 51 } 52 catch (OverflowException e) { 53 53 throw new PersistenceException("Overflow during element parsing while trying to reconstruct List<double>.", e); 54 54 } -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Compact/IntArray2XmlSerializer.cs
r3742 r4068 20 20 #endregion 21 21 22 using System;23 using HeuristicLab.Persistence.Core;24 22 25 23 namespace HeuristicLab.Persistence.Default.Xml.Compact { -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Compact/IntList2XmlSerializer.cs
r3742 r4068 22 22 using System.Collections; 23 23 using System.Collections.Generic; 24 using System;25 using HeuristicLab.Persistence.Core;26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;27 24 28 25 namespace HeuristicLab.Persistence.Default.Xml.Compact { -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Compact/NumberArray2XmlSerializerBase.cs
r3945 r4068 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections; 24 using System.Collections.Generic; 23 25 using System.Text; 24 using HeuristicLab.Persistence.Interfaces; 25 using System; 26 using HeuristicLab.Persistence.Auxiliary; 26 27 using HeuristicLab.Persistence.Core; 27 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 using HeuristicLab.Persistence.Auxiliary;29 using HeuristicLab.Tracing;30 using System.Collections.Generic;31 29 32 30 namespace HeuristicLab.Persistence.Default.Xml.Compact { … … 51 49 lengths[i] = a.GetLength(i); 52 50 nElements *= lengths[i]; 53 } 51 } 54 52 sb.EnsureCapacity(sb.Length + nElements * 3); 55 53 for (int i = 0; i < a.Rank; i++) { … … 71 69 } 72 70 } 73 } 71 } 74 72 return new XmlString(sb.ToString()); 75 73 } … … 92 90 Array a = Array.CreateInstance(this.SourceType.GetElementType(), lengths, lowerBounds); 93 91 int[] positions = (int[])lowerBounds.Clone(); 94 while (values.MoveNext()) { 92 while (values.MoveNext()) { 95 93 a.SetValue(ParseValue(values.Current), positions); 96 94 positions[0] += 1; … … 107 105 throw new PersistenceException("Insufficient number of elements while trying to fill number array."); 108 106 return (T)(object)a; 109 } catch (InvalidOperationException e) { 107 } 108 catch (InvalidOperationException e) { 110 109 throw new PersistenceException("Insufficient information to rebuild number array.", e); 111 } catch (InvalidCastException e) { 110 } 111 catch (InvalidCastException e) { 112 112 throw new PersistenceException("Invalid element data or meta data to reconstruct number array.", e); 113 } catch (OverflowException e) { 113 } 114 catch (OverflowException e) { 114 115 throw new PersistenceException("Overflow during element parsing while trying to reconstruct number array.", e); 115 116 } -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Compact/NumberEnumeration2XmlSerializerBase.cs
r3937 r4068 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections; 23 24 using System.Text; 24 using HeuristicLab.Persistence.Interfaces; 25 using System; 25 using HeuristicLab.Persistence.Auxiliary; 26 26 using HeuristicLab.Persistence.Core; 27 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 using HeuristicLab.Persistence.Auxiliary;29 28 30 29 namespace HeuristicLab.Persistence.Default.Xml.Compact { … … 55 54 } 56 55 return (T)enumeration; 57 } catch (InvalidCastException e) { 56 } 57 catch (InvalidCastException e) { 58 58 throw new PersistenceException("Invalid element data during reconstruction of number enumerable.", e); 59 } catch (OverflowException e) { 59 } 60 catch (OverflowException e) { 60 61 throw new PersistenceException("Overflow during element parsing while trying to reconstruct number enumerable.", e); 61 62 } -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/EasyXmlGenerator.cs
r3937 r4068 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 23 using System; 24 using System.Text; 24 using System.IO; 25 using HeuristicLab.Persistence.Auxiliary; 26 using HeuristicLab.Persistence.Core; 27 using HeuristicLab.Persistence.Core.Tokens; 25 28 using HeuristicLab.Persistence.Interfaces; 26 using HeuristicLab.Persistence.Core;27 using System.IO;28 using ICSharpCode.SharpZipLib.Zip;29 29 using HeuristicLab.Tracing; 30 using HeuristicLab.Persistence.Core.Tokens;31 using System.IO.Compression;32 using HeuristicLab.Persistence.Auxiliary;33 30 34 31 namespace HeuristicLab.Persistence.Default.Xml { … … 146 143 /// <param name="filename">The filename.</param> 147 144 /// <param name="config">The configuration.</param> 148 public static void Serialize(object obj, string filename, Configuration config) { 145 public static void Serialize(object obj, string filename, Configuration config) { 149 146 try { 150 147 string tempfile = Path.GetTempFileName(); … … 157 154 File.Copy(tempfile, filename, true); 158 155 File.Delete(tempfile); 159 } catch (Exception) { 156 } 157 catch (Exception) { 160 158 Logger.Warn("Exception caught, no data has been written."); 161 159 throw; … … 180 178 /// <param name="stream">The stream.</param> 181 179 /// <param name="config">The configuration.</param> 182 public static void Serialize(object obj, Stream stream, Configuration config) { 180 public static void Serialize(object obj, Stream stream, Configuration config) { 183 181 try { 184 182 using (StreamWriter writer = new StreamWriter(stream)) { … … 192 190 writer.Flush(); 193 191 } 194 } catch (PersistenceException) { 192 } 193 catch (PersistenceException) { 195 194 throw; 196 } catch (Exception e) { 195 } 196 catch (Exception e) { 197 197 throw new PersistenceException("Unexpected exception during Serialization.", e); 198 198 } -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/Bool2XmlSerializer.cs
r3742 r4068 20 20 #endregion 21 21 22 using System;23 using HeuristicLab.Persistence.Core;24 using HeuristicLab.Persistence.Interfaces;25 using System.Reflection;26 using System.Globalization;27 22 28 23 namespace HeuristicLab.Persistence.Default.Xml.Primitive { -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/Byte2XmlSerializer.cs
r3742 r4068 20 20 #endregion 21 21 22 using System;23 using HeuristicLab.Persistence.Core;24 using HeuristicLab.Persistence.Interfaces;25 using System.Reflection;26 using System.Globalization;27 22 28 23 namespace HeuristicLab.Persistence.Default.Xml.Primitive { -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/Char2XmlFormatter.cs
r3742 r4068 20 20 #endregion 21 21 22 using System;23 22 using HeuristicLab.Persistence.Core; 24 23 using HeuristicLab.Persistence.Interfaces; 25 using System.Reflection;26 using System.Globalization;27 24 28 25 namespace HeuristicLab.Persistence.Default.Xml.Primitive { -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/DateTime2XmlSerializer.cs
r3742 r4068 22 22 using System; 23 23 using HeuristicLab.Persistence.Core; 24 using HeuristicLab.Persistence.Interfaces;25 24 26 25 namespace HeuristicLab.Persistence.Default.Xml.Primitive { … … 35 34 try { 36 35 return new DateTime(long.Parse(x.Data)); 37 } catch (Exception e) { 36 } 37 catch (Exception e) { 38 38 throw new PersistenceException("Exception caugth while trying to reconstruct DateTime object.", e); 39 39 } -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/Decimal2XmlSerializer.cs
r3742 r4068 21 21 22 22 using System; 23 using HeuristicLab.Persistence.Core;24 using HeuristicLab.Persistence.Interfaces;25 using System.Reflection;26 23 using System.Globalization; 27 24 -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/Double2XmlSerializer.cs
r3742 r4068 21 21 22 22 using System; 23 using HeuristicLab.Persistence.Core;24 using HeuristicLab.Persistence.Interfaces;25 using System.Reflection;26 23 using System.Globalization; 27 24 … … 54 51 } 55 52 56 57 53 54 58 55 59 56 } -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/Float2XmlSerializer.cs
r3742 r4068 21 21 22 22 using System; 23 using HeuristicLab.Persistence.Core;24 using HeuristicLab.Persistence.Interfaces;25 using System.Reflection;26 23 using System.Globalization; 27 24 -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/Guid2XmlSerializer.cs
r3742 r4068 21 21 22 22 using System; 23 using System.Globalization; 23 24 using HeuristicLab.Persistence.Core; 24 using HeuristicLab.Persistence.Interfaces;25 using System.Text;26 using System.Text.RegularExpressions;27 using System.Globalization;28 25 29 26 … … 39 36 try { 40 37 return new Guid(t.Data); 41 } catch (FormatException x) { 38 } 39 catch (FormatException x) { 42 40 throw new PersistenceException("Cannot parse Guid string representation.", x); 43 } catch (OverflowException x) { 41 } 42 catch (OverflowException x) { 44 43 throw new PersistenceException("Overflow during Guid parsing.", x); 45 44 } -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/Int2XmlSerializer.cs
r3742 r4068 20 20 #endregion 21 21 22 using System;23 using HeuristicLab.Persistence.Core;24 using HeuristicLab.Persistence.Interfaces;25 using System.Reflection;26 using System.Globalization;27 22 28 23 namespace HeuristicLab.Persistence.Default.Xml.Primitive { -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/Long2XmlSerializer.cs
r3742 r4068 20 20 #endregion 21 21 22 using System;23 using HeuristicLab.Persistence.Core;24 using HeuristicLab.Persistence.Interfaces;25 using System.Reflection;26 using System.Globalization;27 22 28 23 namespace HeuristicLab.Persistence.Default.Xml.Primitive { -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/PrimitiveXmlSerializerBase.cs
r3742 r4068 20 20 #endregion 21 21 22 using HeuristicLab.Persistence.Interfaces;23 using HeuristicLab.Persistence.Core;24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;25 22 26 23 namespace HeuristicLab.Persistence.Default.Xml.Primitive { -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/SByte2XmlSerializer.cs
r3742 r4068 20 20 #endregion 21 21 22 using System;23 using HeuristicLab.Persistence.Core;24 using HeuristicLab.Persistence.Interfaces;25 using System.Reflection;26 using System.Globalization;27 22 28 23 namespace HeuristicLab.Persistence.Default.Xml.Primitive { -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/Short2XmlSerializer.cs
r3742 r4068 20 20 #endregion 21 21 22 using System;23 using HeuristicLab.Persistence.Core;24 using HeuristicLab.Persistence.Interfaces;25 using System.Reflection;26 using System.Globalization;27 22 28 23 namespace HeuristicLab.Persistence.Default.Xml.Primitive { -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/SimpleNumber2XmlSerializerBase.cs
r3742 r4068 21 21 22 22 using System; 23 using System.Reflection; 23 24 using HeuristicLab.Persistence.Core; 24 using HeuristicLab.Persistence.Interfaces;25 using System.Reflection;26 using System.Globalization;27 25 28 26 namespace HeuristicLab.Persistence.Default.Xml.Primitive { … … 46 44 try { 47 45 return (T)ParseMethod.Invoke(null, new[] { x.Data }); 48 } catch (Exception e) { 46 } 47 catch (Exception e) { 49 48 throw new PersistenceException("Could not parse simple number.", e); 50 49 } -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/String2XmlSerializer.cs
r3742 r4068 20 20 #endregion 21 21 22 using System;23 using HeuristicLab.Persistence.Core;24 using HeuristicLab.Persistence.Interfaces;25 22 using System.Text; 26 23 using System.Text.RegularExpressions; 27 using System.Globalization;24 using HeuristicLab.Persistence.Core; 28 25 29 26 -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/System.Drawing/Bitmap2XmlSerializer.cs
r3742 r4068 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.Linq;25 using System.Text;26 22 using System.Drawing; 23 using System.Drawing.Imaging; 27 24 using System.IO; 28 using System.Drawing.Imaging;29 using System.Text.RegularExpressions;30 using HeuristicLab.Persistence.Core;31 25 using HeuristicLab.Persistence.Default.Xml.Compact; 32 26 -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/TimeSpan2XmlSerializer.cs
r3742 r4068 22 22 using System; 23 23 using HeuristicLab.Persistence.Core; 24 using HeuristicLab.Persistence.Interfaces;25 using System.Text;26 using System.Text.RegularExpressions;27 using System.Globalization;28 24 29 25 … … 39 35 try { 40 36 return TimeSpan.Parse(t.Data); 41 } catch (FormatException x) { 37 } 38 catch (FormatException x) { 42 39 throw new PersistenceException("Cannot parse TimeSpan string representation.", x); 43 } catch (OverflowException x) { 40 } 41 catch (OverflowException x) { 44 42 throw new PersistenceException("Overflow during TimeSpan parsing.", x); 45 43 } -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/UInt2XmlSerializer.cs
r3742 r4068 20 20 #endregion 21 21 22 using System;23 using HeuristicLab.Persistence.Core;24 using HeuristicLab.Persistence.Interfaces;25 using System.Reflection;26 using System.Globalization;27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;28 22 29 23 namespace HeuristicLab.Persistence.Default.Xml.Primitive { -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/ULong2XmlSerializer.cs
r3742 r4068 20 20 #endregion 21 21 22 using System;23 using HeuristicLab.Persistence.Core;24 using HeuristicLab.Persistence.Interfaces;25 using System.Reflection;26 using System.Globalization;27 22 28 23 namespace HeuristicLab.Persistence.Default.Xml.Primitive { -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/UShort2XmlSerializer.cs
r3742 r4068 20 20 #endregion 21 21 22 using System;23 using HeuristicLab.Persistence.Core;24 using HeuristicLab.Persistence.Interfaces;25 using System.Reflection;26 using System.Globalization;27 22 28 23 namespace HeuristicLab.Persistence.Default.Xml.Primitive { -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/XmlFormat.cs
r3742 r4068 20 20 #endregion 21 21 22 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 22 23 using HeuristicLab.Persistence.Interfaces; 23 using HeuristicLab.Persistence.Core;24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;25 24 26 25 namespace HeuristicLab.Persistence.Default.Xml { -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/XmlGenerator.cs
r3944 r4068 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 23 using System; 24 using System.IO; 25 using System.IO.Compression; 26 using System.Linq; 24 27 using System.Text; 25 using System.Linq; 28 using HeuristicLab.Persistence.Core; 29 using HeuristicLab.Persistence.Core.Tokens; 26 30 using HeuristicLab.Persistence.Interfaces; 27 using HeuristicLab.Persistence.Core; 28 using System.IO; 31 using HeuristicLab.Tracing; 29 32 using ICSharpCode.SharpZipLib.Zip; 30 using HeuristicLab.Tracing;31 using HeuristicLab.Persistence.Core.Tokens;32 using System.IO.Compression;33 33 34 34 namespace HeuristicLab.Persistence.Default.Xml { … … 257 257 {"typeName", lastTypeToken.TypeName }, 258 258 {"serializer", lastTypeToken.Serializer }}); 259 } finally { 259 } 260 finally { 260 261 lastTypeToken = null; 261 262 } … … 367 368 File.Copy(tempfile, filename, true); 368 369 File.Delete(tempfile); 369 } catch (Exception) { 370 } 371 catch (Exception) { 370 372 Logger.Warn("Exception caught, no data has been written."); 371 373 throw; … … 413 415 writer.Flush(); 414 416 } 415 } catch (PersistenceException) { 417 } 418 catch (PersistenceException) { 416 419 throw; 417 } catch (Exception e) { 420 } 421 catch (Exception e) { 418 422 throw new PersistenceException("Unexpected exception during Serialization.", e); 419 423 } -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/XmlParser.cs
r3913 r4068 20 20 #endregion 21 21 22 using System.Xml;23 using System.Collections.Generic;24 22 using System; 25 23 using System.Collections; 24 using System.Collections.Generic; 26 25 using System.IO; 26 using System.IO.Compression; 27 using System.Xml; 27 28 using HeuristicLab.Persistence.Core; 29 using HeuristicLab.Persistence.Core.Tokens; 28 30 using HeuristicLab.Persistence.Interfaces; 29 31 using ICSharpCode.SharpZipLib.Zip; 30 using HeuristicLab.Persistence.Core.Tokens;31 using System.IO.Compression;32 32 33 33 namespace HeuristicLab.Persistence.Default.Xml { … … 75 75 try { 76 76 iterator = handlers[reader.Name].Invoke(); 77 } catch (KeyNotFoundException) { 77 } 78 catch (KeyNotFoundException) { 78 79 throw new PersistenceException(String.Format( 79 80 "Invalid XML tag \"{0}\" in persistence file.", … … 175 176 } 176 177 return typeCache; 177 } catch (PersistenceException) { 178 } 179 catch (PersistenceException) { 178 180 throw; 179 } catch (Exception e) { 181 } 182 catch (Exception e) { 180 183 throw new PersistenceException("Unexpected exception during type cache parsing.", e); 181 184 } … … 193 196 return Deserialize(file); 194 197 } 195 } finally { 198 } 199 finally { 196 200 TimeSpan end = System.Diagnostics.Process.GetCurrentProcess().TotalProcessorTime; 197 201 Tracing.Logger.Info(string.Format( … … 224 228 return deserializer.Deserialize(parser); 225 229 } 226 } catch (PersistenceException) { 230 } 231 catch (PersistenceException) { 227 232 throw; 228 } catch (Exception x) { 233 } 234 catch (Exception x) { 229 235 throw new PersistenceException("Unexpected exception during deserialization", x); 230 236 } … … 255 261 zipFile.Close(); 256 262 return result; 257 } catch (PersistenceException) { 263 } 264 catch (PersistenceException) { 258 265 throw; 259 } catch (Exception e) { 266 } 267 catch (Exception e) { 260 268 throw new PersistenceException("Unexpected exception during deserialization", e); 261 269 } -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/XmlSerializerBase.cs
r3742 r4068 21 21 22 22 using HeuristicLab.Persistence.Interfaces; 23 using HeuristicLab.Persistence.Core;24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;25 23 26 24 namespace HeuristicLab.Persistence.Default.Xml { -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/XmlString.cs
r3742 r4068 20 20 #endregion 21 21 22 using HeuristicLab.Persistence.Interfaces;23 using HeuristicLab.Persistence.Core;24 22 using System.Text; 25 23 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 24 using HeuristicLab.Persistence.Interfaces; 26 25 27 26 namespace HeuristicLab.Persistence.Default.Xml { … … 30 29 /// XML friendly encapsulation of string data. 31 30 /// </summary> 32 [StorableClass] 31 [StorableClass] 33 32 public class XmlString : ISerialData { 34 33 -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/XmlStringConstants.cs
r3742 r4068 20 20 #endregion 21 21 22 using System.Collections.Generic;23 using System;24 using System.Text;25 using HeuristicLab.Persistence.Interfaces;26 using HeuristicLab.Persistence.Core;27 using System.IO;28 using ICSharpCode.SharpZipLib.Zip;29 using HeuristicLab.Tracing;30 using HeuristicLab.Persistence.Core.Tokens;31 22 32 23 namespace HeuristicLab.Persistence.Default.Xml { … … 41 32 public const string METAINFO = "METAINFO"; 42 33 } 43 34 44 35 }
Note: See TracChangeset
for help on using the changeset viewer.