Changeset 16396 for branches/PersistenceReintegration
- Timestamp:
- 12/18/18 17:07:52 (6 years ago)
- Location:
- branches/PersistenceReintegration
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PersistenceReintegration/HeuristicLab.ExtLibs/HeuristicLab.ProtobufCS/3.5.0/HeuristicLab.ProtobufCS/HeuristicLab.Protobuf-3.5.0.csproj
r15529 r16396 25 25 <DebugType>pdbonly</DebugType> 26 26 <Optimize>true</Optimize> 27 <OutputPath>..\..\ bin\</OutputPath>27 <OutputPath>..\..\..\..\bin\</OutputPath> 28 28 <DefineConstants>TRACE</DefineConstants> 29 29 <ErrorReport>prompt</ErrorReport> -
branches/PersistenceReintegration/HeuristicLab.Persistence/4.0/Transformers/Transformers.cs
r16210 r16396 436 436 } 437 437 438 foreach (var item in (IEnumerable)value) 439 uints.Add(mapper.GetBoxId(item)); 438 if (type.IsGenericType) { 439 var genericType = type.GetGenericArguments().Single(); 440 if (genericType.IsPrimitive) { 441 if (genericType == typeof(bool)) { 442 } else if (genericType == typeof(bool)) { 443 box.Bools.AddRange(((IEnumerable<bool>)value).ToArray()); 444 } else if (genericType == typeof(int)) { 445 box.Ints.AddRange(((IEnumerable<int>)value).ToArray()); 446 } else if (genericType == typeof(uint)) { 447 box.UInts.AddRange(((IEnumerable<uint>)value).ToArray()); 448 } else if (genericType == typeof(long)) { 449 box.Longs.AddRange(((IEnumerable<long>)value).ToArray()); 450 } else if (genericType == typeof(ulong)) { 451 box.ULongs.AddRange(((IEnumerable<ulong>)value).ToArray()); 452 } else if (genericType == typeof(float)) { 453 box.Floats.AddRange(((IEnumerable<float>)value).ToArray()); 454 } else if (genericType == typeof(double)) { 455 box.Doubles.AddRange(((IEnumerable<double>)value).ToArray()); 456 } else if (genericType == typeof(byte)) { 457 box.Bytes = ByteString.CopyFrom(((IEnumerable<byte>)value).ToArray()); 458 } else { 459 foreach (var item in (IEnumerable)value) 460 uints.Add(mapper.GetBoxId(item)); 461 } 462 } else { 463 foreach (var item in (IEnumerable)value) 464 uints.Add(mapper.GetBoxId(item)); 465 } 466 } else { 467 foreach (var item in (IEnumerable)value) 468 uints.Add(mapper.GetBoxId(item)); 469 } 440 470 } 441 471 … … 446 476 public override void FillFromBox(object obj, Box box, Mapper mapper) { 447 477 var uints = box.UInts; 448 var elements = uints.Select(mapper.GetObject); 478 479 List<object> elements = null; 480 449 481 var type = obj.GetType(); 450 482 if (type.IsGenericType) { 483 var genericType = type.GetGenericArguments().Single(); 484 if (genericType.IsPrimitive) { 485 if (genericType == typeof(bool)) { 486 } else if (genericType == typeof(bool)) { 487 elements = box.Bools.Select(x => (object)x).ToList(); 488 } else if (genericType == typeof(int)) { 489 elements = box.Ints.Select(x => (object)x).ToList(); 490 } else if (genericType == typeof(uint)) { 491 elements = box.UInts.Select(x => (object)x).ToList(); 492 } else if (genericType == typeof(long)) { 493 elements = box.Longs.Select(x => (object)x).ToList(); 494 } else if (genericType == typeof(ulong)) { 495 elements = box.ULongs.Select(x => (object)x).ToList(); 496 } else if (genericType == typeof(float)) { 497 elements = box.Floats.Select(x => (object)x).ToList(); 498 } else if (genericType == typeof(double)) { 499 elements = box.Doubles.Select(x => (object)x).ToList(); 500 } else if (genericType == typeof(byte)) { 501 elements = box.Bytes.Select(x => (object)x).ToList(); 502 } else { 503 elements = uints.Select(mapper.GetObject).ToList(); 504 } 505 } else elements = uints.Select(mapper.GetObject).ToList(); 506 } else elements = uints.Select(mapper.GetObject).ToList(); 451 507 string methodName = string.Empty; 452 508 if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Stack<>) || type == typeof(Stack)) { 453 elements = elements.Reverse();509 elements.Reverse(); 454 510 methodName = "Push"; 455 511 } else if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Queue<>) || type == typeof(Queue)) {
Note: See TracChangeset
for help on using the changeset viewer.