Ejemplo n.º 1
0
 protected virtual void IdentifyRuleForArgument(out XmlNode oNode, ArgumentStruct oArg)
 {
     if (!IdentifyLayoutConversationPattern(out oNode, oArg))
     {
         IdentifyDefault(out oNode, oArg);
     }
 }
Ejemplo n.º 2
0
        private ArgumentStruct GetArgumentInfo(XmlNode oArgNode)
        {
            XmlAttribute   oTempAttri;
            ArgumentStruct oArg = new ArgumentStruct();

            oTempAttri = oArgNode.Attributes[Constants.ArgInfoFieldName.NameField]; oArg.Name = (null == oTempAttri) ? string.Empty : oTempAttri.Value;
            oTempAttri = oArgNode.Attributes[Constants.ArgInfoFieldName.ValueField]; oArg.Value = (null == oTempAttri) ? string.Empty : oTempAttri.Value;
            oTempAttri = oArgNode.Attributes[Constants.ArgInfoFieldName.DataTypeField]; oArg.DataType = (null == oTempAttri) ? string.Empty : oTempAttri.Value;
            oTempAttri = oArgNode.Attributes[Constants.ArgInfoFieldName.DescriptionField]; oArg.Description = (null == oTempAttri) ? string.Empty : oTempAttri.Value;
            oTempAttri = oArgNode.Attributes[Constants.ArgInfoFieldName.EnumValuesField]; oArg.EnumValues = (null == oTempAttri) ? new string[] { string.Empty } : oTempAttri.Value.Split(';');
            oTempAttri = oArgNode.Attributes[Constants.ArgInfoFieldName.IsTagNameField]; oArg.IsTagName = (null == oTempAttri) ? false : bool.Parse(oTempAttri.Value);
            oTempAttri = oArgNode.Attributes[Constants.ArgInfoFieldName.ValueAttriNameField]; oArg.ValueAttriName = (null == oTempAttri) ? string.Empty : oTempAttri.Value;
            oTempAttri = oArgNode.Attributes[Constants.ArgInfoFieldName.UITypeField]; oArg.UIType = (null == oTempAttri) ? UIControlType.None : ParseUIControlTypeFromString(oTempAttri.Value);
            if (UIControlType.ParameterGrid == oArg.UIType)
            {
                oArg.ParameterXml = oArgNode.SelectNodes("//parameter");
            }
            else
            {
                foreach (XmlNode oChildArgNode in oArgNode.ChildNodes)
                {
                    oArg.AddChildArgument(GetArgumentInfo(oChildArgNode));
                }
            }
            return(oArg);
        }
Ejemplo n.º 3
0
        protected virtual void IdentifyDefault(out XmlNode oNode, ArgumentStruct oArg)
        {
            XmlAttribute oAttri = null;

            if (!oArg.IsTagName)
            {
                oNode        = _moXmlDoc.CreateNode(XmlNodeType.Element, "param", string.Empty);
                oAttri       = _moXmlDoc.CreateAttribute("name");
                oAttri.Value = oArg.Name;
                oNode.Attributes.Append(oAttri);
                oAttri = _moXmlDoc.CreateAttribute("value");
            }
            else
            {
                oNode = _moXmlDoc.CreateNode(XmlNodeType.Element, oArg.Name, string.Empty);
                if (string.Empty != oArg.ValueAttriName)
                {
                    oAttri = _moXmlDoc.CreateAttribute(oArg.ValueAttriName);
                }
            }
            if (null != oAttri)
            {
                oAttri.Value = oArg.Value;
                oNode.Attributes.Append(oAttri);
            }
        }
Ejemplo n.º 4
0
        protected virtual void IdentifyDefault(XmlNode oNode)
        {
            string ArgName  = oNode.Name.ToLower().Trim();
            string ArgValue = string.Empty;

            if (ArgName == "param")
            {
                ArgName  = oNode.Attributes["name"].Value;
                ArgValue = oNode.Attributes["value"].Value;
            }
            else
            {
                if (oNode.Attributes.Count > 0)
                {
                    ArgValue = oNode.Attributes[0].Value;
                }
            }
            ArgumentStruct oArg = SearchUpdateArg(ArgName, ArgValue);

            if (null != oArg)
            {
                if (UIControlType.ParameterGrid == oArg.UIType)
                {
                    oArg.ParameterXml = oNode.ParentNode.SelectNodes("parameter");
                }
            }
        }
Ejemplo n.º 5
0
        public virtual ArgumentStruct SearchUpdateArg(string sArgName, string UpdatedValue)
        {
            ArgumentStruct oFinalArg = null;

            foreach (object oTemp in _mMyArguments)
            {
                ArgumentStruct oArg = ((ArgumentStruct)oTemp).Find(sArgName);
                if (null != oArg)
                {
                    oFinalArg  = oArg;
                    oArg.Value = UpdatedValue;
                }
            }
            return(oFinalArg);
        }
Ejemplo n.º 6
0
        public ArgumentStruct Find(string sArgName)
        {
            ArgumentStruct oArg = null;

            if (Name.ToLower().Trim() == sArgName.ToLower().Trim())
            {
                return(this);
            }
            if (_moChildArguments.Count > 0)
            {
                foreach (object oChildArg in _moChildArguments)
                {
                    oArg = ((ArgumentStruct)oChildArg).Find(sArgName);
                }
            }
            return(oArg);
        }
Ejemplo n.º 7
0
        protected virtual void AddLayoutArgument()
        {
            ArgumentStruct oArg = new ArgumentStruct();

            oArg.Name        = Constants.ArgName.msCONST_LOG4NET_LAYOUT;
            oArg.DataType    = typeof(string).Name.ToLower();
            oArg.Value       = Constants.msCONST_LOG4NET_DEFAULT_LAYOUT;
            oArg.Description = "Assign layout pattern";
            oArg.UIType      = UIControlType.DropDownList;
            oArg.EnumValues  = EnumerateAllLayouts();
            _mMyArguments.Add(oArg);

            oArg             = new ArgumentStruct();
            oArg.DataType    = typeof(string).Name.ToLower();
            oArg.Name        = Constants.ArgName.msCONST_LOG4NET_CONVPATTERN;
            oArg.Value       = Constants.msCONST_LOG4NET_DEFAULT_PATTERNLAYOUT;
            oArg.UIType      = UIControlType.SingleLineTextBox;
            oArg.Description = "Assign regular expression for this pattern layout.";
            ((ArgumentStruct)_mMyArguments[_mMyArguments.Count - 1]).AddChildArgument(oArg);
        }
Ejemplo n.º 8
0
 private void RecursiveFromArguments(XmlNode oCurrentNode, ArgumentStruct oArg)
 {
     if (UIControlType.ParameterGrid == oArg.UIType)
     {
         foreach (XmlNode oNode in oArg.ParameterXml)
         {
             oCurrentNode.AppendChild(oNode);
         }
     }
     else
     {
         XmlNode oArgNode;
         IdentifyRuleForArgument(out oArgNode, oArg);
         if (oArg.ChildArguments != null)
         {
             foreach (ArgumentStruct oArgChild in oArg.ChildArguments)
             {
                 RecursiveFromArguments(oArgNode, oArgChild);
             }
         }
         oCurrentNode.AppendChild(oArgNode);
     }
 }
Ejemplo n.º 9
0
        protected virtual bool IdentifyLayoutConversationPattern(out XmlNode oNode, ArgumentStruct oArg)
        {
            XmlAttribute attribute1;
            bool         flag1 = true;

            switch (oArg.Name.ToLower().Trim())
            {
            case "layout":
                oNode            = _moXmlDoc.CreateNode(XmlNodeType.Element, oArg.Name, string.Empty);
                attribute1       = _moXmlDoc.CreateAttribute("type");
                attribute1.Value = oArg.Value;
                oNode.Attributes.Append(attribute1);
                return(flag1);

            case "conversionpattern":
                oNode            = _moXmlDoc.CreateNode(XmlNodeType.Element, oArg.Name, string.Empty);
                attribute1       = _moXmlDoc.CreateAttribute("value");
                attribute1.Value = oArg.Value;
                oNode.Attributes.Append(attribute1);
                return(flag1);
            }
            oNode = null;
            return(false);
        }
Ejemplo n.º 10
0
 public void AddChildArgument(ArgumentStruct oChildArgument)
 {
     oChildArgument.ParentArgument = this;
     _moChildArguments.Add(oChildArgument);
 }