Ejemplo n.º 1
0
        private void ProcessProgressEvent(ConsoleProgressEventStruct e)
        {
            using (_logger.CreateCallstack())
            {
                _logger.WriteLine(
                    "File Name [{0}] - Directory [{1}] - Overall Progress [{2}] - File Progress [{3}] - CPS [{4}]",
                    e.FileName, e.Directory, e.OverallProgress, e.FileProgress, e.CPS);

                if (!_cancel)
                {
                    FileTransferProgressEventArgs args = new FileTransferProgressEventArgs();

                    switch (e.Operation)
                    {
                    case ConsoleProgressEventStruct.ProgressOperation.Copy:
                        args.Operation = ProgressOperation.Transfer;
                        break;

                    default:
                        throw _logger.WriteException(new ArgumentOutOfRangeException("Unknown progress operation", (Exception)null));
                    }

                    switch (e.Side)
                    {
                    case ConsoleProgressEventStruct.ProgressSide.Local:
                        args.Side = ProgressSide.Local;
                        break;

                    case ConsoleProgressEventStruct.ProgressSide.Remote:
                        args.Side = ProgressSide.Remote;
                        break;

                    default:
                        throw _logger.WriteException(new ArgumentOutOfRangeException("Unknown progress side", (Exception)null));
                    }

                    args.FileName        = e.FileName;
                    args.Directory       = e.Directory;
                    args.OverallProgress = ((double)e.OverallProgress) / 100;
                    args.FileProgress    = ((double)e.FileProgress) / 100;
                    args.CPS             = (int)e.CPS;
                    args.Cancel          = false;

                    _session.ProcessProgress(args);
                }

                if (_cancel)
                {
                    e.Cancel = true;
                }
            }
        }
Ejemplo n.º 2
0
        private void ProcessProgressEvent(ConsoleProgressEventStruct e)
        {
            using (_logger.CreateCallstack())
            {
                _logger.WriteLine(
                    "File Name [{0}] - Directory [{1}] - Overall Progress [{2}] - File Progress [{3}] - CPS [{4}]",
                    e.FileName, e.Directory, e.OverallProgress, e.FileProgress, e.CPS);

                FileTransferProgressEventArgs args = new FileTransferProgressEventArgs();

                switch (e.Operation)
                {
                    case ConsoleProgressEventStruct.ProgressOperation.Copy:
                        args.Operation = ProgressOperation.Transfer;
                        break;

                    default:
                        throw new ArgumentOutOfRangeException("Unknown progress operation", (Exception)null);
                }

                switch (e.Side)
                {
                    case ConsoleProgressEventStruct.ProgressSide.Local:
                        args.Side = ProgressSide.Local;
                        break;

                    case ConsoleProgressEventStruct.ProgressSide.Remote:
                        args.Side = ProgressSide.Remote;
                        break;

                    default:
                        throw new ArgumentOutOfRangeException("Unknown progress side", (Exception)null);
                }

                args.FileName = e.FileName;
                args.Directory = e.Directory;
                args.OverallProgress = ((double)e.OverallProgress) / 100;
                args.FileProgress = ((double)e.FileProgress) / 100;
                args.CPS = (int) e.CPS;
                _session.ProcessProgress(args);
            }
        }
Ejemplo n.º 3
0
 private void Progress(FileTransferProgressEventArgs args)
 {
     if ((_progressHandling >= 0) && WantsProgress)
     {
         _fileTransferProgress(this, args);
     }
 }
Ejemplo n.º 4
0
 internal void ProcessProgress(FileTransferProgressEventArgs args)
 {
     ScheduleEvent(() => Progress(args));
 }
 private void SessionFileTransferProgress(object sender, WinSCP.FileTransferProgressEventArgs e)
 {
     Console.WriteLine("Synchronise file: {0}, progress: {1}", e.FileName, e.FileProgress);
 }
Ejemplo n.º 6
0
        private void SessionFileTransferProgress(object sender, FileTransferProgressEventArgs e)
        {
            // Print transfer progress
            LOG.InfoFormat("\r{0} ({1:P0} CPS = {2})", e.FileName, e.FileProgress, e.CPS);

            // Remember a name of the last file reported
            m_lastFileName = e.FileName;
        }
Ejemplo n.º 7
0
 public static void FileTransferProgress(object sender, FileTransferProgressEventArgs e)
 {
     fenetrePrincipale.label11.Text = ": " + e.FileName.Replace(cheminARMA3, "");
     fenetrePrincipale.label19.Text = ": " + Path.GetDirectoryName(e.Directory).Replace (cheminARMA3,"");
     fenetrePrincipale.progressBar2.Value = int.Parse(Math.Truncate(e.FileProgress * 100).ToString());
     fenetrePrincipale.progressBar3.Value = int.Parse(Math.Truncate(e.OverallProgress * 100).ToString());
 }
Ejemplo n.º 8
0
 private void SessionFileTransferProgress(object sender, FileTransferProgressEventArgs e)
 {
     bpLoadFile.Value = Convert.ToInt32(e.FileProgress * 100);
       bpLoadFile.Update();
 }