14 [OptionalField(VersionAdded = 2)]
15 private bool m_unrestricted;
17 [OptionalField(VersionAdded = 2)]
18 private URLString[] m_urls;
20 [OptionalField(VersionAdded = 2)]
21 private string m_serializedPermission;
23 private URLString m_url;
36 if (m_urls.Length == 1)
38 return m_urls[0].ToString();
44 m_unrestricted =
false;
45 if (value ==
null || value.Length == 0)
50 m_urls =
new URLString[1];
51 m_urls[0] =
new URLString(value);
58 if (m_serializedPermission !=
null)
61 m_serializedPermission =
null;
63 else if (m_url !=
null)
65 m_unrestricted =
false;
66 m_urls =
new URLString[1];
78 if (m_urls !=
null && m_urls.Length == 1)
90 m_serializedPermission =
null;
103 m_unrestricted =
true;
106 m_unrestricted =
false;
129 m_unrestricted =
false;
130 m_urls =
new URLString[1];
134 internal void AppendOrigin(
ArrayList originList)
141 for (
int i = 0; i < m_urls.Length; i++)
152 urlIdentityPermission.m_unrestricted = m_unrestricted;
155 urlIdentityPermission.m_urls =
new URLString[m_urls.Length];
156 for (
int i = 0; i < m_urls.Length; i++)
158 urlIdentityPermission.m_urls[i] = (URLString)m_urls[i].
Copy();
161 return urlIdentityPermission;
181 if (m_urls.Length == 0)
188 if (urlIdentityPermission ==
null)
192 if (urlIdentityPermission.m_unrestricted)
202 URLString[] urls = m_urls;
203 foreach (URLString uRLString
in urls)
206 if (urlIdentityPermission.m_urls !=
null)
208 URLString[] urls2 = urlIdentityPermission.m_urls;
209 foreach (URLString operand
in urls2)
211 if (uRLString.IsSubsetOf(operand))
238 if (urlIdentityPermission ==
null)
242 if (m_unrestricted && urlIdentityPermission.m_unrestricted)
245 urlIdentityPermission2.m_unrestricted =
true;
246 return urlIdentityPermission2;
250 return urlIdentityPermission.
Copy();
252 if (urlIdentityPermission.m_unrestricted)
256 if (m_urls ==
null || urlIdentityPermission.m_urls ==
null || m_urls.Length == 0 || urlIdentityPermission.m_urls.Length == 0)
261 URLString[] urls = m_urls;
262 foreach (URLString uRLString
in urls)
264 URLString[] urls2 = urlIdentityPermission.m_urls;
265 foreach (URLString operand
in urls2)
267 URLString uRLString2 = (URLString)uRLString.Intersect(operand);
268 if (uRLString2 !=
null)
270 list.Add(uRLString2);
279 urlIdentityPermission3.m_urls = list.ToArray();
280 return urlIdentityPermission3;
291 if ((m_urls ==
null || m_urls.Length == 0) && !m_unrestricted)
298 if (urlIdentityPermission ==
null)
302 if (m_unrestricted || urlIdentityPermission.m_unrestricted)
305 urlIdentityPermission2.m_unrestricted =
true;
306 return urlIdentityPermission2;
308 if (m_urls ==
null || m_urls.Length == 0)
310 if (urlIdentityPermission.m_urls ==
null || urlIdentityPermission.m_urls.Length == 0)
314 return urlIdentityPermission.
Copy();
316 if (urlIdentityPermission.m_urls ==
null || urlIdentityPermission.m_urls.Length == 0)
321 URLString[] urls = m_urls;
322 foreach (URLString item
in urls)
326 URLString[] urls2 = urlIdentityPermission.m_urls;
327 foreach (URLString uRLString
in urls2)
330 foreach (URLString item2
in list)
332 if (uRLString.Equals(item2))
344 urlIdentityPermission3.m_urls = list.ToArray();
345 return urlIdentityPermission3;
354 m_unrestricted =
false;
357 string text = esd.Attribute(
"Unrestricted");
358 if (text !=
null &&
string.Compare(text,
"true",
StringComparison.OrdinalIgnoreCase) == 0)
360 m_unrestricted =
true;
363 string text2 = esd.Attribute(
"Url");
367 list.Add(
new URLString(text2, parsed:
true));
370 if (children !=
null)
374 text2 = item.Attribute(
"Url");
377 list.Add(
new URLString(text2, parsed:
true));
383 m_urls = list.ToArray();
396 else if (m_urls !=
null)
398 if (m_urls.Length == 1)
404 for (
int i = 0; i < m_urls.Length; i++)
408 securityElement.
AddChild(securityElement2);
412 return securityElement;
415 int IBuiltInPermission.GetTokenIndex()
417 return GetTokenIndex();
420 internal static int GetTokenIndex()
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
override IPermission Intersect(IPermission target)
Creates and returns a permission that is the intersection of the current permission and the specified...
StreamingContextStates State
Gets the source or destination of the transmitted data.
StringComparison
Specifies the culture, case, and sort rules to be used by certain overloads of the M:System....
override bool IsSubsetOf(IPermission target)
Determines whether the current permission is a subset of the specified permission.
Describes the source and destination of a given serialized stream, and provides an additional caller-...
override SecurityElement ToXml()
Creates an XML encoding of the permission and its current state.
void AddChild(SecurityElement child)
Adds a child element to the XML element.
Provides information about, and means to manipulate, the current environment and platform....
UrlIdentityPermission(string site)
Initializes a new instance of the T:System.Security.Permissions.UrlIdentityPermission class to repres...
Represents the XML object model for encoding security objects. This class cannot be inherited.
Defines the underlying structure of all code access permissions.
override IPermission Union(IPermission target)
Creates a permission that is the union of the current permission and the specified permission.
UrlIdentityPermission(PermissionState state)
Initializes a new instance of the T:System.Security.Permissions.UrlIdentityPermission class with the ...
Defines methods implemented by permission types.
virtual int Add(object value)
Adds an object to the end of the T:System.Collections.ArrayList.
The exception that is thrown when one of the arguments provided to a method is not valid.
Defines the identity permission for the URL from which the code originates. This class cannot be inhe...
static SecurityElement FromString(string xml)
Creates a security element from an XML-encoded string.
Represents a strongly typed list of objects that can be accessed by index. Provides methods to search...
PermissionState
Specifies whether a permission should have all or no access to resources at creation.
override string ToString()
Creates and returns a string representation of the current permission object.
void AddAttribute(string name, string value)
Adds a name/value attribute to an XML element.
Specifies that the class can be serialized.
ArrayList Children
Gets or sets the array of child elements of the XML element.
StreamingContextStates
Defines a set of flags that specifies the source or destination context for the stream during seriali...
The exception that is thrown when an invoked method is not supported, or when there is an attempt to ...
override IPermission Copy()
Creates and returns an identical copy of the current permission.
override void FromXml(SecurityElement esd)
Reconstructs a permission with a specified state from an XML encoding.
override string ToString()
Produces a string representation of an XML element and its constituent attributes,...
string Url
Gets or sets a URL representing the identity of Internet code.
Implements the T:System.Collections.IList interface using an array whose size is dynamically increase...