[Modify] Polish it
This commit is contained in:
parent
747fc0557e
commit
1e288d344d
@ -2802,13 +2802,13 @@ namespace WebSocketSharp
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends the specified <paramref name="file"/> as the binary data
|
/// Sends the specified <paramref name="fileInfo"/> as the binary data
|
||||||
/// asynchronously using the WebSocket connection.
|
/// asynchronously using the WebSocket connection.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// This method does not wait for the send to be complete.
|
/// This method does not wait for the send to be complete.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="file">
|
/// <param name="fileInfo">
|
||||||
/// A <see cref="FileInfo"/> that represents the file to send.
|
/// A <see cref="FileInfo"/> that represents the file to send.
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <param name="completed">
|
/// <param name="completed">
|
||||||
@ -2820,27 +2820,27 @@ namespace WebSocketSharp
|
|||||||
/// The current state of the connection is not Open.
|
/// The current state of the connection is not Open.
|
||||||
/// </exception>
|
/// </exception>
|
||||||
/// <exception cref="ArgumentNullException">
|
/// <exception cref="ArgumentNullException">
|
||||||
/// <paramref name="file"/> is <see langword="null"/>.
|
/// <paramref name="fileInfo"/> is <see langword="null"/>.
|
||||||
/// </exception>
|
/// </exception>
|
||||||
/// <exception cref="ArgumentException">
|
/// <exception cref="ArgumentException">
|
||||||
/// <paramref name="file"/> cannot be opened to read.
|
/// <paramref name="fileInfo"/> cannot be opened to read.
|
||||||
/// </exception>
|
/// </exception>
|
||||||
public void SendAsync (FileInfo file, Action<bool> completed)
|
public void SendAsync (FileInfo fileInfo, Action<bool> completed)
|
||||||
{
|
{
|
||||||
if (_readyState != WebSocketState.Open) {
|
if (_readyState != WebSocketState.Open) {
|
||||||
var msg = "The current state of the connection is not Open.";
|
var msg = "The current state of the connection is not Open.";
|
||||||
throw new InvalidOperationException (msg);
|
throw new InvalidOperationException (msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file == null)
|
if (fileInfo == null)
|
||||||
throw new ArgumentNullException ("file");
|
throw new ArgumentNullException ("fileInfo");
|
||||||
|
|
||||||
if (!file.Exists)
|
if (!fileInfo.Exists)
|
||||||
throw new ArgumentException ("The file does not exist.", "file");
|
throw new ArgumentException ("The file does not exist.", "fileInfo");
|
||||||
|
|
||||||
FileStream stream;
|
FileStream stream;
|
||||||
if (!file.TryOpenRead (out stream))
|
if (!fileInfo.TryOpenRead (out stream))
|
||||||
throw new ArgumentException ("Cannot be opened to read.", "file");
|
throw new ArgumentException ("The file could not be opened.", "fileInfo");
|
||||||
|
|
||||||
sendAsync (Opcode.Binary, stream, completed);
|
sendAsync (Opcode.Binary, stream, completed);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user