コード例 #1
0
        internal static TransferEventArgs Read(CustomLogReader areader)
        {
            TransferEventArgs args = new TransferEventArgs();

            using (ElementLogReader reader = new ElementLogReader(areader))
            {
                while (reader.Read(0))
                {
                    string value;
                    if (reader.GetEmptyElementValue("filename", out value))
                    {
                        args.FileName = value;
                    }
                    else if (reader.GetEmptyElementValue("destination", out value))
                    {
                        args.Destination = value;
                    }
                    else if (SessionRemoteException.IsResult(reader))
                    {
                        args.Error = SessionRemoteException.ReadResult(reader);
                    }
                }
            }

            return(args);
        }
コード例 #2
0
ファイル: TransferEventArgs.cs プロジェクト: Rupan/winscp
        internal static TransferEventArgs Read(CustomLogReader areader)
        {
            TransferEventArgs args = new TransferEventArgs();

            using (ElementLogReader reader = new ElementLogReader(areader))
            {
                while (reader.Read(0))
                {
                    string value;
                    if (reader.GetEmptyElementValue("filename", out value))
                    {
                        args.FileName = value;
                    }
                    else if (reader.GetEmptyElementValue("destination", out value))
                    {
                        args.Destination = value;
                    }
                    else if (SessionRemoteException.IsResult(reader))
                    {
                        args.Error = SessionRemoteException.ReadResult(reader);
                    }
                }
            }

            return args;
        }
コード例 #3
0
        internal static TransferEventArgs Read(ProgressSide side, CustomLogReader areader)
        {
            TransferEventArgs args = new TransferEventArgs()
            {
                Side = side
            };

            using (ElementLogReader reader = new ElementLogReader(areader))
            {
                while (reader.Read(0))
                {
                    if (reader.GetEmptyElementValue("filename", out string value))
                    {
                        args.FileName = value;
                    }
                    else if (reader.GetEmptyElementValue("destination", out value))
                    {
                        args.Destination = value;
                    }
                    else if (reader.GetEmptyElementValue("size", out value))
                    {
                        args.Length = long.Parse(value, CultureInfo.InvariantCulture);
                    }
                    else if (SessionRemoteException.IsResult(reader))
                    {
                        args.Error = SessionRemoteException.ReadResult(reader);
                    }
                }
            }

            return(args);
        }
コード例 #4
0
 internal void AddDownload(TransferEventArgs download)
 {
     Downloads.InternalAdd(download);
 }
コード例 #5
0
 internal void AddUpload(TransferEventArgs upload)
 {
     Uploads.InternalAdd(upload);
 }
コード例 #6
0
ファイル: Session.cs プロジェクト: Rupan/winscp
        private void RaiseFileTransferredEvent(TransferEventArgs args)
        {
            Logger.WriteLine("FileTransferredEvent: [{0}]", args.FileName);

            if (FileTransferred != null)
            {
                FileTransferred(this, args);
            }
        }
コード例 #7
0
ファイル: Session.cs プロジェクト: Rupan/winscp
 private void AddSynchronizationTransfer(SynchronizationResult result, bool transferIsUpload, TransferEventArgs transfer)
 {
     if (transferIsUpload)
     {
         result.AddUpload(transfer);
     }
     else
     {
         result.AddDownload(transfer);
     }
     RaiseFileTransferredEvent(transfer);
 }
コード例 #8
0
 internal void AddUpload(TransferEventArgs upload)
 {
     Uploads.InternalAdd(upload);
 }
コード例 #9
0
 internal void AddDownload(TransferEventArgs download)
 {
     Downloads.InternalAdd(download);
 }
コード例 #10
0
ファイル: Session.cs プロジェクト: thinkinnight/winscp
 private void AddTransfer(TransferOperationResult result, TransferEventArgs args)
 {
     if (args != null)
     {
         result.AddTransfer(args);
         RaiseFileTransferredEvent(args);
     }
 }
コード例 #11
0
ファイル: Util.cs プロジェクト: RemaxThailand/POS
        private static void FileTransferred(object sender, TransferEventArgs e)
        {
            if (e.Error == null)
            {
                Console.WriteLine("Upload of {0} succeeded", e.FileName);
            }
            else
            {
                Console.WriteLine("Upload of {0} failed: {1}", e.FileName, e.Error);
            }

            if (e.Chmod != null)
            {
                if (e.Chmod.Error == null)
                {
                    Console.WriteLine("Permisions of {0} set to {1}", e.Chmod.FileName, e.Chmod.FilePermissions);
                }
                else
                {
                    Console.WriteLine("Setting permissions of {0} failed: {1}", e.Chmod.FileName, e.Chmod.Error);
                }
            }
            else
            {
                Console.WriteLine("Permissions of {0} kept with their defaults", e.Destination);
            }

            if (e.Touch != null)
            {
                if (e.Touch.Error == null)
                {
                    Console.WriteLine("Timestamp of {0} set to {1}", e.Touch.FileName, e.Touch.LastWriteTime);
                }
                else
                {
                    Console.WriteLine("Setting timestamp of {0} failed: {1}", e.Touch.FileName, e.Touch.Error);
                }
            }
            else
            {
                // This should never happen during "local to remote" synchronization
                Console.WriteLine("Timestamp of {0} kept with its default (current time)", e.Destination);
            }
        }
コード例 #12
0
 internal void AddTransfer(TransferEventArgs operation)
 {
     Transfers.InternalAdd(operation);
 }
コード例 #13
0
        public static void FileTransferred(object sender, TransferEventArgs e)
        {
            if (e.Error == null)
            {
                fenetrePrincipale.textBox11.AppendText(e.FileName + " (ok)" + Environment.NewLine);

            }
            else
            {
                if (e.FileName.IndexOf("FSFLauncher") == 0)
                {
                    fenetrePrincipale.textBox11.AppendText("ERREUR :" + e.FileName + " (" + e.Error + ")" + Environment.NewLine);
                }
                else
                {
                    fenetrePrincipale.textBox11.AppendText("INFO  : Impossible de mettre a jour FSFLauncher.exe quand il est lancé" + Environment.NewLine);
                }
            }
        }
コード例 #14
0
 internal void AddTransfer(TransferEventArgs operation)
 {
     Transfers.InternalAdd(operation);
 }
コード例 #15
0
ファイル: WinSCPClient.cs プロジェクト: Gerrey/DataFeed
        /// <summary>
        /// 捕获文件传输过程中发生的事
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FileTransCatch(object sender, TransferEventArgs e)
        {
            if (e.Error == null)
            {

                build.AppendLine("Upload of "+e.FileName+" succeeded");
                stringFileNames.Add(e.FileName);
            }
            else
            {
                build.AppendLine("Upload of " + e.FileName + " failed:" + e.Error);
            }

            if (e.Chmod != null)
            {
                if (e.Chmod.Error == null)
                {
                    build.AppendLine("Permisions of "+e.Chmod.FileName+" set to "+e.Chmod.FilePermissions);
                }
                else
                {
                    build.AppendLine("Setting permissions of "+e.Chmod.FileName +" failed: "+ e.Chmod.Error);
                }
            }
            else
            {
                 build.AppendLine("Permissions of "+e.Destination+" kept with their defaults");
            }

            if (e.Touch != null)
            {
                if (e.Touch.Error == null)
                {
                    build.AppendLine("Timestamp of "+e.Touch.FileName+" set to "+e.Touch.LastWriteTime);
                }
                else
                {
                    build.AppendLine("Setting timestamp of "+e.Touch.FileName+" failed: "+ e.Touch.Error);
                }
            }
            else
            {
                // This should never happen during "local to remote" synchronization
                build.AppendLine("Timestamp of " + e.Destination + " kept with its default (current time)");
            }
        }