Exemplo n.º 1
0
        /// <summary>
        /// Adds a parent to the fParents array.
        /// </summary>
        /// <returns>The PermissionGroup that the parent was added to. This is for chaining.</returns>
        internal PermissionGroup AddParent(PermissionGroup Parent)
        {
            PermissionGroup[] NewArray = new PermissionGroup[this.fParents.Length + 1]; // Create a new array one bigger than the current.

            for (int i = 0; i < this.fParents.Length; i++)                              // For every existing parent...
            {
                if (this.fParents[i] == Parent)                                         // If the new parent matches it...
                {
                    return(this);                                                       // Abort!
                }
                NewArray[i] = this.fParents[i];                                         // If not then add it to NewArray.
            }
            NewArray[this.fParents.Length] = Parent;                                    // Add the new parent to the end of the NewArray (in the extra cell that was not in the old array).

            this.fParents = NewArray;                                                   // Replace the old fParents array with NewArray.
            return(this);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Adds a child to the fChildren array.
        /// </summary>
        /// <returns>The PermissionGroup that the child was added to. This is for chaining.</returns>
        internal PermissionGroup AddChild(PermissionGroup Child)
        {
            PermissionGroup[] NewArray = new PermissionGroup[this.fChildren.Length + 1]; // Create a new array one bigger than the current.

            for (int i = 0; i < this.fChildren.Length; i++)                              // For every existing child...
            {
                if (this.fChildren[i] == Child)                                          // If the new child matches it...
                {
                    return(this);                                                        // Abort!
                }
                NewArray[i] = this.fChildren[i];                                         // If not then add it to NewArray.
            }
            NewArray[this.fChildren.Length] = Child;                                     // Add the new child to the end of the NewArray (in the extra cell that was not in the old array).

            this.fChildren = NewArray;                                                   // Replace the old fChildren array with NewArray.
            return(this);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Adds a parent to the fParents array.
        /// </summary>
        /// <returns>The PermissionGroup that the parent was added to. This is for chaining.</returns>
        internal PermissionGroup AddParent(PermissionGroup Parent)
        {
            PermissionGroup[] NewArray = new PermissionGroup[this.fParents.Length + 1];    // Create a new array one bigger than the current.

            for (int i = 0; i < this.fParents.Length; i++)  // For every existing parent...
            {
                if (this.fParents[i] == Parent)           // If the new parent matches it...
                    return this;                                // Abort!

                NewArray[i] = this.fParents[i];            // If not then add it to NewArray.
            }
            NewArray[this.fParents.Length] = Parent;      // Add the new parent to the end of the NewArray (in the extra cell that was not in the old array).

            this.fParents = NewArray;      // Replace the old fParents array with NewArray.
            return this;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Adds a child to the fChildren array.
        /// </summary>
        /// <returns>The PermissionGroup that the child was added to. This is for chaining.</returns>
        internal PermissionGroup AddChild(PermissionGroup Child)
        {
            PermissionGroup[] NewArray = new PermissionGroup[this.fChildren.Length + 1];    // Create a new array one bigger than the current.

            for(int i = 0; i < this.fChildren.Length; i++)  // For every existing child...
            {
                if (this.fChildren[i] == Child)           // If the new child matches it...
                    return this;                                // Abort!

                NewArray[i] = this.fChildren[i];            // If not then add it to NewArray.
            }
            NewArray[this.fChildren.Length] = Child;      // Add the new child to the end of the NewArray (in the extra cell that was not in the old array).

            this.fChildren = NewArray;      // Replace the old fChildren array with NewArray.
            return this;
        }