/// <summary>Initializes a new instance of the <see cref="T:System.Security.Policy.CodeConnectAccess" /> class. </summary> /// <param name="allowScheme">The URI scheme represented by the current instance.</param> /// <param name="allowPort">The port represented by the current instance.</param> /// <exception cref="T:System.ArgumentOutOfRangeException"> /// <paramref name="allowScheme" /> is <see langword="null" />.-or- /// <paramref name="allowScheme" /> is an empty string ("").-or- /// <paramref name="allowScheme" /> contains characters that are not permitted in schemes.-or- /// <paramref name="allowPort" /> is less than 0.-or- /// <paramref name="allowPort" /> is greater than 65,535.</exception> // Token: 0x06002968 RID: 10600 RVA: 0x000987B5 File Offset: 0x000969B5 public CodeConnectAccess(string allowScheme, int allowPort) { if (!CodeConnectAccess.IsValidScheme(allowScheme)) { throw new ArgumentOutOfRangeException("allowScheme"); } this.SetCodeConnectAccess(allowScheme.ToLower(CultureInfo.InvariantCulture), allowPort); }
internal CodeConnectAccess(string allowScheme, string allowPort) { if (allowScheme == null || allowScheme.Length == 0) { throw new ArgumentNullException("allowScheme"); } if (allowPort == null || allowPort.Length == 0) { throw new ArgumentNullException("allowPort"); } this._LowerCaseScheme = allowScheme.ToLower(CultureInfo.InvariantCulture); if (this._LowerCaseScheme == CodeConnectAccess.OriginScheme) { this._LowerCaseScheme = CodeConnectAccess.OriginScheme; } else if (this._LowerCaseScheme == CodeConnectAccess.AnyScheme) { this._LowerCaseScheme = CodeConnectAccess.AnyScheme; } else if (!CodeConnectAccess.IsValidScheme(this._LowerCaseScheme)) { throw new ArgumentOutOfRangeException("allowScheme"); } this._LowerCasePort = allowPort.ToLower(CultureInfo.InvariantCulture); if (this._LowerCasePort == "$default") { this._IntPort = CodeConnectAccess.DefaultPort; } else if (this._LowerCasePort == "$origin") { this._IntPort = CodeConnectAccess.OriginPort; } else { this._IntPort = int.Parse(allowPort, (IFormatProvider)CultureInfo.InvariantCulture); if (this._IntPort < 0 || this._IntPort > (int)ushort.MaxValue) { throw new ArgumentOutOfRangeException("allowPort"); } this._LowerCasePort = this._IntPort.ToString((IFormatProvider)CultureInfo.InvariantCulture); } }
// // Added public stuff for programmatic support of the talkback access // The connectAccess can be null means an empty access (no access) is added // public void AddConnectAccess(string originScheme, CodeConnectAccess connectAccess) { if (originScheme == null) { throw new ArgumentNullException("originScheme"); } if (originScheme != AbsentOriginScheme && originScheme != AnyOtherOriginScheme && !CodeConnectAccess.IsValidScheme(originScheme)) { throw new ArgumentOutOfRangeException("originScheme"); } if (originScheme == AbsentOriginScheme && connectAccess.IsOriginScheme) { throw new ArgumentOutOfRangeException("connectAccess"); } if (m_schemesList == null) { m_schemesList = new ArrayList(); m_accessList = new ArrayList(); } originScheme = originScheme.ToLower(CultureInfo.InvariantCulture); for (int i = 0; i < m_schemesList.Count; ++i) { if ((string)m_schemesList[i] == originScheme) { // originScheme entry is found and we may want to add nothing to it. if (connectAccess == null) { return; } ArrayList list = (ArrayList)m_accessList[i]; for (i = 0; i < list.Count; ++i) { if (((CodeConnectAccess)list[i]).Equals(connectAccess)) { return; } } list.Add(connectAccess); return; } } // originScheme entry is not found, create a new one. m_schemesList.Add(originScheme); ArrayList newOriginSchemeList = new ArrayList(); m_accessList.Add(newOriginSchemeList); // we may want to keep it empty. if (connectAccess != null) { newOriginSchemeList.Add(connectAccess); } }
/// <summary>Adds the specified connection access to the current code group.</summary> /// <param name="originScheme">A <see cref="T:System.String" /> containing the scheme to match against the code's scheme.</param> /// <param name="connectAccess">A <see cref="T:System.Security.Policy.CodeConnectAccess" /> that specifies the scheme and port code can use to connect back to its origin server.</param> /// <exception cref="T:System.ArgumentNullException"> /// <paramref name="originScheme" /> is <see langword="null" />.</exception> /// <exception cref="T:System.ArgumentOutOfRangeException"> /// <paramref name="originScheme" /> contains characters that are not permitted in schemes.-or- /// <paramref name="originScheme" /> = <see cref="F:System.Security.Policy.NetCodeGroup.AbsentOriginScheme" /> and <paramref name="connectAccess" /> specifies <see cref="F:System.Security.Policy.CodeConnectAccess.OriginScheme" /> as its scheme.</exception> // Token: 0x06002980 RID: 10624 RVA: 0x00098BA4 File Offset: 0x00096DA4 public void AddConnectAccess(string originScheme, CodeConnectAccess connectAccess) { if (originScheme == null) { throw new ArgumentNullException("originScheme"); } if (originScheme != NetCodeGroup.AbsentOriginScheme && originScheme != NetCodeGroup.AnyOtherOriginScheme && !CodeConnectAccess.IsValidScheme(originScheme)) { throw new ArgumentOutOfRangeException("originScheme"); } if (originScheme == NetCodeGroup.AbsentOriginScheme && connectAccess.IsOriginScheme) { throw new ArgumentOutOfRangeException("connectAccess"); } if (this.m_schemesList == null) { this.m_schemesList = new ArrayList(); this.m_accessList = new ArrayList(); } originScheme = originScheme.ToLower(CultureInfo.InvariantCulture); int i = 0; while (i < this.m_schemesList.Count) { if ((string)this.m_schemesList[i] == originScheme) { if (connectAccess == null) { return; } ArrayList arrayList = (ArrayList)this.m_accessList[i]; for (i = 0; i < arrayList.Count; i++) { if (((CodeConnectAccess)arrayList[i]).Equals(connectAccess)) { return; } } arrayList.Add(connectAccess); return; } else { i++; } } this.m_schemesList.Add(originScheme); ArrayList arrayList2 = new ArrayList(); this.m_accessList.Add(arrayList2); if (connectAccess != null) { arrayList2.Add(connectAccess); } }
/// <summary>将指定的连接访问权限添加到当前代码组。</summary> /// <param name="originScheme">一个 <see cref="T:System.String" />,包含要与代码的方案进行匹配的方案。</param> /// <param name="connectAccess">一个 <see cref="T:System.Security.Policy.CodeConnectAccess" />,指定代码可用来连接回其原始服务器的方案和端口。</param> /// <exception cref="T:System.ArgumentNullException"> /// <paramref name="originScheme" /> 为 null。</exception> /// <exception cref="T:System.ArgumentOutOfRangeException">一个 <paramref name="originScheme" />,包含方案中不允许的字符。- 或 -<paramref name="originScheme" /> = <see cref="F:System.Security.Policy.NetCodeGroup.AbsentOriginScheme" /> 和 <paramref name="connectAccess" /> 指定 <see cref="F:System.Security.Policy.CodeConnectAccess.OriginScheme" /> 作为其方案。</exception> public void AddConnectAccess(string originScheme, CodeConnectAccess connectAccess) { if (originScheme == null) { throw new ArgumentNullException("originScheme"); } if (originScheme != NetCodeGroup.AbsentOriginScheme && originScheme != NetCodeGroup.AnyOtherOriginScheme && !CodeConnectAccess.IsValidScheme(originScheme)) { throw new ArgumentOutOfRangeException("originScheme"); } if (originScheme == NetCodeGroup.AbsentOriginScheme && connectAccess.IsOriginScheme) { throw new ArgumentOutOfRangeException("connectAccess"); } if (this.m_schemesList == null) { this.m_schemesList = new ArrayList(); this.m_accessList = new ArrayList(); } originScheme = originScheme.ToLower(CultureInfo.InvariantCulture); for (int index1 = 0; index1 < this.m_schemesList.Count; ++index1) { if ((string)this.m_schemesList[index1] == originScheme) { if (connectAccess == null) { return; } ArrayList arrayList = (ArrayList)this.m_accessList[index1]; for (int index2 = 0; index2 < arrayList.Count; ++index2) { if (((CodeConnectAccess)arrayList[index2]).Equals((object)connectAccess)) { return; } } arrayList.Add((object)connectAccess); return; } } this.m_schemesList.Add((object)originScheme); ArrayList arrayList1 = new ArrayList(); this.m_accessList.Add((object)arrayList1); if (connectAccess == null) { return; } arrayList1.Add((object)connectAccess); }
public void AddConnectAccess(string originScheme, CodeConnectAccess connectAccess) { if (originScheme == null) { throw new ArgumentNullException("originScheme"); } if (((originScheme != AbsentOriginScheme) && (originScheme != AnyOtherOriginScheme)) && !CodeConnectAccess.IsValidScheme(originScheme)) { throw new ArgumentOutOfRangeException("originScheme"); } if ((originScheme == AbsentOriginScheme) && connectAccess.IsOriginScheme) { throw new ArgumentOutOfRangeException("connectAccess"); } if (this.m_schemesList == null) { this.m_schemesList = new ArrayList(); this.m_accessList = new ArrayList(); } originScheme = originScheme.ToLower(CultureInfo.InvariantCulture); for (int i = 0; i < this.m_schemesList.Count; i++) { if (((string)this.m_schemesList[i]) == originScheme) { if (connectAccess != null) { ArrayList list = (ArrayList)this.m_accessList[i]; for (i = 0; i < list.Count; i++) { if (((CodeConnectAccess)list[i]).Equals(connectAccess)) { return; } } list.Add(connectAccess); } return; } } this.m_schemesList.Add(originScheme); ArrayList list2 = new ArrayList(); this.m_accessList.Add(list2); if (connectAccess != null) { list2.Add(connectAccess); } }