public ResponseParam(ResponseParam param) { this.name = param.name; this.remark = param.remark; this.type = param.type; this.subItems = new Dictionary<string, ResponseParam>(param.subItems); }
public ResponseParam(XmlNode xnResponseParam) { this.name = xnResponseParam.SelectSingleNode("name").InnerText; this.remark = xnResponseParam.SelectSingleNode("remark").InnerText; switch (xnResponseParam.Attributes["type"].Value) { case "dict": foreach (XmlNode subNode in xnResponseParam.SelectNodes("item")) { ResponseParam subItem = new ResponseParam(subNode); subItems.Add(subItem.name, subItem); } if (subItems.Count > 0) { this.type = ResponseParamType.DICT; } else { this.type = ResponseParamType.DICT_NULL; } break; case "list": foreach (XmlNode subNode in xnResponseParam.SelectNodes("item")) { ResponseParam subItem = new ResponseParam(subNode); subItems.Add(subItem.name, subItem); } if (subItems.Count > 0) { this.type = ResponseParamType.LIST; } else { this.type = ResponseParamType.LIST_STRING; } break; case "string": this.type = ResponseParamType.STRING; break; case "int": this.type = ResponseParamType.INT; break; case "bool": this.type = ResponseParamType.BOOL; break; default: this.type = ResponseParamType.DEFAULT; break; } }
public ResponseInXML(XmlNode xnResponseNode) { switch (xnResponseNode.Attributes["type"].Value) { case "json": this.type = ResponseType.JSON; rootParam = new ResponseParam(xnResponseNode.SelectSingleNode("item")); break; case "raw": this.type = ResponseType.RAW; break; default: this.type = ResponseType.DEFAULT; break; } }