/// <summary>
        /// Start a transfer for local data
        /// </summary>
        /// <param name="fileStream">A data stream</param>
        /// <param name="size">The stream length</param>
        /// <param name="name">A file name representing the data</param>
        public void StartFileTransfer(System.IO.Stream fileStream, long size, string name)
        {
            var fileTransfer = new ExistingFileTransfer()
            {
                FileStream = fileStream,
                FileLength = size,
                FileName = name
            };

            StartFileTransfer(fileTransfer);
        }
Beispiel #2
0
        public static Transfer GetForRequest(Network.Entities.FileTransferRequest req)
        {
            Transfer t = null;

            switch (req.FileType)
            {
                case "data":
                    t = new UnsavedBinaryTransfer();
                    break;
                case "file":
                    t = new ExistingFileTransfer();
                    break;
                case "cont":
                    t = new ContactTransfer();
                    break;
                default:
                    break;
            }

            if (t != null)
            {
                t.FileName = req.FileName;
                t.FileLength = req.FileLength;
            }

            t.IsReading = false;
            t.PrepareForWriting();

            return t;
        }
        /// <summary>
        /// Start a transfer for a local file
        /// </summary>
        /// <param name="localFilePath">Path to a local file</param>
        public void StartFileTransfer(string localFilePath)
        {
            var fileTransfer = new ExistingFileTransfer()
            {
                AbsoluteFilePath = localFilePath
            };

            StartFileTransfer(fileTransfer);
        }