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);
            }
        }
 protected virtual void IdentifyRuleForArgument(out XmlNode oNode, ArgumentStruct oArg)
 {
     if (!IdentifyLayoutConversationPattern(out oNode, oArg))
     {
         IdentifyDefault(out oNode, oArg);
     }
 }
        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");
                }
            }
        }
        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);
        }
Exemplo n.º 5
0
 // Methods
 public ArgumentStruct()
 {
     _moChildArguments = new ArrayList();
     _moParameterXml = null;
     Name = string.Empty;
     Description = string.Empty;
     DataType = string.Empty;
     Value = string.Empty;
     ValueAttriName = string.Empty;
     IsTagName = false;
     UIType = UIControlType.SingleLineTextBox;
     ParentArgument = null;
 }
        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);
        }
Exemplo n.º 7
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);
        }
        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);
        }
 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);
     }
 }
Exemplo n.º 10
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);
        }
Exemplo n.º 11
0
 public void AddChildArgument(ArgumentStruct oChildArgument)
 {
     oChildArgument.ParentArgument = this;
     _moChildArguments.Add(oChildArgument);
 }
Exemplo n.º 12
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);
        }
Exemplo n.º 13
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);
     }
 }
Exemplo n.º 14
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;
        }
Exemplo n.º 15
0
 public void AddChildArgument(ArgumentStruct oChildArgument)
 {
     oChildArgument.ParentArgument = this;
     _moChildArguments.Add(oChildArgument);
 }
Exemplo n.º 16
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);
     }
 }
Exemplo n.º 17
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;
 }
Exemplo n.º 18
0
 protected virtual void IdentifyRuleForArgument(out XmlNode oNode, ArgumentStruct oArg)
 {
     if (!IdentifyLayoutConversationPattern(out oNode, oArg))
     {
         IdentifyDefault(out oNode, oArg);
     }
 }
Exemplo n.º 19
0
        private void RecursiveGenerateControls(ArgumentStruct oArg)
        {
            Control control1;
            switch (oArg.Name)
            {
                case "layout":
                    foreach (string sEnumValue in oArg.EnumValues)
                    {
                        ddlLayoutType.Items.Add(sEnumValue);
                    }
                    ddlLayoutType.Text = oArg.Value;
                    break;
                case "conversionPattern":
                    txtConversionPattern.Text = oArg.Value;
                    break;
                default:
                    Label label1 = new Label();
                    label1.Text = oArg.Name + " : ";
                    label1.AutoSize = true;
                    switch (oArg.UIType)
                    {
                        case UIControlType.MultiLineTextBox:
                            control1 = new TextBox();
                            ((TextBox) control1).Multiline = true;
                            ((TextBox) control1).ScrollBars = ScrollBars.Both;
                            ((TextBox) control1).Text = oArg.Value;
                            control1.Height *= 5;
                            break;

                        case UIControlType.DropDownList:
                            control1 = new ComboBox();
                            ((ComboBox) control1).DropDownStyle = ComboBoxStyle.DropDownList;
                            foreach (string text2 in oArg.EnumValues)
                            {
                                ((ComboBox) control1).Items.Add(text2);
                            }
                            ((ComboBox) control1).Text = oArg.Value;
                            break;

                        case UIControlType.ListBox:
                            control1 = new ListBox();
                            foreach (string text1 in oArg.EnumValues)
                            {
                                ((ListBox) control1).Items.Add(text1);
                            }
                            ((ListBox) control1).Text = oArg.Value;
                            break;

                        case UIControlType.ParameterGrid:
                            control1 = new ParameterGrid();
                            ((ParameterGrid)control1).ParameterXmlNodes = oArg.ParameterXml;
                            break;

                        case UIControlType.None:
                            control1 = new Label();
                            break;

                        default:
                            control1 = new TextBox();
                            ((TextBox) control1).Text = oArg.Value;
                            break;
                    }
                    control1.Tag = oArg.Name;
                    toolTip.SetToolTip(control1, oArg.Description);
                    argPanel.Controls.Add(label1);
                    argPanel.Controls.Add(control1);
                    break;
            }
            if (oArg.ChildArguments != null)
            {
                foreach (ArgumentStruct struct1 in oArg.ChildArguments)
                {
                    RecursiveGenerateControls(struct1);
                }
            }
        }
Exemplo n.º 20
0
        private void RecursiveGenerateControls(ArgumentStruct oArg)
        {
            Control control1;

            switch (oArg.Name)
            {
            case "layout":
                foreach (string sEnumValue in oArg.EnumValues)
                {
                    ddlLayoutType.Items.Add(sEnumValue);
                }
                ddlLayoutType.Text = oArg.Value;
                break;

            case "conversionPattern":
                txtConversionPattern.Text = oArg.Value;
                break;

            default:
                Label label1 = new Label();
                label1.Text     = oArg.Name + " : ";
                label1.AutoSize = true;
                switch (oArg.UIType)
                {
                case UIControlType.MultiLineTextBox:
                    control1 = new TextBox();
                    ((TextBox)control1).Multiline  = true;
                    ((TextBox)control1).ScrollBars = ScrollBars.Both;
                    ((TextBox)control1).Text       = oArg.Value;
                    control1.Height *= 5;
                    break;

                case UIControlType.DropDownList:
                    control1 = new ComboBox();
                    ((ComboBox)control1).DropDownStyle = ComboBoxStyle.DropDownList;
                    foreach (string text2 in oArg.EnumValues)
                    {
                        ((ComboBox)control1).Items.Add(text2);
                    }
                    ((ComboBox)control1).Text = oArg.Value;
                    break;

                case UIControlType.ListBox:
                    control1 = new ListBox();
                    foreach (string text1 in oArg.EnumValues)
                    {
                        ((ListBox)control1).Items.Add(text1);
                    }
                    ((ListBox)control1).Text = oArg.Value;
                    break;

                case UIControlType.ParameterGrid:
                    control1 = new ParameterGrid();
                    ((ParameterGrid)control1).ParameterXmlNodes = oArg.ParameterXml;
                    break;

                case UIControlType.None:
                    control1 = new Label();
                    break;

                default:
                    control1 = new TextBox();
                    ((TextBox)control1).Text = oArg.Value;
                    break;
                }
                control1.Tag = oArg.Name;
                toolTip.SetToolTip(control1, oArg.Description);
                argPanel.Controls.Add(label1);
                argPanel.Controls.Add(control1);
                break;
            }
            if (oArg.ChildArguments != null)
            {
                foreach (ArgumentStruct struct1 in oArg.ChildArguments)
                {
                    RecursiveGenerateControls(struct1);
                }
            }
        }