コード例 #1
0
        internal static void ToExtendedFeatureScope(string extendedAttribute, string[] directoryAttributes, ADEntity userObj, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo)
        {
            ADPropertyValueCollection aDPropertyValueCollection = new ADPropertyValueCollection();
            int value = (int)directoryObj[directoryAttributes[0]].Value;

            foreach (ADOptionalFeatureScope aDOptionalFeatureScope in Enum.GetValues(typeof(ADOptionalFeatureScope)))
            {
                if ((aDOptionalFeatureScope & (ADOptionalFeatureScope)value) <= ADOptionalFeatureScope.Unknown)
                {
                    continue;
                }
                aDPropertyValueCollection.Add(aDOptionalFeatureScope);
            }
            userObj.Add(extendedAttribute, aDPropertyValueCollection);
        }
コード例 #2
0
        public ADPropertyValueCollection ConvertToADPropertyValueCollection(string parameterName)
        {
            ADPropertyValueCollection aDPropertyValueCollection = new ADPropertyValueCollection();

            aDPropertyValueCollection.TrackChanges = true;
            T[] tArray = this._array;
            for (int i = 0; i < (int)tArray.Length; i++)
            {
                T t = tArray[i];
                if (t != null)
                {
                    aDPropertyValueCollection.Add(t);
                }
                else
                {
                    aDPropertyValueCollection.Value = null;
                }
            }
            return(aDPropertyValueCollection);
        }
コード例 #3
0
        private static ADPropertyValueCollection ConvertLinkedGroupPolicyObjects(string rawGPLink)
        {
            ADPropertyValueCollection aDPropertyValueCollection = new ADPropertyValueCollection();

            if (rawGPLink != null && rawGPLink.Length > 0)
            {
                string[] strArrays = rawGPLink.Split(GPLinkUtil.GpLinkSplitChars, StringSplitOptions.RemoveEmptyEntries);
                if (strArrays != null && (int)strArrays.Length > 0)
                {
                    string[] strArrays1 = strArrays;
                    for (int i = 0; i < (int)strArrays1.Length; i++)
                    {
                        string str   = strArrays1[i];
                        Match  match = GPLinkUtil.GpLinkRegEx.Match(str);
                        if (match.Success)
                        {
                            aDPropertyValueCollection.Add(match.Groups[GPLinkUtil.GpLinkRegExDNGroup].Value);
                        }
                    }
                }
            }
            return(aDPropertyValueCollection);
        }
コード例 #4
0
        private void processMultivalueElement(PropertyModifyOp operation, ADPropertyValueCollection collection, object value, string parameterName)
        {
            object baseObject;

            if (value as object[] == null)
            {
                if (value.GetType() == typeof(PSObject))
                {
                    value = ((PSObject)value).BaseObject;
                }
                if (operation != PropertyModifyOp.Add)
                {
                    if (operation != PropertyModifyOp.Remove)
                    {
                        if (operation != PropertyModifyOp.Replace)
                        {
                            throw new ArgumentException();
                        }
                        else
                        {
                            collection.Add(value);
                            return;
                        }
                    }
                    else
                    {
                        collection.ForceRemove(value);
                        return;
                    }
                }
                else
                {
                    collection.Add(value);
                    return;
                }
            }
            else
            {
                object[] objArray = (object[])value;
                for (int i = 0; i < (int)objArray.Length; i++)
                {
                    object obj = objArray[i];
                    if (obj.GetType() != typeof(PSObject))
                    {
                        baseObject = obj;
                    }
                    else
                    {
                        baseObject = ((PSObject)obj).BaseObject;
                    }
                    if (operation != PropertyModifyOp.Add)
                    {
                        if (operation != PropertyModifyOp.Remove)
                        {
                            if (operation != PropertyModifyOp.Replace)
                            {
                                throw new ArgumentException();
                            }
                            else
                            {
                                collection.Add(baseObject);
                            }
                        }
                        else
                        {
                            collection.ForceRemove(baseObject);
                        }
                    }
                    else
                    {
                        collection.Add(baseObject);
                    }
                }
                return;
            }
        }