public static SyncLink ParseFromADString(string adString) { if (string.IsNullOrEmpty(adString)) { throw new FormatException(DirectoryStrings.InvalidSyncLinkFormat(adString)); } string[] array = adString.Split(new char[] { ',' }); if (array.Length != 4) { throw new FormatException(DirectoryStrings.InvalidSyncLinkFormat(adString)); } SyncLink syncLink = null; try { LinkState linkState = (LinkState)Enum.Parse(typeof(LinkState), array[0]); if (!string.IsNullOrEmpty(array[0])) { string @string = Encoding.UTF8.GetString(Convert.FromBase64String(array[1])); syncLink = new SyncLink(@string, linkState); } else { string string2 = Encoding.UTF8.GetString(Convert.FromBase64String(array[2])); ADObjectId link = ADObjectId.ParseDnOrGuid(string2); syncLink = new SyncLink(link, linkState); } syncLink.targetObjectClass = (DirectoryObjectClass)Enum.Parse(typeof(DirectoryObjectClass), array[3]); } catch (FormatException innerException) { throw new FormatException(DirectoryStrings.InvalidSyncLinkFormat(adString), innerException); } return(syncLink); }
public KeyMapping ToTaskObject() { string transferToGALContactLegacyDN = null; if (!string.IsNullOrEmpty(this.TransferToGALContactLegacyDN)) { Guid guid; if (Guid.TryParse(this.TransferToGALContactLegacyDN, out guid)) { ADObjectId adobjectId = ADObjectId.ParseDnOrGuid(this.TransferToGALContactLegacyDN); if (adobjectId == null) { goto IL_85; } IEnumerable <PeopleRecipientObject> enumerable = RecipientObjectResolver.Instance.ResolvePeople(new ADObjectId[] { adobjectId }); if (enumerable == null) { goto IL_85; } using (IEnumerator <PeopleRecipientObject> enumerator = enumerable.GetEnumerator()) { if (enumerator.MoveNext()) { PeopleRecipientObject peopleRecipientObject = enumerator.Current; transferToGALContactLegacyDN = peopleRecipientObject.LegacyExchangeDN; } goto IL_85; } } transferToGALContactLegacyDN = this.TransferToGALContactLegacyDN; } IL_85: return(new KeyMapping((KeyMappingType)Enum.Parse(typeof(KeyMappingType), this.KeyMappingType), this.Key, this.Context, this.FindMeFirstNumber, this.FindMeFirstNumberDuration, this.FindMeSecondNumber, this.FindMeSecondNumberDuration, this.TransferToNumber, transferToGALContactLegacyDN)); }
// Token: 0x06000AFA RID: 2810 RVA: 0x000235D4 File Offset: 0x000217D4 internal static string GetHierarchicalIdentityFromDN(string dnString) { string distinguishedName = ADObjectId.ParseDnOrGuid(dnString).DistinguishedName; string[] array = DNConvertor.SplitDistinguishedName(distinguishedName, ','); bool flag = false; StringBuilder stringBuilder = new StringBuilder(); for (int i = array.Length - 1; i >= 0; i--) { if (!flag) { if (array[i].StartsWith("OU=Microsoft Exchange Hosted Organizations", StringComparison.OrdinalIgnoreCase)) { flag = true; } } else { if (array[i].Length <= 3 || !array[i].StartsWith("OU=")) { throw new FormatException(Strings.ErrorInvalidOrganizationalUnitDNFormat(dnString)); } if (stringBuilder.Length != 0) { stringBuilder.Append("\\"); } stringBuilder.Append(array[i].Substring(3)); } } if (!flag) { throw new FormatException(Strings.ErrorInvalidOrganizationalUnitDNFormat(dnString)); } return(stringBuilder.ToString()); }