public PropertyValueCollectionWrapper(PropertyValueCollection propertyValueCollection) { if(propertyValueCollection == null) throw new ArgumentNullException("propertyValueCollection"); this._propertyValueCollection = propertyValueCollection; }
/// <summary> /// Get a PropertyValueCollection as a string delimited set. /// </summary> /// <param name="oEntry">The directory object entry.</param> /// <param name="Prop">The property to get.</param> /// <param name="div">The delimiter to seperate property values by.</param> /// <returns></returns> public static String GetPropertyAsStringSet(DirectoryEntry oEntry, string Prop, string div) { string res = ""; if (oEntry.Properties.Contains(Prop)) { if (oEntry.Properties[Prop].Count > 0) { System.DirectoryServices.PropertyValueCollection oPropSet = (System.DirectoryServices.PropertyValueCollection)oEntry.Properties["mail"]; foreach (string val in oPropSet) { if (val.Trim() != "") { if (res == "") { res = val; } else { res = res + div + val; } } } } } return(res); }
public bool MIMESetting(DirectoryEntry rootEntry, Dictionary <string, string> exList) { if (rootEntry == null) { return(false); } System.DirectoryServices.PropertyValueCollection mime = rootEntry.Properties["MimeMap"]; foreach (string e in exList.Keys) { IISOle.MimeMapClass Ex = new IISOle.MimeMapClass(); Ex.Extension = e; Ex.MimeType = exList[e]; object v = ContianValue(Ex, mime); if (v != null) { continue; //mime.Remove(v); } mime.Add(Ex); Ex = null; } rootEntry.CommitChanges(); return(true); }
public void AddRange(PropertyValueCollection value) { if (value == null) { throw new ArgumentNullException("value"); } int count = value.Count; for (int i = 0; i < count; i++) { this.Add(value[i]); } }
/// <summary> /// Get a PropertyValue as a Object. /// </summary> /// <param name="oEntry">The directory object entry.</param> /// <param name="Prop">The property to get.</param> /// <returns></returns> public static object GetPropertyObject(DirectoryEntry oEntry, string Prop) { object oProp = null; if (oEntry.Properties.Contains(Prop)) { if (oEntry.Properties[Prop].Count > 0) { System.DirectoryServices.PropertyValueCollection oPropSet = (System.DirectoryServices.PropertyValueCollection)oEntry.Properties[Prop]; oProp = (object)oPropSet[0]; } } return(oProp); }
// generically set a value in the uac to the value of 'isSet' internal static void Set(PropertyValueCollection pvc, int flag, bool? isSet) { int uac = GetUAC(pvc); if(isSet == null) { throw new ArgumentException(); } // boolean false if (isSet.Value.Equals(false)) { uac &= (~flag); } else { uac |= flag; } SetUAC(pvc, uac); }
/// <include file='doc\PropertyCollection.uex' path='docs/doc[@for="PropertyCollection.this"]/*' /> /// <devdoc> /// <para>Gets the property with the given name.</para> /// </devdoc> public PropertyValueCollection this[string propertyName] { get { if (propertyName == null) throw new ArgumentNullException("propertyName"); string name = propertyName.ToLower(CultureInfo.InvariantCulture); if (valueTable.Contains(name)) return (PropertyValueCollection)valueTable[name]; else { PropertyValueCollection value = new PropertyValueCollection(_entry, propertyName); valueTable.Add(name, value); return value; } } }
protected string[] GetSchemaProperties(string schemaNamingContext, string objectType) { string[] data; using (DirectoryEntry de = new DirectoryEntry()) { de.Username = username; de.Password = password; de.Path = "LDAP://" + hostname + "CN=" + objectType + "," + schemaNamingContext; DS.PropertyCollection properties = de.Properties; DS.PropertyValueCollection values = properties["systemMayContain"]; data = new String[values.Count]; values.CopyTo(data, 0); } return(data); }
public PropertyValueCollection this[string propertyName] { get { if (propertyName == null) { throw new ArgumentNullException("propertyName"); } string key = propertyName.ToLower(CultureInfo.InvariantCulture); if (this.valueTable.Contains(key)) { return((PropertyValueCollection)this.valueTable[key]); } PropertyValueCollection values = new PropertyValueCollection(this.entry, propertyName); this.valueTable.Add(key, values); return(values); } }
public PropertyValueCollection this[string propertyName] { get { if (Contains(propertyName)) { // String tstr=new String(propertyName.ToCharArray()); // return (PropertyValueCollection)m_oValues[tstr.ToLower()]; return((PropertyValueCollection)m_oValues[propertyName.ToLower()]); } else { PropertyValueCollection _pValColl = new PropertyValueCollection(_parent); // String tstr=new String(propertyName.ToCharArray()); // Add((string)tstr.ToLower(), (PropertyValueCollection)_pValColl); Add((string)propertyName.ToLower(), (PropertyValueCollection)_pValColl); return(_pValColl); } // throw new InvalidOperationException(); } }
public static string PropertyValueCollection(PSObject instance) { if (instance == null) { return(string.Empty); } System.DirectoryServices.PropertyValueCollection baseObject = (System.DirectoryServices.PropertyValueCollection)instance.BaseObject; if (baseObject == null) { return(string.Empty); } if (baseObject.Count != 1) { return(PSObject.ToStringEnumerable(null, baseObject, null, null, null)); } if (baseObject[0] == null) { return(string.Empty); } return(PSObject.AsPSObject(baseObject[0]).ToString()); }
/// <devdoc> /// Gets the property with the given name. /// </devdoc> public PropertyValueCollection this[string propertyName] { get { if (propertyName == null) { throw new ArgumentNullException(nameof(propertyName)); } string name = propertyName.ToLowerInvariant(); if (valueTable.Contains(name)) { return((PropertyValueCollection)valueTable[name]); } else { PropertyValueCollection value = new PropertyValueCollection(_entry, propertyName); valueTable.Add(name, value); return(value); } } }
/// <summary> /// Harvest bindings. /// </summary> /// <param name="propertyName">The property name of the bindings property.</param> /// <param name="bindingsProperty">The bindings property.</param> /// <returns>The harvested bindings.</returns> private IIs.WebAddress HarvestBindings(string propertyName, PropertyValueCollection bindingsProperty) { if (1 == bindingsProperty.Count) { IIs.WebAddress webAddress = new IIs.WebAddress(); string[] bindings = ((string)bindingsProperty[0]).Split(":".ToCharArray()); if (0 < bindings[0].Length) { webAddress.IP = bindings[0]; } if (0 < bindings[1].Length) { webAddress.Port = bindings[1]; } if (0 < bindings[2].Length) { webAddress.Header = bindings[2]; } if ("SecureBindings" == propertyName) { webAddress.Secure = IIs.YesNoType.yes; } return webAddress; } return null; }
private int FindMatchingScriptMapIndex(PropertyValueCollection scriptMaps) { for (var i = 0; i < scriptMaps.Count; i++) { var scriptMap = scriptMaps[i] as string; if (scriptMap == null) continue; if (Matches(scriptMap)) { return i; } } return -1; }
public static PropertyValueCollectionWrapper FromPropertyValueCollection(PropertyValueCollection propertyValueCollection) { return propertyValueCollection; }
public static int ModifyProperty(Likewise.LMC.LDAP.DirectoryContext dirContext, string nodeDN, string propertyName, PropertyValueCollection propertyValue) { List <object> valueObjects = propertyValue.ValueCollection; string[] values; if (valueObjects == null || valueObjects.Count == 0) { values = new string[] { null } } ; else if (valueObjects.Count == 1) { values = new string[] { ParsingValueObj(valueObjects[0]), null }; //Console.WriteLine("In SDSUtils::modifyPropertyvalue is " + ParsingValueObj(valueObjects[0])); } else { values = new string[valueObjects.Count + 1]; int i; for (i = 0; i < valueObjects.Count; i++) { values[i] = ParsingValueObj(valueObjects[i]); //Console.WriteLine("In SDSUtils::modifyPropertyvalue " + i + "is " + values[i]); } values[i] = null; } LDAPMod[] attrinfo = new LDAPMod[] { new LDAPMod((int)LDAPMod.mod_ops.LDAP_MOD_REPLACE, propertyName, values) }; return(dirContext.ModifySynchronous(nodeDN, attrinfo)); }
public PropertyValueCollection this[string propertyName] { get { if (propertyName == null) { throw new ArgumentNullException("propertyName"); } string key = propertyName.ToLower(CultureInfo.InvariantCulture); if (this.valueTable.Contains(key)) { return (PropertyValueCollection) this.valueTable[key]; } PropertyValueCollection values = new PropertyValueCollection(this.entry, propertyName); this.valueTable.Add(key, values); return values; } }
// // Summary: // Appends the contents of the System.DirectoryServices.PropertyValueCollection // object to this collection. // // Parameters: // value: // A System.DirectoryServices.PropertyValueCollection object that contains the objects // to append to this collection. // // Exceptions: // T:System.ArgumentNullException: // The property value is a null reference (Nothing in Visual Basic). public void AddRange(PropertyValueCollection value) { //TODO: ALACHISOFT throw new NotImplementedException(); }
/* /// <summary> /// creates and returns a connector attribute or null. the attribute /// has the name 'name' and the values associated with 'name' in the /// directory entry /// </summary> /// <param name="name"></param> /// <param name="pvc"></param> /// <returns></returns> private static ConnectorAttribute CreateConnectorAttribute(String name, PropertyValueCollection pvc) { ConnectorAttributeBuilder attributeBuilder = new ConnectorAttributeBuilder(); if (name == null) { return null; } attributeBuilder.Name = name; if (pvc == null) { attributeBuilder.AddValue(null); } else { for (int i = 0; i < pvc.Count; i++) { Object valueObject = pvc[i]; if ((pvc[i] == null) || (FrameworkUtil.IsSupportedAttributeType(valueObject.GetType()))) { attributeBuilder.AddValue(pvc[i]); } else { Trace.TraceWarning( "Unsupported attribute type ... calling ToString (Name: \'{0}\'({1}) Type: \'{2}\' String Value: \'{3}\'", name, i, pvc[i].GetType(), pvc[i].ToString()); attributeBuilder.AddValue(pvc[i].ToString()); } } } return attributeBuilder.Build(); } private static void AddConnectorAttributeToADProperties_general( PropertyCollection properties, ConnectorAttribute attribute, UpdateType type) { // null out the values if we are deleting // or replacing attributes. if (type.Equals(UpdateType.DELETE) || type.Equals(UpdateType.REPLACE)) { properties[attribute.Name].Value = null; } // if we are updating or adding, put the // new values in. if (type.Equals(UpdateType.ADD) || type.Equals(UpdateType.REPLACE)) { foreach (Object valueObject in attribute.Value) { properties[attribute.Name].Add(valueObject); } } } */ /// <summary> /// Gets a single value from a propertyvaluecollection /// for a particular property name. Its an error if the /// property contains multiple values. /// </summary> /// <param name="pvc"></param> /// <returns></returns> internal Object GetSingleValue(PropertyValueCollection pvc) { if((pvc == null) || (pvc.Count == 0)) { return null; } if (pvc.Count > 1) { String msg = _configuration.ConnectorMessages.Format( "ex_ExpectingSingleValue", "Expecting single value, but found multiple values for attribute {0}", pvc.PropertyName); throw new ConnectorException(msg); } return pvc[0]; }
/// <include file='doc\PropertyCollection.uex' path='docs/doc[@for="PropertyCollection.CopyTo"]/*' /> /// <devdoc> /// <para>Copies the elements of this instance into an <see cref='System.Array'/>, starting at a particular index into the array.</para> /// </devdoc> public void CopyTo(PropertyValueCollection[] array, int index) { ((ICollection)this).CopyTo((Array)array, index); }
// sets the uac value in a propertyvaluecollection private static void SetUAC(PropertyValueCollection pvc, int value) { // set the value pvc[0] = value; }
// chec to see if a particular value of the uac is set internal static bool IsSet(PropertyValueCollection pvc, int flag) { int uac = GetUAC(pvc); return ((uac & flag) != 0); }
public static int ModifyProperty(Likewise.LMC.LDAP.DirectoryContext dirContext, string nodeDN, string propertyName, PropertyValueCollection propertyValue) { List<object> valueObjects = propertyValue.ValueCollection; string[] values; if (valueObjects == null || valueObjects.Count == 0) values = new string[] { null }; else if (valueObjects.Count == 1) { values = new string[] { ParsingValueObj(valueObjects[0]), null }; //Console.WriteLine("In SDSUtils::modifyPropertyvalue is " + ParsingValueObj(valueObjects[0])); } else { values = new string[valueObjects.Count + 1]; int i; for (i = 0; i < valueObjects.Count; i++) { values[i] = ParsingValueObj(valueObjects[i]); //Console.WriteLine("In SDSUtils::modifyPropertyvalue " + i + "is " + values[i]); } values[i] = null; } LDAPMod[] attrinfo = new LDAPMod[] { new LDAPMod((int)LDAPMod.mod_ops.LDAP_MOD_REPLACE, propertyName, values) }; return dirContext.ModifySynchronous(nodeDN, attrinfo); }
public void AddRange(PropertyValueCollection value) { Contract.Requires(value != null); }
private static void AddGroupMembers(IList<string> oguMemberIDs, PropertyValueCollection adGroupMembers, SynchronizeContext context) { for (int i = 0; i < oguMemberIDs.Count / SynchronizeHelper.ADQueryBatchSize; i++) { SynchronizeContext.Current.ExtendLockTime(); FillGroupMembersByOguIDs(CopyPartOfList(oguMemberIDs, i * SynchronizeHelper.ADQueryBatchSize, SynchronizeHelper.ADQueryBatchSize), adGroupMembers, context); } FillGroupMembersByOguIDs(CopyPartOfList(oguMemberIDs, (oguMemberIDs.Count / SynchronizeHelper.ADQueryBatchSize) * SynchronizeHelper.ADQueryBatchSize, oguMemberIDs.Count % SynchronizeHelper.ADQueryBatchSize), adGroupMembers, context); }
// get the uac value from the property value collection private static int GetUAC(PropertyValueCollection pvc) { // default schema says it's an integer, so it better be one if ((pvc != null) && (pvc.Count == 1) && (pvc[0] is int)) { return (int)pvc[0]; } else { return 0; } }
public void AddRange (PropertyValueCollection coll) { foreach (object value in coll) Add (value); }
private static bool IsBoundToPort(PropertyValueCollection serverBindings, PropertyValueCollection secureBindings, string port) { if (serverBindings != null) { foreach (object binding in serverBindings) { string value = Convert.ToString(binding); if (value.Contains(port)) return true; } } if (secureBindings != null) { foreach(object binding in secureBindings) { string value = Convert.ToString(binding); if (value.Contains(port)) return true; } } return false; }
internal dSPropertyValueCollection(PropertyValueCollection pc) { _pc = pc; }
private static void FillGroupMembersByOguIDs(IEnumerable<string> oguObjectIDs, PropertyValueCollection adGroupMembers, SynchronizeContext context) { IEnumerable<SearchResult> result = SynchronizeHelper.GetSearchResultsByIDs(context.ADHelper, context.IDMapper.GetMappedADObjectIDs(oguObjectIDs), new string[] { "distinguishedName" }, oguObjectIDs.Count()); foreach (SearchResult sr in result) { SynchronizeContext.Current.ExtendLockTime(); adGroupMembers.Add(sr.Properties["distinguishedName"][0]); } }
public PropertyValueCollection this[string propertyName] { get { if(Contains(propertyName)) { // String tstr=new String(propertyName.ToCharArray()); // return (PropertyValueCollection)m_oValues[tstr.ToLower()]; return (PropertyValueCollection)m_oValues[propertyName.ToLower()]; } else { PropertyValueCollection _pValColl=new PropertyValueCollection(_parent); // String tstr=new String(propertyName.ToCharArray()); // Add((string)tstr.ToLower(), (PropertyValueCollection)_pValColl); Add((string)propertyName.ToLower(), (PropertyValueCollection)_pValColl); return _pValColl; } // throw new InvalidOperationException(); } }
public void CopyTo(PropertyValueCollection[] array, int index) { }
// goes through AD object's prop's propcollection and decides if any prop's value equals to the given one public static bool PropValueCollContains(PropertyValueCollection propValueColl, string value) { bool bContains = false; for (int i = 0; i < propValueColl.Count; i++) { if (propValueColl[i].Equals(value)) { bContains = true; break; } } return bContains; }