public void RelayError(ToxErrorFileSend error) { if (error != ToxErrorFileSend.Ok) { Debug.WriteLine("An unexpected error occurred when sending a file: " + error); } }
internal static extern uint FileSend(ToxHandle tox, uint friendNumber, ToxFileKind kind, ulong fileSize, byte[] fileId, byte[] fileName, uint fileNameLength, ref ToxErrorFileSend error);
public void RelayError(ToxErrorFileSend error) { if (error != ToxErrorFileSend.Ok) Debug.WriteLine("An unexpected error occurred when sending a file: " + error); }
/// <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; }
/// <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; }
public static extern UInt32 Send(ToxHandle tox, UInt32 friendNumber, ToxFileKind kind, UInt64 fileSize, Byte[] fileId, Byte[] fileName, SizeT fileNameLength, ref ToxErrorFileSend error);