Changeset 11594 for branches/Breadcrumbs/HeuristicLab.Persistence
- Timestamp:
- 11/27/14 11:23:37 (10 years ago)
- Location:
- branches/Breadcrumbs
- Files:
-
- 115 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/Breadcrumbs
- Property svn:ignore
-
old new 8 8 FxCopResults.txt 9 9 Google.ProtocolBuffers-0.9.1.dll 10 Google.ProtocolBuffers-2.4.1.473.dll 10 11 HeuristicLab 3.3.5.1.ReSharper.user 11 12 HeuristicLab 3.3.6.0.ReSharper.user 12 13 HeuristicLab.4.5.resharper.user 13 14 HeuristicLab.ExtLibs.6.0.ReSharper.user 15 HeuristicLab.Scripting.Development 14 16 HeuristicLab.resharper.user 15 17 ProtoGen.exe … … 17 19 _ReSharper.HeuristicLab 18 20 _ReSharper.HeuristicLab 3.3 21 _ReSharper.HeuristicLab 3.3 Tests 19 22 _ReSharper.HeuristicLab.ExtLibs 20 23 bin 21 24 protoc.exe 22 _ReSharper.HeuristicLab 3.3 Tests23 Google.ProtocolBuffers-2.4.1.473.dll
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/Breadcrumbs/HeuristicLab.Persistence
- Property svn:mergeinfo changed
-
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Auxiliary/ObjectEqualityComparer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Auxiliary/ReflectionTools.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Auxiliary/StringExtensions.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Auxiliary/TypeExtensions.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Auxiliary/TypeLoader.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Auxiliary/TypeName.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Auxiliary/TypeNameParser.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Core/Configuration.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Core/ConfigurationService.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Core/DataMemberAccessor.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Core/Deserializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Core/FormatBase.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Core/GeneratorBase.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Core/PersistenceException.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Core/PrimitiveSerializerBase.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Core/Serializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Core/Tag.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Core/Tokens/BeginToken.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Core/Tokens/CompositeTokenBase.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Core/Tokens/EndToken.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Core/Tokens/MetaInfoBeginToken.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Core/Tokens/MetaInfoEndToken.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Core/Tokens/NullReferenceToken.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Core/Tokens/PrimitiveToken.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Core/Tokens/ReferenceToken.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Core/Tokens/SerializationTokenBase.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Core/Tokens/TypeToken.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Core/TypeMapping.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/ArraySerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/CompactNumberArray2StringSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/ConcreteDictionarySerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/DictionarySerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/EnumSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/EnumerableSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/HashSetSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/KeyValuePairSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Number2StringSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 78 78 /// </returns> 79 79 public bool CanSerialize(Type type) { 80 return numberSerializerMap.ContainsKey( type);80 return numberSerializerMap.ContainsKey(Nullable.GetUnderlyingType(type) ?? type); 81 81 } 82 82 … … 90 90 /// </returns> 91 91 public string JustifyRejection(Type type) { 92 return string.Format("not a number type (one of {0})",92 return string.Format("not a (nullable) number type (one of {0})", 93 93 string.Join(", ", numberSerializers.Select(n => n.SourceType.Name).ToArray())); 94 94 } … … 100 100 /// <returns></returns> 101 101 public string Format(object obj) { 102 return ((XmlString)numberSerializerMap[obj.GetType()].Format(obj)).Data; 102 if (obj == null) return "null"; 103 Type type = obj.GetType(); 104 return ((XmlString)numberSerializerMap[Nullable.GetUnderlyingType(type) ?? type].Format(obj)).Data; 103 105 } 104 106 … … 110 112 /// <returns></returns> 111 113 public object Parse(string stringValue, Type type) { 114 if (stringValue == "null") return null; 112 115 try { 113 return numberSerializerMap[ type].Parse(new XmlString(stringValue));116 return numberSerializerMap[Nullable.GetUnderlyingType(type) ?? type].Parse(new XmlString(stringValue)); 114 117 } 115 118 catch (FormatException e) { -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/NumberEnumerable2StringSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/StackSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableAttribute.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableClassAttribute.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableClassType.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableConstructorAttribute.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableHookAttribute.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableMemberInfo.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableReflection.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 47 47 hookCache = new Dictionary<HookDesignator, List<StorableReflection.Hook>>(); 48 48 } 49 49 50 [StorableConstructor] 50 51 private StorableSerializer(bool deserializing) : this() { } … … 68 69 /// </returns> 69 70 public bool CanSerialize(Type type) { 70 boolmarkedStorable = StorableReflection.HasStorableClassAttribute(type);71 var markedStorable = StorableReflection.HasStorableClassAttribute(type); 71 72 if (GetConstructor(type) == null) 72 73 if (markedStorable) … … 91 92 /// </returns> 92 93 public string JustifyRejection(Type type) { 93 StringBuilder sb = new StringBuilder();94 var sb = new StringBuilder(); 94 95 if (GetConstructor(type) == null) 95 96 sb.Append("class has no default constructor and no [StorableConstructor]"); … … 117 118 /// <returns>An enumerable of <see cref="Tag"/>s.</returns> 118 119 public IEnumerable<Tag> Decompose(object obj) { 119 foreach (var accessor in GetStorableAccessors(obj.GetType())) { 120 if (accessor.Get != null) 121 yield return new Tag(accessor.Name, accessor.Get(obj)); 122 } 120 return from accessor in GetStorableAccessors(obj.GetType()) 121 where accessor.Get != null 122 select new Tag(accessor.Name, accessor.Get(obj)); 123 123 } 124 124 … … 147 147 public void Populate(object instance, IEnumerable<Tag> objects, Type type) { 148 148 var memberDict = new Dictionary<string, Tag>(); 149 IEnumerator<Tag>iter = objects.GetEnumerator();149 var iter = objects.GetEnumerator(); 150 150 while (iter.MoveNext()) { 151 151 memberDict.Add(iter.Current.Name, iter.Current); … … 170 170 BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; 171 171 172 private static readonly object[] emptyArgs = new object[] { }; 173 private static readonly object[] trueArgs = new object[] { true }; 174 175 private sealed class HookDesignator { 176 public Type Type { get; private set; } 177 public HookType HookType { get; private set; } 178 public HookDesignator() { } 179 public HookDesignator(Type type, HookType hookType) { 180 Type = type; 181 HookType = HookType; 182 } 172 private sealed class HookDesignator : Tuple<Type, HookType> { 173 public HookDesignator(Type type, HookType hookType) : base(type, hookType) { } 183 174 } 184 175 … … 191 182 #region caches 192 183 193 private AccessorListCache accessorListCache;194 private AccessorCache accessorCache;195 private Dictionary<Type, Constructor> constructorCache;196 private Dictionary<HookDesignator, List<StorableReflection.Hook>> hookCache;184 private readonly AccessorListCache accessorListCache; 185 private readonly AccessorCache accessorCache; 186 private readonly Dictionary<Type, Constructor> constructorCache; 187 private readonly Dictionary<HookDesignator, List<StorableReflection.Hook>> hookCache; 197 188 198 189 #endregion … … 206 197 var storableMembers = StorableReflection 207 198 .GenerateStorableMembers(type) 208 .Select(mi => GetMemberAccessor(mi)); 199 .Select(GetMemberAccessor) 200 .ToList(); 209 201 accessorListCache[type] = storableMembers; 210 202 return storableMembers; … … 216 208 if (accessorCache.ContainsKey(mi.MemberInfo)) 217 209 return new DataMemberAccessor(accessorCache[mi.MemberInfo], mi.DisentangledName, mi.DefaultValue); 218 DataMemberAccessor dma = new DataMemberAccessor(mi.MemberInfo, mi.DisentangledName, mi.DefaultValue);210 var dma = new DataMemberAccessor(mi.MemberInfo, mi.DisentangledName, mi.DefaultValue); 219 211 accessorCache[mi.MemberInfo] = dma; 220 212 return dma; … … 226 218 if (constructorCache.ContainsKey(type)) 227 219 return constructorCache[type]; 228 Constructor c = FindStorableConstructor(type) ?? GetDefaultConstructor(type);220 var c = FindStorableConstructor(type) ?? GetDefaultConstructor(type); 229 221 constructorCache.Add(type, c); 230 222 return c; … … 233 225 234 226 private Constructor GetDefaultConstructor(Type type) { 235 ConstructorInfoci = type.GetConstructor(ALL_CONSTRUCTORS, null, Type.EmptyTypes, null);227 var ci = type.GetConstructor(ALL_CONSTRUCTORS, null, Type.EmptyTypes, null); 236 228 if (ci == null) 237 229 return null; 238 DynamicMethoddm = new DynamicMethod("", typeof(object), null, type, true);239 ILGenerator ilgen = dm.GetILGenerator();230 var dm = new DynamicMethod("", typeof(object), null, type, true); 231 var ilgen = dm.GetILGenerator(); 240 232 ilgen.Emit(OpCodes.Newobj, ci); 241 233 ilgen.Emit(OpCodes.Ret); … … 244 236 245 237 private Constructor FindStorableConstructor(Type type) { 246 foreach ( ConstructorInfo ci in type.GetConstructors(ALL_CONSTRUCTORS)) {247 if (ci.GetCustomAttributes(typeof(StorableConstructorAttribute), false).Length > 0) {248 if (ci.GetParameters().Length != 1 ||249 ci.GetParameters()[0].ParameterType != typeof(bool))250 throw new PersistenceException("StorableConstructor must have exactly one argument of type bool");251 DynamicMethod dm = new DynamicMethod("", typeof(object), null, type, true);252 ILGenerator ilgen = dm.GetILGenerator();253 ilgen.Emit(OpCodes.Ldc_I4_1); // load true254 ilgen.Emit(OpCodes.Newobj, ci);255 ilgen.Emit(OpCodes.Ret);256 return (Constructor)dm.CreateDelegate(typeof(Constructor));257 }238 foreach (var ci in type 239 .GetConstructors(ALL_CONSTRUCTORS) 240 .Where(ci => ci.GetCustomAttributes(typeof(StorableConstructorAttribute), false).Length > 0)) { 241 if (ci.GetParameters().Length != 1 || 242 ci.GetParameters()[0].ParameterType != typeof(bool)) 243 throw new PersistenceException("StorableConstructor must have exactly one argument of type bool"); 244 var dm = new DynamicMethod("", typeof(object), null, type, true); 245 var ilgen = dm.GetILGenerator(); 246 ilgen.Emit(OpCodes.Ldc_I4_1); // load true 247 ilgen.Emit(OpCodes.Newobj, ci); 248 ilgen.Emit(OpCodes.Ret); 249 return (Constructor)dm.CreateDelegate(typeof(Constructor)); 258 250 } 259 251 return null; … … 262 254 private void InvokeHook(HookType hookType, object obj) { 263 255 if (obj == null) 264 throw new ArgumentNullException(" Cannot invoke hooks on null");265 foreach ( StorableReflection.Hookhook in GetHooks(hookType, obj.GetType())) {256 throw new ArgumentNullException("obj"); 257 foreach (var hook in GetHooks(hookType, obj.GetType())) { 266 258 hook(obj); 267 259 } -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/StructSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/TupleSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/TypeSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/DebugString/DebugString.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/DebugString/DebugStringFormat.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/DebugString/DebugStringGenerator.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/DebugString/PrimitiveSerializers/Bool2DebugStringSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/DebugString/PrimitiveSerializers/Byte2DebugStringSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/DebugString/PrimitiveSerializers/Char2DebugStringSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/DebugString/PrimitiveSerializers/DateTime2DebugStringSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/DebugString/PrimitiveSerializers/Double2DebugStringSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/DebugString/PrimitiveSerializers/Float2DebugStringSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/DebugString/PrimitiveSerializers/Int2DebugStringSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/DebugString/PrimitiveSerializers/Long2DebugStringSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/DebugString/PrimitiveSerializers/SByte2DebugStringSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/DebugString/PrimitiveSerializers/Short2DebugStringSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/DebugString/PrimitiveSerializers/String2DebugStringSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/DebugString/PrimitiveSerializers/Type2DebugStringSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/DebugString/PrimitiveSerializers/UInt2DebugStringSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/DebugString/PrimitiveSerializers/ULong2DebugStringSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/DebugString/PrimitiveSerializers/UShort2DebugStringSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/DebugString/PrimitiveSerializers/ValueType2DebugStringSerializerBase.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/Xml/Compact/ByteArray2XmlSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/Xml/Compact/CompactXmlSerializerBase.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/Xml/Compact/DoubleArray2XmlSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/Xml/Compact/DoubleList2XmlSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/Xml/Compact/IntArray2XmlSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/Xml/Compact/IntList2XmlSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/Xml/Compact/NumberArray2XmlSerializerBase.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/Xml/Compact/NumberEnumeration2XmlSerializerBase.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/Xml/EasyXmlGenerator.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/Bool2XmlSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/Byte2XmlSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/Char2XmlFormatter.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 20 20 #endregion 21 21 22 using System; 23 using System.Text; 24 using System.Text.RegularExpressions; 22 25 using HeuristicLab.Persistence.Core; 23 26 using HeuristicLab.Persistence.Interfaces; … … 27 30 internal sealed class Char2XmlSerializer : PrimitiveSerializerBase<char, XmlString> { 28 31 32 private static readonly Regex base64Regex = new Regex("<Base64>(.+)</Base64>"); 33 34 private static bool IsSpecial(char c) { 35 return c <= 0x1F && c != 0x9 && c != 0xA && c != 0xD; 36 } 37 38 private static string ToBase64String(char c) { 39 return string.Format("<Base64>{0}</Base64>", Convert.ToBase64String(Encoding.ASCII.GetBytes(new[] {c}))); 40 } 41 29 42 public override XmlString Format(char c) { 30 return new XmlString( new string(c, 1));43 return new XmlString(IsSpecial(c) ? ToBase64String(c) : new string(c, 1)); 31 44 } 32 45 33 46 public override char Parse(XmlString x) { 34 if (x.Data.Length != 1) 35 throw new PersistenceException("Invalid character format, XML string length != 1"); 36 return x.Data[0]; 47 if (x.Data.Length <= 1) return x.Data[0]; 48 var m = base64Regex.Match(x.Data); 49 if (m.Success) 50 return Encoding.ASCII.GetString(Convert.FromBase64String(m.Groups[1].Value))[0]; 51 throw new PersistenceException("Invalid character format, XML string length != 1"); 37 52 } 38 53 } -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/DateTime2XmlSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/Decimal2XmlSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/Double2XmlSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/Float2XmlSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/Guid2XmlSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/Int2XmlSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/Long2XmlSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/PrimitiveXmlSerializerBase.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/SByte2XmlSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/Short2XmlSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/SimpleNumber2XmlSerializerBase.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/String2XmlSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 20 20 #endregion 21 21 22 using System; 22 23 using System.Text; 23 24 using System.Text.RegularExpressions; 24 25 using HeuristicLab.Persistence.Core; 25 26 26 27 27 namespace HeuristicLab.Persistence.Default.Xml.Primitive { … … 42 42 sb.Append(s.Replace("]]>", "]]]]><![CDATA[>")); 43 43 sb.Append("]]>"); 44 return new XmlString(sb.ToString()); 44 s = special.Replace(sb.ToString(), m => ToBase64Tag(m.Value)); 45 return new XmlString(s); 45 46 } 46 47 47 private static Regex re = new Regex(@"<!\[CDATA\[((?:[^]]|\](?!\]>))*)\]\]>", RegexOptions.Singleline); 48 private static readonly Regex re = new Regex(@"<!\[CDATA\[((?:[^]]|\](?!\]>))*)\]\]>|<Base64>([^<]*)</Base64>", RegexOptions.Singleline); 49 private static readonly Regex special = new Regex(@"[\x00-\x08\x0b\x0c\x0e-\x1f]+", RegexOptions.Singleline); 50 51 private static string ToBase64Tag(string s) { 52 return new StringBuilder() 53 .Append("]]><Base64>") 54 .Append(Convert.ToBase64String(Encoding.ASCII.GetBytes(s))) 55 .Append("</Base64><![CDATA[") 56 .ToString(); 57 } 48 58 49 59 /// <summary> … … 55 65 StringBuilder sb = new StringBuilder(); 56 66 foreach (Match m in re.Matches(x.Data)) { 57 sb.Append(m.Groups[1]); 67 if (m.Groups[1].Success) 68 sb.Append(m.Groups[1].Value); 69 else if (m.Groups[2].Success) { 70 sb.Append(Encoding.ASCII.GetString(Convert.FromBase64String(m.Groups[2].Value))); 71 } 58 72 } 59 73 string result = sb.ToString(); -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/System.Drawing/Bitmap2XmlSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/System.Drawing/Font2XmlSerializer.cs
r9988 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 28 28 public override XmlString Format(Font font) { 29 29 return new XmlString(string.Format("{0};{1};{2};{3};{4};{5}", 30 font.FontFamily.Name,30 GetFontFamilyName(font.FontFamily), 31 31 Float2XmlSerializer.FormatG8(font.Size), 32 32 font.Style, … … 39 39 string[] tokens = fontData.Data.Split(';'); 40 40 return new Font( 41 tokens[0],41 GetFontFamily(tokens[0]), 42 42 Float2XmlSerializer.ParseG8(tokens[1]), 43 43 (FontStyle)Enum.Parse(typeof(FontStyle), tokens[2]), … … 46 46 bool.Parse(tokens[5])); 47 47 } 48 49 public const string GENERIC_MONOSPACE_NAME = "_GenericMonospace"; 50 public const string GENERIC_SANS_SERIF_NAME = "_GenericSansSerif"; 51 public const string GENERIC_SERIF_NAME = "_GenericSerif"; 52 53 public static FontFamily GetFontFamily(string name) { 54 if (name == GENERIC_MONOSPACE_NAME) return FontFamily.GenericMonospace; 55 if (name == GENERIC_SANS_SERIF_NAME) return FontFamily.GenericSansSerif; 56 if (name == GENERIC_SERIF_NAME) return FontFamily.GenericSerif; 57 return new FontFamily(name); 58 } 59 60 public static string GetFontFamilyName(FontFamily ff) { 61 if (ff.Equals(FontFamily.GenericMonospace)) return GENERIC_MONOSPACE_NAME; 62 if (ff.Equals(FontFamily.GenericSansSerif)) return GENERIC_SANS_SERIF_NAME; 63 if (ff.Equals(FontFamily.GenericSerif)) return GENERIC_SERIF_NAME; 64 return ff.Name; 65 } 66 48 67 } 49 68 } -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/TimeSpan2XmlSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/UInt2XmlSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/ULong2XmlSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/UShort2XmlSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/Xml/XmlFormat.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/Xml/XmlGenerator.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/Xml/XmlParser.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/Xml/XmlSerializerBase.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/Xml/XmlString.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Default/Xml/XmlStringConstants.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/HeuristicLab.Persistence-3.3.csproj
r8641 r11594 143 143 <Compile Include="Default\CompositeSerializers\CompactNumberArray2StringSerializer.cs" /> 144 144 <Compile Include="Default\CompositeSerializers\ConcreteDictionarySerializer.cs" /> 145 <Compile Include="Default\CompositeSerializers\QueueSerializer.cs" /> 145 146 <Compile Include="Default\CompositeSerializers\TupleSerializer.cs" /> 146 147 <Compile Include="Default\CompositeSerializers\HashSetSerializer.cs" /> -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Interfaces/ICompositeSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Interfaces/IFormat.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Interfaces/IPrimitiveSerializer.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Interfaces/ISerialData.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Interfaces/ISerializationToken.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Plugin.cs.frame
r10037 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 27 27 /// The plugin for HeuriticLab.Persistence 28 28 /// </summary> 29 [Plugin("HeuristicLab.Persistence", "3.3. 9.$WCREV$")]29 [Plugin("HeuristicLab.Persistence", "3.3.10.$WCREV$")] 30 30 [PluginFile("HeuristicLab.Persistence-3.3.dll", PluginFileType.Assembly)] 31 31 [PluginDependency("HeuristicLab.Tracing", "3.3")] -
branches/Breadcrumbs/HeuristicLab.Persistence/3.3/Properties/AssemblyInfo.cs.frame
r10037 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 32 32 [assembly: AssemblyCompany("")] 33 33 [assembly: AssemblyProduct("HeuristicLab")] 34 [assembly: AssemblyCopyright("(c) 2002-201 3HEAL")]34 [assembly: AssemblyCopyright("(c) 2002-2014 HEAL")] 35 35 [assembly: AssemblyTrademark("")] 36 36 [assembly: AssemblyCulture("")] … … 52 52 // 53 53 [assembly: AssemblyVersion("3.3.0.0")] 54 [assembly: AssemblyFileVersion("3.3. 9.$WCREV$")]54 [assembly: AssemblyFileVersion("3.3.10.$WCREV$")]
Note: See TracChangeset
for help on using the changeset viewer.