Moved System.IO references from DMO classes to Static Helpers

Removed nugetSource from pipeline
Removed more comments
Created Static Classes for most DMO / Controller Classes
Push ConfigurationManager.AppSettings to controller
Align Tests with other Projects
This commit is contained in:
2024-12-11 09:29:01 -07:00
parent b1c6903c1c
commit b99b721458
86 changed files with 2961 additions and 4432 deletions

View File

@ -57,15 +57,12 @@ public class FTP {
#endregion
#region Constructors
/// <summary>
/// Constructor
/// </summary>
public FTP() {
server = null;
user = null;
pass = null;
port = 21;
passive_mode = true; // #######################################
passive_mode = true;
main_sock = null;
main_ipEndPoint = null;
listening_sock = null;
@ -77,18 +74,13 @@ public class FTP {
timeout = 10000; // 10 seconds
messages = "";
}
/// <summary>
/// Constructor
/// </summary>
/// <param name="server">Server to connect to</param>
/// <param name="user">Account to login as</param>
/// <param name="pass">Account password</param>
public FTP(string server, string user, string pass) {
this.server = server;
this.user = user;
this.pass = pass;
port = 21;
passive_mode = true; // #######################################
passive_mode = true;
main_sock = null;
main_ipEndPoint = null;
listening_sock = null;
@ -100,19 +92,13 @@ public class FTP {
timeout = 10000; // 10 seconds
messages = "";
}
/// <summary>
/// Constructor
/// </summary>
/// <param name="server">Server to connect to</param>
/// <param name="port">Port server is listening on</param>
/// <param name="user">Account to login as</param>
/// <param name="pass">Account password</param>
public FTP(string server, int port, string user, string pass) {
this.server = server;
this.user = user;
this.pass = pass;
this.port = port;
passive_mode = true; // #######################################
passive_mode = true;
main_sock = null;
main_ipEndPoint = null;
listening_sock = null;
@ -275,7 +261,6 @@ public class FTP {
messages = "";
while (true) {
//buf = GetLineFromBucket();
buf = GetLineFromBucket();
#if (FTP_DEBUG)
@ -570,8 +555,8 @@ public class FTP {
SendCommand("LIST");
ReadResponse();
//FILIPE MADUREIRA.
//Added response 125
// FILIPE MADUREIRA.
// Added response 125
switch (response) {
case 125:
case 150:
@ -589,13 +574,10 @@ public class FTP {
// so the code doesn't hang if there is
// no data comming.
if (msecs_passed > (timeout / 10)) {
//CloseDataSocket();
//throw new Exception("Timed out waiting on server to respond.");
//FILIPE MADUREIRA.
//If there are no files to list it gives timeout.
//So I wait less time and if no data is received, means that there are no files
break;//Maybe there are no files
// FILIPE MADUREIRA.
// If there are no files to list it gives timeout.
// So I wait less time and if no data is received, means that there are no files
break; // Maybe there are no files
}
}
@ -626,8 +608,7 @@ public class FTP {
ArrayList list = new();
foreach (string f in List()) {
//FILIPE MADUREIRA
//In Windows servers it is identified by <DIR>
// FILIPE MADUREIRA
if ((f.Length > 0)) {
if ((f[0] != 'd') && (f.ToUpper().IndexOf("<DIR>") < 0))
list.Add(f);
@ -636,6 +617,7 @@ public class FTP {
return list;
}
/// <summary>
/// Gets a directory list only
/// </summary>
@ -644,8 +626,8 @@ public class FTP {
ArrayList list = new();
foreach (string f in List()) {
//FILIPE MADUREIRA
//In Windows servers it is identified by <DIR>
// FILIPE MADUREIRA
// In Windows servers it is identified by <DIR>
if (f.Length > 0) {
if ((f[0] == 'd') || (f.ToUpper().IndexOf("<DIR>") >= 0))
list.Add(f);
@ -685,7 +667,7 @@ public class FTP {
if (input.Length < 14)
throw new ArgumentException("Input Value for ConvertFTPDateToDateTime method was too short.");
//YYYYMMDDhhmmss":
// YYYYMMDDhhmmss":
int year = Convert.ToInt16(input.Substring(0, 4));
int month = Convert.ToInt16(input.Substring(4, 2));
int day = Convert.ToInt16(input.Substring(6, 2));
@ -700,7 +682,7 @@ public class FTP {
/// </summary>
/// <returns>The working directory</returns>
public string GetWorkingDirectory() {
//PWD - print working directory
// PWD - print working directory
Connect();
SendCommand("PWD");
ReadResponse();
@ -710,7 +692,7 @@ public class FTP {
string pwd;
try {
pwd = responseStr.Substring(responseStr.IndexOf("\"", 0) + 1);//5);
pwd = responseStr.Substring(responseStr.IndexOf("\"", 0) + 1);
pwd = pwd.Substring(0, pwd.LastIndexOf("\""));
pwd = pwd.Replace("\"\"", "\""); // directories with quotes in the name come out as "" from the server
} catch (Exception ex) {
@ -719,6 +701,7 @@ public class FTP {
return pwd;
}
/// <summary>
/// Change to another directory on the ftp server
/// </summary>