protected override void OnInsert(int index, Object value) { base.OnInsert(index, value); if (!_IsLoadInit) { WordSqlXmlAction sql = (WordSqlXmlAction)value; XmlNode node = this.ElementList[index]; this.DocumentElement.InsertBefore(sql.ToXmlElement(this._InnerDocument), node); } }
protected override void OnRemove(int index, Object value) { base.OnRemove(index, value); if (!_IsLoadInit) { WordSqlXmlAction sql = (WordSqlXmlAction)value; XmlElement ele = (XmlElement)this.DocumentElement.SelectSingleNode(string.Format(".//sql[@id='{0}']", sql.Id)); this.DocumentElement.RemoveChild(ele); } }
protected override void OnSet(int index, Object oldValue, Object newValue) { base.OnSet(index, oldValue, newValue); if (!_IsLoadInit) { WordSqlXmlAction oldSql = (WordSqlXmlAction)oldValue; WordSqlXmlAction newSql = (WordSqlXmlAction)newValue; XmlElement oldEle = (XmlElement)this.DocumentElement.SelectSingleNode(string.Format(".//sql[@id='{0}']", oldSql.Id)); this.DocumentElement.ReplaceChild(newSql.ToXmlElement(this._InnerDocument), oldEle); } }
public void Load(string file) { this._File = file; this._InnerDocument = new XmlDocument(); this._InnerDocument.Load(file); this._IsLoadInit = true; foreach (XmlNode node in this.ElementList) { XmlElement ele = (XmlElement)node; WordSqlXmlAction action = new WordSqlXmlAction(ele); this.List.Add(action); } this._IsLoadInit = false; this._Id = ulong.Parse(this._InnerDocument.DocumentElement.GetAttribute("id")); }
public void LoadXml(string xmlcode) { Debug.Assert(!string.IsNullOrEmpty(xmlcode), "LoadXml(string xmlcode), 'xmlcode' is empty!"); this._InnerDocument = new XmlDocument(); if (string.IsNullOrEmpty(xmlcode)) { this._InnerDocument.LoadXml("<?xml version=\"1.0\" encoding=\"UTF-8\"?><SqlXml id=\"0\" />"); } else { this._InnerDocument.LoadXml(xmlcode); } this._IsLoadInit = true; foreach (XmlNode node in this.ElementList) { XmlElement ele = (XmlElement)node; WordSqlXmlAction action = new WordSqlXmlAction(ele); this.List.Add(action); } this._IsLoadInit = false; this._Id = ulong.Parse(this._InnerDocument.DocumentElement.GetAttribute("id")); }
public WordSqlXmlAction CreatAction(DictAction dictAction, string word, ulong frequency, string dictName) { WordSqlXmlAction action = new WordSqlXmlAction(this.GetId(), dictAction, word, frequency, dictName); return(action); }
public bool Contains(WordSqlXmlAction value) { return(List.Contains(value)); }
public void Remove(WordSqlXmlAction value) { List.Remove(value); }
public void Insert(int index, WordSqlXmlAction value) { List.Insert(index, value); }
public int IndexOf(WordSqlXmlAction value) { return(List.IndexOf(value)); }
public int Add(WordSqlXmlAction value) { return(List.Add(value)); }