checking in all the old panacean stuff
This commit is contained in:
150
puttysrc/psftp_cs/Program.cs
Normal file
150
puttysrc/psftp_cs/Program.cs
Normal file
@@ -0,0 +1,150 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
||||
namespace psftp_cs
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Assembly sftpasm = Assembly.LoadFile(@"C:\Users\Administrator\Documents\Visual Studio 2010\Projects\puttysrc\SMFTP\bin\Debug\SMFTP.dll");
|
||||
if (sftpasm != null)
|
||||
{
|
||||
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[] { "out/997" };
|
||||
bSuccess = (bool)t.InvokeMember("CmdExec_RemoteDirExists", 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[] { "*.997" };
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
//Dim sftpasm As Assembly = Assembly.LoadFile("C:\Users\Administrator\Documents\Visual Studio 2010\Projects\puttysrc\SMFTP\bin\Debug\SMFTP.dll")
|
||||
//If sftpasm IsNot Nothing Then
|
||||
// Dim t As Type = sftpasm.[GetType]("SMFTP.SFTPClient")
|
||||
// Dim o As Object = Activator.CreateInstance(t)
|
||||
// Dim bindings As BindingFlags = BindingFlags.InvokeMethod Or BindingFlags.[Public] Or BindingFlags.Instance
|
||||
// Dim prms As Object() = Nothing
|
||||
|
||||
// prms = New Object() {"secureftp.navicure.com", "5S3F054P", "LPM2055", "22"}
|
||||
// Dim bSuccess As Boolean = CBool(t.InvokeMember("Connect", bindings, Nothing, o, prms))
|
||||
// If bSuccess Then
|
||||
// prms = New Object() {"out/997"}
|
||||
// bSuccess = CBool(t.InvokeMember("CmdExec_RemoteDirExists", bindings, Nothing, o, prms))
|
||||
// End If
|
||||
// If bSuccess Then
|
||||
// prms = New Object() {"c:\out", True}
|
||||
// bSuccess = CBool(t.InvokeMember("CmdExec_LocalDirSet", bindings, Nothing, o, prms))
|
||||
// End If
|
||||
// If bSuccess Then
|
||||
// prms = New Object() {True, "out/997"}
|
||||
// bSuccess = CBool(t.InvokeMember("CmdExe_MGetDir", bindings, Nothing, o, prms))
|
||||
// End If
|
||||
// If bSuccess Then
|
||||
// prms = New Object() {"in"}
|
||||
// bSuccess = CBool(t.InvokeMember("CmdExec_RemoteDirSet", bindings, Nothing, o, prms))
|
||||
// End If
|
||||
// If bSuccess Then
|
||||
// prms = New Object() {"c:\out\997", True}
|
||||
// bSuccess = CBool(t.InvokeMember("CmdExec_LocalDirSet", bindings, Nothing, o, prms))
|
||||
// End If
|
||||
// If bSuccess Then
|
||||
// prms = New Object() {"*.997"}
|
||||
// bSuccess = CBool(t.InvokeMember("CmdExe_MPutFiles", bindings, Nothing, o, prms))
|
||||
// End If
|
||||
// If bSuccess Then
|
||||
// prms = New Object() {"*.997"}
|
||||
// bSuccess = CBool(t.InvokeMember("CmdExe_MDelFiles", bindings, Nothing, o, prms))
|
||||
// End If
|
||||
//End If
|
||||
|
||||
//using (SMFTP.SFTPClient client = new SMFTP.SFTPClient())
|
||||
//{
|
||||
// bool bConnected = client.Connect("secureftp.navicure.com", "5S3F054P", "LPM2055");
|
||||
// if (bConnected)
|
||||
// {
|
||||
// bool 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("*.997");
|
||||
// if (bSuccess)
|
||||
// bSuccess = client.CmdExe_MDelFiles("*.997");
|
||||
// }
|
||||
//}
|
||||
|
||||
// Using client As New SMFTP.SFTPClient()
|
||||
// Dim bConnected As Boolean = client.Connect("secureftp.navicure.com", "5S3F054P", "LPM2055")
|
||||
// If bConnected Then
|
||||
// Dim bSuccess As Boolean = client.CmdExec_RemoteDirExists("out/997")
|
||||
// If bSuccess Then
|
||||
// bSuccess = client.CmdExec_LocalDirSet("c:\out", True)
|
||||
// End If
|
||||
// If bSuccess Then
|
||||
// bSuccess = client.CmdExe_MGetDir(True, "out/997")
|
||||
// End If
|
||||
// If bSuccess Then
|
||||
// bSuccess = client.CmdExec_RemoteDirSet("in")
|
||||
// End If
|
||||
// If bSuccess Then
|
||||
// bSuccess = client.CmdExec_LocalDirSet("c:\out\997", True)
|
||||
// End If
|
||||
// If bSuccess Then
|
||||
// bSuccess = client.CmdExe_MPutFiles("*.997")
|
||||
// End If
|
||||
// If bSuccess Then
|
||||
// bSuccess = client.CmdExe_MDelFiles("*.997")
|
||||
// End If
|
||||
// End If
|
||||
//End Using
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user