110 lines
4.3 KiB
C#
110 lines
4.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Reflection;
|
|
|
|
namespace SMFTP_CallTestCS
|
|
{
|
|
class Program
|
|
{
|
|
|
|
private static Assembly _sftpasm = null;
|
|
|
|
static void Main(string[] args)
|
|
{
|
|
//#if DEBUG
|
|
//_sftpasm = Assembly.LoadFile(@"C:\_ROOT_\PanaceanTech\sFTPlugins\Target\Debug\SMFTP.dll");
|
|
//if (_sftpasm != null)
|
|
// DebugModeTest();
|
|
//#else
|
|
//_sftpasm = Assembly.LoadFile(@"C:\_ROOT_\PanaceanTech\sFTPlugins\Target\Release\SMFTP.dll");
|
|
//if (_sftpasm != null)
|
|
// ReleaseModeTest();
|
|
//#endif
|
|
|
|
DebugModeTest();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Test SMFTP using Dynamic Invokes on a release dll
|
|
/// </summary>
|
|
public static void ReleaseModeTest()
|
|
{
|
|
Type t = _sftpasm.GetType("SMFTP.SFTPClient");
|
|
object o = Activator.CreateInstance(t);
|
|
BindingFlags bindings = BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Instance;
|
|
object[] prms = null;
|
|
|
|
prms = new object[] { "secureftp.navicure.com", "5S3F054P", "LPM2055", "22" };
|
|
bool bSuccess = (bool)t.InvokeMember("Connect", bindings, null, o, prms);
|
|
if (bSuccess)
|
|
{
|
|
prms = new object[] { "in" };
|
|
bSuccess = (bool)t.InvokeMember("CmdExec_RemoteDirSet", bindings, null, o, prms);
|
|
}
|
|
//if (bSuccess)
|
|
//{
|
|
// prms = new object[] { "c:\\out", true };
|
|
// bSuccess = (bool)t.InvokeMember("CmdExec_LocalDirSet", bindings, null, o, prms);
|
|
//}
|
|
//if (bSuccess)
|
|
//{
|
|
// prms = new object[] { true, "out/997" };
|
|
// bSuccess = (bool)t.InvokeMember("CmdExe_MGetDir", bindings, null, o, prms);
|
|
//}
|
|
//if (bSuccess)
|
|
//{
|
|
// prms = new object[] { "in" };
|
|
// bSuccess = (bool)t.InvokeMember("CmdExec_RemoteDirSet", bindings, null, o, prms);
|
|
//}
|
|
//if (bSuccess)
|
|
//{
|
|
// prms = new object[] { "c:\\out\\997", true };
|
|
// bSuccess = (bool)t.InvokeMember("CmdExec_LocalDirSet", bindings, null, o, prms);
|
|
//}
|
|
if (bSuccess)
|
|
{
|
|
prms = new object[] { "C:\\out\\Doris day\\EmptyDummy File.txt" };
|
|
bSuccess = (bool)t.InvokeMember("CmdExe_MPutFiles", bindings, null, o, prms);
|
|
}
|
|
//if (bSuccess)
|
|
//{
|
|
// prms = new object[] { "*.997" };
|
|
// bSuccess = (bool)t.InvokeMember("CmdExe_MDelFiles", bindings, null, o, prms);
|
|
//}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Test SMTP using direct invokes on debug dll
|
|
/// </summary>
|
|
public static void DebugModeTest()
|
|
{
|
|
using (SMFTP.SFTPClient client = new SMFTP.SFTPClient())
|
|
{
|
|
//bool bConnected = client.Connect("secureftp.navicure.com", "5S3F054P", "LPM2055");
|
|
|
|
bool bConnected = client.Connect("ftp.eresourceplanner.com", "billingsolutions_embark", "Emb@rkD4t4");
|
|
if (bConnected)
|
|
{
|
|
bool bSuccess = true;
|
|
//if (bSuccess)
|
|
// bSuccess = client.CmdExec_RemoteDirExists("out/997");
|
|
//if (bSuccess)
|
|
// bSuccess = client.CmdExec_LocalDirSet("c:\\out", true);
|
|
//if (bSuccess)
|
|
// bSuccess = client.CmdExe_MGetDir(true, "out/997");
|
|
if (bSuccess)
|
|
bSuccess = client.CmdExec_RemoteDirSet("in");
|
|
//if (bSuccess)
|
|
// bSuccess = client.CmdExec_LocalDirSet("c:\\out\\997", true);
|
|
if (bSuccess)
|
|
bSuccess = client.CmdExe_MPutFiles("\"C:\\out\\Doris day\\EmptyDummy File.txt\"");
|
|
//if (bSuccess)
|
|
// bSuccess = client.CmdExe_MDelFiles("*.997");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|