/// <summary> /// Attempts to parse all LDAP attributes outside of the ones already collected and converts them to a human readable /// format using a best guess /// </summary> /// <param name="entry"></param> private static Dictionary <string, object> ParseAllProperties(ISearchResultEntry entry) { var flag = IsTextUnicodeFlags.IS_TEXT_UNICODE_STATISTICS; var props = new Dictionary <string, object>(); foreach (var property in entry.PropertyNames()) { if (ReservedAttributes.Contains(property)) { continue; } var collCount = entry.PropCount(property); if (collCount == 0) { continue; } if (collCount == 1) { var testBytes = entry.GetByteProperty(property); if (testBytes == null || testBytes.Length == 0 || !IsTextUnicode(testBytes, testBytes.Length, ref flag)) { continue; } var testString = entry.GetProperty(property); if (!string.IsNullOrEmpty(testString)) { if (property == "badpasswordtime") { props.Add(property, Helpers.ConvertFileTimeToUnixEpoch(testString)); } else { props.Add(property, BestGuessConvert(testString)); } } } else { var arrBytes = entry.GetByteArrayProperty(property); if (arrBytes.Length == 0 || !IsTextUnicode(arrBytes[0], arrBytes[0].Length, ref flag)) { continue; } var arr = entry.GetArrayProperty(property); if (arr.Length > 0) { props.Add(property, arr.Select(BestGuessConvert).ToArray()); } } } return(props); }