コード例 #1
0
                public int Compare(object x, object y)
                {
                    ComputerGroupRegEx r1 = (ComputerGroupRegEx)x;
                    ComputerGroupRegEx r2 = (ComputerGroupRegEx)y;

                    if (r1.Priority > r2.Priority)
                    {
                        return(1);
                    }
                    if (r1.Priority < r2.Priority)
                    {
                        return(-1);
                    }

                    // Items are identical
                    return(0);
                }
コード例 #2
0
            public ComputerGroupRegEx MatchPC(string fulldomainname, string ip)
            {
                ComputerGroupRegEx rx = null;

                foreach (clsConfig.ComputerGroupRegEx r in this)
                {
                    // Assume the rules match unless one of the two regex expressions is non-empty and does not match or the rule is not enabled
                    bool matched = true;

                    if (!r.Enabled)
                    {
                        matched = false;
                    }

                    if (r.ComputerNameRegex != null && r.ComputerNameRegex != "")
                    {
                        Match m = Regex.Match(fulldomainname, r.ComputerNameRegex);
                        if (!m.Success)
                        {
                            matched = false;
                        }
                    }

                    if (r.IPRegex != null && r.IPRegex != "")
                    {
                        Match m = Regex.Match(ip, r.IPRegex);
                        if (!m.Success)
                        {
                            matched = false;
                        }
                    }

                    if (matched)
                    {
                        // If we have a match, note it and break out
                        rx = r;
                        break;
                    }
                }

                // Return the rule that was matched (or null if no rule was matched)
                return(rx);
            }
コード例 #3
0
 public int Add(ComputerGroupRegEx add)
 {
     // Add item to list
     return(this.List.Add(add));
 }
コード例 #4
0
 public int Add(ComputerGroupRegEx add)
 {
     // Add item to list
     return this.List.Add(add);
 }