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

IsolatedStoragePermission.cs « System.Security.Permissions « corlib « class « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 907d7de36158efd8b08b4f4d2a9ff85659be8eec (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
80
81
82
83
84
//
// System.Security.Permissions.IsolatedStoragePermission.cs
//
// Piers Haken <piersh@friskit.com>
//
// (C) 2002 Ximian, Inc.			http://www.ximian.com
//

using System;
using System.Security.Permissions;

namespace System.Security.Permissions
{
	[Serializable]
	public abstract class IsolatedStoragePermission : CodeAccessPermission, IUnrestrictedPermission
	{
		internal long m_userQuota;
		internal long m_machineQuota;
		internal long m_expirationDays;
		internal bool m_permanentData;
		internal IsolatedStorageContainment m_allowed;

		public IsolatedStoragePermission (PermissionState state)
		{
			if (state == PermissionState.None)
			{
				m_userQuota = 0;
				m_machineQuota = 0;
				m_expirationDays = 0;
				m_permanentData = false;
				m_allowed = IsolatedStorageContainment.None;
			}
			else if (state == PermissionState.Unrestricted)
			{
				m_userQuota = Int64.MaxValue;
				m_machineQuota = Int64.MaxValue;
				m_expirationDays = Int64.MaxValue ;
				m_permanentData = true;
				m_allowed = IsolatedStorageContainment.UnrestrictedIsolatedStorage;
			}
			else
			{
				throw new ArgumentException("Invalid Permission state");
			}
		}

		public long UserQuota
		{
			set { m_userQuota = value; }
			get { return m_userQuota; }
		}


		public IsolatedStorageContainment UsageAllowed
		{
			set { m_allowed = value; }
			get { return m_allowed; }
		}


		public bool IsUnrestricted ()
		{
			return IsolatedStorageContainment.UnrestrictedIsolatedStorage == m_allowed;
		}

		[MonoTODO]
		public override SecurityElement ToXml ()
		{
			throw new NotImplementedException ();
		}


		[MonoTODO]
		public override void FromXml (SecurityElement esd)
		{
			throw new NotImplementedException ();
		}
	}
}