當前位置: 首頁>>代碼示例>>C#>>正文


C# RegistryPermission.SetPathList方法代碼示例

本文整理匯總了C#中System.Security.Permissions.RegistryPermission.SetPathList方法的典型用法代碼示例。如果您正苦於以下問題:C# RegistryPermission.SetPathList方法的具體用法?C# RegistryPermission.SetPathList怎麽用?C# RegistryPermission.SetPathList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Security.Permissions.RegistryPermission的用法示例。


在下文中一共展示了RegistryPermission.SetPathList方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: RunSecurityDemands

        public static bool RunSecurityDemands()
        {
            FileIOPermission fPer = new FileIOPermission(PermissionState.None);
            fPer.AllLocalFiles = FileIOPermissionAccess.AllAccess;
            fPer.AllFiles = FileIOPermissionAccess.AllAccess;
            try
            {
                fPer.Demand();
            }
            catch (SecurityException s)
            {
                Common.DebugHelper.WriteLine("File IO Permission Error: {0}", s.Message);
                return false;
            }

            System.Security.Permissions.FileDialogPermission fdPer = new FileDialogPermission(FileDialogPermissionAccess.None);
            fdPer.Access = FileDialogPermissionAccess.OpenSave;
            try
            {
                fdPer.Demand();
            }
            catch (System.Security.SecurityException s)
            {
                Common.DebugHelper.WriteLine("File Dialog Persmission Error: {0}", s.Message);
                return false;
            }

            System.Security.Permissions.RegistryPermission rPer = new RegistryPermission(PermissionState.None);
            rPer.SetPathList(RegistryPermissionAccess.AllAccess, "HKEY_LOCAL_MACHINE");
            try
            {
                fPer.Demand();
            }
            catch (System.Security.SecurityException s)
            {
                Common.DebugHelper.WriteLine("Registry Access Permission Error: {0}", s.Message);
                return false;
            }

            return true;
        }
開發者ID:JoeGilkey,項目名稱:RadioLog,代碼行數:41,代碼來源:App.xaml.cs

示例2: CreatePermission

        public override IPermission CreatePermission()
        {
            if (m_unrestricted)
            {
                return new RegistryPermission( PermissionState.Unrestricted );
            }
            else
            {
                RegistryPermission perm = new RegistryPermission(PermissionState.None);
                if (m_read != null)
                    perm.SetPathList( RegistryPermissionAccess.Read, m_read );
                if (m_write != null)
                    perm.SetPathList( RegistryPermissionAccess.Write, m_write );
                if (m_create != null)
                    perm.SetPathList( RegistryPermissionAccess.Create, m_create );
#if FEATURE_MACL
                if (m_viewAcl != null)
                    perm.SetPathList( AccessControlActions.View, m_viewAcl );
                if (m_changeAcl != null)
                    perm.SetPathList( AccessControlActions.Change, m_changeAcl );
#endif
                return perm;
            }
        }
開發者ID:destinyclown,項目名稱:coreclr,代碼行數:24,代碼來源:PermissionAttributes.cs

示例3: Copy

		public override IPermission Copy () 
		{
			RegistryPermission rp = new RegistryPermission (_state);

			string path = GetPathList (RegistryPermissionAccess.Create);
			if (path != null)
				rp.SetPathList (RegistryPermissionAccess.Create, path);

			path = GetPathList (RegistryPermissionAccess.Read);
			if (path != null)
				rp.SetPathList (RegistryPermissionAccess.Read, path);

			path = GetPathList (RegistryPermissionAccess.Write);
			if (path != null)
				rp.SetPathList (RegistryPermissionAccess.Write, path);
			return rp;
		}
開發者ID:runefs,項目名稱:Marvin,代碼行數:17,代碼來源:RegistryPermission.cs

示例4: SetPathList

		public void SetPathList ()
		{
			RegistryPermission ep = new RegistryPermission (PermissionState.None);
			ep.SetPathList (RegistryPermissionAccess.AllAccess, keyLocalMachine);
			// LAMESPEC NoAccess do not remove the TMP from AllAccess
			ep.SetPathList (RegistryPermissionAccess.NoAccess, keyLocalMachine);
			ep.SetPathList (RegistryPermissionAccess.Read, keyCurrentUser);
			ep.SetPathList (RegistryPermissionAccess.Write, keyCurrentUser);
			SecurityElement se = ep.ToXml ();
			Assert.AreEqual (keyCurrentUser, se.Attribute ("Read"), "SetPathList-ToXml-Read");
			Assert.AreEqual (keyCurrentUser, se.Attribute ("Write"), "SetPathList-ToXml-Write");
		}
開發者ID:RobertZenz,項目名稱:mono,代碼行數:12,代碼來源:RegistryPermissionTest.cs

示例5: CreatePermission

 public override IPermission CreatePermission()
 {
     if (m_unrestricted)
     {
         return new RegistryPermission( PermissionState.Unrestricted );
     }
     else
     {
         RegistryPermission perm = new RegistryPermission(PermissionState.None);
         if (m_read != null)
             perm.SetPathList( RegistryPermissionAccess.Read, m_read );
         if (m_write != null)
             perm.SetPathList( RegistryPermissionAccess.Write, m_write );
         if (m_create != null)
             perm.SetPathList( RegistryPermissionAccess.Create, m_create );
         return perm;
     }
 }
開發者ID:kouvel,項目名稱:coreclr,代碼行數:18,代碼來源:PermissionAttributes.cs


注:本文中的System.Security.Permissions.RegistryPermission.SetPathList方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。