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; }
private FileIOAccess(FileIOAccess operand) { this.m_ignoreCase = true; this.m_set = operand.m_set.Copy(); this.m_allFiles = operand.m_allFiles; this.m_allLocalFiles = operand.m_allLocalFiles; this.m_pathDiscovery = operand.m_pathDiscovery; }
public FileIOAccess() { this.m_ignoreCase = true; this.m_set = new StringExpressionSet(this.m_ignoreCase, true); this.m_allFiles = false; this.m_allLocalFiles = false; this.m_pathDiscovery = false; }
public FileIOAccess(bool allFiles, bool allLocalFiles, bool pathDiscovery) { this.m_ignoreCase = true; this.m_set = new StringExpressionSet(this.m_ignoreCase, true); this.m_allFiles = allFiles; this.m_allLocalFiles = allLocalFiles; this.m_pathDiscovery = pathDiscovery; }
public void SetPathList( RegistryPermissionAccess access, String pathList ) { VerifyAccess( access ); m_unrestricted = false; if ((access & RegistryPermissionAccess.Read) != 0) m_read = null; if ((access & RegistryPermissionAccess.Write) != 0) m_write = null; if ((access & RegistryPermissionAccess.Create) != 0) m_create = null; AddPathList( access, pathList ); }
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); } }
[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); }
[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); }
public StringExpressionSet Union(StringExpressionSet ses) { if (ses == null || ses.IsEmpty()) { return(this.Copy()); } if (this.IsEmpty()) { return(ses.Copy()); } this.CheckList(); ses.CheckList(); StringExpressionSet stringExpressionSet1 = ses.m_list.Count > this.m_list.Count ? ses : this; StringExpressionSet stringExpressionSet2 = ses.m_list.Count <= this.m_list.Count ? ses : this; StringExpressionSet stringExpressionSet3 = stringExpressionSet1.Copy(); stringExpressionSet3.Reduce(); for (int index = 0; index < stringExpressionSet2.m_list.Count; ++index) { stringExpressionSet3.AddSingleExpressionNoDuplicates((string)stringExpressionSet2.m_list[index]); } stringExpressionSet3.GenerateString(); return(stringExpressionSet3); }
internal static ArrayList CreateListFromExpressions(string[] str, bool needFullPath) { if (str == null) { throw new ArgumentNullException("str"); } ArrayList arrayList = new ArrayList(); for (int index = 0; index < str.Length; ++index) { if (str[index] == null) { throw new ArgumentNullException("str"); } string str1 = StringExpressionSet.StaticProcessWholeString(str[index]); if (str1 != null && str1.Length != 0) { string path = StringExpressionSet.StaticProcessSingleString(str1); int length = path.IndexOf(char.MinValue); if (length != -1) { path = path.Substring(0, length); } if (path != null && path.Length != 0) { if (Path.IsRelative(path)) { throw new ArgumentException(Environment.GetResourceString("Argument_AbsolutePathRequired")); } string str2 = StringExpressionSet.CanonicalizePath(path, needFullPath); arrayList.Add((object)str2); } } } return(arrayList); }
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); }
/// <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 ); } }
public void SetPathList( EnvironmentPermissionAccess flag, String pathList ) { VerifyFlag( flag ); m_unrestricted = false; if ((flag & EnvironmentPermissionAccess.Read) != 0) m_read = null; if ((flag & EnvironmentPermissionAccess.Write) != 0) m_write = null; AddPathList( flag, pathList ); }
[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; }
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; }
[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; }
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; }
private FileIOAccess( FileIOAccess operand ) { m_set = operand.m_set.Copy(); m_allFiles = operand.m_allFiles; m_allLocalFiles = operand.m_allLocalFiles; m_pathDiscovery = operand.m_pathDiscovery; }
internal void SetPathList( AccessControlActions control, String pathList ) { m_unrestricted = false; if ((control & AccessControlActions.View) != 0) m_viewAcl = null; if ((control & AccessControlActions.Change) != 0) m_changeAcl = null; AddPathList( RegistryPermissionAccess.NoAccess, control, pathList ); }
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; }
/// <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")); } }
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; }
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); }
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; }
[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 }
/// <include file='doc\EnvironmentPermission.uex' path='docs/doc[@for="EnvironmentPermission.FromXml"]/*' /> public override void FromXml(SecurityElement esd) { CodeAccessPermission.ValidateElement( esd, this ); String et; if (XMLUtil.IsUnrestricted(esd)) { m_unrestricted = true; return; } m_unrestricted = false; et = esd.Attribute( "Read" ); if (et != null) { m_read = new EnvironmentStringExpressionSet( et ); } et = esd.Attribute( "Write" ); if (et != null) { m_write = new EnvironmentStringExpressionSet( et ); } }
[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 ); } }
//------------------------------- // protected static helper functions //------------------------------- protected bool StringSubsetStringExpression( String left, StringExpressionSet right, bool ignoreCase ) { for (int index = 0; index < right.m_list.Count; ++index) { if (StringSubsetString( left, (String)right.m_list[index], ignoreCase )) { return true; } } return false; }
[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; }
public void AddExpressions(string[] str, bool checkForDuplicates, bool needFullPath) { this.AddExpressions(StringExpressionSet.CreateListFromExpressions(str, needFullPath), checkForDuplicates); }
[System.Security.SecurityCritical] // auto-generated public StringExpressionSet Intersect( StringExpressionSet ses ) { // If either set is empty, the intersection is empty if (this.IsEmpty() || ses == null || ses.IsEmpty()) return CreateNewEmpty(); CheckList(); ses.CheckList(); // Do the intersection for real StringExpressionSet intersectSet = CreateNewEmpty(); for (int this_index = 0; this_index < this.m_list.Count; ++this_index) { for (int ses_index = 0; ses_index < ses.m_list.Count; ++ses_index) { if (StringSubsetString( (String)this.m_list[this_index], (String)ses.m_list[ses_index], m_ignoreCase )) { if (intersectSet.m_list == null) { intersectSet.m_list = new ArrayList(); } intersectSet.AddSingleExpressionNoDuplicates( (String)this.m_list[this_index] ); } else if (StringSubsetString( (String)ses.m_list[ses_index], (String)this.m_list[this_index], m_ignoreCase )) { if (intersectSet.m_list == null) { intersectSet.m_list = new ArrayList(); } intersectSet.AddSingleExpressionNoDuplicates( (String)ses.m_list[ses_index] ); } } } intersectSet.GenerateString(); return intersectSet; }
internal static string CanonicalizePath(string path) { return(StringExpressionSet.CanonicalizePath(path, true)); }
public FileIOAccess( bool pathDiscovery ) { m_set = new StringExpressionSet( m_ignoreCase, true ); m_allFiles = false; m_allLocalFiles = false; m_pathDiscovery = pathDiscovery; }
// Token: 0x06002B27 RID: 11047 RVA: 0x000A0202 File Offset: 0x0009E402 protected virtual string ProcessSingleString(string str) { return(StringExpressionSet.StaticProcessSingleString(str)); }
public FileIOAccess( StringExpressionSet set, bool allFiles, bool allLocalFiles, bool pathDiscovery ) { m_set = set; m_set.SetThrowOnRelative( true ); m_allFiles = allFiles; m_allLocalFiles = allLocalFiles; m_pathDiscovery = pathDiscovery; }
protected bool StringSubsetStringExpression(string left, StringExpressionSet right, bool ignoreCase) { for (int i = 0; i < right.m_list.Count; i++) { if (this.StringSubsetString(left, (string) right.m_list[i], ignoreCase)) { return true; } } return false; }
public FileIOAccess Intersect( FileIOAccess operand ) { if (operand == null) { return null; } Contract.Assert( this.m_pathDiscovery == operand.m_pathDiscovery, "Path discovery settings must match" ); if (this.m_allFiles) { if (operand.m_allFiles) { return new FileIOAccess( true, false, this.m_pathDiscovery ); } else { return new FileIOAccess( operand.m_set.Copy(), false, operand.m_allLocalFiles, this.m_pathDiscovery ); } } else if (operand.m_allFiles) { return new FileIOAccess( this.m_set.Copy(), false, this.m_allLocalFiles, this.m_pathDiscovery ); } StringExpressionSet intersectionSet = new StringExpressionSet( m_ignoreCase, true ); if (this.m_allLocalFiles) { String[] expressions = operand.m_set.UnsafeToStringArray(); if (expressions != null) { for (int i = 0; i < expressions.Length; ++i) { String root = GetRoot( expressions[i] ); if (root != null && IsLocalDrive( GetRoot( root ) ) ) { intersectionSet.AddExpressions( new String[] { expressions[i] }, true, false ); } } } } if (operand.m_allLocalFiles) { String[] expressions = this.m_set.UnsafeToStringArray(); if (expressions != null) { for (int i = 0; i < expressions.Length; ++i) { String root = GetRoot( expressions[i] ); if (root != null && IsLocalDrive(GetRoot(root))) { intersectionSet.AddExpressions( new String[] { expressions[i] }, true, false ); } } } } String[] regularIntersection = this.m_set.Intersect( operand.m_set ).UnsafeToStringArray(); if (regularIntersection != null) intersectionSet.AddExpressions( regularIntersection, !intersectionSet.IsEmpty(), false ); return new FileIOAccess( intersectionSet, false, this.m_allLocalFiles && operand.m_allLocalFiles, this.m_pathDiscovery ); }
public FileIOAccess(StringExpressionSet set, bool allFiles, bool allLocalFiles, bool pathDiscovery) { this.m_ignoreCase = true; this.m_set = set; this.m_set.SetThrowOnRelative(true); this.m_allFiles = allFiles; this.m_allLocalFiles = allLocalFiles; this.m_pathDiscovery = pathDiscovery; }