public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false) { if (rootNode == null) { return; } _xDoc = xDoc; XmlControlHandler.GetDefaultXmlItemAttributes(rootNode, xDoc, this); XmlNode headerNode = XmlGetter.Child(rootNode, Properties.Resources.CommandHeader_Tag); //header 매칭.. _header.LoadXml(HeaderPath + "\\" + _headerFileName, refLoad); if (headerNode != null) //Header 태그가 없으면 그냥 둔다. { foreach (String fieldName in _header.FieldList.Keys) { String attr = XmlGetter.Attribute(headerNode, fieldName); if (attr.Length > 0) { _header.FieldList[fieldName].Data = attr; } } } //_header.LoadXml(_xDoc, headerNode); XmlNode dataNode = XmlGetter.Child(rootNode, Properties.Resources.CommandData_Tag); if (dataNode != null) { _data.LoadXml(_xDoc, dataNode); } }
public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false) { if (rootNode == null) { return; } XmlControlHandler.GetDefaultControlAttributes(rootNode, xDoc, this); foreach (XmlNode child in rootNode.ChildNodes) { if (child.Name.Equals("BufferSize")) { if (int.TryParse(child.InnerText, out _bufferSize) == false) { _bufferSize = _initBufferSize; } } else if (child.Name.Equals("SaveFile")) { String path = XmlGetter.Attribute(child, "Path"); if (path.Contains(":") == false)//절대경로가 아닐 경우.. { path = XmlLayoutCollection.NowLoadingPath + "\\" + path; } String fileFormat = XmlGetter.Attribute(child, "SavingFormat"); String ext = XmlGetter.Attribute(child, "Extension"); SetSaveFile(path, fileFormat, ext); } } }
/* public void setDynamicFieldType(String typeText) * { * DynamicFieldType = DynamicFieldTypes.BoardID; * for (int i = 0; i < (int)DynamicFieldTypes.NULL; i++) * { * if (typeText.ToLower().Equals(((DynamicFieldTypes)i).ToString().ToLower())) DynamicFieldType = (DynamicFieldTypes)i; * } * } * * public void setAutoFieldType(String typeText) * { * AutoFieldType = AutoFieldTypes.StartEventID; * for (int i = 0; i < (int)AutoFieldTypes.NULL; i++) * { * if (typeText.ToLower().Equals(((AutoFieldTypes)i).ToString().ToLower())) AutoFieldType = (AutoFieldTypes)i; * } * } */ //Encoding _stringEncoding; public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false) { if (rootNode == null) { return; } _xDoc = xDoc; XmlControlHandler.GetDefaultXmlItemAttributes(rootNode, xDoc, this); Name = XmlGetter.Attribute(rootNode, Properties.Resources.Field_Name_Attr); if (Name.Length == 0) { throw new Exception(Properties.Resources.Field_Name_Attr + "이 정의되지 않았습니다."); } String typeText = XmlGetter.Attribute(rootNode, Properties.Resources.Field_ValueType_Attr);// "ValueType"); if (typeText.Length == 0) { throw new Exception(Properties.Resources.Field_ValueType_Attr + "이 정의되지 않았습니다."); } DataType = TypeHandling.getTypeFromTypeName(typeText); setFieldType(XmlGetter.Attribute(rootNode, Properties.Resources.Field_FieldType_Attr));// "FieldType")); Data = XmlGetter.Attribute(rootNode, Properties.Resources.Field_Value_Attr); }
public static void LoadInterface(IXmlItem xmlComponent, XmlNode rootNode, XmlDocument document) { if (xmlComponent.Interface == null) { xmlComponent.Interface = new XmlItemInterface(rootNode, document, xmlComponent); } if (rootNode == null) { return; } NowEventLoadingXmlItem = xmlComponent; //Action에서 각각의 type에 따라서 적절한 Condition을 가져오기 위해 사용됨.. XmlNode xEvents = XmlGetter.Child(rootNode, "Events"); // rootNode.SelectSingleNode("Events"); if (xEvents != null) { xmlComponent.Interface.Events.LoadXml(document, xEvents); } XmlNodeList xArguments = XmlGetter.Children(rootNode, "Arguments/Argument"); if (xArguments != null) { foreach (XmlNode xArg in xArguments) { String name = XmlGetter.Attribute(xArg, "Name"); String value = xArg.InnerText; xmlComponent.Interface.Arguments.Add(name, value); } } }
public void LoadXml(String xmlFile, Boolean refLoad = false) { XmlLayoutCollection.PathSeperator = "\\"; if (xmlFile.Equals(_filePath)) { throw new Exception("같은 시나리오를 재귀적으로 Ref했습니다. 시나리오파일명:" + _filePath); } _filePath = xmlFile.Replace("/", "\\"); string fileDir = _filePath.Substring(0, _filePath.LastIndexOf("\\")); string fileName = _filePath.Substring(_filePath.LastIndexOf("\\") + 1); _name = fileName.Substring(0, fileName.LastIndexOf(".")); //xml을 뺌.. _baseDir = fileDir; NowLoadingFile = xmlFile; //_filePath = _filePath.Replace("\\", "/").Replace(Directory.GetCurrentDirectory().Replace("\\", "/"), ""); XmlNode rootNode = XmlGetter.RootNode(out _xDoc,_filePath, ".\\ComponentSchemas\\LayoutCollectionSchema.xsd", XmlSchemaValidation); //try { LoadXml(_xDoc, rootNode); } //catch (Exception e) { // throw new Exception(e.Message + ":" + xmlFile); } }
public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false) { //this.Clear(); if (rootNode == null) { return; } XmlControlHandler.GetDefaultXmlItemAttributes(rootNode, xDoc, this); if (rootNode == null || rootNode.Name.Equals("Events") == false) { throw new Exception("올바른 Events Tag가 아닙니다. 루트가 Events 가 아닙니다. "); } for (int i = 0; i < rootNode.ChildNodes.Count; i++) { XmlNode xEvent = rootNode.FirstChild; //OnClick, OnDoubleClick....등등 String eType = xEvent.Name; // (EventTypes)(GlobalVars.EventTypes.ToList().IndexOf(xEvent.Name)); if (eType.Equals("CustomEvent")) { eType = XmlGetter.Attribute(xEvent, "Name"); } //if ((int)eType < 0) throw new Exception(xEvent.Name + "는 올바른 EventType 태그가 아닙니다." + String.Concat(GlobalVars.EventTypes)); XmlEvent xe = new XmlEvent(); xe.LoadXml(xDoc, xEvent); this[eType] = xe; } }
public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false) { if (rootNode == null) { return; } XmlControlHandler.GetDefaultXmlItemAttributes(rootNode, xDoc, this); XmlNodeList children; children = XmlGetter.Children(rootNode, "Item"); if (children != null) { foreach (XmlNode child in children) { String name = XmlGetter.Attribute(child, "Name"); if (name.Length > 0) { _items.Add(name, child.InnerText.Trim()); } //if (child != null) _items = child.InnerText; } } /* * child = XmlGetter.Child(rootNode, "ColumnName"); * if (child != null) _columnName = child.InnerText; * * child = XmlGetter.Child(rootNode, "RowName"); * if (child != null) _rowName = child.InnerText; * * child = XmlGetter.Child(rootNode, "Enabled"); * if (child != null) _enabled = child.InnerText; */ }
public void LoadXml(String xmlFile, bool refLoad = false) { if (XmlLayoutCollection.NowLoadingPath.Length > 0) { _filePath = XmlLayoutCollection.NowLoadingPath + XmlLayoutCollection.PathSeperator + xmlFile; } else { _filePath = xmlFile; } //DataSet dt = new DataSet(); //dt.ReadXmlSchema(Properties.Resources.TableSchema); //dt.ReadXml(xmlFile); //schema를 불러와서 체크하기 위하여.. /* * XmlDocument xDoc; * * xDoc = new XmlDocument(); * xDoc.PreserveWhitespace = false; * xDoc.Schemas = new System.Xml.Schema.XmlSchemaSet(); * * * XmlSchema schema = XmlSchema.Read(File.OpenRead("./ComponentSchemas/TableSchema.xsd"), XmlScenarioTable_E_XmlSchemaValidation); * * xDoc.Schemas.Add(schema); * xDoc.Load(xmlFile); * LoadXml( xDoc.SelectSingleNode("//Table") ); */ XmlNode root = XmlGetter.RootNode(out _xDoc, _filePath, "./ComponentSchemas/ScenarioTableSchema.xsd", XmlScenarioTable_E_XmlSchemaValidation); LoadXml(_xDoc, root, refLoad); }
public void LoadXml(String xmlFile, Boolean refLoad = false) { _filePath = xmlFile; if (_filePath.LastIndexOf("/") >= 0) { _filePath = _filePath.Replace("\\", "/"); XmlLayoutCollection.NowLoadingPath = _filePath.Substring(0, _filePath.LastIndexOf("/")); XmlLayoutCollection.PathSeperator = "/"; } else if (_filePath.LastIndexOf("\\") >= 0) { _filePath = _filePath.Replace("/", "\\"); XmlLayoutCollection.NowLoadingPath = _filePath.Substring(0, _filePath.LastIndexOf("\\")); XmlLayoutCollection.PathSeperator = "\\"; } XmlNode rootNode = XmlGetter.RootNode(out _xDoc, _filePath);//"./ComponentSchemas/LayoutCollectionSchema.xsd", XmlSchemaValidation); //try { LoadXml(_xDoc, rootNode); } //catch (Exception e) { // throw new Exception(e.Message + ":" + xmlFile); } }
public void LoadXml(XmlDocument xDoc, XmlNode rootNode, bool refLoad = false) { if (rootNode == null) { return; } XmlControlHandler.GetDefaultControlAttributes(rootNode, xDoc, this, refLoad); if (rootNode.ChildNodes.Count == 0) { throw new Exception("올바른 Tab 태그가 아닙니다. <Panel> 이나 <Flow> 중 하나를 자식으로 가져야 합니다."); } string ns = XmlGetter.Attribute(rootNode, "NameSpace"); if (ns.Length > 0) { if (_namespace != null && _namespace.Length > 0) { _namespace += GlobalVars.Seperator + ns; } else { _namespace = ns; } } this.Dock = DockStyle.Fill; _layoutPanel = XmlControlHandler.LoadLayoutChildren(rootNode.FirstChild, this, _idList, _namespace, this); }
public void LoadXml(String xmlFile, Boolean refLoad = false) { if (XmlLayoutCollection.NowLoadingPath.Length > 0) { _filePath = XmlLayoutCollection.NowLoadingPath + XmlLayoutCollection.PathSeperator + xmlFile; } else { _filePath = xmlFile; } XmlNode xNode = XmlGetter.RootNode(out _xDoc, _filePath, null, XmlScenarioTable_E_XmlSchemaValidation); /* * _xDoc = new XmlDocument(); * _xDoc.PreserveWhitespace = false; * _xDoc.Schemas = new System.Xml.Schema.XmlSchemaSet(); * XmlSchema schema = XmlSchema.Read(File.OpenRead("./ComponentSchemas/LabelSchema.xsd"), XmlScenarioTable_E_XmlSchemaValidation); * _xDoc.Schemas.Add(schema); * * _xDoc.Load(xmlFile); * * * xNode = _xDoc.SelectSingleNode("//Label"); */ try { LoadXml(_xDoc, xNode, refLoad); } catch (Exception e) { MessageBox.Show("IXmlComponentBase.LoadXml1:" + e.Message + ":" + xmlFile); } }
public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false) { if (rootNode == null) { return; } XmlControlHandler.GetDefaultControlAttributes(rootNode, xDoc, this); if (rootNode.ChildNodes.Count == 0) { throw new Exception("올바른 Layout 태그가 아닙니다. <Panel> 이나 <Flow> 중 하나를 자식으로 가져야 합니다."); } if (_namespace.Length == 0) { _namespace = XmlGetter.Attribute(rootNode, "NameSpace"); } else { String Namespace = XmlGetter.Attribute(rootNode, "NameSpace"); if (Namespace.Length > 0) { _namespace = _namespace + GlobalVars.Seperator + Namespace; } else { } //do nothing. parent's namesapce will be used for control's namespace. } _layoutPanel = XmlControlHandler.LoadLayoutChildren(rootNode.ChildNodes[0], this, _idList, _namespace, this); try { string backPath = XmlGetter.Attribute(rootNode, "Background-Image"); if (XmlLayoutCollection.NowLoadingPath.Length > 0) { backPath = XmlLayoutCollection.NowLoadingPath + XmlLayoutCollection.PathSeperator + backPath; } if (backPath.Length > 0) { _layoutPanel.BackgroundImage = Image.FromFile(backPath); } string imageLayout = XmlGetter.Attribute(rootNode, "Background-ImageLayout"); if (imageLayout.Length > 0) { _layoutPanel.BackgroundImageLayout = (ImageLayout)GlobalVars.ImageLayouts.ToList().IndexOf(imageLayout); } _backgroundImage_Path = backPath; //이미지 지정에 성공하면 배정함. } catch { } String backColor = XmlGetter.Attribute(rootNode, "Background-Color"); if (backColor.Length > 0) { _layoutPanel.BackColor = XmlHandlers.ValueParser.StringToColor(backColor); } }
public void LoadXml(XmlDocument xDoc, XmlNode rootNode, bool refLoad = false) { if (rootNode == null) { return; } XmlControlHandler.GetDefaultControlAttributes(rootNode, xDoc, this); this.TextAlign = GlobalVars.ContentAlignment(XmlGetter.Attribute(rootNode, "TextAlign")); }
public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false) { if (rootNode == null) { return; } _xDoc = xDoc; XmlControlHandler.GetDefaultXmlItemAttributes(rootNode, xDoc, this); try { XmlNode infoNode = XmlGetter.Child(rootNode, "Info"); _info.LoadXml(xDoc, infoNode, refLoad); } catch (Exception e) { throw new Exception("Error On Loading Template [" + _filePath + "].Info.." + e.Message); } try { XmlNode commandNode = XmlGetter.Child(rootNode, "Command"); if (commandNode != null) { _command = new XmlCommandStructDefinition("CommandHeader.xml", StructType.Command); _command.LoadXml(_xDoc, commandNode); } } catch (Exception e) { throw new Exception("Error on Loading Template [" + _info.Name + "].Command..." + e.Message); } try { XmlNodeList responseNodeList = XmlGetter.Children(rootNode, "Response"); foreach (XmlNode responseNode in responseNodeList) { String type = XmlGetter.Attribute(responseNode, "Type"); if (type.ToLower().Equals("continuous")) { _autoResponse = new XmlCommandStructDefinition("ResponseHeader.xml", StructType.Response); _autoResponse.LoadXml(_xDoc, responseNode); } else { _response = new XmlCommandStructDefinition("ResponseHeader.xml", StructType.Response); _response.LoadXml(_xDoc, responseNode); } } } catch (Exception e) { throw new Exception("Error on Loading Template [" + _info.Name + "].Response..." + e.Message); } }
public static void GetDefaultXmlItemAttributes(XmlNode rootNode, XmlDocument document, IXmlItem xmlItem, bool refLoad = false) { xmlItem.Interface = new XmlItemInterface(rootNode, document, xmlItem); if (refLoad == false) { String refPath = XmlGetter.Attribute(rootNode, "Ref"); if (refPath.Length > 0) { xmlItem.LoadXml(refPath, true); } } }
public void LoadXml(XmlNode root) { string cond = XmlGetter.Attribute(root, "CondText"); string fieldName = ""; string symbol = ""; string value = ""; for (int i = 0; i < cond.Length; i++) { if (cond[i].Equals('=') || cond[i].Equals('<') || cond[i].Equals('>') || cond[i].Equals('!')) { symbol += cond[i]; } else if (symbol.Length == 0) { fieldName += cond[i]; } else { Value += cond[i]; } } Field = _command.ResponseData.Field(fieldName.Trim()); switch (symbol.Trim()) { case "==": CondSymbol = CondSymbols.EQ; break; case ">=": CondSymbol = CondSymbols.GE; break; case ">": CondSymbol = CondSymbols.GT; break; case "<=": CondSymbol = CondSymbols.LE; break; case "<": CondSymbol = CondSymbols.LT; break; case "!=": CondSymbol = CondSymbols.NE; break; } Value = value.Trim(); }
public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false) { if (rootNode == null) { return; } XmlControlHandler.GetDefaultControlAttributes(rootNode, xDoc, this); XmlNode xImages = XmlGetter.Child(rootNode, "ImageList"); if (xImages != null) { this.LedImages.Clear(); XmlNode xImage; String url; Image img; xImage = XmlGetter.Child(xImages, "OffImage"); if (xImages == null) { throw new Exception("Led/ImageList/OffImage 태그는 필수입니다."); } url = XmlGetter.Attribute(xImages, "URL"); img = Image.FromFile(url); this.LedImages.Add(img); xImage = XmlGetter.Child(xImages, "OnImage"); if (xImages == null) { throw new Exception("Led/ImageList/OnImage 태그는 필수입니다."); } url = XmlGetter.Attribute(xImages, "URL"); img = Image.FromFile(url); this.LedImages.Add(img); xImage = XmlGetter.Child(xImages, "MidStateImage"); if (xImages == null) { throw new Exception("Led/ImageList/MidStateImage 태그는 필수입니다."); } url = XmlGetter.Attribute(xImages, "URL"); img = Image.FromFile(url); this.LedImages.Add(img); } else { this.setImage( FormAdders.Properties.Resources.led_on, FormAdders.Properties.Resources.led_off, FormAdders.Properties.Resources.led_mid); } }
public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false) { if (rootNode == null) { return; } _xDoc = xDoc; XmlControlHandler.GetDefaultXmlItemAttributes(rootNode, xDoc, this); _columnName = XmlGetter.Attribute(rootNode, "ColumnName"); if (_columnName.Length == 0) { throw new Exception("ScenarioTable 태그에 ColumnName이 없습니다."); } }
/// <summary> /// 시나리오에서 데이터를 가져와 필드에 값을 넣어주는 함수이다. /// </summary> /// <param name="xDoc"></param> /// <param name="rootNode"></param> internal void loadFields(XmlDocument xDoc, XmlNode rootNode) { foreach (String name in FieldList.Keys) { string value = XmlGetter.Attribute(rootNode, name); XmlCommandField field = FieldList[name]; if (value.Length > 0) { field.Data = value; //값 설정. } /* * if (field.FieldType == FieldTypes.LoopCount) * { * _loopCountField = field; * * } * else if (field.FieldType == FieldTypes.VariableSize) * { * _ * } */ } if (TemplateFields != null) { string fieldsName = TemplateFields.Name; int count = 0; foreach (XmlNode node in rootNode.ChildNodes) { if (node.Name.Equals(fieldsName)) { count++; //이름이 같은 Tag만 가져와 count함.. } } NumberOfFields = count; //방의 크기를 조정함.. int index = 0; foreach (XmlNode node in rootNode.ChildNodes) //값을 채워넣음.. { if (node.Name.Equals(fieldsName)) { FieldsList.ValueList[index++].loadFields(xDoc, node); } } } }
public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false) { if (rootNode == null) { return; } _xDoc = xDoc; XmlControlHandler.GetDefaultXmlItemAttributes(rootNode, xDoc, this); XmlNodeList fields = XmlGetter.Children(rootNode, "Field"); int count = 0; foreach (XmlNode field in fields) { XmlCommandField xField = new XmlCommandField(null); xField.LoadXml(xDoc, field, refLoad); FieldList.Add(xField.Name, xField); if (xField.FieldType == FieldTypes.DataSize) { _dataSizeField = xField; } else if (xField.Name.ToLower().Equals("id")) { _idField = xField; } else if (xField.Name.ToLower().Equals("tag")) { _tagField = xField; } addItem(count++, xField.DataSize, true); } setBuffSize(); int offset = 0; foreach (XmlCommandField field in FieldList.Values) { field.SetTargetBuffer(this.buffer, offset); field.Data = field.Data; offset += field.DataSize; } /* * XmlCommandFields xmlFields = new XmlCommandFields(null); * xmlFields.LoadXml(xDoc, fields, refLoad); */ }
public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false) { if (rootNode == null) { return; } _xDoc = xDoc; XmlControlHandler.GetDefaultXmlItemAttributes(rootNode, xDoc, this); XmlNode headerNode = XmlGetter.Child(rootNode, "Header"); _header.LoadXml(_xDoc, headerNode); XmlNode dataNode = XmlGetter.Child(rootNode, "Data"); _data.LoadXml(_xDoc, dataNode); }
public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false) { if (rootNode == null) { return; } XmlControlHandler.GetDefaultXmlItemAttributes(rootNode, xDoc, this); _tagName = rootNode.Name; for (int i = 0; i < rootNode.ChildNodes.Count; i++) { XmlNode xImg = rootNode.ChildNodes[i]; string url = XmlGetter.Attribute(xImg, "URL"); AddImage(url); } }
public void LoadXml(XmlNode rootNode) { string symbol = XmlGetter.Attribute(rootNode, "Symbol"); for (int i = 0; i < (int)GroupingSymbols.NULL; i++) { if (((GroupingSymbols)i).ToString().ToLower().Equals(symbol.ToLower())) { GroupingSymbol = (GroupingSymbols)i; break; } } int count = 0; foreach (XmlNode respCond in rootNode.ChildNodes) { if (respCond.Name.Equals("CondGroup")) { if (count++ == 0) { _condition1 = new XmlResponseConditionGroup(_command); _condition1.LoadXml(respCond); } else { _condition2 = new XmlResponseConditionGroup(_command); _condition2.LoadXml(respCond); } } else if (respCond.Name.Equals("Cond")) { if (count++ == 0) { _condition1 = new XmlResponseCondition(_command); _condition1.LoadXml(respCond); } else { _condition2 = new XmlResponseCondition(_command); _condition2.LoadXml(respCond); } } } }
public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false) { if (rootNode == null) { return; } XmlControlHandler.GetDefaultControlAttributes(rootNode, xDoc, this); if (rootNode.Attributes == null) { throw new Exception("Label에 최소한 Text 속성은 있어야 합니다."); } this.TextAlign = GlobalVars.ContentAlignment(XmlGetter.Attribute(rootNode, "TextAlign")); }
public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false) { if (rootNode == null) { return; } _xDoc = xDoc; XmlControlHandler.GetDefaultXmlItemAttributes(rootNode, xDoc, this); XmlNode node; if ((node = XmlGetter.Child(rootNode, "Version")) != null) { Version = node.InnerText; } else { Version = XmlGetter.Attribute(rootNode, "Version"); } if ((node = XmlGetter.Child(rootNode, "Writer")) != null) { Writer = node.InnerText; } else { Writer = XmlGetter.Attribute(rootNode, "Writer"); } if ((node = XmlGetter.Child(rootNode, "LastModified")) != null) { if (DateTime.TryParse(node.InnerText, out LastModified) == false) { LastModified = DateTime.Now; } } else { if (DateTime.TryParse(XmlGetter.Attribute(rootNode, "LastModified"), out LastModified) == false) { LastModified = DateTime.Now; } } }
/// <summary> /// BitItem Tag에서 값을 불러온다. /// </summary> /// <param name="root"></param> public void LoadXml(XmlNode root) { BitName = XmlGetter.Attribute(root, "Name"); if (int.TryParse(XmlGetter.Attribute(root, "StartOffset"), out _startOffset) == false) { _startOffset = 0; } if (int.TryParse(XmlGetter.Attribute(root, "BitSize"), out _bitSize) == false) { _bitSize = 1; } string pc = XmlGetter.Attribute(root, "PassCondition").Replace("<", "<").Replace(">", ">"); PassCondition = pc; Description = XmlGetter.Attribute(root, "Description"); //Visible = (XmlGetter.Attribute(root, "Visible").Equals("True")); ShowOnReport = (XmlGetter.Attribute(root, "ShowOnReport").Equals("False") == false);//true가 기본값. }
public void Undo() { if (UndoStack.Count > 0) { //SaveXml();//현재상태 저장 //XmlDocument doc = UndoStack.Pop(); RedoStack.Push(_xDoc);//현재상태는 일단 Redo stack으로.. XmlDocument doc = UndoStack.Pop(); _xDoc = doc;//현재상태 갱신.. XmlNode rootNode = XmlGetter.FirstChild(doc);// XmlGetter.RootNode(out _xDoc, _filePath, ".\\ComponentSchemas\\LayoutCollectionSchema.xsd", XmlSchemaValidation); //try { LoadXml(_xDoc, rootNode); } this.Interface.RunEvent( } }
public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false) { if (rootNode == null) { return; } _xDoc = xDoc; XmlControlHandler.GetDefaultXmlItemAttributes(rootNode, xDoc, this); NowLoading = this; XmlNode commonMatchItem = XmlGetter.Child(rootNode, "CommonMatches"); XmlMatchItem commonMatches = new XmlMatchItem(); commonMatches.LoadXml(xDoc, commonMatchItem); XmlNodeList matchItems = XmlGetter.Children(rootNode, "MatchItem"); foreach (XmlNode matchItem in matchItems) { String targetTemplate = XmlGetter.Attribute(matchItem, "TargetTemplate"); if (targetTemplate.Length == 0) { throw new Exception("MatchItem Tag에 TargetTemplate 속성이 없습니다."); } XmlMatchItem item = new XmlMatchItem(); item.LoadXml(xDoc, matchItem); foreach (XmlMatchData matchData in commonMatches.GetMatchDataList(XmlMatchItem.ActiveTimes.Init)) { item.GetMatchDataList(XmlMatchItem.ActiveTimes.Init).Add(matchData); } foreach (XmlMatchData matchData in commonMatches.GetMatchDataList(XmlMatchItem.ActiveTimes.Send)) { item.GetMatchDataList(XmlMatchItem.ActiveTimes.Send).Add(matchData); } foreach (XmlMatchData matchData in commonMatches.GetMatchDataList(XmlMatchItem.ActiveTimes.Recv)) { item.GetMatchDataList(XmlMatchItem.ActiveTimes.Recv).Add(matchData); } _matchItems.Add(targetTemplate, item); } }
XmlDocument _xDoc; public void LoadXml(String xmlFile, bool refLoad = false) { if (XmlLayoutCollection.NowLoadingPath.Length > 0) { _filePath = XmlLayoutCollection.NowLoadingPath + XmlLayoutCollection.PathSeperator + xmlFile; } else { _filePath = xmlFile; } XmlNode rootNode = XmlGetter.RootNode(out _xDoc, _filePath, "./ComponentSchemas/TabSchema.xsd", XmlSchemaValidation); try { LoadXml(_xDoc, rootNode, refLoad); } catch (Exception e) { throw new Exception(e.Message + ":" + _filePath); } }
public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false) { if (rootNode == null) { return; } _xDoc = xDoc; XmlControlHandler.GetDefaultXmlItemAttributes(rootNode, xDoc, this); Name = XmlGetter.Attribute(rootNode, "Name"); if (Name.Length == 0) { throw new Exception("Name이 정의되지 않았습니다."); } String typeText = XmlGetter.Attribute(rootNode, "Type"); if (typeText.Length == 0) { throw new Exception("Type이 정의되지 않았습니다."); } DataType = TypeHandling.getTypeFromTypeName(typeText); String sizeText = XmlGetter.Attribute(rootNode, "Size"); if (sizeText.Length == 0 || int.TryParse(sizeText, out DataTypeSize) == false) { DataTypeSize = Marshal.SizeOf(DataType); } String countText = XmlGetter.Attribute(rootNode, "Count"); if (countText.Length == 0 || int.TryParse(countText, out Count) == false) { Count = 1; } if (Count == 0) { Count = 1; //Count 0은 의미가 없음.. } _dataString = XmlGetter.Attribute(rootNode, "Data"); }