Changeset 18077 for branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ValueTypeArrayConverter.cs
- Timestamp:
- 11/04/21 17:04:01 (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ValueTypeArrayConverter.cs
r18043 r18077 12 12 13 13 public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) { 14 IntArray arr = item as IntArray; 15 IntArrayJsonItem intArrayItem = data as IntArrayJsonItem; 16 bool resizeTmp = arr.Resizable; 17 arr.Resizable = true; 18 arr.Length = intArrayItem.Value.Length; 19 for (int i = 0; i < intArrayItem.Value.Length; ++i) 20 arr[i] = intArrayItem.Value[i]; 21 arr.Resizable = resizeTmp; 14 if(data.Active) { 15 IntArray arr = item as IntArray; 16 IntArrayJsonItem intArrayItem = data as IntArrayJsonItem; 17 bool resizeTmp = arr.Resizable; 18 arr.Resizable = true; 19 arr.Length = intArrayItem.Value.Length; 20 for (int i = 0; i < intArrayItem.Value.Length; ++i) 21 arr[i] = intArrayItem.Value[i]; 22 arr.Resizable = resizeTmp; 23 } 22 24 } 23 25 … … 39 41 40 42 public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) { 41 DoubleArray arr = item as DoubleArray; 42 DoubleArrayJsonItem doubleArrayItem = data as DoubleArrayJsonItem; 43 bool resizeTmp = arr.Resizable; 44 arr.Resizable = true; 45 arr.Length = doubleArrayItem.Value.Length; 46 for (int i = 0; i < doubleArrayItem.Value.Length; ++i) 47 arr[i] = doubleArrayItem.Value[i]; 48 arr.Resizable = resizeTmp; 43 if(data.Active) { 44 DoubleArray arr = item as DoubleArray; 45 DoubleArrayJsonItem doubleArrayItem = data as DoubleArrayJsonItem; 46 bool resizeTmp = arr.Resizable; 47 arr.Resizable = true; 48 arr.Length = doubleArrayItem.Value.Length; 49 for (int i = 0; i < doubleArrayItem.Value.Length; ++i) 50 arr[i] = doubleArrayItem.Value[i]; 51 arr.Resizable = resizeTmp; 52 } 49 53 } 50 54 … … 66 70 67 71 public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) { 68 PercentArray arr = item as PercentArray; 69 DoubleArrayJsonItem doubleArrayItem = data as DoubleArrayJsonItem; 70 bool resizeTmp = arr.Resizable; 71 arr.Resizable = true; 72 arr.Length = doubleArrayItem.Value.Length; 73 for (int i = 0; i < doubleArrayItem.Value.Length; ++i) 74 arr[i] = doubleArrayItem.Value[i]; 75 arr.Resizable = resizeTmp; 72 if(data.Active) { 73 PercentArray arr = item as PercentArray; 74 DoubleArrayJsonItem doubleArrayItem = data as DoubleArrayJsonItem; 75 bool resizeTmp = arr.Resizable; 76 arr.Resizable = true; 77 arr.Length = doubleArrayItem.Value.Length; 78 for (int i = 0; i < doubleArrayItem.Value.Length; ++i) 79 arr[i] = doubleArrayItem.Value[i]; 80 arr.Resizable = resizeTmp; 81 } 76 82 } 77 83 … … 93 99 94 100 public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) { 95 BoolArray arr = item as BoolArray; 96 BoolArrayJsonItem boolArrayItem = data as BoolArrayJsonItem; 97 bool resizeTmp = arr.Resizable; 98 arr.Resizable = true; 99 arr.Length = boolArrayItem.Value.Length; 100 for(int i = 0; i < boolArrayItem.Value.Length; ++i) 101 arr[i] = boolArrayItem.Value[i]; 102 arr.Resizable = resizeTmp; 101 if(data.Active) { 102 BoolArray arr = item as BoolArray; 103 BoolArrayJsonItem boolArrayItem = data as BoolArrayJsonItem; 104 bool resizeTmp = arr.Resizable; 105 arr.Resizable = true; 106 arr.Length = boolArrayItem.Value.Length; 107 for (int i = 0; i < boolArrayItem.Value.Length; ++i) 108 arr[i] = boolArrayItem.Value[i]; 109 arr.Resizable = resizeTmp; 110 } 103 111 } 104 112
Note: See TracChangeset
for help on using the changeset viewer.