Esempio n. 1
0
 public static void Upload(IPEndPoint serverEndPoint, Stream localStream, string remoteFilename, Settings settings = null)
 {
     using (var session = new TFTPClient(serverEndPoint, settings))
     {
         session.Upload(remoteFilename, localStream);
     }
 }
Esempio n. 2
0
 private static void OnTrace(object sender, TFTPClient.TraceEventArgs args)
 {
     Console.WriteLine(args.Message);
 }
Esempio n. 3
0
 private void OnProgress(object sender, TFTPClient.ProgressEventArgs e)
 {
     if (InvokeRequired)
     {
         Invoke(new EventHandler<TFTPClient.ProgressEventArgs>(OnProgress), sender, e);
     }
     else
     {
         toolStripStatusLabel1.Text = string.Format("({0}/{1} bytes) {2} '{3}'", e.Transferred, (e.TransferSize >= 0) ? e.TransferSize.ToString() : "?", e.IsUpload ? "Uploading" : "Downloading", e.Filename);
         toolStripProgressBar1.Value = (e.TransferSize > 0) ? (int)(100.0 * e.Transferred / e.TransferSize) : 0;
     }
 }
Esempio n. 4
0
 private static void OnProgress(object sender, TFTPClient.ProgressEventArgs args)
 {
     Console.WriteLine("'{0}': {1} of {2}", args.Filename, args.Transferred, args.TransferSize >= 0 ? args.TransferSize.ToString() : "?");
 }
Esempio n. 5
0
 public static void Upload(IPEndPoint serverEndPoint, Stream localStream, string remoteFilename, Settings settings=null)
 {
     using (var session = new TFTPClient(serverEndPoint, settings))
     {
         session.Upload(remoteFilename, localStream);
     }
 }