[Modify] Use it
This commit is contained in:
parent
bc4b4a9d8e
commit
f5ab00bf4e
@ -2696,15 +2696,19 @@ namespace WebSocketSharp
|
|||||||
/// </exception>
|
/// </exception>
|
||||||
public void Send (FileInfo file)
|
public void Send (FileInfo file)
|
||||||
{
|
{
|
||||||
if (file == null)
|
|
||||||
throw new ArgumentNullException ("file");
|
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
send (Opcode.Binary, file.OpenRead ());
|
if (file == null)
|
||||||
|
throw new ArgumentNullException ("file");
|
||||||
|
|
||||||
|
FileStream stream;
|
||||||
|
if (!file.TryOpenRead (out stream))
|
||||||
|
throw new ArgumentException ("Cannot be opened to read.", "file");
|
||||||
|
|
||||||
|
send (Opcode.Binary, stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user