Пример #1
0
        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);
                }
            }
        }
Пример #2
0
        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;
            }
        }
Пример #3
0
        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);
        }
Пример #4
0
        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;
             */
        }
Пример #5
0
        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);
            }
        }
Пример #6
0
/*        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);
        }
Пример #7
0
        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);
                }
            }
        }
Пример #8
0
        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);
            }
        }
Пример #9
0
        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"));
        }
Пример #10
0
        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);
            }
        }
Пример #11
0
        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);
                }
            }
        }
Пример #12
0
        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();
        }
Пример #13
0
        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);
            }
        }
Пример #14
0
        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이 없습니다.");
            }
        }
Пример #15
0
        /// <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);
                    }
                }
            }
        }
Пример #16
0
        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);
            }
        }
Пример #17
0
        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);
                    }
                }
            }
        }
Пример #18
0
        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"));
        }
Пример #19
0
        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;
                }
            }
        }
Пример #20
0
        /// <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("&lt;", "<").Replace("&gt;", ">");

            PassCondition = pc;
            Description   = XmlGetter.Attribute(root, "Description");
            //Visible = (XmlGetter.Attribute(root, "Visible").Equals("True"));
            ShowOnReport = (XmlGetter.Attribute(root, "ShowOnReport").Equals("False") == false);//true가 기본값.
        }
Пример #21
0
        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);
            }
        }
Пример #22
0
        public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false)
        {
            if (rootNode == null)
            {
                return;
            }
            _xDoc = xDoc;
            XmlControlHandler.GetDefaultXmlItemAttributes(rootNode, xDoc, this);
            NowLoading = this;
            try
            {
                _color = ValueParser.StringToColor(XmlGetter.Attribute(rootNode, "Color"));
            }
            catch
            {
                _color = Color.Black;
            }
            for (int i = 0; i < rootNode.ChildNodes.Count; i++)
            {
                XmlNode child = rootNode.ChildNodes[i];

                if (child.Name.Equals("String"))
                {
                    _formatItems.Add(new FormatItem(FormatItem.FormatItemType.String, child.InnerText));
                }
                else if (child.Name.Equals("FieldItem"))
                {
                    String parser = XmlGetter.Attribute(child, "Parser");
                    if (parser.Length > 0)
                    {
                        string[] args = ValueParser.GetArgs(parser, XmlGetter.Attribute(child, "Args"));
                        _formatItems.Add(new FormatItem(FormatItem.FormatItemType.FieldItem, args));
                    }
                    else
                    {
                        _formatItems.Add(new FormatItem(FormatItem.FormatItemType.FieldItem));
                    }
                }
            }
        }
Пример #23
0
        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");
        }
Пример #24
0
        public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false)
        {
            if (rootNode == null)
            {
                return;
            }
            XmlControlHandler.GetDefaultXmlItemAttributes(rootNode, xDoc, this);

            _tagName = rootNode.Name;
            if (rootNode.ChildNodes.Count > 0)
            {
                XmlNode xImg;
                string  url = "";

                xImg = XmlGetter.Child(rootNode, "NormalImage");
                //xImg = rootNode.SelectSingleNode("NormalImage");
                url = XmlGetter.Attribute(xImg, "URL");
                AddImage(url);
                xImg = xImg = XmlGetter.Child(rootNode, "CheckImage");
                url  = XmlGetter.Attribute(xImg, "URL");
                AddImage(url);
                xImg = xImg = XmlGetter.Child(rootNode, "InterImage");
                url  = XmlGetter.Attribute(xImg, "URL");
                AddImage(url);
                xImg = xImg = XmlGetter.Child(rootNode, "DisabledImage");
                url  = XmlGetter.Attribute(xImg, "URL");
                AddImage(url);
            }

            /*
             * for (int i = 0; i < rootNode.ChildNodes.Count; i++)
             * {
             *  XmlNode xImg = rootNode.ChildNodes[i];
             *  string url = XmlGetter.getAttr(xImg, "URL");
             *
             *  AddImage(url);
             * }
             */
        }
Пример #25
0
        public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false)
        {
            if (rootNode == null)
            {
                return;
            }
            XmlControlHandler.GetDefaultControlAttributes(rootNode, xDoc, this);


            if (XmlGetter.Attribute(rootNode, "TextAlign").Equals("Right"))
            {
                this.TextAlign = HorizontalAlignment.Right;
            }
            else if (XmlGetter.Attribute(rootNode, "TextAlign").Equals("Center"))
            {
                this.TextAlign = HorizontalAlignment.Center;
            }
            else
            {
                this.TextAlign = HorizontalAlignment.Left;
            }
        }
Пример #26
0
        public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false)
        {
            if (rootNode == null)
            {
                return;
            }
            _xDoc      = xDoc;  XmlControlHandler.GetDefaultXmlItemAttributes(rootNode, xDoc, this);
            NowLoading = this;

            _targetTemplate = XmlGetter.Attribute(rootNode, "TargetTemplate");


            foreach (XmlNode match in rootNode.ChildNodes)
            {
                String fieldName = XmlGetter.Attribute(match, "FieldName");
                if (fieldName.Length == 0)
                {
                    throw new Exception(rootNode.Name + "MatchItem [TargetTemplate:" + _targetTemplate + "]/Match 태그에는 FieldName이 반드시 들어가야 합니다. 형식예: Info.Name 혹은 Command.Header.id");
                }

                String             activeTimesText = XmlGetter.Attribute(match, "ActiveTimes");
                List <ActiveTimes> activeTimes     = getActiveTimes(activeTimesText);
                if (activeTimes.Count == 0)
                {
                    activeTimes.Add(ActiveTimes.Init);
                }

                XmlMatchData data = new XmlMatchData(activeTimes, fieldName);
                data.LoadXml(xDoc, match, refLoad);

                _fieldToMatchData.Add(fieldName, data); //field->match 란에 추가

                for (int i = 0; i < activeTimes.Count; i++)
                {
                    _activeTimeToMatchData[activeTimes[i]].Add(data); //activeTime->Match 란에 추가.
                }
            }
        }
Пример #27
0
        public override void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false)
        {
            if (rootNode == null)
            {
                return;
            }
            XmlControlHandler.GetDefaultXmlItemAttributes(rootNode, xDoc, this);

            for (int i = 0; i < rootNode.ChildNodes.Count; i++)
            {
                XmlNode xValues = rootNode.ChildNodes[i];
                foreach (XmlNode xValue in xValues.ChildNodes)
                {
                    string type        = XmlGetter.Attribute(xValue, "Type");
                    bool   isVariable  = XmlGetter.Attribute(xValue, "IsVariable").Equals("true");
                    bool   isComponent = XmlGetter.Attribute(xValue, "IsComponent").Equals("true");

                    string            value     = xValue.InnerText;
                    XmlConditionValue condValue = new XmlConditionValue(type, value, isVariable, isComponent);
                    _values.Add(condValue);
                }
            }
        }
Пример #28
0
        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");
            //_template = XmlGetter.Attribute(rootNode, "Template");
            _description = XmlGetter.Attribute(rootNode, "Description");

            String packetType = XmlGetter.Attribute(rootNode, "Type");

            _packetType = PacketTypes.IO; //default..
            for (int i = (int)PacketTypes.IO; i < (int)PacketTypes.None; i++)
            {
                if (packetType.Equals(((PacketTypes)i).ToString()))
                {
                    _packetType = (PacketTypes)i;
                }
            }
        }
Пример #29
0
        public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false)
        {
            if (rootNode == null)
            {
                return;
            }
            XmlControlHandler.GetDefaultXmlItemAttributes(rootNode, xDoc, this);

            string name = XmlGetter.Attribute(rootNode, "Name");

            //string realTimeArgs = XmlGetter.Attribute(rootNode, "IsRealTimeArgs");

            Name = name;
            //IsRealTimeArgs = ValueParser.IsTrue(realTimeArgs);

            XmlNodeList argList = XmlGetter.Children(rootNode, "Arg"); //Arg로 하나씩 나누었을 때

            if (argList.Count == 0)
            {
                XmlNode node = XmlGetter.Child(rootNode, "Args");//Args로 빈칸으로 구분하여 넣었을 때
                if (node != null)
                {
                    string[] args = node.InnerText.Split(" ,".ToCharArray());
                    Args = args;
                }
            }
            else
            {
                List <String> args = new List <string>();
                foreach (XmlNode node in argList)
                {
                    args.Add(node.InnerText);
                }
                Args = args.ToArray();
            }
        }
Пример #30
0
        public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false)
        {
            if (rootNode == null)
            {
                return;
            }
            XmlControlHandler.GetDefaultXmlItemAttributes(rootNode, xDoc, this);

            if (rootNode.ChildNodes.Count == 0)
            {
                throw new Exception("올바른 LayoutCollection 태그가 아닙니다. <Layout>이 적어도 하나는 있어야 합니다.");
            }

            String xmlNamespace = XmlGetter.Attribute(rootNode, "NameSpace");

            if (xmlNamespace.Length > 0)
            {
                _namespace = xmlNamespace;                         //namepace를 덮어씌운다.
            }
            for (int i = 0; i < rootNode.ChildNodes.Count; i++)
            {
                XmlNode xLayout = rootNode.ChildNodes[i];
                if (xLayout.NodeType != XmlNodeType.Element)
                {
                    continue;                                          //주석을 거른다.
                }
                if (xLayout.Name.Equals("Layout") == false)
                {
                    continue;                                         //오직 자식으로는 Component만을 가진다.
                }
                XmlLayout layout = new XmlLayout(_localComponents, _namespace);
                layout.LoadXml(xDoc, xLayout);
                _parent.Controls.Add(layout);
            }

            foreach (string key in _localComponents.Keys)
            {
                if (_globalComponents.ContainsKey(key))
                {
                    throw new Exception("이미 [" + key + "] 이름으로 추가된 컴포넌트가 존재합니다. ");
                }
                else
                {
                    _globalComponents.Add(key, _localComponents[key]);
                }

                /*
                 * if (_namespace.Length == 0)
                 * {
                 *  if (_globalComponents.ContainsKey(key))
                 *  {
                 *      throw new Exception("이미 [" + key + "] 이름으로 추가된 컴포넌트가 존재합니다. ");
                 *  }
                 *  else
                 *  {
                 *      _globalComponents.Add(key, _localComponents[key]);
                 *  }
                 * }
                 * else
                 * {
                 *  if (_globalComponents.ContainsKey(_namespace +  GlobalVars.Seperator + key))
                 *  {
                 *      throw new Exception("같은 namespace [" + _namespace + "] 가 존재합니다. Namespace를 같이 쓰면 안됩니다.");
                 *  }
                 *  else
                 *  {
                 *      _globalComponents.Add(_namespace +  GlobalVars.Seperator + key, _localComponents[key]);
                 *  }
                 * }
                 */
            }
        }