2d91a1dd10dddf8c37b60e2434b27eddb6d8930a
[mono.git] / mcs / class / corlib / System.Security.Permissions / PermissionSetAttribute.cs
1 //
2 // System.Security.Permissions.PermissionSetAttribute.cs
3 //
4 // Duncan Mak <duncan@ximian.com>
5 //
6 // (C) 2002 Ximian, Inc. http://www.ximian.com
7 //
8
9 using System;
10
11 namespace System.Security.Permissions {
12
13         [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class |
14                          AttributeTargets.Struct | AttributeTargets.Constructor |
15                          AttributeTargets.Method, AllowMultiple=true, Inherited=false)]
16         [Serializable]
17         public sealed class PermissionSetAttribute : CodeAccessSecurityAttribute {
18
19                 // Fields
20                 private string file;
21                 private string name;
22                 private bool isUnicodeEncoded;
23                 private string xml;
24                 
25                 // Constructor
26                 public PermissionSetAttribute (SecurityAction action)
27                         : base (action)
28                 {
29                 }
30                 
31                 // Properties
32                 public string File
33                 {
34                         get { return file; }
35                         set { file = value; }
36                 }
37
38                 public string Name
39                 {
40                         get { return name; }
41                         set { name = value; }
42                 }
43
44                 public bool UnicodeEncoded
45                 {
46                         get { return isUnicodeEncoded; }
47                         set { isUnicodeEncoded = value; }
48                 }
49
50                 public string XML
51                 {
52                         get { return xml; }
53                         set { xml = value; }
54                 }
55                 
56                 // Methods
57                 public override IPermission CreatePermission ()
58                 {
59                         return null;      // Not used, used for inheritance from SecurityAttribute
60                 }
61
62                 [MonoTODO]
63                 public PermissionSet CreatePermissionSet ()
64                 {
65                         PermissionSet pset = null;
66                         if (this.Unrestricted)
67                                 pset = new PermissionSet (PermissionState.Unrestricted);
68                         else {
69                                 pset = new PermissionSet (PermissionState.None);
70                                 if (name != null) {
71                                 }
72                                 else if (file != null) {
73                                 }
74                                 else if (xml != null) {
75                                 }
76                         }
77                         return pset;
78                 }
79         }
80 }