コード例 #1
0
 public static void UnionCodeGroupCallMethods()
 {
     Policy.UnionCodeGroup  ucg = new Policy.UnionCodeGroup(new Policy.GacMembershipCondition(), new Policy.PolicyStatement(new PermissionSet(new PermissionState())));
     Policy.CodeGroup       cg  = ucg.Copy();
     Policy.PolicyStatement ps  = ucg.Resolve(new Policy.Evidence());
     cg = ucg.ResolveMatchingCodeGroups(new Policy.Evidence());
 }
コード例 #2
0
        public static void FileCodeGroupCallMethods()
        {
            Policy.FileCodeGroup fcg = new Policy.FileCodeGroup(new Policy.GacMembershipCondition(), new FileIOPermissionAccess());
            Policy.CodeGroup     cg  = fcg.Copy();
            bool equals = fcg.Equals(new object());
            int  hash   = fcg.GetHashCode();

            Policy.PolicyStatement ps = fcg.Resolve(new Policy.Evidence());
            cg = fcg.ResolveMatchingCodeGroups(new Policy.Evidence());
        }
コード例 #3
0
        public static void NetCodeGroupCallMethods()
        {
            Policy.NetCodeGroup ncg = new Policy.NetCodeGroup(new Policy.GacMembershipCondition());
            string teststring       = Policy.NetCodeGroup.AbsentOriginScheme;

            teststring = Policy.NetCodeGroup.AnyOtherOriginScheme;
            ncg.AddConnectAccess("test", new Policy.CodeConnectAccess("test", 0));
            Policy.CodeGroup cg     = ncg.Copy();
            bool             equals = ncg.Equals(new object());

            System.Collections.DictionaryEntry[] de = ncg.GetConnectAccessRules();
            int hash = ncg.GetHashCode();

            ncg.ResetConnectAccess();
            Policy.PolicyStatement ps = ncg.Resolve(new Policy.Evidence());
            cg = ncg.ResolveMatchingCodeGroups(new Policy.Evidence());
        }
コード例 #4
0
        public static void PolicyLevelCallMethods()
        {
            Policy.PolicyLevel pl  = (Policy.PolicyLevel)Activator.CreateInstance(typeof(Policy.PolicyLevel), true);
            NamedPermissionSet nps = new NamedPermissionSet("test");

            pl.AddNamedPermissionSet(nps);
            nps = pl.ChangeNamedPermissionSet("test", new PermissionSet(new Permissions.PermissionState()));
            Policy.PolicyLevel.CreateAppDomainLevel();
            nps = pl.GetNamedPermissionSet("test");
            pl.Recover();
            NamedPermissionSet nps2 = pl.RemoveNamedPermissionSet(nps);

            nps2 = pl.RemoveNamedPermissionSet("test");
            pl.Reset();
            Policy.Evidence        evidence = new Policy.Evidence();
            Policy.PolicyStatement ps       = pl.Resolve(evidence);
            Policy.CodeGroup       cg       = pl.ResolveMatchingCodeGroups(evidence);
            SecurityElement        se       = new SecurityElement("");

            pl.FromXml(se);
            se = pl.ToXml();
        }