Transfer() public static méthode

Transfer from a source Uri stream to destination Stream. Uris may contain username and password information -- this will be used to make the connection.
public static Transfer ( Uri From ) : Stream
From System.Uri Source data stream
Résultat Stream
        private void SendChunk(ChunkDetail chunk)
        {
            string frag = "-" + chunk.ChunkIndex.ToString("00000") + ".ts";
            string fn   = pre + frag;


            using (Stream fs = File.Open(chunk.SourceFilePath, FileMode.Open)) {
                TransferAgent.Transfer(fs, new Uri(dest + fn));
            }
            OnUploadComplete(this, new ChunkUploadedEventArgs()
            {
                ChunkIndex = chunk.ChunkIndex, ChunkDuration = chunk.ChunkDuration, SourceFilePath = chunk.SourceFilePath
            });
        }
Exemple #2
0
        protected void UploadAction(object o)
        {
            try {
                string dir      = BaseDirectory;
                string filename = Path.Combine(dir, PlaylistFilename);
                TransferAgent.Transfer(new Uri(filename, UriKind.Absolute), new Uri(PlaylistDestination, UriKind.Absolute));

                filename += ".gz";                 // upload compressed version
                TransferAgent.Transfer(new Uri(filename, UriKind.Absolute), new Uri(PlaylistDestination + ".gz", UriKind.Absolute));

                WaitingUploads = 0;                 // any transfer is as good as all.
                Console.WriteLine("Uploaded new playlist");
            } catch {
                // Some sort of error notification might help!
                Console.WriteLine("Missed a playlist upload");
                TransportPlaylist();                 // try again!
            }
        }