mirror of
https://github.com/winscp/winscp.git
synced 2026-10-24 02:28:55 +03:00
https://winscp.net/tracker/597
(cherry picked from commit 3442fc2b6c)
Source commit: 06eea0dc71a88d9a4109cbf702e81232ea3e791d
60 lines
2.0 KiB
C#
60 lines
2.0 KiB
C#
using System.Globalization;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace WinSCP
|
|
{
|
|
[Guid("772FACCC-0786-42E1-B1C8-F08D13C9CD07")]
|
|
[ClassInterface(Constants.ClassInterface)]
|
|
[ComVisible(true)]
|
|
public sealed class TransferEventArgs : FileOperationEventArgs
|
|
{
|
|
public ProgressSide Side { get; internal set; }
|
|
|
|
public string Destination { get; private set; }
|
|
|
|
public long Length { get; private set; }
|
|
|
|
public TouchEventArgs Touch { get; internal set; }
|
|
public ChmodEventArgs Chmod { get; internal set; }
|
|
public RemovalEventArgs Removal { get; internal set; }
|
|
|
|
internal const string UploadTag = "upload";
|
|
internal const string DownloadTag = "download";
|
|
internal const string MkDirTag = "mkdir";
|
|
|
|
internal TransferEventArgs()
|
|
{
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|
|
}
|