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