private void AppendStackHelper(TokenBasedSet thisSet, TokenBasedSet permSet, bool unrestrictedThisSet, bool unrestrictedPermSet, bool unrestricted) { int maxThis = thisSet.GetMaxUsedIndex(); int maxPerm = permSet.GetMaxUsedIndex(); int maxIndex = maxThis > maxPerm ? maxThis : maxPerm; for (int i = 0; i <= maxIndex; i++) { PermissionList plist = (PermissionList)thisSet.GetItem(i); PermissionList appendList = (PermissionList)permSet.GetItem(i); if (plist != null) { if (appendList != null) { // This call will not add the permission if the list is // empty, or if the last element is a normal check with // a null Permission. Let the method take care of it... plist.AppendStack(appendList.Copy()); } else { // Nothing on the compressed stack for this index, // so terminate current list. if (!unrestrictedPermSet) { plist.AppendPermissionAndCompress(null, PermissionList.MatchChecked); } } } else if (unrestrictedThisSet && appendList != null) { thisSet.SetItem(i, appendList.Copy()); } } }
public PermissionListSet(PermissionListSet permListSet) { if (permListSet == null) { Reset(); return; } m_unrestrictedPermSet = new TokenBasedSet(permListSet.m_unrestrictedPermSet); // Now deep copy all permission lists in set. // Note that this DOES deep copy permissions in the list. for (int i = 0; i <= m_unrestrictedPermSet.GetMaxUsedIndex(); i++) { PermissionList plist = (PermissionList)m_unrestrictedPermSet.GetItem(i); if (plist != null) { m_unrestrictedPermSet.SetItem(i, plist.Copy()); } } m_normalPermSet = new TokenBasedSet(permListSet.m_normalPermSet); // Now deep copy all permission lists in set. // Note that this DOES deep copy permissions in the list. for (int i = 0; i <= m_normalPermSet.GetMaxUsedIndex(); i++) { PermissionList plist = (PermissionList)m_normalPermSet.GetItem(i); if (plist != null) { m_normalPermSet.SetItem(i, plist.Copy()); } } m_unrestricted = permListSet.m_unrestricted; m_state = permListSet.m_state; }