Changeset 1780 for trunk/sources/HeuristicLab.Persistence/3.3/Auxiliary
- Timestamp:
- 05/11/09 16:09:29 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Persistence/3.3/Auxiliary/TypeStringBuilder.cs
r1779 r1780 365 365 366 366 public string ToString(bool full) { 367 return ToString(full, true); 368 } 369 370 public string ToString(bool full, bool includeAssembly) { 367 371 StringBuilder sb = new StringBuilder(); 368 372 sb.Append(Namespace).Append('.').Append(ClassName); … … 380 384 } 381 385 sb.Append(MemoryMagic); 382 if ( AssemblyName != null)386 if (includeAssembly && AssemblyName != null) { 383 387 sb.Append(", ").Append(AssemblyName); 384 if (full) 385 foreach (var property in AssemblyAttribues) 386 sb.Append(", ").Append(property.Key).Append('=').Append(property.Value); 388 if (full) 389 foreach (var property in AssemblyAttribues) 390 sb.Append(", ").Append(property.Key).Append('=').Append(property.Value); 391 } 387 392 return sb.ToString(); 388 393 } … … 393 398 394 399 public bool IsOlderThan(TypeName t) { 395 if (this.ClassName != t.ClassName || 396 this.Namespace != t.Namespace || 397 this.AssemblyName != t.AssemblyName) 398 throw new Exception("Cannot compare versions of different types"); 399 if (CompareVersions( 400 this.AssemblyAttribues["Version"], 401 t.AssemblyAttribues["Version"]) < 0) 402 return true; 403 IEnumerator<TypeName> thisIt = this.GenericArgs.GetEnumerator(); 404 IEnumerator<TypeName> tIt = t.GenericArgs.GetEnumerator(); 405 while (thisIt.MoveNext()) { 406 tIt.MoveNext(); 407 if (thisIt.Current.IsOlderThan(tIt.Current)) 400 try { 401 if (this.ClassName != t.ClassName || 402 this.Namespace != t.Namespace || 403 this.AssemblyName != t.AssemblyName) 404 throw new Exception("Cannot compare versions of different types"); 405 if (CompareVersions( 406 this.AssemblyAttribues["Version"], 407 t.AssemblyAttribues["Version"]) < 0) 408 408 return true; 409 } 410 return false; 409 IEnumerator<TypeName> thisIt = this.GenericArgs.GetEnumerator(); 410 IEnumerator<TypeName> tIt = t.GenericArgs.GetEnumerator(); 411 while (thisIt.MoveNext()) { 412 tIt.MoveNext(); 413 if (thisIt.Current.IsOlderThan(tIt.Current)) 414 return true; 415 } 416 return false; 417 } catch (KeyNotFoundException) { 418 throw new Exception("Could not extract version information from type string"); 419 } 411 420 } 412 421
Note: See TracChangeset
for help on using the changeset viewer.