- Timestamp:
- 05/04/17 17:19:35 (7 years ago)
- Location:
- branches/PersistenceReintegration/HeuristicLab.Persistence/3.3/Auxiliary
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PersistenceReintegration/HeuristicLab.Persistence/3.3/Auxiliary/TypeLoader.cs
r14185 r14927 59 59 try { 60 60 typeName = TypeNameParser.Parse(typeNameString); 61 } 62 catch (Exception) { 61 } catch (Exception) { 63 62 throw new PersistenceException(String.Format( 64 63 "Could not parse type string \"{0}\"", … … 69 68 // try to load type normally 70 69 return LoadInternal(typeName); 71 } 72 catch (PersistenceException) { 70 } catch (PersistenceException) { 73 71 #region Mono Compatibility 74 72 // if that fails, try to convert to the corresponding Mono or .NET type … … 92 90 try { 93 91 type = Type.GetType(typeName.ToString(true, true), true); 94 } 95 catch (Exception) { 92 } catch (Exception) { 96 93 Logger.Warn(String.Format( 97 94 "Cannot load type \"{0}\", falling back to partial name", typeName.ToString(true, true))); … … 109 106 #pragma warning restore 0618 110 107 return a.GetType(typeName.ToString(false, false), true); 111 } 112 catch (Exception) { 108 } catch (Exception) { 113 109 throw new PersistenceException(String.Format( 114 110 "Could not load type \"{0}\"", … … 130 126 typeName.ToString(true, true), 131 127 type.AssemblyQualifiedName)); 132 } 133 catch (PersistenceException) { 128 } catch (PersistenceException) { 134 129 throw; 135 } 136 catch (Exception e) { 130 } catch (Exception e) { 137 131 Logger.Warn(String.Format( 138 132 "Could not perform version check requested type was {0} while loaded type is {1}:", -
branches/PersistenceReintegration/HeuristicLab.Persistence/3.3/Auxiliary/TypeName.cs
r14185 r14927 24 24 using System.Linq; 25 25 using System.Text; 26 using HeuristicLab.Persistence .Default.CompositeSerializers.Storable;26 using HeuristicLab.Persistence; 27 27 28 28 namespace HeuristicLab.Persistence.Auxiliary { … … 33 33 /// attributes. 34 34 /// </summary> 35 [Storable Class]35 [StorableType("a83d8580-07c2-4805-a31f-23b702689e0c")] 36 36 public class TypeName { 37 37 … … 57 57 public List<int> GenericArgCounts { get; private set; } 58 58 59 59 /// <summary> 60 60 /// Gets or sets the generic args. 61 61 /// </summary> … … 110 110 /// <param name="nameSpace">The namespace.</param> 111 111 /// <param name="className">Name of the class.</param> 112 internal TypeName(string nameSpace, string className, List<int> genericArgCounts =null) {112 internal TypeName(string nameSpace, string className, List<int> genericArgCounts = null) { 113 113 Namespace = nameSpace; 114 114 ClassName = className; … … 187 187 private IEnumerable<string> GetNestedClassesInCode(HashSet<string> omitNamespaces, bool includeAllNamespaces) { 188 188 var i = 0; 189 foreach (var pair in ClassName.Split('+').Zip(GenericArgCounts, (n, c) => new { n, c})) {189 foreach (var pair in ClassName.Split('+').Zip(GenericArgCounts, (n, c) => new { n, c })) { 190 190 if (pair.c == 0) { 191 191 yield return pair.n; 192 } 193 else { 192 } else { 194 193 yield return string.Format("{0}<{1}>", 195 194 pair.n, … … 208 207 (omitNamespaces == null && includeNamespaces) || 209 208 omitNamespaces != null && !omitNamespaces.Contains(Namespace)) 210 209 sb.Append(Namespace).Append('.'); 211 210 if (GenericArgCounts != null) { 212 211 sb.Append(string.Join(".", GetNestedClassesInCode(omitNamespaces, includeNamespaces))); … … 273 272 } 274 273 return false; 275 } 276 catch (KeyNotFoundException) { 274 } catch (KeyNotFoundException) { 277 275 throw new Exception("Could not extract version information from type string"); 278 276 } … … 311 309 } 312 310 return true; 313 } 314 catch (KeyNotFoundException) { 311 } catch (KeyNotFoundException) { 315 312 throw new Exception("Could not extract version infomration from type string"); 316 313 } -
branches/PersistenceReintegration/HeuristicLab.Persistence/3.3/Auxiliary/TypeNameParser.cs
r14185 r14927 166 166 try { 167 167 return p.TransformTypeSpec(); 168 } 169 catch (ParseError x) { 168 } catch (ParseError x) { 170 169 if (p.Position > 0) 171 170 throw new ParseError(String.Format(
Note: See TracChangeset
for help on using the changeset viewer.