public string this[string paramName, string defValue] { get { DataParam dp = (DataParam)this.Get("Param", paramName); if (dp == null) { if (defValue != null) { return(defValue); } else { return(null); } } return(dp.GetValue()); } set { DataParam dp = (DataParam)this.Get("Param", paramName); if (dp == null) { dp = new DataParam(); dp.SetName(paramName); dp.SetValue(value); this.Add(dp); } else { dp.SetValue(value); } } }
/// <summary> /// 在本DataStore中新建数据节点 /// </summary> /// <param name="type"></param> /// <returns></returns> public DataNode New(string type) { type = type.ToLower(); string tag = this.GetTag(type, false); XmlNode pnode = this.XmlEle.SelectSingleNode(tag); XmlNode node = null; DataNode nodeobj = null; if (pnode == null) { pnode = this.XmlDoc.CreateElement(tag); this.XmlEle.AppendChild(pnode); } switch (type) { case "form": node = this.XmlDoc.CreateElement("Form"); pnode.AppendChild(node); nodeobj = new DataForm(this.XmlDoc, (XmlElement)node); break; case "list": node = (XmlElement)this.XmlDoc.CreateElement("List"); pnode.AppendChild(node); nodeobj = new DataList(this.XmlDoc, (XmlElement)node); break; case "enum": node = (XmlElement)this.XmlDoc.CreateElement("Enum"); pnode.AppendChild(node); nodeobj = new DataEnum(this.XmlDoc, (XmlElement)node); break; case "param": node = (XmlElement)this.XmlDoc.CreateElement("Param"); pnode.AppendChild(node); nodeobj = new DataParam(this.XmlDoc, (XmlElement)node); break; } return(nodeobj); }
/// <summary> /// 根据DataParam构造新的DataParam /// </summary> /// <param name="ele"></param> public DataParam(DataParam dataParam) : base(dataParam.ToString()) { this.Type = "Param"; }