本文整理汇总了C#中System.IO.FileInfo.CheckIfValidSendData方法的典型用法代码示例。如果您正苦于以下问题:C# FileInfo.CheckIfValidSendData方法的具体用法?C# FileInfo.CheckIfValidSendData怎么用?C# FileInfo.CheckIfValidSendData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.FileInfo
的用法示例。
在下文中一共展示了FileInfo.CheckIfValidSendData方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendAsync
/// <summary>
/// Sends the specified <paramref name="file"/> as a binary data asynchronously
/// using the WebSocket connection.
/// </summary>
/// <remarks>
/// This method doesn't wait for the send to be complete.
/// </remarks>
/// <param name="file">
/// A <see cref="FileInfo"/> that represents the file to send.
/// </param>
/// <param name="completed">
/// An Action<bool> delegate that references the method(s) called when the send is
/// complete. A <see cref="bool"/> passed to this delegate is <c>true</c> if the send is
/// complete successfully; otherwise, <c>false</c>.
/// </param>
public void SendAsync(FileInfo file, Action<bool> completed)
{
var msg = _readyState.CheckIfOpen () ?? file.CheckIfValidSendData ();
if (msg != null) {
_logger.Error (msg);
error (msg);
return;
}
sendAsync (Opcode.Binary, file.OpenRead (), completed);
}
示例2: Send
/// <summary>
/// Sends the specified <paramref name="file"/> as a binary data
/// using the WebSocket connection.
/// </summary>
/// <param name="file">
/// A <see cref="FileInfo"/> that represents the file to send.
/// </param>
public void Send(FileInfo file)
{
var msg = _readyState.CheckIfOpen () ?? file.CheckIfValidSendData ();
if (msg != null) {
_logger.Error (msg);
error (msg);
return;
}
send (Opcode.Binary, file.OpenRead ());
}
示例3: SendAsync
/// <summary>
/// Sends the specified <paramref name="file"/> as a binary data
/// asynchronously using the WebSocket connection.
/// </summary>
/// <remarks>
/// This method doesn't wait for the send to be complete.
/// </remarks>
/// <param name="file">
/// A <see cref="FileInfo"/> that represents the file to send.
/// </param>
/// <param name="completed">
/// An Action<bool> delegate that references the method(s) called when
/// the send is complete. A <see cref="bool"/> passed to this delegate is
/// <c>true</c> if the send is complete successfully; otherwise, <c>false</c>.
/// </param>
public void SendAsync(FileInfo file, Action<bool> completed)
{
var msg = checkIfCanSend (() => file.CheckIfValidSendData ());
if (msg != null) {
_logger.Error (msg);
error (msg);
return;
}
sendAsync (Opcode.BINARY, file.OpenRead (), completed);
}
示例4: SendAsync
/// <summary>
/// Sends the specified <paramref name="file"/> as binary data asynchronously using
/// the WebSocket connection.
/// </summary>
/// <remarks>
/// This method doesn't wait for the send to be complete.
/// </remarks>
/// <param name="file">
/// A <see cref="FileInfo"/> that represents the file to send.
/// </param>
/// <param name="completed">
/// An <c>Action<bool></c> delegate that references the method(s) called when
/// the send is complete. A <see cref="bool"/> passed to this delegate is <c>true</c>
/// if the send is complete successfully.
/// </param>
public void SendAsync(FileInfo file, Action<bool> completed)
{
var msg = _readyState.CheckIfAvailable (false, true, false, false) ??
file.CheckIfValidSendData ();
if (msg != null) {
_logger.Error (msg);
error ("An error has occurred in sending the data.", null);
return;
}
sendAsync (Opcode.Binary, file.OpenRead (), completed);
}
示例5: Send
/// <summary>
/// Sends the specified <paramref name="file"/> as a binary data
/// using the WebSocket connection.
/// </summary>
/// <param name="file">
/// A <see cref="FileInfo"/> that represents the file to send.
/// </param>
public void Send(FileInfo file)
{
var msg = checkIfCanSend (() => file.CheckIfValidSendData ());
if (msg != null) {
_logger.Error (msg);
error (msg);
return;
}
send (Opcode.BINARY, file.OpenRead ());
}