internal static void ToDirectoryComputerSamAccountName(string extendedAttribute, string[] directoryAttributes, ADPropertyValueCollection extendedData, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo) { if (extendedData == null || extendedData.Value == null) { AttributeConverters.ToDirectoryObject(extendedAttribute, directoryAttributes, extendedData, directoryObj, cmdletSessionInfo); return; } else { string value = extendedData.Value as string; if (!string.IsNullOrEmpty(value) && !value.EndsWith("$", StringComparison.OrdinalIgnoreCase)) { value = string.Concat(value, "$"); } AttributeConverters.ToDirectoryObject(extendedAttribute, directoryAttributes, new ADPropertyValueCollection(value), directoryObj, cmdletSessionInfo); return; } }
internal static void ToDirectoryServiceAccountSamAccountName(string extendedAttribute, string[] directoryAttributes, ADPropertyValueCollection extendedData, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo) { int num; if (extendedData == null || extendedData.Value == null) { AttributeConverters.ToDirectoryObject(extendedAttribute, directoryAttributes, extendedData, directoryObj, cmdletSessionInfo); return; } else { string value = extendedData.Value as string; if (!string.IsNullOrEmpty(value)) { bool flag = value.EndsWith("$", StringComparison.OrdinalIgnoreCase); int length = value.Length; if (flag) { num = 16; } else { num = 15; } if (length <= num) { if (!flag) { value = string.Concat(value, "$"); } } else { object[] objArray = new object[1]; objArray[0] = value; throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, StringResources.ServiceAccountNameLengthInvalid, objArray)); } } AttributeConverters.ToDirectoryObject(extendedAttribute, directoryAttributes, new ADPropertyValueCollection(value), directoryObj, cmdletSessionInfo); return; } }