Line | |
---|
1 | using Newtonsoft.Json;
|
---|
2 | using Newtonsoft.Json.Serialization;
|
---|
3 | using System;
|
---|
4 | using System.Collections.Generic;
|
---|
5 | using System.IO;
|
---|
6 | using System.Linq;
|
---|
7 | using System.Reflection;
|
---|
8 | using System.Threading.Tasks;
|
---|
9 |
|
---|
10 | namespace HeuristicLab.Clients.Hive.WebJobManager.Services
|
---|
11 | {
|
---|
12 | /// <summary>
|
---|
13 | /// Throws some properties out to save on bandwidth space while refreshing
|
---|
14 | /// the selected job
|
---|
15 | /// </summary>
|
---|
16 | public class JsonTaskResolver : DefaultContractResolver
|
---|
17 | {
|
---|
18 | protected override JsonProperty CreateProperty(MemberInfo member,
|
---|
19 | MemberSerialization memberSerialization)
|
---|
20 | {
|
---|
21 | JsonProperty property = base.CreateProperty(member, memberSerialization);
|
---|
22 | if (property.PropertyName == "ItemImage" ||
|
---|
23 | property.PropertyName == "Parameters" ||
|
---|
24 | property.PropertyName == "OperatorGraph" ||
|
---|
25 | property.PropertyName == "DistanceMatrix" ||
|
---|
26 | property.PropertyName == "Operators" ||
|
---|
27 | property.PropertyName == "Engine" ||
|
---|
28 | property.PropertyName == "ActualValue" ||
|
---|
29 | property.PropertyName == "CurrentScope" ||
|
---|
30 | property.PropertyName == "Problems" ||
|
---|
31 | property.PropertyName == "Random" ||
|
---|
32 | property.PropertyName == "Optimizer" ||
|
---|
33 | property.PropertyName == "Optimizers" ||
|
---|
34 | property.PropertyName == "Problem" ||
|
---|
35 | property.PropertyName == "NestedOptimizers")
|
---|
36 | {
|
---|
37 | property.ShouldSerialize = instanceOfProblematic => false;
|
---|
38 | }
|
---|
39 |
|
---|
40 | return property;
|
---|
41 | }
|
---|
42 | }
|
---|
43 |
|
---|
44 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.