示例#1
0
 public dmGroup(dmContainer dmcParent)
     : base(dmcParent)
 {
     this.FiltersAndDefaults = new dmRuleset(this);
     this.Rulesets           = new SortableBindingList <dmRuleset>();
     this.Groups             = new SortableBindingList <dmGroup>();
 }
示例#2
0
        protected int ParseGroup(string[] strArray, int nLineStart, dmContainer Parent)
        {
            int     nReturn  = nLineStart;
            dmGroup newGroup = new dmGroup(this);
            Dictionary <string, string> itemParameters = GetParameters(strArray[nReturn]);

            foreach (KeyValuePair <string, string> item in itemParameters)
            {
                switch (item.Key)
                {
                case "FILTERSANDDEFAULTS":
                    newGroup.FiltersAndDefaults.Parse(item.Value);
                    break;

                case "GROUP":
                    newGroup.Name = item.Value;
                    break;

                case "COMMENT":
                    newGroup.Comment = item.Value;
                    break;
                }
            }
            nReturn++;

            //parses until it reaches the end of the group and returns the line number after the end of the group
            while (nReturn < strArray.Length && IdentifyLineType(strArray[nReturn]) != LineParseType.GroupEndLine)
            {
                string[] tmpVariable = new string[0];
                switch (IdentifyLineType(strArray[nReturn]))
                {
                case LineParseType.GroupStartLine:
                    nReturn = ParseGroup(strArray, nReturn, newGroup);
                    break;

                case LineParseType.RulesetLine:
                case LineParseType.RulesetNameLine:
                    nReturn = ParseRuleset(strArray, nReturn, newGroup);
                    break;

                default:
                    nReturn++;
                    break;
                }
            }
            nReturn++;
            Parent.AddGroup(newGroup);

            return(nReturn);
        }
示例#3
0
        public dmRuleset(dmContainer dmcParent, dmRuleset other)
            : this(dmcParent)
        {
            dmRuleset tmp = new dmRuleset(dmcParent);
            tmp.Name    = this.Name;
            tmp.Comment = this.Comment;

            foreach (dmRule item in Rules)
            {
                tmp.Rules.Add((dmRule)item.Clone());
            }

            foreach (dmAction item in Actions)
            {
                tmp.Actions.Add((dmAction)item.Clone());
            }

            this.OriginalText = other.OriginalText;
        }
示例#4
0
 public dmRuleset(dmContainer dmcParent, string[] strStrings)
     : this(dmcParent)
 {
     if (strStrings.Length > 1)
     {
         string[] NameAndComment = strStrings[0].Split(new string[] { Global.RulesetNameHeader, Global.CommentHeader }, StringSplitOptions.RemoveEmptyEntries);
         if (NameAndComment.Length > 0)
         {
             Name = NameAndComment[0];
         }
         if (NameAndComment.Length > 1)
         {
             Comment = NameAndComment[1];
         }
         Parse(strStrings[1]);
     }
     else
     {
         Parse(strStrings[0]);
     }
 }
示例#5
0
        public int MergeRuleset(string[] strArray, int nLineStart, dmContainer dmcParent)
        {
            int nReturn = nLineStart;
            //parses until it reaches the end of the group and returns the line number after the end of the group
            dmRuleset newRS = new dmRuleset(this);


            string        tmpString = strArray[nReturn];
            LineParseType tmpLPT    = IdentifyLineType(tmpString);

            if (tmpLPT == LineParseType.RulesetNameLine)
            {
                Dictionary <string, string> itemParameters = GetParameters(strArray[nReturn]);
                foreach (KeyValuePair <string, string> item in itemParameters)
                {
                    switch (item.Key)
                    {
                    case "NAME":
                        newRS.Name = item.Value;
                        break;

                    case "COMMENT":
                        newRS.Comment = item.Value;
                        break;
                    }
                }
                nReturn++;
            }

            newRS.Parse(strArray[nReturn]);

            if (!dmcParent.Rulesets.Contains(newRS))
            {
                dmcParent.AddRuleset(newRS);
            }
            nReturn++;

            return(nReturn);
        }
示例#6
0
 public dmGroup(dmContainer dmcParent, string[] strArrayGroup)
     : this(dmcParent)
 {
     Parse(strArrayGroup, 0);
 }
示例#7
0
 public dmGroup(dmContainer dmcParent, XElement xParameters)
     : this(dmcParent)
 {
     FromXML(xParameters);
 }
示例#8
0
 public dmGroup Clone(dmContainer dmcParent)
 {
     return(new dmGroup(dmcParent, this.ToXML("group")));
 }
示例#9
0
 public dmRuleset(dmContainer dmcParent, string strRule)
     : this(dmcParent)
 {
     Parse(strRule);
 }
示例#10
0
 public dmRuleset(dmContainer dmcParent, string strRule, Version version)
     : this(dmcParent)
 {
     Parse(strRule, version);
 }
示例#11
0
 public dmRuleset(dmContainer dmcParent)
     : base(dmcParent)
 {
 }
示例#12
0
 public dmRuleset Clone(dmContainer dmcParent)
 {
     return(new dmRuleset(dmcParent, this.ToXML("ruleset")));
 }
示例#13
0
 public dmRuleset(dmContainer dmcParent, XElement xParameters)
     : base(dmcParent)
 {
     FromXML(xParameters);
 }
示例#14
0
 public dmContainer(dmContainer dmcParent)
     : base(dmcParent)
 {
     Clear();
 }