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); }
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; }
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); }
internal void AddDownload(TransferEventArgs download) { Downloads.InternalAdd(download); }
internal void AddUpload(TransferEventArgs upload) { Uploads.InternalAdd(upload); }
private void RaiseFileTransferredEvent(TransferEventArgs args) { Logger.WriteLine("FileTransferredEvent: [{0}]", args.FileName); if (FileTransferred != null) { FileTransferred(this, args); } }
private void AddSynchronizationTransfer(SynchronizationResult result, bool transferIsUpload, TransferEventArgs transfer) { if (transferIsUpload) { result.AddUpload(transfer); } else { result.AddDownload(transfer); } RaiseFileTransferredEvent(transfer); }
private void AddTransfer(TransferOperationResult result, TransferEventArgs args) { if (args != null) { result.AddTransfer(args); RaiseFileTransferredEvent(args); } }
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); } }
internal void AddTransfer(TransferEventArgs operation) { Transfers.InternalAdd(operation); }
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); } } }
/// <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)"); } }