Пример #1
0
 protected void AddAce(Ace ace)
 {
     if (_aces == null)
     {
         _aces = new Aces();
     }
     _aces.Add(ace);
     Dirty();
 }
Пример #2
0
        internal protected Acl(IntPtr pacl)
        {
            // If NULL for the pacl, create an empty DACL
            if (pacl == IntPtr.Zero)
            {
                _revision = AclRevision.ACL_REVISION;
                return;
            }
            MemoryMarshaler m   = new MemoryMarshaler(pacl);
            ACL             acl = (ACL)m.ParseStruct(typeof(ACL));

            _revision = acl.AclRevision;
            for (int i = 0; i < acl.AceCount; i++)
            {
                Ace ace = Ace.Create(m);
                _aces.Add(ace);
            }
        }
Пример #3
0
        /// <summary>
        ///  This algorithm was copied from ATL source code: CAdcl::PrepareAcesForACL.
        ///
        ///  We can't use QuickSort (or any other n log (n)) generic sort algorithm
        ///  because we want partial ordering to be preserved. All we want to do is sort
        ///  the elements according to their "Order" (see OrderAceAccess.Compare method),
        ///  but we want the elements which compare to "Equal" to remain in their
        ///  original order in the array.
        /// </summary>
        protected override void PrepareAcesForACL()
        {
            IComparer comparer = new OrderAceAccess();

            int nCount = this.AceCount;

            // Find first "h" such that
            // 1. h * 3 + 1 < nCount
            // 2. (h - 1) is exactly divisible by 3
            int h = 1;

            while (h * 3 + 1 < nCount)
            {
                h = 3 * h + 1;
            }

            while (h > 0)
            {
                for (int i = h - 1; i < nCount; i++)
                {
                    Ace pivot = this.GetAce(i);

                    int j;
                    for (j = i;
                         (j >= h) && (comparer.Compare(this.GetAce(j - h), pivot) > 0);
                         j -= h)
                    {
                        this.SetAce(j, this.GetAce(j - h));
                    }

                    this.SetAce(j, pivot);
                }

                h /= 3;
            }
        }
Пример #4
0
 protected void SetAce(int i, Ace ace)
 {
     _aces.SetAce(i, ace);
 }
Пример #5
0
 protected void SetAce(int i, Ace ace)
 {
     _aces.SetAce(i, ace);
 }
Пример #6
0
 protected void AddAce(Ace ace)
 {
     if (_aces == null)
         _aces = new Aces();
     _aces.Add(ace);
     Dirty();
 }
Пример #7
0
 public void Add(Ace ace)
 {
     base.InnerList.Add(ace);
 }
Пример #8
0
 public void SetAce(int i, Ace ace)
 {
     base.InnerList[i] = ace;
 }
Пример #9
0
 public void SetAce(int i, Ace ace)
 {
     base.InnerList[i] = ace;
 }
Пример #10
0
 public void Add(Ace ace)
 {
     base.InnerList.Add(ace);
 }