protected static int GetFlagsValue(string flagsAttrName, ExSearchResultEntry resultEntry, EhfSyncItem syncItem) { DirectoryAttribute attribute = resultEntry.GetAttribute(flagsAttrName); if (attribute == null) { return(0); } string text = (string)attribute[0]; if (string.IsNullOrEmpty(text)) { return(0); } int result; if (!int.TryParse(text, out result)) { syncItem.AddSyncError(syncItem.DiagSession.LogAndTraceError("Unable to parse flags value ({0}) of attribute {1} for AD object ({2}); using default value 0", new object[] { text, flagsAttrName, resultEntry.DistinguishedName })); } return(result); }