当前位置: 首页>>代码示例>>C#>>正文


C# TokenBasedSet.OnDeserializedInternal方法代码示例

本文整理汇总了C#中System.Security.Util.TokenBasedSet.OnDeserializedInternal方法的典型用法代码示例。如果您正苦于以下问题:C# TokenBasedSet.OnDeserializedInternal方法的具体用法?C# TokenBasedSet.OnDeserializedInternal怎么用?C# TokenBasedSet.OnDeserializedInternal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Security.Util.TokenBasedSet的用法示例。


在下文中一共展示了TokenBasedSet.OnDeserializedInternal方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SpecialUnion

 internal TokenBasedSet SpecialUnion(TokenBasedSet other)
 {
     int maxUsedIndex;
     this.OnDeserializedInternal();
     TokenBasedSet set = new TokenBasedSet();
     if (other != null)
     {
         other.OnDeserializedInternal();
         maxUsedIndex = (this.GetMaxUsedIndex() > other.GetMaxUsedIndex()) ? this.GetMaxUsedIndex() : other.GetMaxUsedIndex();
     }
     else
     {
         maxUsedIndex = this.GetMaxUsedIndex();
     }
     for (int i = 0; i <= maxUsedIndex; i++)
     {
         object item = this.GetItem(i);
         IPermission perm = item as IPermission;
         ISecurityElementFactory factory = item as ISecurityElementFactory;
         object obj3 = (other != null) ? other.GetItem(i) : null;
         IPermission permission2 = obj3 as IPermission;
         ISecurityElementFactory factory2 = obj3 as ISecurityElementFactory;
         if ((item != null) || (obj3 != null))
         {
             if (item == null)
             {
                 if (factory2 != null)
                 {
                     permission2 = PermissionSet.CreatePerm(factory2, false);
                 }
                 PermissionToken token = PermissionToken.GetToken(permission2);
                 if (token == null)
                 {
                     throw new SerializationException(Environment.GetResourceString("Serialization_InsufficientState"));
                 }
                 set.SetItem(token.m_index, permission2);
             }
             else if (obj3 == null)
             {
                 if (factory != null)
                 {
                     perm = PermissionSet.CreatePerm(factory, false);
                 }
                 PermissionToken token2 = PermissionToken.GetToken(perm);
                 if (token2 == null)
                 {
                     throw new SerializationException(Environment.GetResourceString("Serialization_InsufficientState"));
                 }
                 set.SetItem(token2.m_index, perm);
             }
         }
     }
     return set;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:54,代码来源:TokenBasedSet.cs

示例2: SpecialUnion

        // Used to merge two distinct TokenBasedSets (used currently only in PermissionSet Deserialization)
        internal TokenBasedSet SpecialUnion(TokenBasedSet other)
        {
            // This gets called from PermissionSet.OnDeserialized and it's possible that the TokenBasedSets have 
            // not been subjected to VTS callbacks yet
            OnDeserializedInternal();
            TokenBasedSet unionSet = new TokenBasedSet();
            int maxMax;
            if (other != null)
            {
                other.OnDeserializedInternal();
                maxMax = this.GetMaxUsedIndex() > other.GetMaxUsedIndex() ? this.GetMaxUsedIndex() : other.GetMaxUsedIndex();
            }
            else
                maxMax = this.GetMaxUsedIndex();
        
            for (int i = 0; i <= maxMax; ++i)
            {
                Object thisObj = this.GetItem( i );
                IPermission thisPerm = thisObj as IPermission;
#if FEATURE_CAS_POLICY
                ISecurityElementFactory thisElem = thisObj as ISecurityElementFactory;
#endif // FEATURE_CAS_POLICY

                Object otherObj = (other != null)?other.GetItem( i ):null;
                IPermission otherPerm = otherObj as IPermission;
#if FEATURE_CAS_POLICY
                ISecurityElementFactory otherElem = otherObj as ISecurityElementFactory;
#endif // FEATURE_CAS_POLICY

                if (thisObj == null && otherObj == null)
                    continue;
        
             
                if (thisObj == null)
                {
#if FEATURE_CAS_POLICY
                    if (otherElem != null)
                    {
                        otherPerm = PermissionSet.CreatePerm(otherElem, false);
                    }
#endif // FEATURE_CAS_POLICY

                    PermissionToken token = PermissionToken.GetToken(otherPerm);
                    
                    if (token == null)
                    {
                        throw new SerializationException(Environment.GetResourceString("Serialization_InsufficientState"));
                    }
                    
                    unionSet.SetItem(token.m_index, otherPerm);
                }
                else if (otherObj == null)
                {
#if FEATURE_CAS_POLICY
                    if (thisElem != null)
                    {
                        thisPerm = PermissionSet.CreatePerm(thisElem, false);
                    }
#endif // FEATURE_CAS_POLICY

                    PermissionToken token = PermissionToken.GetToken(thisPerm);
                    if (token == null)
                    {
                        throw new SerializationException(Environment.GetResourceString("Serialization_InsufficientState"));
                    }
                    unionSet.SetItem( token.m_index, thisPerm);
                }
                else
                {
                    Contract.Assert( (thisObj == null || otherObj == null), "Permission cannot be in both TokenBasedSets" );
                }
            }
            return unionSet;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:75,代码来源:TokenBasedSet.cs

示例3: SpecialUnion

        // Used to merge two distinct TokenBasedSets (used currently only in PermissionSet Deserialization)
        internal TokenBasedSet SpecialUnion(TokenBasedSet other, ref bool canUnrestrictedOverride)
        {
            // This gets called from PermissionSet.OnDeserialized and it's possible that the TokenBasedSets have 
            // not been subjected to VTS callbacks yet
            OnDeserializedInternal();
            TokenBasedSet unionSet = new TokenBasedSet();
            int maxMax;
            if (other != null)
            {
                other.OnDeserializedInternal();
                maxMax = this.GetMaxUsedIndex() > other.GetMaxUsedIndex() ? this.GetMaxUsedIndex() : other.GetMaxUsedIndex();
            }
            else
                maxMax = this.GetMaxUsedIndex();
        
            for (int i = 0; i <= maxMax; ++i)
            {
                Object thisObj = this.GetItem( i );
                IPermission thisPerm = thisObj as IPermission;
                ISecurityElementFactory thisElem = thisObj as ISecurityElementFactory;
                
                Object otherObj = (other != null)?other.GetItem( i ):null;
                IPermission otherPerm = otherObj as IPermission;
                ISecurityElementFactory otherElem = otherObj as ISecurityElementFactory;
        
                if (thisObj == null && otherObj == null)
                    continue;
        
             
                if (thisObj == null)
                {
                    if (otherElem != null)
                    {
                        otherPerm = PermissionSet.CreatePerm(otherElem, false);
                    }
                    
                    
                    

                    PermissionToken token = PermissionToken.GetToken(otherPerm);
                    
                    if (token == null)
                    {
                        throw new SerializationException(Environment.GetResourceString("Serialization_InsufficientState"));
                    }
                    
                    unionSet.SetItem(token.m_index, otherPerm);
                    if (!CodeAccessPermission.CanUnrestrictedOverride(otherPerm))
                        canUnrestrictedOverride = false;
                }
                else if (otherObj == null)
                {
                    if (thisElem != null)
                    {
                        thisPerm = PermissionSet.CreatePerm(thisElem, false);
                    }
                    PermissionToken token = PermissionToken.GetToken(thisPerm);
                    if (token == null)
                    {
                        throw new SerializationException(Environment.GetResourceString("Serialization_InsufficientState"));
                    }
                    unionSet.SetItem( token.m_index, thisPerm);
                    if (!CodeAccessPermission.CanUnrestrictedOverride(thisPerm))
                        canUnrestrictedOverride = false;

                }
                else
                {
                    BCLDebug.Assert( (thisObj == null || otherObj == null), "Permission cannot be in both TokenBasedSets" );
                }
            }
            return unionSet;
        }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:74,代码来源:tokenbasedset.cs


注:本文中的System.Security.Util.TokenBasedSet.OnDeserializedInternal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。