本文整理汇总了C#中System.Security.Util.StringExpressionSet类的典型用法代码示例。如果您正苦于以下问题:C# StringExpressionSet类的具体用法?C# StringExpressionSet怎么用?C# StringExpressionSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StringExpressionSet类属于System.Security.Util命名空间,在下文中一共展示了StringExpressionSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FileIOAccess
public FileIOAccess(string value)
{
this.m_ignoreCase = true;
if (value == null)
{
this.m_set = new StringExpressionSet(this.m_ignoreCase, true);
this.m_allFiles = false;
this.m_allLocalFiles = false;
}
else if ((value.Length >= "*AllFiles*".Length) && (string.Compare("*AllFiles*", value, StringComparison.Ordinal) == 0))
{
this.m_set = new StringExpressionSet(this.m_ignoreCase, true);
this.m_allFiles = true;
this.m_allLocalFiles = false;
}
else if ((value.Length >= "*AllLocalFiles*".Length) && (string.Compare("*AllLocalFiles*", 0, value, 0, "*AllLocalFiles*".Length, StringComparison.Ordinal) == 0))
{
this.m_set = new StringExpressionSet(this.m_ignoreCase, value.Substring("*AllLocalFiles*".Length), true);
this.m_allFiles = false;
this.m_allLocalFiles = true;
}
else
{
this.m_set = new StringExpressionSet(this.m_ignoreCase, value, true);
this.m_allFiles = false;
this.m_allLocalFiles = false;
}
this.m_pathDiscovery = false;
}
示例2: AddPathList
public void AddPathList(EnvironmentPermissionAccess flag, string pathList)
{
this.VerifyFlag(flag);
if (this.FlagIsSet(flag, EnvironmentPermissionAccess.Read))
{
if (this.m_read == null)
{
this.m_read = new EnvironmentStringExpressionSet();
}
this.m_read.AddExpressions(pathList);
}
if (this.FlagIsSet(flag, EnvironmentPermissionAccess.Write))
{
if (this.m_write == null)
{
this.m_write = new EnvironmentStringExpressionSet();
}
this.m_write.AddExpressions(pathList);
}
}
示例3: IsSubsetOfPathDiscovery
[System.Security.SecurityCritical] // auto-generated
public bool IsSubsetOfPathDiscovery( StringExpressionSet ses )
{
if (this.IsEmpty())
return true;
if (ses == null || ses.IsEmpty())
return false;
CheckList();
ses.CheckList();
for (int index = 0; index < this.m_list.Count; ++index)
{
if (!StringSubsetStringExpressionPathDiscovery( (String)this.m_list[index], ses, m_ignoreCase ))
{
return false;
}
}
return true;
}
示例4: FromXml
[System.Security.SecuritySafeCritical] // auto-generated
public override void FromXml(SecurityElement esd)
{
CodeAccessPermission.ValidateElement( esd, this );
String et;
if (XMLUtil.IsUnrestricted( esd ))
{
m_unrestricted = true;
return;
}
m_unrestricted = false;
m_read = null;
m_write = null;
m_create = null;
m_viewAcl = null;
m_changeAcl = null;
et = esd.Attribute( "Read" );
if (et != null)
{
m_read = new StringExpressionSet( et );
}
et = esd.Attribute( "Write" );
if (et != null)
{
m_write = new StringExpressionSet( et );
}
et = esd.Attribute( "Create" );
if (et != null)
{
m_create = new StringExpressionSet( et );
}
et = esd.Attribute( "ViewAccessControl" );
if (et != null)
{
m_viewAcl = new StringExpressionSet( et );
}
et = esd.Attribute( "ChangeAccessControl" );
if (et != null)
{
m_changeAcl = new StringExpressionSet( et );
}
}
示例5: AddPathList
[System.Security.SecuritySafeCritical] // auto-generated
public void AddPathList( RegistryPermissionAccess access, AccessControlActions control, String pathList )
{
VerifyAccess( access );
if ((access & RegistryPermissionAccess.Read) != 0)
{
if (m_read == null)
m_read = new StringExpressionSet();
m_read.AddExpressions( pathList );
}
if ((access & RegistryPermissionAccess.Write) != 0)
{
if (m_write == null)
m_write = new StringExpressionSet();
m_write.AddExpressions( pathList );
}
if ((access & RegistryPermissionAccess.Create) != 0)
{
if (m_create == null)
m_create = new StringExpressionSet();
m_create.AddExpressions( pathList );
}
#if !FEATURE_PAL && FEATURE_MACL
if ((control & AccessControlActions.View) != 0)
{
if (m_viewAcl == null)
m_viewAcl = new StringExpressionSet();
m_viewAcl.AddExpressions( pathList );
}
if ((control & AccessControlActions.Change) != 0)
{
if (m_changeAcl == null)
m_changeAcl = new StringExpressionSet();
m_changeAcl.AddExpressions( pathList );
}
#endif
}
示例6: StringSubsetStringExpressionPathDiscovery
private static bool StringSubsetStringExpressionPathDiscovery( String left, StringExpressionSet right, bool ignoreCase )
{
for (int index = 0; index < right.m_list.Count; ++index)
{
if (StringSubsetStringPathDiscovery( left, (String)right.m_list[index], ignoreCase ))
{
return true;
}
}
return false;
}
示例7: StringSubsetStringExpressionPathDiscovery
protected static bool StringSubsetStringExpressionPathDiscovery(string left, StringExpressionSet right, bool ignoreCase)
{
for (int i = 0; i < right.m_list.Count; i++)
{
if (StringSubsetStringPathDiscovery(left, (string) right.m_list[i], ignoreCase))
{
return true;
}
}
return false;
}
示例8: FileIOAccess
[System.Security.SecurityCritical] // auto-generated
public FileIOAccess( String value )
{
if (value == null)
{
m_set = new StringExpressionSet( m_ignoreCase, true );
m_allFiles = false;
m_allLocalFiles = false;
}
else if (value.Length >= m_strAllFiles.Length && String.Compare( m_strAllFiles, value, StringComparison.Ordinal) == 0)
{
m_set = new StringExpressionSet( m_ignoreCase, true );
m_allFiles = true;
m_allLocalFiles = false;
}
else if (value.Length >= m_strAllLocalFiles.Length && String.Compare( m_strAllLocalFiles, 0, value, 0, m_strAllLocalFiles.Length, StringComparison.Ordinal) == 0)
{
m_set = new StringExpressionSet( m_ignoreCase, value.Substring( m_strAllLocalFiles.Length ), true );
m_allFiles = false;
m_allLocalFiles = true;
}
else
{
m_set = new StringExpressionSet( m_ignoreCase, value, true );
m_allFiles = false;
m_allLocalFiles = false;
}
m_pathDiscovery = false;
}
示例9: Intersect
public StringExpressionSet Intersect(StringExpressionSet ses)
{
if ((this.IsEmpty() || (ses == null)) || ses.IsEmpty())
{
return this.CreateNewEmpty();
}
this.CheckList();
ses.CheckList();
StringExpressionSet set = this.CreateNewEmpty();
for (int i = 0; i < this.m_list.Count; i++)
{
for (int j = 0; j < ses.m_list.Count; j++)
{
if (this.StringSubsetString((string) this.m_list[i], (string) ses.m_list[j], this.m_ignoreCase))
{
if (set.m_list == null)
{
set.m_list = new ArrayList();
}
set.AddSingleExpressionNoDuplicates((string) this.m_list[i]);
}
else if (this.StringSubsetString((string) ses.m_list[j], (string) this.m_list[i], this.m_ignoreCase))
{
if (set.m_list == null)
{
set.m_list = new ArrayList();
}
set.AddSingleExpressionNoDuplicates((string) ses.m_list[j]);
}
}
}
set.GenerateString();
return set;
}
示例10: EnvironmentPermission
/// <include file='doc\EnvironmentPermission.uex' path='docs/doc[@for="EnvironmentPermission.EnvironmentPermission"]/*' />
public EnvironmentPermission(PermissionState state)
{
if (state == PermissionState.Unrestricted)
{
m_unrestricted = true;
}
else if (state == PermissionState.None)
{
m_unrestricted = false;
m_read = new EnvironmentStringExpressionSet();
m_write = new EnvironmentStringExpressionSet();
}
else
{
throw new ArgumentException(Environment.GetResourceString("Argument_InvalidPermissionState"));
}
}
示例11: IsSubsetOfPathDiscovery
public bool IsSubsetOfPathDiscovery(StringExpressionSet ses)
{
if (!this.IsEmpty())
{
if ((ses == null) || ses.IsEmpty())
{
return false;
}
this.CheckList();
ses.CheckList();
for (int i = 0; i < this.m_list.Count; i++)
{
if (!StringSubsetStringExpressionPathDiscovery((string) this.m_list[i], ses, this.m_ignoreCase))
{
return false;
}
}
}
return true;
}
示例12: Intersect
public FileIOAccess Intersect(FileIOAccess operand)
{
if (operand == null)
{
return null;
}
if (this.m_allFiles)
{
if (operand.m_allFiles)
{
return new FileIOAccess(true, false, this.m_pathDiscovery);
}
return new FileIOAccess(operand.m_set.Copy(), false, operand.m_allLocalFiles, this.m_pathDiscovery);
}
if (operand.m_allFiles)
{
return new FileIOAccess(this.m_set.Copy(), false, this.m_allLocalFiles, this.m_pathDiscovery);
}
StringExpressionSet set = new StringExpressionSet(this.m_ignoreCase, true);
if (this.m_allLocalFiles)
{
string[] strArray = operand.m_set.ToStringArray();
if (strArray != null)
{
for (int i = 0; i < strArray.Length; i++)
{
string root = GetRoot(strArray[i]);
if ((root != null) && IsLocalDrive(GetRoot(root)))
{
set.AddExpressions(new string[] { strArray[i] }, true, false);
}
}
}
}
if (operand.m_allLocalFiles)
{
string[] strArray2 = this.m_set.ToStringArray();
if (strArray2 != null)
{
for (int j = 0; j < strArray2.Length; j++)
{
string path = GetRoot(strArray2[j]);
if ((path != null) && IsLocalDrive(GetRoot(path)))
{
set.AddExpressions(new string[] { strArray2[j] }, true, false);
}
}
}
}
string[] strArray3 = this.m_set.Intersect(operand.m_set).ToStringArray();
if (strArray3 != null)
{
set.AddExpressions(strArray3, !set.IsEmpty(), false);
}
return new FileIOAccess(set, false, this.m_allLocalFiles && operand.m_allLocalFiles, this.m_pathDiscovery);
}
示例13: Union
public StringExpressionSet Union(StringExpressionSet ses)
{
if ((ses == null) || ses.IsEmpty())
{
return this.Copy();
}
if (this.IsEmpty())
{
return ses.Copy();
}
this.CheckList();
ses.CheckList();
StringExpressionSet set = (ses.m_list.Count > this.m_list.Count) ? ses : this;
StringExpressionSet set2 = (ses.m_list.Count <= this.m_list.Count) ? ses : this;
StringExpressionSet set3 = set.Copy();
set3.Reduce();
for (int i = 0; i < set2.m_list.Count; i++)
{
set3.AddSingleExpressionNoDuplicates((string) set2.m_list[i]);
}
set3.GenerateString();
return set3;
}
示例14: Union
[System.Security.SecurityCritical] // auto-generated
public StringExpressionSet Union( StringExpressionSet ses )
{
// If either set is empty, the union represents a copy of the other.
if (ses == null || ses.IsEmpty())
return this.Copy();
if (this.IsEmpty())
return ses.Copy();
CheckList();
ses.CheckList();
// Perform the union
// note: insert smaller set into bigger set to reduce needed comparisons
StringExpressionSet bigger = ses.m_list.Count > this.m_list.Count ? ses : this;
StringExpressionSet smaller = ses.m_list.Count <= this.m_list.Count ? ses : this;
StringExpressionSet unionSet = bigger.Copy();
unionSet.Reduce();
for (int index = 0; index < smaller.m_list.Count; ++index)
{
unionSet.AddSingleExpressionNoDuplicates( (String)smaller.m_list[index] );
}
unionSet.GenerateString();
return unionSet;
}
示例15: AddPathList
/// <include file='doc\EnvironmentPermission.uex' path='docs/doc[@for="EnvironmentPermission.AddPathList"]/*' />
public void AddPathList( EnvironmentPermissionAccess flag, String pathList )
{
VerifyFlag( flag );
m_unrestricted = false;
if (FlagIsSet( flag, EnvironmentPermissionAccess.Read ))
{
if (m_read == null)
{
m_read = new EnvironmentStringExpressionSet();
}
m_read.AddExpressions( pathList );
}
if (FlagIsSet( flag, EnvironmentPermissionAccess.Write ))
{
if (m_write == null)
{
m_write = new EnvironmentStringExpressionSet();
}
m_write.AddExpressions( pathList );
}
}