Esempio n. 1
0
        /// <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&lt;bool&gt; 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);
        }
Esempio n. 2
0
        /// <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 ());
        }
Esempio n. 3
0
        /// <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&lt;bool&gt; 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);
        }
Esempio n. 4
0
        /// <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&lt;bool&gt;</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);
        }
Esempio n. 5
0
        /// <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 ());
        }