Files
panaceantech/QuickFTP/quickftp/Program.cs

117 lines
4.0 KiB
C#

using Sdaleo;
using Sdaleo.Systems.Advantage;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.IO;
using System.Linq;
using System.Text;
using Yaulw.Registry;
namespace quickftp
{
class Program
{
static void Main(string[] args)
{
string path = quickftp.Properties.Settings.Default.AdvantagePath;
string user = quickftp.Properties.Settings.Default.AdvantageUser;
string pass = quickftp.Properties.Settings.Default.AdvantagePass;
if (String.IsNullOrEmpty(path) || String.IsNullOrEmpty(user) || String.IsNullOrEmpty(pass))
{
Console.WriteLine("Advantage settings blank or null");
return;
}
AdvantageCredential cred = new AdvantageCredential(path, user, pass, AdvantageCredential.ServerType.REMOTE_LOCAL);
if(!cred.IsValid)
{
Console.WriteLine("Advantage connection invalid");
return;
}
string query1 = ReadQuery("query1.txt");
if (String.IsNullOrEmpty(query1))
return;
DB db = DB.Create(cred);
DBRetVal retVal = db.FillDataTable(query1);
if(!retVal.IsValid)
{
Console.WriteLine(retVal.ErrorMsg);
return;
}
foreach (DataRow r in retVal.GetDataTableRetVal().Rows)
{
var d = r[1];
}
//Console.Writeline()
ddd();
//DBMS.CreateErrorDBRetVal
//cred.AdvDataSource = credential.DataSource;
//cred.AdvIsRemote = (ConnStr.RetrieveValue("SERVERTYPE", credential.ConnectionString) == "REMOTE");
}
public static string ReadQuery(string filename)
{
try
{ // Open the text file using a stream reader.
using (StreamReader sr = new StreamReader(filename))
{
// Read the stream to a string, and write the string to the console.
String line = sr.ReadToEnd();
return line;
}
}
catch (Exception e)
{
Console.WriteLine(String.Format("The file could not be read: {0}", filename));
Console.WriteLine(e.Message);
}
return "";
}
public static void ddd()
{
string regValue = RegKey.GetKey<string>(HKEYRoot.LocalMachine, "Software\\PanaceanTech", "SMFTP", "").ToLower();
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");
}
}
}
}
}