Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
IsolatedStorage.cs
Go to the documentation of this file.
2
4
5public abstract class IsolatedStorage : MarshalByRefObject
6{
7 private ulong _quota;
8
9 private bool _validQuota;
10
11 private object _applicationIdentity;
12
13 private object _assemblyIdentity;
14
15 private object _domainIdentity;
16
17 public object ApplicationIdentity
18 {
19 get
20 {
22 {
24 }
26 }
27 }
28
29 public object AssemblyIdentity
30 {
31 get
32 {
34 {
35 return _assemblyIdentity;
36 }
38 }
39 }
40
41 public object DomainIdentity
42 {
43 get
44 {
46 {
47 return _domainIdentity;
48 }
50 }
51 }
52
53 [CLSCompliant(false)]
54 [Obsolete("IsolatedStorage.CurrentSize has been deprecated because it is not CLS Compliant. To get the current size use IsolatedStorage.UsedSize instead.")]
55 public virtual ulong CurrentSize
56 {
57 get
58 {
60 }
61 }
62
63 public virtual long UsedSize
64 {
65 get
66 {
68 }
69 }
70
71 public virtual long AvailableFreeSpace
72 {
73 get
74 {
76 }
77 }
78
79 [CLSCompliant(false)]
80 [Obsolete("IsolatedStorage.MaximumSize has been deprecated because it is not CLS Compliant. To get the maximum size use IsolatedStorage.Quota instead.")]
81 public virtual ulong MaximumSize
82 {
83 get
84 {
85 if (_validQuota)
86 {
87 return _quota;
88 }
90 }
91 }
92
93 public virtual long Quota
94 {
95 get
96 {
97 if (_validQuota)
98 {
99 return (long)_quota;
100 }
102 }
103 }
104
105 public IsolatedStorageScope Scope { get; private set; }
106
108
109 protected virtual char SeparatorInternal => '.';
110
111 internal string? IdentityHash { get; private set; }
112
113 public virtual bool IncreaseQuotaTo(long newQuotaSize)
114 {
115 return false;
116 }
117
118 public abstract void Remove();
119
120 protected void InitStore(IsolatedStorageScope scope, Type appEvidenceType)
121 {
122 InitStore(scope, null, appEvidenceType);
123 }
124
125 protected void InitStore(IsolatedStorageScope scope, Type? domainEvidenceType, Type? assemblyEvidenceType)
126 {
127 VerifyScope(scope);
128 Scope = scope;
129 Helper.GetDefaultIdentityAndHash(out var identity, out var hash, SeparatorInternal);
130 if (Helper.IsApplication(scope))
131 {
132 _applicationIdentity = identity;
133 }
134 else
135 {
136 if (Helper.IsDomain(scope))
137 {
138 _domainIdentity = identity;
139 IFormatProvider formatProvider = null;
140 IFormatProvider provider = formatProvider;
141 Span<char> initialBuffer = stackalloc char[128];
142 DefaultInterpolatedStringHandler handler = new DefaultInterpolatedStringHandler(0, 3, formatProvider, initialBuffer);
143 handler.AppendFormatted(hash);
145 handler.AppendFormatted(hash);
146 hash = string.Create(provider, initialBuffer, ref handler);
147 }
148 _assemblyIdentity = identity;
149 }
150 IdentityHash = hash;
151 }
152
153 private static void VerifyScope(IsolatedStorageScope scope)
154 {
155 switch (scope)
156 {
157 case IsolatedStorageScope.User | IsolatedStorageScope.Assembly:
158 case IsolatedStorageScope.User | IsolatedStorageScope.Domain | IsolatedStorageScope.Assembly:
159 case IsolatedStorageScope.User | IsolatedStorageScope.Assembly | IsolatedStorageScope.Roaming:
160 case IsolatedStorageScope.User | IsolatedStorageScope.Domain | IsolatedStorageScope.Assembly | IsolatedStorageScope.Roaming:
161 case IsolatedStorageScope.Assembly | IsolatedStorageScope.Machine:
162 case IsolatedStorageScope.Domain | IsolatedStorageScope.Assembly | IsolatedStorageScope.Machine:
163 case IsolatedStorageScope.User | IsolatedStorageScope.Application:
164 case IsolatedStorageScope.User | IsolatedStorageScope.Roaming | IsolatedStorageScope.Application:
165 case IsolatedStorageScope.Machine | IsolatedStorageScope.Application:
166 return;
167 }
169 }
170}
static bool IsAssembly(IsolatedStorageScope scope)
Definition Helper.cs:48
static bool IsDomain(IsolatedStorageScope scope)
Definition Helper.cs:63
static bool IsApplication(IsolatedStorageScope scope)
Definition Helper.cs:53
static void GetDefaultIdentityAndHash(out object identity, out string hash, char separator)
Definition Helper.cs:76
static void VerifyScope(IsolatedStorageScope scope)
void InitStore(IsolatedStorageScope scope, Type appEvidenceType)
virtual bool IncreaseQuotaTo(long newQuotaSize)
void InitStore(IsolatedStorageScope scope, Type? domainEvidenceType, Type? assemblyEvidenceType)
static readonly char DirectorySeparatorChar
Definition Path.cs:71
static string IsolatedStorage_QuotaIsUndefined
Definition SR.cs:34
static string IsolatedStorage_AssemblyUndefined
Definition SR.cs:44
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string IsolatedStorage_CurrentSizeUndefined
Definition SR.cs:46
static string IsolatedStorage_ApplicationUndefined
Definition SR.cs:42
static string IsolatedStorage_Scope_Invalid
Definition SR.cs:50
Definition SR.cs:7