Пример #1
0
		// Row[] を HtmlData[] に変換します。
		private HtmlData[] DataRowsToHtmlData(DataRow[] rows){
			HtmlData[] result = new HtmlData[rows.Length];
			for(int i = 0; i < rows.Length; i++){
				result[i] = GetHtmlData(rows[i]);
			}
			return result;
		}
Пример #2
0
// データの取得

// データのロード

		public void AddData(HtmlData hd){
			Object[] data = new Object[]{null, hd.Id, hd.Name, hd.NameJa, hd};
			DataRow row = this.NewRow();
			row.ItemArray = data;
			this.Rows.Add(row);
		}
Пример #3
0
		/// <summary>
		/// 指定された XML ファイルからデータをロードします。
		/// この処理はスレッドセーフではありません。
		/// </summary>
		public void Load(){
			XmlNodeList elems = Document.DocumentElement[ElementsRefName].GetElementsByTagName(ElementElementName);
			XmlNodeList elemGroups = Document.DocumentElement[ElementsRefName].GetElementsByTagName(ElementGroupElementName);
			XmlNodeList attrs = Document.DocumentElement[AttributesRefName].GetElementsByTagName(AttributeElementName);
			XmlNodeList attrGroups = Document.DocumentElement[AttributesRefName].GetElementsByTagName(AttributeGroupElementName);
			XmlNodeList datas = Document.DocumentElement[DataRefName].GetElementsByTagName(DataFormatElementName);

			HtmlElement[] he = new HtmlElement[elems.Count];
			for(int i=0; i < elems.Count; i++){he[i] = new HtmlElement(elems[i] as XmlElement);}
			HtmlElementGroup[] heg = new HtmlElementGroup[elemGroups.Count];
			for(int i=0; i < elemGroups.Count; i++){heg[i] = new HtmlElementGroup(elemGroups[i] as XmlElement);}
			HtmlAttribute[] ha = new HtmlAttribute[attrs.Count];
			for(int i=0; i < attrs.Count; i++){ha[i] = new HtmlAttribute(attrs[i] as XmlElement);}
			HtmlAttributeGroup[] hag = new HtmlAttributeGroup[attrGroups.Count];
			for(int i=0; i < attrGroups.Count; i++){hag[i] = new HtmlAttributeGroup(attrGroups[i] as XmlElement);}
			HtmlData[] hd = new HtmlData[datas.Count];
			for(int i=0; i < datas.Count; i++){hd[i] = new HtmlData(datas[i] as XmlElement);}

			ElementTable.MinimumCapacity = he.Length;
			Array.ForEach(he, item=>{ElementTable.AddData(item);});
			ElementGroupTable.MinimumCapacity = heg.Length;
			Array.ForEach(heg, item=>{ElementGroupTable.AddData(item);});
			AttributeTable.MinimumCapacity = ha.Length;
			Array.ForEach(ha, item=>{AttributeTable.AddData(item);});
			AttributeGroupTable.MinimumCapacity = hag.Length;
			Array.ForEach(hag, item=>{AttributeGroupTable.AddData(item);});
			DataTable.MinimumCapacity = hd.Length;
			Array.ForEach(hd, item=>{DataTable.AddData(item);});

			// 属性や親子関係を取得
			Array.ForEach(he, item=>{SetChildren(item);SetAttribute(item);});
			Array.ForEach(heg, item=>{SetChildren(item);});
			Array.ForEach(ha, item=>{SetChildren(item);});
			Array.ForEach(hag, item=>{SetChildren(item);});

		}