Welcome to mirror list, hosted at ThFree Co, Russian Federation.

SecurityException.cs « System.Security « corlib « class « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: aaa0086bbe2ee924abcdffc517aef9e6afe9b509 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
//
// System.Security.SecurityException.cs
//
// Author:
//   Nick Drochak(ndrochak@gol.com)
//
// (C) Nick Drochak
//

using System.Runtime.Serialization;
using System.Globalization;

namespace System.Security {
	[Serializable]
	public class SecurityException : SystemException {

		// Fields
		string permissionState;
		Type permissionType;

		// Properties
		public string PermissionState
		{
			get { return permissionState; }
		}

		public Type PermissionType
		{
			get { return permissionType; }
		}

		// Constructors
		public SecurityException ()
			: base (Locale.GetText ("A security error has been detected."))
		{
		}

		public SecurityException (string message) 
			: base (message)
		{
		}
		
		protected SecurityException (SerializationInfo info, StreamingContext context) 
			: base (info, context)
		{
			permissionState = info.GetString ("permissionState");
		}
		
		public SecurityException (string message, Exception inner) 
			: base (message, inner)
		{
		}
		
		public SecurityException (string message, Type type) 
			:  base (message) 
		{
			permissionType = type;
		}
		
		public SecurityException (string message, Type type, string state) 
			: base (message) 
		{
			permissionType = type;
			permissionState = state;
		}

		// Methods
		public override void GetObjectData (SerializationInfo info, StreamingContext context)
		{
			base.GetObjectData (info, context);
			info.AddValue ("PermissionState", permissionState);
		}

		public override string ToString ()
		{
			return permissionType.FullName + ": " + permissionState;
		}
	}
}