示例#1
0
 public FileTransfer(int fileNumber, int friendNumber, ToxFileKind kind, FileTransferDirection direction)
 {
     FileNumber   = fileNumber;
     FriendNumber = friendNumber;
     Kind         = kind;
     Direction    = direction;
 }
示例#2
0
 public FileSendRequestEventArgs(uint friendNumber, uint fileNumber, ToxFileKind kind, ulong fileSize, string fileName)
     : base(friendNumber, fileNumber)
 {
     this.FileSize = fileSize;
     this.FileName = fileName;
     this.FileKind = kind;
 }
示例#3
0
 public FileSendRequestEventArgs(int friendNumber, int fileNumber, ToxFileKind kind, long fileSize, string fileName)
     : base(friendNumber, fileNumber)
 {
     FileSize = fileSize;
     FileName = fileName;
     FileKind = kind;
 }
示例#4
0
 public FileTransfer(Tox tox, int fileNumber, int friendNumber, ToxFileKind kind, long fileSize, string fileName, string path)
 {
     Tox          = tox;
     FileNumber   = fileNumber;
     FriendNumber = friendNumber;
     Kind         = kind;
     FileSize     = fileSize;
     FileName     = fileName;
     Path         = path;
 }
示例#5
0
 public FileTransfer(Tox tox, int fileNumber, int friendNumber, ToxFileKind kind, long fileSize, string fileName, string path)
 {
     Tox = tox;
     FileNumber = fileNumber;
     FriendNumber = friendNumber;
     Kind = kind;
     FileSize = fileSize;
     FileName = fileName;
     Path = path;
 }
示例#6
0
        public ToxFileInfo FileSend(int friendNumber, ToxFileKind kind, long fileSize, string fileName, byte[] fileId,
                                    out bool success)
        {
            ToxErrorFileSend error;
            var retVal = _tox.FileSend(friendNumber, kind, fileSize, fileName, fileId, out error);

            ToxErrorViewModel.Instance.RelayError(error);
            success = error == ToxErrorFileSend.Ok;
            return(retVal);
        }
示例#7
0
 internal static extern uint FileSend(ToxHandle tox, uint friendNumber, ToxFileKind kind, ulong fileSize, byte[] fileId, byte[] fileName, uint fileNameLength, ref ToxErrorFileSend error);
示例#8
0
 public FileSendRequestEventArgs(int friendNumber, int fileNumber, ToxFileKind kind, long fileSize, string fileName)
     : base(friendNumber, fileNumber)
 {
     FileSize = fileSize;
     FileName = fileName;
     FileKind = kind;
 }
示例#9
0
 public ToxFileInfo FileSend(int friendNumber, ToxFileKind kind, long fileSize, string fileName, byte[] fileId,
                             out bool success)
 {
     success = true;
     return(null);
 }
示例#10
0
 internal static extern uint FileSend(ToxHandle tox, uint friendNumber, ToxFileKind kind, ulong fileSize, byte[] fileId, byte[] fileName, uint fileNameLength, ref ToxErrorFileSend error);
示例#11
0
 public FileReceiver(Tox tox, int fileNumber, int friendNumber, ToxFileKind kind, long fileSize, string fileName, string path)
     : base(tox, fileNumber, friendNumber, kind, fileSize, fileName, path)
 {
 }
示例#12
0
 public FileSender(Tox tox, int fileNumber, int friendNumber, ToxFileKind kind, long fileSize, string fileName, string path)
     : base(tox, fileNumber, friendNumber, kind, fileSize, fileName, path)
 {
 }
示例#13
0
 public static extern UInt32 Send(ToxHandle tox, UInt32 friendNumber, ToxFileKind kind, UInt64 fileSize, Byte[] fileId, Byte[] fileName, SizeT fileNameLength, ref ToxErrorFileSend error);
示例#14
0
文件: Tox.cs 项目: hexafluoride/Detox
 /// <summary>
 /// Send a file transmission request.
 /// </summary>
 /// <param name="friendNumber">The friend number to send the request to.</param>
 /// <param name="kind">The kind of file that will be transferred.</param>
 /// <param name="fileSize">The size of the file that will be transferred.</param>
 /// <param name="fileName">The filename of the file that will be transferred.</param>
 /// <param name="fileId">The id to identify this transfer with. Should be ToxConstants.FileIdLength bytes long.</param>
 /// <returns>Info about the file transfer on success.</returns>
 public ToxFileInfo FileSend(int friendNumber, ToxFileKind kind, long fileSize, string fileName, byte[] fileId)
 {
     var error = ToxErrorFileSend.Ok;
     return FileSend(friendNumber, kind, fileSize, fileName, fileId, out error);
 }
示例#15
0
文件: Tox.cs 项目: hexafluoride/Detox
        /// <summary>
        /// Send a file transmission request.
        /// </summary>
        /// <param name="friendNumber">The friend number to send the request to.</param>
        /// <param name="kind">The kind of file that will be transferred.</param>
        /// <param name="fileSize">The size of the file that will be transferred.</param>
        /// <param name="fileName">The filename of the file that will be transferred.</param>
        /// <param name="fileId">The id to identify this transfer with. Should be ToxConstants.FileIdLength bytes long.</param>
        /// <param name="error"></param>
        /// <returns>Info about the file transfer on success.</returns>
        public ToxFileInfo FileSend(int friendNumber, ToxFileKind kind, long fileSize, string fileName, byte[] fileId, out ToxErrorFileSend error)
        {
            ThrowIfDisposed();

            if (fileId.Length != ToxConstants.FileIdLength)
                throw new ArgumentException("fileId should be exactly ToxConstants.FileIdLength bytes long", "fileId");

            error = ToxErrorFileSend.Ok;
            byte[] fileNameBytes = Encoding.UTF8.GetBytes(fileName);
            int fileNumber = (int)ToxFunctions.FileSend(_tox, (uint)friendNumber, kind, (ulong)fileSize, fileId, fileNameBytes, (uint)fileNameBytes.Length, ref error);

            if (error == ToxErrorFileSend.Ok)
                return new ToxFileInfo(fileNumber, fileId);

            return null;
        }
示例#16
0
文件: Tox.cs 项目: hexafluoride/Detox
        /// <summary>
        /// Send a file transmission request.
        /// </summary>
        /// <param name="friendNumber">The friend number to send the request to.</param>
        /// <param name="kind">The kind of file that will be transferred.</param>
        /// <param name="fileSize">The size of the file that will be transferred.</param>
        /// <param name="fileName">The filename of the file that will be transferred.</param>
        /// <param name="error"></param>
        /// <returns>Info about the file transfer on success.</returns>
        public ToxFileInfo FileSend(int friendNumber, ToxFileKind kind, long fileSize, string fileName, out ToxErrorFileSend error)
        {
            ThrowIfDisposed();

            error = ToxErrorFileSend.Ok;
            byte[] fileNameBytes = Encoding.UTF8.GetBytes(fileName);
            int fileNumber = (int)ToxFunctions.FileSend(_tox, (uint)friendNumber, kind, (ulong)fileSize, null, fileNameBytes, (uint)fileNameBytes.Length, ref error);

            if (error == ToxErrorFileSend.Ok)
                return new ToxFileInfo(fileNumber, FileGetId(friendNumber, fileNumber));

            return null;
        }
示例#17
0
 public FileSender(Tox tox, int fileNumber, int friendNumber, ToxFileKind kind, long fileSize, string fileName, Stream stream)
     : base(tox, fileNumber, friendNumber, kind, fileSize, fileName, string.Empty)
 {
     _stream = stream;
 }
示例#18
0
 public ToxFileInfo FileSend(int friendNumber, ToxFileKind kind, long fileSize, string fileName, byte[] fileId,
     out bool success)
 {
     ToxErrorFileSend error;
     var retVal = _tox.FileSend(friendNumber, kind, fileSize, fileName, fileId, out error);
     ToxErrorViewModel.Instance.RelayError(error);
     success = error == ToxErrorFileSend.Ok;
     return retVal;
 }
示例#19
0
 public FileSender(Tox tox, int fileNumber, int friendNumber, ToxFileKind kind, long fileSize, string fileName, Stream stream)
     : base(tox, fileNumber, friendNumber, kind, fileSize, fileName, string.Empty)
 {
     _stream = stream;
 }