Exemple #1
0
 public static void Assert(bool condition, string category, string format, object[] args)
 {
     if (DebugLogger._level >= DebugLogLevel.Error && !condition)
     {
         DebugLogger.LogError(category, format, args);
     }
 }
Exemple #2
0
 public static void Assert(bool condition, string category, string message)
 {
     if (DebugLogger._level >= DebugLogLevel.Error && !condition)
     {
         DebugLogger.LogError(category, message);
     }
 }
Exemple #3
0
        public static ADAttributeSyntax OIDToSyntax(string OID)
        {
            ADAttributeSyntax aDAttributeSyntax = ADAttributeSyntax.CaseExactString;

            if (ADSyntax._syntaxMap.TryGetValue(OID, out aDAttributeSyntax))
            {
                return(aDAttributeSyntax);
            }
            else
            {
                DebugLogger.LogError("adschema", string.Format("OID {0} not found in mapping table", OID));
                return(ADAttributeSyntax.NotFound);
            }
        }
Exemple #4
0
        private void ReadConstructedSchema(ADObjectSearcher searcher, ADSchema adSchema)
        {
            searcher.SchemaTranslation = false;
            ADRootDSE rootDSE = searcher.GetRootDSE();

            searcher.SearchRoot = rootDSE.SubSchemaSubEntry;
            searcher.Filter     = ADOPathUtil.CreateFilterClause(ADOperator.Like, "objectClass", "*");
            searcher.Scope      = ADSearchScope.Base;
            searcher.Properties.Clear();
            searcher.Properties.Add("extendedAttributeInfo");
            searcher.Properties.Add("attributeTypes");
            ADObject aDObject = searcher.FindOne();
            int      success  = SchemaConstants.AttributeTypesRegex.GroupNumberFromName(SchemaConstants.NameGroup);
            int      num      = SchemaConstants.AttributeTypesRegex.GroupNumberFromName(SchemaConstants.SyntaxGroup);
            int      num1     = SchemaConstants.AttributeTypesRegex.GroupNumberFromName(SchemaConstants.SingleValueGroup);

            adSchema._schemaProperties = new Dictionary <string, ADSchemaAttribute>(1, StringComparer.OrdinalIgnoreCase);
            foreach (string item in aDObject["attributeTypes"])
            {
                Match match = SchemaConstants.AttributeTypesRegex.Match(item);
                if (match != null)
                {
                    if (!match.Groups[success].Success)
                    {
                        DebugLogger.LogError("adschema", string.Format("AttributeType {0} no match on Name", item));
                    }
                    if (!match.Groups[num].Success)
                    {
                        DebugLogger.LogError("adschema", string.Format("AttributeType {0} no match on Syntax", item));
                    }
                    adSchema._schemaProperties.Add(match.Groups[success].Value, new ADSchemaAttribute(ADSyntax.OIDToSyntax(match.Groups[num].Value), match.Groups[num1].Success, false));
                }
                else
                {
                    DebugLogger.LogError("adschema", string.Format("unable to match AttributeType {0}", item));
                    throw new ADException();
                }
            }
            success = SchemaConstants.ExtendedAttrInfoRegex.GroupNumberFromName(SchemaConstants.NameGroup);
            int num2 = SchemaConstants.ExtendedAttrInfoRegex.GroupNumberFromName(SchemaConstants.SystemOnlyGroup);

            foreach (string str in aDObject["extendedAttributeInfo"])
            {
                Match match1 = SchemaConstants.ExtendedAttrInfoRegex.Match(str);
                adSchema._schemaProperties[match1.Groups[success].Value].IsSystemOnly = match1.Groups[num2].Success;
            }
        }