Removed throwing the exception in from Ext.EqualsWith method

This commit is contained in:
sta 2014-11-30 15:29:11 +09:00
parent e7bb146394
commit 477ef2277e
2 changed files with 6 additions and 9 deletions

View File

@ -424,7 +424,7 @@ namespace WebSocketSharp
/// <summary> /// <summary>
/// Determines whether the specified <see cref="int"/> equals the specified <see cref="char"/>, /// Determines whether the specified <see cref="int"/> equals the specified <see cref="char"/>,
/// and invokes the specified Action&lt;int&gt; delegate at the same time. /// and invokes the specified <c>Action&lt;int&gt;</c> delegate at the same time.
/// </summary> /// </summary>
/// <returns> /// <returns>
/// <c>true</c> if <paramref name="value"/> equals <paramref name="c"/>; /// <c>true</c> if <paramref name="value"/> equals <paramref name="c"/>;
@ -437,18 +437,12 @@ namespace WebSocketSharp
/// A <see cref="char"/> to compare. /// A <see cref="char"/> to compare.
/// </param> /// </param>
/// <param name="action"> /// <param name="action">
/// An Action&lt;int&gt; delegate that references the method(s) called at /// An <c>Action&lt;int&gt;</c> delegate that references the method(s) called
/// the same time as comparing. An <see cref="int"/> parameter to pass to /// at the same time as comparing. An <see cref="int"/> parameter to pass to
/// the method(s) is <paramref name="value"/>. /// the method(s) is <paramref name="value"/>.
/// </param> /// </param>
/// <exception cref="ArgumentOutOfRangeException">
/// <paramref name="value"/> isn't between 0 and 255.
/// </exception>
internal static bool EqualsWith (this int value, char c, Action<int> action) internal static bool EqualsWith (this int value, char c, Action<int> action)
{ {
if (value < 0 || value > 255)
throw new ArgumentOutOfRangeException ("value");
action (value); action (value);
return value == c - 0; return value == c - 0;
} }

View File

@ -122,6 +122,9 @@ namespace WebSocketSharp
var buff = new List<byte> (); var buff = new List<byte> ();
var cnt = 0; var cnt = 0;
Action<int> add = i => { Action<int> add = i => {
if (i == -1)
throw new EndOfStreamException ("The header cannot be read from the data source.");
buff.Add ((byte) i); buff.Add ((byte) i);
cnt++; cnt++;
}; };