00001 using System;
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 namespace Tamir.SharpSsh
00034 {
00038 public abstract class SshTransferProtocolBase : SshBase, ITransferProtocol
00039 {
00040 public SshTransferProtocolBase(string host, string user, string password)
00041 : base(host, user, password)
00042 {
00043 }
00044
00045 public SshTransferProtocolBase(string host, string user)
00046 : base(host, user)
00047 {
00048 }
00049 #region ITransferProtocol Members
00050
00051 public abstract void Get(string fromFilePath, string toFilePath);
00052 public abstract void Put(string fromFilePath, string toFilePath);
00053 public abstract void Mkdir(string directory);
00054 public abstract void Cancel();
00055
00059 public event FileTransferEvent OnTransferStart;
00063 public event FileTransferEvent OnTransferEnd;
00067 public event FileTransferEvent OnTransferProgress;
00068
00076 protected void SendStartMessage(string src, string dst, int totalBytes, string msg)
00077 {
00078 if (OnTransferStart != null)
00079 OnTransferStart(src, dst, 0, totalBytes, msg);
00080 }
00081
00090 protected void SendEndMessage(string src, string dst, int transferredBytes, int totalBytes, string msg)
00091 {
00092 if (OnTransferEnd != null)
00093 OnTransferEnd(src, dst, transferredBytes, totalBytes, msg);
00094 }
00095
00104 protected void SendProgressMessage(string src, string dst, int transferredBytes, int totalBytes, string msg)
00105 {
00106 if (OnTransferProgress != null)
00107 {
00108 OnTransferProgress(src, dst, transferredBytes, totalBytes, msg);
00109 }
00110 }
00111
00112 #endregion
00113 }
00114 }