private void ParseNonFileURL(String url) { String temp = url; int index = temp.IndexOf('/'); if (index == -1) { m_localSite = null; // for drive letter m_siteString = new SiteString(temp); m_directory = new DirectoryString(); } else { String site = temp.Substring(0, index); m_localSite = null; m_siteString = new SiteString(site); String directoryString = temp.Substring(index + 1); if (directoryString.Length == 0) { m_directory = new DirectoryString(); } else { m_directory = new DirectoryString(directoryString, false); } } return; }
public override bool IsSubsetOf(SiteString site) { if (site == null) { return(false); } URLString urlString1 = site as URLString; if (urlString1 == null) { return(false); } this.DoDeferredParse(); urlString1.DoDeferredParse(); URLString urlString2 = this.SpecialNormalizeUrl(); URLString urlString3 = urlString1.SpecialNormalizeUrl(); if (string.Compare(urlString2.m_protocol, urlString3.m_protocol, StringComparison.OrdinalIgnoreCase) != 0 || !urlString2.m_directory.IsSubsetOf(urlString3.m_directory)) { return(false); } if (urlString2.m_localSite != null) { return(urlString2.m_localSite.IsSubsetOf(urlString3.m_localSite)); } if (urlString2.m_port != urlString3.m_port || urlString3.m_siteString == null) { return(false); } return(urlString2.m_siteString.IsSubsetOf(urlString3.m_siteString)); }
/// <include file='doc\Site.uex' path='docs/doc[@for="Site.Site"]/*' /> public Site(String name) { if (name == null) throw new ArgumentNullException("name"); m_name = new SiteString( name ); }
private void ParseNonFileURL(string url) { string site = url; int index = site.IndexOf('/'); if (index == -1) { this.m_localSite = null; this.m_siteString = new SiteString(site); this.m_directory = new DirectoryString(); } else { string str2 = site.Substring(0, index); this.m_localSite = null; this.m_siteString = new SiteString(str2); string directory = site.Substring(index + 1); if (directory.Length == 0) { this.m_directory = new DirectoryString(); } else { this.m_directory = new DirectoryString(directory, false); } } }
public override bool IsSubsetOf(SiteString site) { if (site == null) { return(false); } URLString str = site as URLString; if (str == null) { return(false); } this.DoDeferredParse(); str.DoDeferredParse(); URLString str2 = this.SpecialNormalizeUrl(); URLString str3 = str.SpecialNormalizeUrl(); if ((string.Compare(str2.m_protocol, str3.m_protocol, StringComparison.OrdinalIgnoreCase) != 0) || !str2.m_directory.IsSubsetOf(str3.m_directory)) { return(false); } if (str2.m_localSite != null) { return(str2.m_localSite.IsSubsetOf(str3.m_localSite)); } if (str2.m_port != str3.m_port) { return(false); } return((str3.m_siteString != null) && str2.m_siteString.IsSubsetOf(str3.m_siteString)); }
private void ParseNonFileURL(string url) { string site1 = url; int length = site1.IndexOf('/'); if (length == -1) { this.m_localSite = (LocalSiteString)null; this.m_siteString = new SiteString(site1); this.m_directory = new DirectoryString(); } else { string site2 = site1.Substring(0, length); this.m_localSite = (LocalSiteString)null; this.m_siteString = new SiteString(site2); string directory = site1.Substring(length + 1); if (directory.Length == 0) { this.m_directory = new DirectoryString(); } else { this.m_directory = new DirectoryString(directory, false); } } }
public Site(String name) { if (name == null) throw new ArgumentNullException("name"); Contract.EndContractBlock(); m_name = new SiteString( name ); }
// Token: 0x06002B16 RID: 11030 RVA: 0x0009FEB8 File Offset: 0x0009E0B8 internal bool Equals(SiteString ss, bool ignoreCase) { if (this.m_site == null) { return(ss.m_site == null); } return(ss.m_site != null && this.IsSubsetOf(ss, ignoreCase) && ss.IsSubsetOf(this, ignoreCase)); }
public SiteMembershipCondition(string site) { if (site == null) { throw new ArgumentNullException("site"); } this.m_site = new SiteString(site); }
public URLString() { m_protocol = ""; m_siteString = new SiteString(); m_port = -1; m_localSite = null; m_directory = new DirectoryString(); m_fullurl = ""; }
private void ParseFileURL(string url) { string str1 = url; int length = str1.IndexOf('/'); if (length != -1 && (length == 2 && (int)str1[length - 1] != 58 && (int)str1[length - 1] != 124 || length != 2) && length != str1.Length - 1) { int num = str1.IndexOf('/', length + 1); length = num == -1 ? -1 : num; } string strIn = length != -1 ? str1.Substring(0, length) : str1; if (strIn.Length == 0) { throw new ArgumentException(Environment.GetResourceString("Argument_InvalidUrl")); } bool flag1; int index1; if ((int)strIn[0] == 92 && (int)strIn[1] == 92) { flag1 = true; index1 = 2; } else { index1 = 0; flag1 = false; } bool flag2 = true; for (; index1 < strIn.Length; ++index1) { char ch = strIn[index1]; if (((int)ch < 65 || (int)ch > 90) && ((int)ch < 97 || (int)ch > 122) && (((int)ch < 48 || (int)ch > 57) && ((int)ch != 45 && (int)ch != 47)) && ((int)ch != 58 && (int)ch != 124 && ((int)ch != 46 && (int)ch != 42) && ((int)ch != 36 && (!flag1 || (int)ch != 32)))) { flag2 = false; break; } } string site = !flag2?strIn.ToUpper(CultureInfo.InvariantCulture) : string.SmallCharToUpper(strIn); this.m_localSite = new LocalSiteString(site); if (length == -1) { string str2 = site; int index2 = str2.Length - 1; this.m_directory = (int)str2[index2] != 42 ? new DirectoryString() : new DirectoryString("*", false); } else { string directory = str1.Substring(length + 1); this.m_directory = directory.Length != 0 ? new DirectoryString(directory, true) : new DirectoryString(); } this.m_siteString = (SiteString)null; }
public URLString() { this.m_protocol = ""; this.m_userpass = ""; this.m_siteString = new SiteString(); this.m_port = -1; this.m_localSite = null; this.m_directory = new DirectoryString(); this.m_parseDeferred = false; }
public URLString() { m_protocol = ""; m_userpass = ""; m_siteString = new SiteString(); m_port = -1; m_localSite = null; m_directory = new DirectoryString(); m_parseDeferred = false; }
public URLString() { this.m_protocol = ""; this.m_userpass = ""; this.m_siteString = new SiteString(); this.m_port = -1; this.m_localSite = (LocalSiteString)null; this.m_directory = new DirectoryString(); this.m_parseDeferred = false; }
// Token: 0x06002B10 RID: 11024 RVA: 0x0009FD88 File Offset: 0x0009DF88 private static bool AllLegalCharacters(string str) { foreach (char c in str) { if (!SiteString.IsLegalDNSChar(c) && !SiteString.IsNetbiosSplChar(c)) { return(false); } } return(true); }
public URLString() { m_protocol = ""; m_siteString = new SiteString(); m_port = -1; #if !PLATFORM_UNIX m_localSite = null; #endif // !PLATFORM_UNIX m_directory = new DirectoryString(); m_fullurl = ""; }
// Token: 0x06002B0F RID: 11023 RVA: 0x0009FC60 File Offset: 0x0009DE60 private static ArrayList CreateSeparatedSite(string site) { if (site == null || site.Length == 0) { throw new ArgumentException(Environment.GetResourceString("Argument_InvalidSite")); } ArrayList arrayList = new ArrayList(); int num = -1; int num2 = site.IndexOf('['); if (num2 == 0) { num = site.IndexOf(']', num2 + 1); } if (num != -1) { string value = site.Substring(num2 + 1, num - num2 - 1); arrayList.Add(value); return(arrayList); } string[] array = site.Split(SiteString.m_separators); for (int i = array.Length - 1; i > -1; i--) { if (array[i] == null) { throw new ArgumentException(Environment.GetResourceString("Argument_InvalidSite")); } if (array[i].Equals("")) { if (i != array.Length - 1) { throw new ArgumentException(Environment.GetResourceString("Argument_InvalidSite")); } } else if (array[i].Equals("*")) { if (i != 0) { throw new ArgumentException(Environment.GetResourceString("Argument_InvalidSite")); } arrayList.Add(array[i]); } else { if (!SiteString.AllLegalCharacters(array[i])) { throw new ArgumentException(Environment.GetResourceString("Argument_InvalidSite")); } arrayList.Add(array[i]); } } return(arrayList); }
public virtual bool IsSubsetOf(SiteString operand, bool ignoreCase) { StringComparison strComp = (ignoreCase? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal); if (operand == null) { return(false); } else if (this.m_separatedSite.Count == operand.m_separatedSite.Count && this.m_separatedSite.Count == 0) { return(true); } else if (this.m_separatedSite.Count < operand.m_separatedSite.Count - 1) { return(false); } else if (this.m_separatedSite.Count > operand.m_separatedSite.Count && operand.m_separatedSite.Count > 0 && !operand.m_separatedSite[operand.m_separatedSite.Count - 1].Equals("*")) { return(false); } else if (String.Compare(this.m_site, operand.m_site, strComp) == 0) { return(true); } for (int index = 0; index < operand.m_separatedSite.Count - 1; ++index) { if (String.Compare((String)this.m_separatedSite[index], (String)operand.m_separatedSite[index], strComp) != 0) { return(false); } } if (this.m_separatedSite.Count < operand.m_separatedSite.Count) { return(operand.m_separatedSite[operand.m_separatedSite.Count - 1].Equals("*")); } else if (this.m_separatedSite.Count == operand.m_separatedSite.Count) { // last item must be the same or operand must have a * in its last item return(String.Compare((String)this.m_separatedSite[this.m_separatedSite.Count - 1], (String)operand.m_separatedSite[this.m_separatedSite.Count - 1], strComp) == 0 || operand.m_separatedSite[operand.m_separatedSite.Count - 1].Equals("*")); } else { return(true); } }
private static bool AllLegalCharacters(string str) { for (int index = 0; index < str.Length; ++index) { char c = str[index]; if (!SiteString.IsLegalDNSChar(c) && !SiteString.IsNetbiosSplChar(c)) { return(false); } } return(true); }
private static ArrayList CreateSeparatedSite(string site) { if (site == null || site.Length == 0) { throw new ArgumentException(Environment.GetResourceString("Argument_InvalidSite")); } ArrayList arrayList = new ArrayList(); int num1 = -1; int num2 = site.IndexOf('['); if (num2 == 0) { num1 = site.IndexOf(']', num2 + 1); } if (num1 != -1) { string str = site.Substring(num2 + 1, num1 - num2 - 1); arrayList.Add((object)str); return(arrayList); } string[] strArray = site.Split(SiteString.m_separators); for (int index = strArray.Length - 1; index > -1; --index) { if (strArray[index] == null) { throw new ArgumentException(Environment.GetResourceString("Argument_InvalidSite")); } if (strArray[index].Equals("")) { if (index != strArray.Length - 1) { throw new ArgumentException(Environment.GetResourceString("Argument_InvalidSite")); } } else if (strArray[index].Equals("*")) { if (index != 0) { throw new ArgumentException(Environment.GetResourceString("Argument_InvalidSite")); } arrayList.Add((object)strArray[index]); } else { if (!SiteString.AllLegalCharacters(strArray[index])) { throw new ArgumentException(Environment.GetResourceString("Argument_InvalidSite")); } arrayList.Add((object)strArray[index]); } } return(arrayList); }
public URLString() { m_protocol = ""; m_userpass = ""; m_siteString = new SiteString(); m_port = -1; #if !PLATFORM_UNIX m_localSite = null; #endif // !PLATFORM_UNIX m_directory = new DirectoryString(); m_parseDeferred = false; }
public virtual SiteString Intersect(SiteString operand) { if (operand != null) { if (this.IsSubsetOf(operand)) { return(this.Copy()); } if (operand.IsSubsetOf(this)) { return(operand.Copy()); } } return(null); }
public void FromXml(SecurityElement e, PolicyLevel level) { if (e == null) { throw new ArgumentNullException("e"); } if (!e.Tag.Equals("IMembershipCondition")) { throw new ArgumentException(Environment.GetResourceString("Argument_MembershipConditionElement")); } lock (this) { this.m_site = null; this.m_element = e; } }
// Token: 0x06002B1B RID: 11035 RVA: 0x000A00EE File Offset: 0x0009E2EE public virtual SiteString Union(SiteString operand) { if (operand == null) { return(this); } if (this.IsSubsetOf(operand)) { return(operand.Copy()); } if (operand.IsSubsetOf(this)) { return(this.Copy()); } return(null); }
public override bool IsSubsetOf(SiteString site) { if (site == null) { return(false); } URLString url = site as URLString; if (url == null) { return(false); } DoDeferredParse(); url.DoDeferredParse(); URLString normalUrl1 = this.SpecialNormalizeUrl(); URLString normalUrl2 = url.SpecialNormalizeUrl(); if (String.Compare(normalUrl1.m_protocol, normalUrl2.m_protocol, StringComparison.OrdinalIgnoreCase) == 0 && normalUrl1.m_directory.IsSubsetOf(normalUrl2.m_directory)) { #if !PLATFORM_UNIX if (normalUrl1.m_localSite != null) { // We do a little extra processing in here for local files since we allow // both <drive_letter>: and <drive_letter>| forms of urls. return(normalUrl1.m_localSite.IsSubsetOf(normalUrl2.m_localSite)); } else #endif // !PLATFORM_UNIX { if (normalUrl1.m_port != normalUrl2.m_port) { return(false); } return(normalUrl2.m_siteString != null && normalUrl1.m_siteString.IsSubsetOf(normalUrl2.m_siteString)); } } else { return(false); } }
public virtual bool IsSubsetOf(SiteString operand, bool ignoreCase) { StringComparison comparisonType = ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal; if (operand == null) { return(false); } if ((this.m_separatedSite.Count != operand.m_separatedSite.Count) || (this.m_separatedSite.Count != 0)) { if (this.m_separatedSite.Count < (operand.m_separatedSite.Count - 1)) { return(false); } if (((this.m_separatedSite.Count > operand.m_separatedSite.Count) && (operand.m_separatedSite.Count > 0)) && !operand.m_separatedSite[operand.m_separatedSite.Count - 1].Equals("*")) { return(false); } if (string.Compare(this.m_site, operand.m_site, comparisonType) == 0) { return(true); } for (int i = 0; i < (operand.m_separatedSite.Count - 1); i++) { if (string.Compare((string)this.m_separatedSite[i], (string)operand.m_separatedSite[i], comparisonType) != 0) { return(false); } } if (this.m_separatedSite.Count < operand.m_separatedSite.Count) { return(operand.m_separatedSite[operand.m_separatedSite.Count - 1].Equals("*")); } if (this.m_separatedSite.Count != operand.m_separatedSite.Count) { return(true); } if (string.Compare((string)this.m_separatedSite[this.m_separatedSite.Count - 1], (string)operand.m_separatedSite[this.m_separatedSite.Count - 1], comparisonType) != 0) { return(operand.m_separatedSite[operand.m_separatedSite.Count - 1].Equals("*")); } } return(true); }
public virtual bool IsSubsetOf(SiteString operand, bool ignoreCase) { if (operand == null) { return(false); } else if (this.m_separatedSite.Count == operand.m_separatedSite.Count && this.m_separatedSite.Count == 0) { return(true); } else if (this.m_separatedSite.Count < operand.m_separatedSite.Count - 1) { return(false); } else if (this.m_separatedSite.Count > operand.m_separatedSite.Count && operand.m_separatedSite.Count > 0 && !operand.m_separatedSite[operand.m_separatedSite.Count - 1].Equals("*")) { return(false); } else if (String.Compare(this.m_site, operand.m_site, ignoreCase, CultureInfo.InvariantCulture) == 0) { return(true); } for (int index = 0; index < operand.m_separatedSite.Count - 1; ++index) { if (String.Compare((String)this.m_separatedSite[index], (String)operand.m_separatedSite[index], ignoreCase, CultureInfo.InvariantCulture) != 0) { return(false); } } if (this.m_separatedSite.Count <= operand.m_separatedSite.Count) { return(operand.m_separatedSite[operand.m_separatedSite.Count - 1].Equals("*")); } else { return(true); } }
public override bool IsSubsetOf(SiteString site) { if (site == null) { return(false); } URLString url = site as URLString; if (url == null) { return(false); } URLString normalUrl1 = this.SpecialNormalizeUrl(); URLString normalUrl2 = url.SpecialNormalizeUrl(); if (String.Compare(normalUrl1.m_protocol, normalUrl2.m_protocol, true, CultureInfo.InvariantCulture) == 0 && normalUrl1.m_directory.IsSubsetOf(normalUrl2.m_directory)) { if (normalUrl1.m_localSite != null) { // We do a little extra processing in here for local files since we allow // both <drive_letter>: and <drive_letter>| forms of urls. return(normalUrl1.m_localSite.IsSubsetOf(normalUrl2.m_localSite)); } else { if (normalUrl1.m_port != normalUrl2.m_port) { return(false); } return(normalUrl2.m_siteString != null && normalUrl1.m_siteString.IsSubsetOf(normalUrl2.m_siteString)); } } else { return(false); } }
public virtual bool IsSubsetOf(SiteString operand, bool ignoreCase) { StringComparison comparisonType = ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal; if (operand == null) { return(false); } if (this.m_separatedSite.Count == operand.m_separatedSite.Count && this.m_separatedSite.Count == 0) { return(true); } if (this.m_separatedSite.Count < operand.m_separatedSite.Count - 1 || this.m_separatedSite.Count > operand.m_separatedSite.Count && operand.m_separatedSite.Count > 0 && !operand.m_separatedSite[operand.m_separatedSite.Count - 1].Equals((object)"*")) { return(false); } if (string.Compare(this.m_site, operand.m_site, comparisonType) == 0) { return(true); } for (int index = 0; index < operand.m_separatedSite.Count - 1; ++index) { if (string.Compare((string)this.m_separatedSite[index], (string)operand.m_separatedSite[index], comparisonType) != 0) { return(false); } } if (this.m_separatedSite.Count < operand.m_separatedSite.Count) { return(operand.m_separatedSite[operand.m_separatedSite.Count - 1].Equals((object)"*")); } if (this.m_separatedSite.Count == operand.m_separatedSite.Count && string.Compare((string)this.m_separatedSite[this.m_separatedSite.Count - 1], (string)operand.m_separatedSite[this.m_separatedSite.Count - 1], comparisonType) != 0) { return(operand.m_separatedSite[operand.m_separatedSite.Count - 1].Equals((object)"*")); } return(true); }
public virtual bool IsSubsetOf( SiteString operand, bool ignoreCase ) { StringComparison strComp = (ignoreCase? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal); if (operand == null) { return false; } else if (this.m_separatedSite.Count == operand.m_separatedSite.Count && this.m_separatedSite.Count == 0) { return true; } else if (this.m_separatedSite.Count < operand.m_separatedSite.Count - 1) { return false; } else if (this.m_separatedSite.Count > operand.m_separatedSite.Count && operand.m_separatedSite.Count > 0 && !operand.m_separatedSite[operand.m_separatedSite.Count - 1].Equals("*")) { return false; } else if (String.Compare( this.m_site, operand.m_site, strComp) == 0) { return true; } for (int index = 0; index < operand.m_separatedSite.Count - 1; ++index) { if (String.Compare((String)this.m_separatedSite[index], (String)operand.m_separatedSite[index], strComp) != 0) { return false; } } if (this.m_separatedSite.Count < operand.m_separatedSite.Count) { return operand.m_separatedSite[operand.m_separatedSite.Count - 1].Equals("*"); } else if (this.m_separatedSite.Count == operand.m_separatedSite.Count) { // last item must be the same or operand must have a * in its last item return (String.Compare((String)this.m_separatedSite[this.m_separatedSite.Count - 1], (String)operand.m_separatedSite[this.m_separatedSite.Count - 1], strComp ) == 0 || operand.m_separatedSite[operand.m_separatedSite.Count - 1].Equals("*")); } else return true; }
public virtual SiteString Intersect(SiteString operand) { if (operand != null) { if (this.IsSubsetOf(operand)) { return this.Copy(); } if (operand.IsSubsetOf(this)) { return operand.Copy(); } } return null; }
internal SiteMembershipCondition() { this.m_site = null; }
internal bool Equals( SiteString ss, bool ignoreCase ) { if (this.m_site == null) return ss.m_site == null; if (ss.m_site == null) return false; return this.IsSubsetOf(ss, ignoreCase) && ss.IsSubsetOf(this, ignoreCase); }
private Site(SiteString name) { this.m_name = name; }
private void ParseSite() { lock (this) { if (this.m_element != null) { string site = this.m_element.Attribute("Site"); if (site == null) { throw new ArgumentException(Environment.GetResourceString("Argument_SiteCannotBeNull")); } this.m_site = new SiteString(site); this.m_element = null; } } }
internal Site() { m_name = null; }
private void OnSerialized(StreamingContext ctx) { if ((ctx.State & ~(StreamingContextStates.CrossAppDomain | StreamingContextStates.Clone)) != 0) { this.m_serializedPermission = null; this.m_site = null; } }
private void OnSerializing(StreamingContext ctx) { if ((ctx.State & ~(StreamingContextStates.CrossAppDomain | StreamingContextStates.Clone)) != 0) { this.m_serializedPermission = this.ToXml().ToString(); if ((this.m_sites != null) && (this.m_sites.Length == 1)) { this.m_site = this.m_sites[0]; } } }
private void OnDeserialized(StreamingContext ctx) { if (this.m_serializedPermission != null) { this.FromXml(SecurityElement.FromString(this.m_serializedPermission)); this.m_serializedPermission = null; } else if (this.m_site != null) { this.m_unrestricted = false; this.m_sites = new SiteString[] { this.m_site }; this.m_site = null; } }
internal Site( byte[] id, String name ) { m_name = ParseSiteFromUrl( name ); }
public virtual bool IsSubsetOf(SiteString operand, bool ignoreCase) { StringComparison comparisonType = ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal; if (operand == null) { return false; } if ((this.m_separatedSite.Count != operand.m_separatedSite.Count) || (this.m_separatedSite.Count != 0)) { if (this.m_separatedSite.Count < (operand.m_separatedSite.Count - 1)) { return false; } if (((this.m_separatedSite.Count > operand.m_separatedSite.Count) && (operand.m_separatedSite.Count > 0)) && !operand.m_separatedSite[operand.m_separatedSite.Count - 1].Equals("*")) { return false; } if (string.Compare(this.m_site, operand.m_site, comparisonType) == 0) { return true; } for (int i = 0; i < (operand.m_separatedSite.Count - 1); i++) { if (string.Compare((string) this.m_separatedSite[i], (string) operand.m_separatedSite[i], comparisonType) != 0) { return false; } } if (this.m_separatedSite.Count < operand.m_separatedSite.Count) { return operand.m_separatedSite[operand.m_separatedSite.Count - 1].Equals("*"); } if (this.m_separatedSite.Count != operand.m_separatedSite.Count) { return true; } if (string.Compare((string) this.m_separatedSite[this.m_separatedSite.Count - 1], (string) operand.m_separatedSite[this.m_separatedSite.Count - 1], comparisonType) != 0) { return operand.m_separatedSite[operand.m_separatedSite.Count - 1].Equals("*"); } } return true; }
private void ParseFileURL(String url) { String temp = url; #if !PLATFORM_UNIX int index = temp.IndexOf( '/'); if (index != -1 && ((index == 2 && temp[index-1] != ':' && temp[index-1] != '|') || index != 2) && index != temp.Length - 1) { // Also, if it is a UNC share, we want m_localSite to // be of the form "computername/share", so if the first // fileEnd character found is a slash, do some more parsing // to find the proper end character. int tempIndex = temp.IndexOf( '/', index+1); if (tempIndex != -1) index = tempIndex; else index = -1; } String localSite; if (index == -1) localSite = temp; else localSite = temp.Substring(0,index); if (localSite.Length == 0) throw new ArgumentException( Environment.GetResourceString( "Argument_InvalidUrl" ) ); int i; bool spacesAllowed; if (localSite[0] == '\\' && localSite[1] == '\\') { spacesAllowed = true; i = 2; } else { i = 0; spacesAllowed = false; } bool useSmallCharToUpper = true; for (; i < localSite.Length; ++i) { char c = localSite[i]; if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || (c == '-') || (c == '/') || (c == ':') || (c == '|') || (c == '.') || (c == '*') || (c == '$') || (spacesAllowed && c == ' ')) { continue; } else { useSmallCharToUpper = false; break; } } if (useSmallCharToUpper) localSite = String.SmallCharToUpper( localSite ); else localSite = localSite.ToUpper(CultureInfo.InvariantCulture); m_localSite = new LocalSiteString( localSite ); if (index == -1) { if (localSite[localSite.Length-1] == '*') m_directory = new DirectoryString( "*", false ); else m_directory = new DirectoryString(); } else { String directoryString = temp.Substring( index + 1 ); if (directoryString.Length == 0) { m_directory = new DirectoryString(); } else { m_directory = new DirectoryString( directoryString, true); } } #else // !PLATFORM_UNIX m_directory = new DirectoryString( temp, true); #endif // !PLATFORM_UNIX m_siteString = null; return; }
/// <include file='doc\Site.uex' path='docs/doc[@for="Site.char1"]/*' /> /// <internalonly/> int IBuiltInEvidence.InitFromBuffer( char[] buffer, int position) { int length = BuiltInEvidenceHelper.GetIntFromCharArray(buffer, position); position += 2; m_name = new SiteString( new String(buffer, position, length )); return position + length; }
private void ParseNonFileURL(String url) { String temp = url; int index = temp.IndexOf('/'); if (index == -1) { #if !PLATFORM_UNIX m_localSite = null; // for drive letter #endif // !PLATFORM_UNIX m_siteString = new SiteString( temp ); m_directory = new DirectoryString(); } else { #if !PLATFORM_UNIX String site = temp.Substring( 0, index ); m_localSite = null; m_siteString = new SiteString( site ); String directoryString = temp.Substring( index + 1 ); if (directoryString.Length == 0) { m_directory = new DirectoryString(); } else { m_directory = new DirectoryString( directoryString, false ); } #else String directoryString = temp.Substring( index + 1 ); String site = temp.Substring( 0, index ); m_directory = new DirectoryString( directoryString, false ); m_siteString = new SiteString( site ); #endif //!PLATFORM_UNIX } return; }
void ParseString(String url, bool parsed) { if (url == null) { throw new ArgumentNullException("url"); } if (url.Length == 0) { throw new FormatException(Environment.GetResourceString("Format_StringZeroLength")); } int index; String temp = url; String intermediate = ""; // If there are any hex or unicode characters in the url, translate those // into the proper character. if (!parsed) { do { index = temp.IndexOf('%'); if (index == -1) { intermediate += temp; break; } if (temp.Length - index < 1) { throw new ArgumentException(Environment.GetResourceString("Argument_InvalidUrl")); } if (temp[index + 1] == 'u' || temp[index + 1] == 'U') { if (temp.Length - index < 5) { throw new ArgumentException(Environment.GetResourceString("Argument_InvalidUrl")); } // We have a unicode character specified in hex char c = (char)(Hex.ConvertHexDigit(temp[index + 2]) << 12 | Hex.ConvertHexDigit(temp[index + 3]) << 8 | Hex.ConvertHexDigit(temp[index + 4]) << 4 | Hex.ConvertHexDigit(temp[index + 5])); intermediate += temp.Substring(0, index) + c; temp = temp.Substring(index + 6); } else { // we have a hex character. if (temp.Length - index < 2) { throw new ArgumentException(Environment.GetResourceString("Argument_InvalidUrl")); } char c = (char)(Hex.ConvertHexDigit(temp[index + 1]) << 4 | Hex.ConvertHexDigit(temp[index + 2])); intermediate += temp.Substring(0, index) + c; temp = temp.Substring(index + 3); } } while (true); temp = intermediate; url = temp; } // Search for the end of the protocol info and grab the actual protocol string // ex. http://www.microsoft.com/complus would have a protocol string of http index = temp.IndexOf(':'); if (index == 0) { throw new ArgumentException(Environment.GetResourceString("Argument_InvalidUrl")); } else if (index != -1 && temp.Length > index + 1) { if (String.Compare(temp.Substring(0, index), "file", true, CultureInfo.InvariantCulture) == 0) { m_protocol = "file"; temp = temp.Substring(index + 1); } else if (temp[index + 1] != '\\') { if (temp.Length > index + 2 && temp[index + 1] == '/' && temp[index + 2] == '/') { m_protocol = url.Substring(0, index); for (int i = 0; i < m_protocol.Length; ++i) { char c = m_protocol[i]; if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) { continue; } else { throw new ArgumentException(Environment.GetResourceString("Argument_InvalidUrl")); } } temp = url.Substring(index + 3); } else { throw new ArgumentException(Environment.GetResourceString("Argument_InvalidUrl")); } } else { m_protocol = m_defaultProtocol; temp = url; } } else { m_protocol = m_defaultProtocol; temp = url; } // Parse out the site info. // In the general case we parse of the site and create a SiteString out of it // (which supports our wildcarding scheme). In the case of files we don't support // wildcarding and furthermore SiteString doesn't like ':' and '|' which can appear // in file urls so we just keep that info in a separate string and set the // SiteString to null. // // ex. http://www.microsoft.com/complus -> m_siteString = "www.microsoft.com" m_localSite = null // ex. file:///c:/complus/mscorlib.dll -> m_siteString = null m_localSite = "c:" // ex. file:///c|/complus/mscorlib.dll -> m_siteString = null m_localSite = "c:" bool fileProtocol; if (String.Compare(m_protocol, "file", true, CultureInfo.InvariantCulture) == 0) { index = temp.IndexOfAny(m_fileEnd); fileProtocol = true; if (String.Compare(temp, 0, "\\\\?\\", 0, 4, true, CultureInfo.InvariantCulture) == 0 || String.Compare(temp, 0, "\\\\.\\", 0, 4, true, CultureInfo.InvariantCulture) == 0) { temp = temp.Substring(4); } } else { index = temp.IndexOfAny(m_siteEnd); fileProtocol = false; } temp = temp.Replace('\\', '/'); // If we find a '/' in the first character of the string and we are using the 'file' // protocol, just ignore it. if (fileProtocol) { // Remove any '/' before the local site information. // ex. file://///d:/complus // ex. file:///d:/complus temp = temp.TrimStart(new char[] { '/' }); index = temp.IndexOfAny(m_fileEnd, 0); if (index != -1 && ((index == 2 && temp[index - 1] != ':' && temp[index - 1] != '|') || index != 2) && index != temp.Length - 1) { int tempIndex = temp.Substring(index + 1).IndexOfAny(m_fileEnd); if (tempIndex != -1) { index = tempIndex + index + 1; } else { index = -1; } } } // Check if there is a port number and parse that out. if (index != -1 && temp[index] == ':') { int tempIndex = temp.IndexOf('/'); if (tempIndex == -1) { m_port = Int32.Parse(temp.Substring(index + 1)); if (m_port < 0) { throw new ArgumentException(Environment.GetResourceString("Argument_InvalidUrl")); } temp = temp.Substring(0, index); index = -1; } else { m_port = Int32.Parse(temp.Substring(index + 1, tempIndex - index - 1)); temp = temp.Substring(0, index) + temp.Substring(tempIndex); } } if (index == -1) { if (fileProtocol) { String localSite = temp; int i; bool spacesAllowed; if (localSite[0] == '\\' && localSite[1] == '\\') { spacesAllowed = true; i = 2; } else { i = 0; spacesAllowed = false; } bool useSmallCharToUpper = true; for (; i < localSite.Length; ++i) { char c = localSite[i]; if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || (c == '-') || (c == '/') || (c == ':') || (c == '|') || (c == '.') || (c == '*') || (c == '$') || (spacesAllowed && c == ' ')) { continue; } else { useSmallCharToUpper = false; break; } } if (useSmallCharToUpper) { localSite = String.SmallCharToUpper(localSite); } else { localSite = localSite.ToUpper(CultureInfo.InvariantCulture); } m_siteString = null; m_localSite = new LocalSiteString(localSite); if (localSite[localSite.Length - 1] == '*') { m_directory = new DirectoryString("*", false); } else { m_directory = new DirectoryString(); } } else { m_localSite = null; m_siteString = new SiteString(temp); m_directory = new DirectoryString(); } } else { String site = temp.Substring(0, index); if (fileProtocol) { String localSite = site; int i; bool spacesAllowed; if (localSite[0] == '\\' && localSite[1] == '\\') { spacesAllowed = true; i = 2; } else { i = 0; spacesAllowed = false; } bool useSmallCharToUpper = true; for (; i < localSite.Length; ++i) { char c = localSite[i]; if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '-' && c <= ':') || (c == '|') || (c == '$') || (c == '_') || (spacesAllowed && c == ' ')) { continue; } else { useSmallCharToUpper = false; break; } } if (useSmallCharToUpper) { localSite = String.SmallCharToUpper(localSite); } else { localSite = localSite.ToUpper(CultureInfo.InvariantCulture); } m_siteString = null; m_localSite = new LocalSiteString(localSite); } else { m_localSite = null; m_siteString = new SiteString(site); } // Finally we parse out the directory string // ex. http://www.microsoft.com/complus -> m_directory = "complus" String directoryString = temp.Substring(index + 1); if (directoryString.Length == 0) { m_directory = new DirectoryString(); } else { m_directory = new DirectoryString(directoryString, fileProtocol); } } String builtUrl; if (fileProtocol) { String directory = m_directory.ToString(); String localSite = m_localSite.ToString(); builtUrl = "file://" + localSite; if (directory != null && !directory.Equals("") && (!directory.Equals("*") || localSite.IndexOf('*') == -1)) { builtUrl += "/" + directory; } } else { builtUrl = m_protocol + "://" + m_siteString.ToString(); if (m_port != -1) { builtUrl += ":" + m_port; } builtUrl += "/" + m_directory.ToString(); } m_fullurl = builtUrl; }
public override bool IsSubsetOf( SiteString site ) { if (site == null) { return false; } URLString url = site as URLString; if (url == null) { return false; } DoDeferredParse(); url.DoDeferredParse(); URLString normalUrl1 = this.SpecialNormalizeUrl(); URLString normalUrl2 = url.SpecialNormalizeUrl(); if (String.Compare( normalUrl1.m_protocol, normalUrl2.m_protocol, StringComparison.OrdinalIgnoreCase) == 0 && normalUrl1.m_directory.IsSubsetOf( normalUrl2.m_directory )) { #if !PLATFORM_UNIX if (normalUrl1.m_localSite != null) { // We do a little extra processing in here for local files since we allow // both <drive_letter>: and <drive_letter>| forms of urls. return normalUrl1.m_localSite.IsSubsetOf( normalUrl2.m_localSite ); } else #endif // !PLATFORM_UNIX { if (normalUrl1.m_port != normalUrl2.m_port) return false; return normalUrl2.m_siteString != null && normalUrl1.m_siteString.IsSubsetOf( normalUrl2.m_siteString ); } } else { return false; } }
// Token: 0x06002B0D RID: 11021 RVA: 0x0009FC2C File Offset: 0x0009DE2C public SiteString(string site) { this.m_separatedSite = SiteString.CreateSeparatedSite(site); this.m_site = site; }
public virtual bool IsSubsetOf(SiteString operand) { return(this.IsSubsetOf(operand, true)); }
private void ParseFileURL(String url) { String temp = url; int index = temp.IndexOf('/'); if (index != -1 && ((index == 2 && temp[index - 1] != ':' && temp[index - 1] != '|') || index != 2) && index != temp.Length - 1) { // Also, if it is a UNC share, we want m_localSite to // be of the form "computername/share", so if the first // fileEnd character found is a slash, do some more parsing // to find the proper end character. int tempIndex = temp.IndexOf('/', index + 1); if (tempIndex != -1) { index = tempIndex; } else { index = -1; } } String localSite; if (index == -1) { localSite = temp; } else { localSite = temp.Substring(0, index); } if (localSite.Length == 0) { throw new ArgumentException(Environment.GetResourceString("Argument_InvalidUrl")); } int i; bool spacesAllowed; if (localSite[0] == '\\' && localSite[1] == '\\') { spacesAllowed = true; i = 2; } else { i = 0; spacesAllowed = false; } bool useSmallCharToUpper = true; for (; i < localSite.Length; ++i) { char c = localSite[i]; if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || (c == '-') || (c == '/') || (c == ':') || (c == '|') || (c == '.') || (c == '*') || (c == '$') || (spacesAllowed && c == ' ')) { continue; } else { useSmallCharToUpper = false; break; } } if (useSmallCharToUpper) { localSite = String.SmallCharToUpper(localSite); } else { localSite = localSite.ToUpper(CultureInfo.InvariantCulture); } m_localSite = new LocalSiteString(localSite); if (index == -1) { if (localSite[localSite.Length - 1] == '*') { m_directory = new DirectoryString("*", false); } else { m_directory = new DirectoryString(); } } else { String directoryString = temp.Substring(index + 1); if (directoryString.Length == 0) { m_directory = new DirectoryString(); } else { m_directory = new DirectoryString(directoryString, true); } } m_siteString = null; return; }
private void ParseFileURL(string url) { string str2; int num3; bool flag; string str = url; int index = str.IndexOf('/'); if (((index != -1) && ((((index == 2) && (str[index - 1] != ':')) && (str[index - 1] != '|')) || (index != 2))) && (index != (str.Length - 1))) { int num2 = str.IndexOf('/', index + 1); if (num2 != -1) { index = num2; } else { index = -1; } } if (index == -1) { str2 = str; } else { str2 = str.Substring(0, index); } if (str2.Length == 0) { throw new ArgumentException(Environment.GetResourceString("Argument_InvalidUrl")); } if ((str2[0] == '\\') && (str2[1] == '\\')) { flag = true; num3 = 2; } else { num3 = 0; flag = false; } bool flag2 = true; while (num3 < str2.Length) { char ch = str2[num3]; if ((((ch < 'A') || (ch > 'Z')) && ((ch < 'a') || (ch > 'z'))) && (((ch < '0') || (ch > '9')) && (((((ch != '-') && (ch != '/')) && ((ch != ':') && (ch != '|'))) && (((ch != '.') && (ch != '*')) && (ch != '$'))) && (!flag || (ch != ' '))))) { flag2 = false; break; } num3++; } if (flag2) { str2 = string.SmallCharToUpper(str2); } else { str2 = str2.ToUpper(CultureInfo.InvariantCulture); } this.m_localSite = new LocalSiteString(str2); if (index == -1) { if (str2[str2.Length - 1] == '*') { this.m_directory = new DirectoryString("*", false); } else { this.m_directory = new DirectoryString(); } } else { string directory = str.Substring(index + 1); if (directory.Length == 0) { this.m_directory = new DirectoryString(); } else { this.m_directory = new DirectoryString(directory, true); } } this.m_siteString = null; }
public override bool IsSubsetOf(SiteString site) { if (site == null) { return false; } URLString str = site as URLString; if (str == null) { return false; } this.DoDeferredParse(); str.DoDeferredParse(); URLString str2 = this.SpecialNormalizeUrl(); URLString str3 = str.SpecialNormalizeUrl(); if ((string.Compare(str2.m_protocol, str3.m_protocol, StringComparison.OrdinalIgnoreCase) != 0) || !str2.m_directory.IsSubsetOf(str3.m_directory)) { return false; } if (str2.m_localSite != null) { return str2.m_localSite.IsSubsetOf(str3.m_localSite); } if (str2.m_port != str3.m_port) { return false; } return ((str3.m_siteString != null) && str2.m_siteString.IsSubsetOf(str3.m_siteString)); }
public virtual bool IsSubsetOf( SiteString operand ) { return this.IsSubsetOf( operand, true ); }
private Site(SiteString name) { Contract.Assert(name != null); m_name = name; }
public virtual SiteString Union( SiteString operand ) { if (operand == null) { return this; } else if (this.IsSubsetOf( operand )) { return operand.Copy(); } else if (operand.IsSubsetOf( this )) { return this.Copy(); } else { return null; } }
internal bool Equals(SiteString ss, bool ignoreCase) { if (this.m_site == null) { return (ss.m_site == null); } if (ss.m_site == null) { return false; } return (this.IsSubsetOf(ss, ignoreCase) && ss.IsSubsetOf(this, ignoreCase)); }