public static string AuthenticationMethodsToText(object authen) { ADMultiValuedProperty <AuthenticationMethod> admultiValuedProperty = (ADMultiValuedProperty <AuthenticationMethod>)authen; StringBuilder stringBuilder = new StringBuilder(); foreach (AuthenticationMethod authenticationMethod in admultiValuedProperty) { stringBuilder.AppendFormat("{0}, ", LocalizedDescriptionAttribute.FromEnum(typeof(AuthenticationMethod), authenticationMethod)); } return(stringBuilder.ToString().TrimEnd(new char[] { ',', ' ' })); }
// Token: 0x06000E85 RID: 3717 RVA: 0x00045C58 File Offset: 0x00043E58 private static MultiValuedProperty <int?> ConvertIntArrayToMvpNullableInt(object obj) { if (obj == null) { return(null); } ADMultiValuedProperty <int?> admultiValuedProperty = new ADMultiValuedProperty <int?>(); if (obj is int) { admultiValuedProperty.Add(new int?((int)obj)); } else if (obj is int[]) { int[] array = (int[])obj; foreach (int value in array) { admultiValuedProperty.Add(new int?(value)); } } return(admultiValuedProperty); }
// Token: 0x0600100A RID: 4106 RVA: 0x0005DCD0 File Offset: 0x0005BED0 private void WriteADEntry(XmlWriter entryWriter, ADRawEntry entry) { base.Logger.TraceDebug(this, "Entering ADCrawler.WriteADEntry", new object[0]); object[] properties = entry.GetProperties(GrammarRecipientHelper.LookupProperties); RecipientTypeDetails recipientTypeDetails = (RecipientTypeDetails)properties[5]; bool flag = this.ShouldAcceptADEntry(recipientTypeDetails); if (flag) { entryWriter.WriteStartElement("ADEntry"); int i = 0; while (i < properties.Length) { string text = string.Empty; if (properties[i] == null) { base.Logger.TraceDebug(this, "ADEntry - Property='{0}', Value is null", new object[] { GrammarRecipientHelper.LookupProperties[i].Name }); goto IL_22D; } if (GrammarRecipientHelper.LookupProperties[i] == ADRecipientSchema.UMRecipientDialPlanId) { ADObjectId adobjectId = properties[i] as ADObjectId; text = adobjectId.ObjectGuid.ToString(); goto IL_22D; } if (GrammarRecipientHelper.LookupProperties[i] == ADRecipientSchema.AddressListMembership) { ADMultiValuedProperty <ADObjectId> admultiValuedProperty = properties[i] as ADMultiValuedProperty <ADObjectId>; List <string> list = new List <string>(admultiValuedProperty.Count); foreach (ADObjectId adobjectId2 in admultiValuedProperty) { list.Add(adobjectId2.ObjectGuid.ToString()); } text = string.Join(",", list.ToArray()); goto IL_22D; } if (GrammarRecipientHelper.LookupProperties[i] == ADRecipientSchema.DisplayName || GrammarRecipientHelper.LookupProperties[i] == ADRecipientSchema.PhoneticDisplayName || GrammarRecipientHelper.LookupProperties[i] == ADObjectSchema.DistinguishedName) { text = GrammarRecipientHelper.GetSanitizedDisplayNameForXMLEntry(properties[i].ToString()); goto IL_22D; } if (GrammarRecipientHelper.LookupProperties[i] == ADRecipientSchema.PrimarySmtpAddress || GrammarRecipientHelper.LookupProperties[i] == ADObjectSchema.Guid || GrammarRecipientHelper.LookupProperties[i] == ADRecipientSchema.RecipientType || GrammarRecipientHelper.LookupProperties[i] == ADObjectSchema.WhenChangedUTC) { text = properties[i].ToString(); goto IL_22D; } if (GrammarRecipientHelper.LookupProperties[i] != ADRecipientSchema.RecipientTypeDetails) { ExAssert.RetailAssert(false, "Invalid lookup property '{0}'", new object[] { GrammarRecipientHelper.LookupProperties[i].Name }); goto IL_22D; } base.Logger.TraceDebug(this, "Skipping property='{0}'", new object[] { GrammarRecipientHelper.LookupProperties[i].Name }); IL_27E: i++; continue; IL_22D: base.Logger.TraceDebug(this, "ADEntry - Property='{0}', Value='{1}'", new object[] { GrammarRecipientHelper.LookupProperties[i].Name, text }); entryWriter.WriteStartAttribute(GrammarRecipientHelper.LookupProperties[i].Name); entryWriter.WriteString(text); entryWriter.WriteEndAttribute(); goto IL_27E; } entryWriter.WriteEndElement(); } }
internal string GetDatabase(Runspace runSpace, string primaryDomainController, string dagName) { string database = string.Empty; if (string.IsNullOrEmpty(dagName)) { return(string.Empty); } ExchangeLog.LogStart("GetDatabase"); ExchangeLog.LogInfo("DAG: " + dagName); // this part of code handles mailboxnames like in the old 2007 provider // check if DAG is in reality DAG\mailboxdatabase string dagNameDAG = string.Empty; string dagNameMBX = string.Empty; bool isFixedDatabase = false; if (dagName.Contains("\\")) { // split the two parts and extract DAG-Name and mailboxdatabase-name string[] parts = dagName.Split(new char[] { '\\' }, 2, StringSplitOptions.None); dagNameDAG = parts[0]; dagNameMBX = parts[1]; // check that we realy have a database name if (!String.IsNullOrEmpty(dagNameMBX)) { isFixedDatabase = true; } } else { // there is no mailboxdatabase-name use the loadbalancing-code dagNameDAG = dagName; isFixedDatabase = false; } //Get Dag Servers - with the name of the database availability group Collection <PSObject> dags = null; Command cmd = new Command("Get-DatabaseAvailabilityGroup"); cmd.Parameters.Add("Identity", dagNameDAG); dags = ExecuteShellCommand(runSpace, cmd); if (htBbalancer == null) { htBbalancer = new Hashtable(); } // use fully qualified dagName for loadbalancer. Thus if there are two services and one of them // contains only the DAG, the "fixed" database could also be used in loadbalancing. If you do not want this, // set either IsExcludedFromProvisioning or IsSuspendedFromProvisioning - it is not evaluated for fixed databases if (htBbalancer[dagName] == null) { htBbalancer.Add(dagName, 0); } if (dags != null && dags.Count > 0) { ADMultiValuedProperty <ADObjectId> servers = (ADMultiValuedProperty <ADObjectId>)GetPSObjectProperty(dags[0], "Servers"); if (servers != null) { System.Collections.Generic.List <string> lstDatabase = new System.Collections.Generic.List <string>(); if (!isFixedDatabase) // "old" loadbalancing code { foreach (object objServer in servers) { Collection <PSObject> databases = null; cmd = new Command("Get-MailboxDatabase"); cmd.Parameters.Add("Server", ObjToString(objServer)); databases = ExecuteShellCommand(runSpace, cmd); foreach (PSObject objDatabase in databases) { if (((bool)GetPSObjectProperty(objDatabase, "IsExcludedFromProvisioning") == false) && ((bool)GetPSObjectProperty(objDatabase, "IsSuspendedFromProvisioning") == false)) { string db = ObjToString(GetPSObjectProperty(objDatabase, "Identity")); bool bAdd = true; foreach (string s in lstDatabase) { if (s.ToLower() == db.ToLower()) { bAdd = false; break; } } if (bAdd) { lstDatabase.Add(db); ExchangeLog.LogInfo("AddDatabase: " + db); } } } } } else // new fixed database code { Collection <PSObject> databases = null; cmd = new Command("Get-MailboxDatabase"); cmd.Parameters.Add("Identity", dagNameMBX); databases = ExecuteShellCommand(runSpace, cmd); // do not check "IsExcludedFromProvisioning" or "IsSuspended", just check if it is a member of the DAG foreach (PSObject objDatabase in databases) { string dagSetting = ObjToString(GetPSObjectProperty(objDatabase, "MasterServerOrAvailabilityGroup")); if (dagNameDAG.Equals(dagSetting, StringComparison.OrdinalIgnoreCase)) { lstDatabase.Add(dagNameMBX); ExchangeLog.LogInfo("AddFixedDatabase: " + dagNameMBX); } } } int balancer = (int)htBbalancer[dagName]; balancer++; if (balancer >= lstDatabase.Count) { balancer = 0; } htBbalancer[dagName] = balancer; if (lstDatabase.Count != 0) { database = lstDatabase[balancer]; } } } ExchangeLog.LogEnd("GetDatabase"); return(database); }