public PerObjectParams TryGet(string logicalId) { PerObjectParams res = null; _perLogicalId.TryGetValue(logicalId, out res); return(res); }
static Json.Node BuildObjectDescription(object obj, PerObjectParams param) { var type = obj.GetType(); var description = new Json.Object(); HashSet <string> allowedFields = param?.TryGet(type.FullName); foreach (var kv in RemotableContent.Get(type).Exported) { description.Add( kv.Key, BuildMember( kv.Value, obj, allowedFields?.Contains(kv.Key) ?? false)); } return(description); }
public PerLogicalIdParams(HttpListenerRequest request) { _perLogicalId = new Dictionary <string, PerObjectParams>(); if (!request.HasEntityBody) { return; } var current = new StringBuilder(); while (true) { var c = request.InputStream.ReadByte(); if (c == -1 || c == '&') // store the last value { if (current.Length == 0) { return; } #if DEBUG Debug.Log("parsing data fragment " + current.ToString()); #endif var components = current.ToString().Split('='); components[0] = Uri.UnescapeDataString(components[0]); PerObjectParams values; if (!_perLogicalId.TryGetValue(components[0], out values)) { values = new PerObjectParams(); _perLogicalId.Add(components[0], values); } values.Add(components[1]); if (c == -1) { return; } current = new StringBuilder(); } else { current.Append((char)c); } } }
static Json.Node BuildObjectDescription(object obj, PerObjectParams param) { var type = obj.GetType(); var description = new Json.Object(); HashSet<string> allowedFields = param?.TryGet(type.FullName); foreach (var kv in RemotableContent.Get(type).Exported) description.Add( kv.Key, BuildMember( kv.Value, obj, allowedFields?.Contains(kv.Key) ?? false)); return description; }
public PerLogicalIdParams(HttpListenerRequest request) { _perLogicalId = new Dictionary<string, PerObjectParams>(); if (! request.HasEntityBody) return; var current = new StringBuilder(); while (true) { var c = request.InputStream.ReadByte(); if (c == -1 || c == '&') // store the last value { var components = current.ToString().Split('='); components[0] = Uri.UnescapeDataString(components[0]); PerObjectParams values; if (! _perLogicalId.TryGetValue(components[0], out values)) { values = new PerObjectParams(); _perLogicalId.Add(components[0], values); } values.Add(components[1]); if (c == -1) return; current = new StringBuilder(); } else { current.Append((char)c); } } }