diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e4b8b668..bba601d3 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -201,6 +201,23 @@ IOB-WIN-NEXT:build:
script:
- '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=Release /p:Platform="x86" /p:OutputPath=bin/ /nodeReuse:false /verbosity:minimal /m'
+EgwProxy.Ftp:build:
+ stage: build
+ tags:
+ - win
+ variables:
+ APP_NAME: EgwProxy.Ftp
+ only:
+ refs:
+ - develop
+ - SDK/Ftp
+ before_script:
+ - *nuget-fix
+ - '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln" -verbosity quiet'
+ - *version-fix
+ script:
+ - '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=Release /p:Platform="x86" /p:OutputPath=bin/ /nodeReuse:false /verbosity:minimal /m'
+
EgwProxy.Icoel:build:
stage: build
tags:
@@ -252,9 +269,33 @@ EgwProxy.OsaiCncLib:build:
script:
- '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.vbproj" -target:Build /p:Configuration=Release /p:Platform="x86" /p:OutputPath=bin/ /nodeReuse:false /verbosity:minimal /m'
+
# --------------------------------
# STAGING: (nuget beta)
# --------------------------------
+EgwProxy.Ftp:build:staging:
+ stage: staging
+ needs: ["EgwProxy.Ftp:build"]
+ tags:
+ - win
+ variables:
+ CONFIG: Debug
+ APP_NAME: EgwProxy.Ftp
+ only:
+ refs:
+ - develop
+ before_script:
+ - *nuget-fix
+ - '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln" -verbosity quiet'
+ - *version-fix
+ - *nuspec-fix
+ script:
+ - '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=$env:CONFIG /p:Platform="Any CPU" /p:OutputPath=bin/$env:CONFIG /verbosity:minimal /m'
+ - '& Remove-Item *.nupkg'
+ - '& $env:NUGET_PATH pack "$env:APP_NAME.Debug.nuspec"'
+ - '& "$env:NUGET_PATH" setapikey fe387daa-d07c-3207-877e-96c8be1be91b -source http://nexus.steamware.net/repository/nuget-hosted'
+ - '& "$env:NUGET_PATH" push *$env:NUM_DEB.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted'
+
EgwProxy.Icoel:build:staging:
stage: staging
needs: ["EgwProxy.Icoel:build"]
@@ -398,6 +439,30 @@ IOB-WIN-NEXT:release:
- *hashBuild
- *nexusUpload
+EgwProxy.Ftp:build:release:
+ stage: release
+ needs: ["EgwProxy.Ftp:build"]
+ tags:
+ - win
+ variables:
+ CONFIG: Release
+ APP_NAME: EgwProxy.Ftp
+ only:
+ refs:
+ - SDK/Ftp
+ before_script:
+ - *nuget-fix
+ - '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln" -verbosity quiet'
+ - *version-fix
+ - *nuspec-fix
+ script:
+ - '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=$env:CONFIG /p:Platform="Any CPU" /p:OutputPath=bin/$env:CONFIG /verbosity:minimal /m'
+ - '& Remove-Item *.nupkg'
+ - '& $env:NUGET_PATH pack "$env:APP_NAME.Release.nuspec"'
+# - '& "$env:NUGET_PATH" pack "$env:APP_NAME\$env:APP_NAME.csproj" -properties Configuration=$env:CONFIG -Version $env:NUM_REL'
+ - '& "$env:NUGET_PATH" setapikey fe387daa-d07c-3207-877e-96c8be1be91b -source http://nexus.steamware.net/repository/nuget-hosted'
+ - '& "$env:NUGET_PATH" push *$env:NUM_REL.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted'
+
EgwProxy.Icoel:build:release:
stage: release
needs: ["EgwProxy.Icoel:build"]
@@ -472,6 +537,20 @@ EgwProxy.OsaiCncLib:build:release:
# --------------------------------
# DocFx
# --------------------------------
+EgwProxy.Ftp:docfx:
+ stage: docfx
+ needs: ["EgwProxy.Ftp:build"]
+ tags:
+ - win
+ variables:
+ APP_NAME: EgwProxy.Ftp
+ only:
+ - SDK/Ftp
+ script:
+ - docfx $env:APP_NAME/docfx.json
+ - mv $env:APP_NAME/_site "docfx"
+ - *DocReplica
+
EgwProxy.Icoel:docfx:
stage: docfx
needs: ["EgwProxy.Icoel:build"]
diff --git a/EgwProxy.FTP.sln b/EgwProxy.FTP.sln
new file mode 100644
index 00000000..20d16d7b
--- /dev/null
+++ b/EgwProxy.FTP.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.32901.82
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EgwProxy.Ftp.Test", "EgwProxy.Ftp.Test\EgwProxy.Ftp.Test.csproj", "{A655A6AC-5997-46F9-9752-8C621B80516C}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EgwProxy.Ftp", "EgwProxy.Ftp\EgwProxy.Ftp.csproj", "{35D95ED8-E48A-434D-A305-A83E48C8FC6F}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {A655A6AC-5997-46F9-9752-8C621B80516C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A655A6AC-5997-46F9-9752-8C621B80516C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A655A6AC-5997-46F9-9752-8C621B80516C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A655A6AC-5997-46F9-9752-8C621B80516C}.Release|Any CPU.Build.0 = Release|Any CPU
+ {35D95ED8-E48A-434D-A305-A83E48C8FC6F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {35D95ED8-E48A-434D-A305-A83E48C8FC6F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {35D95ED8-E48A-434D-A305-A83E48C8FC6F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {35D95ED8-E48A-434D-A305-A83E48C8FC6F}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {E2472E21-58D3-4EAD-BC4A-BC3915B18BEF}
+ EndGlobalSection
+EndGlobal
diff --git a/EgwProxy.Ftp.Debug.nuspec b/EgwProxy.Ftp.Debug.nuspec
new file mode 100644
index 00000000..18a977c3
--- /dev/null
+++ b/EgwProxy.Ftp.Debug.nuspec
@@ -0,0 +1,20 @@
+
+
+
+ EgwProxy.Ftp
+ #version#
+ EgwProxy.Ftp
+ Samuele E. Locatelli, EgalWare
+ false
+ MIT
+ Libreria per comunicazione con server Ftp (IOB-WIN-NEXT) - beta/unstable
+ #releaseNotes#
+ #copyright#
+ EgwProxy.Ftp EgwProxy Ftp
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/EgwProxy.Ftp.Release.nuspec b/EgwProxy.Ftp.Release.nuspec
new file mode 100644
index 00000000..428928da
--- /dev/null
+++ b/EgwProxy.Ftp.Release.nuspec
@@ -0,0 +1,19 @@
+
+
+
+ EgwProxy.Ftp
+ #version#
+ EgwProxy.Ftp
+ Samuele E. Locatelli, EgalWare
+ false
+ MIT
+ Libreria per comunicazione con server Ftp (IOB-WIN-NEXT)
+ #releaseNotes#
+ #copyright#
+ EgwProxy.Ftp EgwProxy Ftp
+
+
+
+
+
+
\ No newline at end of file
diff --git a/EgwProxy.Ftp.Test/App.config b/EgwProxy.Ftp.Test/App.config
new file mode 100644
index 00000000..321eae2c
--- /dev/null
+++ b/EgwProxy.Ftp.Test/App.config
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/EgwProxy.Ftp.Test/EgwProxy.Ftp.Test.csproj b/EgwProxy.Ftp.Test/EgwProxy.Ftp.Test.csproj
new file mode 100644
index 00000000..8384cb13
--- /dev/null
+++ b/EgwProxy.Ftp.Test/EgwProxy.Ftp.Test.csproj
@@ -0,0 +1,84 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {A655A6AC-5997-46F9-9752-8C621B80516C}
+ Exe
+ EgwProxy.Ftp.Test
+ EgwProxy.Ftp.Test
+ v4.6.2
+ 512
+ true
+ true
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+ ..\packages\FluentFTP.41.0.0\lib\net462\FluentFTP.dll
+
+
+ ..\packages\Microsoft.Extensions.Logging.Abstractions.2.1.0\lib\netstandard2.0\Microsoft.Extensions.Logging.Abstractions.dll
+
+
+ ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Always
+
+
+
+
+
+
+ Always
+
+
+
+
+
+
+
+ {35d95ed8-e48a-434d-a305-a83e48c8fc6f}
+ EgwProxy.Ftp
+
+
+
+
\ No newline at end of file
diff --git a/EgwProxy.Ftp.Test/Program.cs b/EgwProxy.Ftp.Test/Program.cs
new file mode 100644
index 00000000..520810f2
--- /dev/null
+++ b/EgwProxy.Ftp.Test/Program.cs
@@ -0,0 +1,374 @@
+using Newtonsoft.Json;
+using System;
+using System.Configuration;
+using System.IO;
+using static System.Net.Mime.MediaTypeNames;
+
+namespace EgwProxy.Ftp.Test
+{
+ internal class Program
+ {
+ #region Protected Methods
+
+ ///
+ /// legge conf in formato stringa
+ ///
+ ///
+ ///
+ protected static string ReadSetting(string key)
+ {
+ string answ = "";
+ try
+ {
+ answ = $"{ConfigurationManager.AppSettings[key]}" ?? "";
+ }
+ catch (Exception exc)
+ {
+ Console.Write("Eccezione in ReadSettings");
+ Console.Write(exc.Message);
+ }
+ return answ;
+ }
+
+ #endregion Protected Methods
+
+ #region Private Fields
+
+ ///
+ /// Helper separatore dash
+ ///
+ private const string separator = "------------------------";
+
+ #endregion Private Fields
+
+ #region Private Methods
+
+ ///
+ /// Programma principale
+ ///
+ ///
+ private static void Main(string[] args)
+ {
+ Console.WriteLine(separator);
+ Console.WriteLine("Test FTP Client");
+ Console.WriteLine(separator);
+ Console.WriteLine();
+ string exePath = System.Reflection.Assembly.GetExecutingAssembly().Location;
+ string BaseDirectory = System.IO.Path.GetDirectoryName(exePath);
+ string testFile = Path.Combine(BaseDirectory, ReadSetting("testFile"));
+ Manager ftpClient = new Manager("", "", "", "", false);
+ if (!string.IsNullOrEmpty(testFile))
+ {
+ Console.WriteLine(separator);
+ Console.WriteLine($"Mode json ({testFile})");
+ Console.WriteLine(separator);
+ Console.WriteLine();
+ if (File.Exists(testFile))
+ {
+ var rawData = File.ReadAllText(testFile);
+ if (!string.IsNullOrEmpty(rawData))
+ {
+ TestSetup testConf = new TestSetup();
+ try
+ {
+ testConf = JsonConvert.DeserializeObject(rawData);
+ }
+ catch
+ { }
+ // setup server
+ ftpClient = new Manager(testConf.server, testConf.user, testConf.password, testConf.rawCert, testConf.skipCert);
+ serverTest(ftpClient);
+
+ // eseguo per ogni step
+ foreach (var item in testConf.steps)
+ {
+ Console.WriteLine($"------ Step {item.id} | {item.description} ------");
+ string esitoStep = "";
+ switch (item.action)
+ {
+ case stepType.checkDir:
+ if (item.paramList != null && item.paramList.Count > 0)
+ {
+ string dir2check = item.paramList[0];
+ var dirCheckExists = ftpClient.dirExists(dir2check);
+ esitoStep = dirCheckExists ? $"Directory {dir2check} found!" : $"Directory {dir2check} NOT found!";
+ }
+ else
+ {
+ esitoStep = "Error: missing parameter!";
+ }
+ break;
+
+ case stepType.checkFile:
+ if (item.paramList != null && item.paramList.Count > 0)
+ {
+ string file2check = item.paramList[0];
+ var dirCheckExists = ftpClient.fileExists(file2check);
+ esitoStep = dirCheckExists ? $"File {file2check} found!" : $"File {file2check} NOT found!";
+ }
+ else
+ {
+ esitoStep = "Error: missing parameter!";
+ }
+ break;
+
+ case stepType.createDir:
+ if (item.paramList != null && item.paramList.Count > 0)
+ {
+ string dir2check = item.paramList[0];
+ var preTest = ftpClient.dirExists(dir2check);
+ if (preTest)
+ {
+ esitoStep = "Error: Folder already exists!";
+ }
+ else
+ {
+ var dirCreate = ftpClient.createDir(dir2check);
+ esitoStep = dirCreate ? $"Directory {dir2check} created!" : $"Error: {dir2check} NOT created!";
+ }
+
+ }
+ else
+ {
+ esitoStep = "Error: missing parameter!";
+ }
+ break;
+
+ case stepType.delDir:
+ if (item.paramList != null && item.paramList.Count > 0)
+ {
+ string dir2check = item.paramList[0];
+ var preTest = ftpClient.dirExists(dir2check);
+ if (preTest)
+ {
+ var dirDelete = ftpClient.deleteDir(dir2check);
+ esitoStep = dirDelete ? $"Directory {dir2check} deleted!" : $"Error: {dir2check} NOT deleted!";
+ }
+ else
+ {
+ esitoStep = "Error: Folder doesn't exists, delete not possible!";
+ }
+
+ }
+ else
+ {
+ esitoStep = "Error: missing parameter!";
+ }
+ break;
+
+ case stepType.delFile:
+ if (item.paramList != null && item.paramList.Count > 0)
+ {
+ string file2check = item.paramList[0];
+ var preTest = ftpClient.fileExists(file2check);
+ if (preTest)
+ {
+ var dirDelete = ftpClient.deleteFile(file2check);
+ esitoStep = dirDelete ? $"File {file2check} deleted!" : $"Error: {file2check} NOT deleted!";
+ }
+ else
+ {
+ esitoStep = "Error: File doesn't exists, delete not possible!";
+ }
+
+ }
+ else
+ {
+ esitoStep = "Error: missing parameter!";
+ }
+ break;
+
+ case stepType.downloadDir:
+ if (item.paramList != null && item.paramList.Count > 1)
+ {
+ string dir2check = item.paramList[0];
+ string localDir = Path.Combine(BaseDirectory, item.paramList[1]);
+ var preTest = ftpClient.dirExists(dir2check);
+ if (preTest)
+ {
+ var dirDelete = ftpClient.getDir(localDir, dir2check);
+ esitoStep = dirDelete ? $"Directory {dir2check} downloaded!" : $"Error: {dir2check} NOT downloaded!";
+ }
+ else
+ {
+ esitoStep = "Error: Folder doesn't exists, download not possible!";
+ }
+
+ }
+ else
+ {
+ esitoStep = "Error: missing parameters!";
+ }
+ break;
+
+ case stepType.downloadFile:
+ if (item.paramList != null && item.paramList.Count > 1)
+ {
+ string dir2check = item.paramList[0];
+ string localDir = Path.Combine(BaseDirectory, item.paramList[1]);
+ var preTest = ftpClient.dirExists(dir2check);
+ if (preTest)
+ {
+ var dirDelete = ftpClient.getDir(localDir, dir2check);
+ esitoStep = dirDelete ? $"Directory {dir2check} downloaded!" : $"Error: {dir2check} NOT downloaded!";
+ }
+ else
+ {
+ esitoStep = "Error: Folder doesn't exists, download not possible!";
+ }
+
+ }
+ else
+ {
+ esitoStep = "Error: missing parameters!";
+ }
+ break;
+
+ case stepType.uploadDir:
+ if (item.paramList != null && item.paramList.Count > 1)
+ {
+ string remoteDir = item.paramList[0];
+ string localDir = Path.Combine(BaseDirectory, item.paramList[1]);
+ var dirUploaded = ftpClient.sendDir(localDir, remoteDir);
+ esitoStep = dirUploaded ? $"Directory {remoteDir} uploaded!" : $"Error: {remoteDir} NOT uploaded!";
+ }
+ else
+ {
+ esitoStep = "Error: missing parameters!";
+ }
+ break;
+
+ case stepType.uploadFile:
+ if (item.paramList != null && item.paramList.Count > 1)
+ {
+ string remotePath = item.paramList[0];
+ string localPath = Path.Combine(BaseDirectory, item.paramList[1]);
+ var fileUploaded = ftpClient.sendFile(localPath, remotePath);
+ esitoStep = fileUploaded ? $"File {remotePath} uploaded!" : $"Error: {remotePath} NOT uploaded!";
+ }
+ else
+ {
+ esitoStep = "Error: missing parameters!";
+ }
+ break;
+
+ case stepType.listContent:
+ if (item.paramList != null && item.paramList.Count > 0)
+ {
+ string remoteDir = item.paramList[0];
+ var preTest = ftpClient.dirExists(remoteDir);
+ if (preTest)
+ {
+ var listResult = ftpClient.listDir(remoteDir, false);
+ Console.WriteLine($"Content of dir {remoteDir}:");
+ foreach (var itemList in listResult)
+ {
+ Console.WriteLine(itemList);
+ }
+ }
+ else
+ {
+ esitoStep = "Error: Folder doesn't exists, list not possible!";
+ }
+
+ }
+ else
+ {
+ esitoStep = "Error: missing parameter!";
+ }
+ break;
+
+ default:
+ break;
+ }
+
+
+ Console.WriteLine(esitoStep);
+ Console.WriteLine($"------ Done Step {item.id} ------");
+ Console.WriteLine();
+ Console.WriteLine("Press a key to continue...");
+ Console.ReadKey();
+ }
+ }
+ }
+ }
+ // test base su server steamware
+ else
+ {
+ Console.WriteLine(separator);
+ Console.WriteLine("Mode: base");
+ Console.WriteLine(separator);
+ Console.WriteLine();
+
+ string sSkipCert = ReadSetting("skipCert");
+ bool skipCert = false;
+ bool.TryParse(sSkipCert, out skipCert);
+ ftpClient = new Manager(ReadSetting("server"), ReadSetting("userName"), ReadSetting("passwd"), ReadSetting("rawCert"), skipCert);
+ serverTest(ftpClient);
+
+ Console.WriteLine("--- Folder ---");
+ var testExists = ftpClient.dirExists($"data/test_folder");
+ if (testExists)
+ {
+ Console.WriteLine("Folder already exists!");
+ }
+ else
+ {
+ Console.WriteLine("--- Create folder ---");
+ var testCreate = ftpClient.createDir($"data/test_folder");
+ Console.WriteLine();
+ }
+
+ Console.WriteLine("Contenuto folder remota: ");
+ var folderContent = ftpClient.listDir("data/", true);
+ foreach (var item in folderContent)
+ {
+ Console.WriteLine(item);
+ }
+ Console.WriteLine();
+ Console.WriteLine("Premere un tasto x continuare...");
+ Console.ReadKey();
+
+ Console.WriteLine("--- Upload file ---");
+ ftpClient.sendFile("test/FileProva.txt", "data/test_folder/FileProva.txt");
+ Console.WriteLine("Contenuto folder remota: ");
+ folderContent = ftpClient.listDir("data/", true);
+ foreach (var item in folderContent)
+ {
+ Console.WriteLine(item);
+ }
+
+ Console.WriteLine();
+ Console.WriteLine("Premere un tasto x continuare...");
+ Console.ReadKey();
+
+ Console.WriteLine("--- Download File ---");
+
+ ftpClient.getFile("test/FileProva_02.txt", "data/test_folder/FileProva.txt");
+ Console.WriteLine("Contenuto folder remota: ");
+ folderContent = ftpClient.listDir("data/", true);
+ foreach (var item in folderContent)
+ {
+ Console.WriteLine(item);
+ }
+
+ Console.WriteLine();
+ Console.WriteLine("Premere un tasto x continuare...");
+ Console.ReadKey();
+ }
+ }
+
+ private static void serverTest(Manager ftpClient)
+ {
+ Console.WriteLine(separator);
+ var testServer = ftpClient.serverOk();
+ Console.WriteLine($"Test connessione: esito {testServer}");
+ var srvType = ftpClient.serverType();
+ Console.WriteLine($"Server: {srvType}");
+ Console.WriteLine(separator);
+ Console.WriteLine();
+ }
+
+ #endregion Private Methods
+ }
+}
\ No newline at end of file
diff --git a/EgwProxy.Ftp.Test/Properties/AssemblyInfo.cs b/EgwProxy.Ftp.Test/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000..22301651
--- /dev/null
+++ b/EgwProxy.Ftp.Test/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("EgwProxy.Ftp.Test")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("EgwProxy.Ftp.Test")]
+[assembly: AssemblyCopyright("Copyright © 2022")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("a655a6ac-5997-46f9-9752-8c621b80516c")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/EgwProxy.Ftp.Test/TestSetup.cs b/EgwProxy.Ftp.Test/TestSetup.cs
new file mode 100644
index 00000000..d00f3e10
--- /dev/null
+++ b/EgwProxy.Ftp.Test/TestSetup.cs
@@ -0,0 +1,42 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace EgwProxy.Ftp.Test
+{
+ public class TestSetup
+ {
+ public string server { get; set; } = "";
+ public string user { get; set; } = "";
+ public string password { get; set; } = "";
+ public string rawCert { get; set; } = "";
+ public bool skipCert { get; set; } = false;
+ public List steps { get; set; }
+ }
+
+ public class singleStep
+ {
+ public string id { get; set; } = "00";
+ public string description { get; set; } = "00";
+ public stepType action { get; set; } = stepType.checkDir;
+
+ public List paramList { get; set; } = new List();
+ }
+
+ public enum stepType
+ {
+ checkDir,
+ checkFile,
+ createDir,
+ delDir,
+ delFile,
+ downloadDir,
+ downloadFile,
+ uploadDir,
+ uploadFile,
+ listContent
+ }
+
+}
diff --git a/EgwProxy.Ftp.Test/conf/.placeholder b/EgwProxy.Ftp.Test/conf/.placeholder
new file mode 100644
index 00000000..5f282702
--- /dev/null
+++ b/EgwProxy.Ftp.Test/conf/.placeholder
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/EgwProxy.Ftp.Test/conf/testSetup.json b/EgwProxy.Ftp.Test/conf/testSetup.json
new file mode 100644
index 00000000..f50719b2
--- /dev/null
+++ b/EgwProxy.Ftp.Test/conf/testSetup.json
@@ -0,0 +1,76 @@
+{
+ "server": "ftp.steamware.net",
+ "user": "testftpuser",
+ "password": "we4reFromB3rghem!",
+ "rawCert": "",
+ "skipCert": true,
+ "steps": [
+ {
+ "id": "01",
+ "description": "Test base directory",
+ "action": "checkDir",
+ "paramList": [
+ "data/"
+ ]
+ },
+ {
+ "id": "02",
+ "description": "Create directory",
+ "action": "createDir",
+ "paramList": [
+ "data/test_directory"
+ ]
+ },
+ {
+ "id": "03",
+ "description": "Upload File",
+ "action": "uploadFile",
+ "paramList": [
+ "data/test_directory/FileProva.txt",
+ "test/FileProva.txt"
+ ]
+ },
+ {
+ "id": "04",
+ "description": "Browse Directory",
+ "action": "listContent",
+ "paramList": [
+ "data/test_directory/"
+ ]
+ },
+ {
+ "id": "05",
+ "description": "Upload File",
+ "action": "uploadFile",
+ "paramList": [
+ "data/test_directory/FileProva_02.txt",
+ "test/FileProva.txt"
+ ]
+ },
+ {
+ "id": "06",
+ "description": "Browse Directory",
+ "action": "listContent",
+ "paramList": [
+ "data/test_directory/"
+ ]
+ },
+ {
+ "id": "07",
+ "description": "Download Directory",
+ "action": "downloadDir",
+ "paramList": [
+ "data/test_directory/",
+ "temp/mirror"
+ ]
+ },
+ {
+ "id": "08",
+ "description": "Delete Remote Directory",
+ "action": "delDir",
+ "paramList": [
+ "data/test_directory/"
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/EgwProxy.Ftp.Test/docfx.json b/EgwProxy.Ftp.Test/docfx.json
new file mode 100644
index 00000000..435e3499
--- /dev/null
+++ b/EgwProxy.Ftp.Test/docfx.json
@@ -0,0 +1,69 @@
+{
+ "metadata": [
+ {
+ "src": [
+ {
+ "files": [
+ "*.csproj",
+ "*.vbproj"
+ ],
+ "cwd": ".",
+ "exclude": [
+ "**/obj/**",
+ "**/bin/**",
+ "_site/**"
+ ]
+ }
+ ],
+ "dest": "obj/api"
+ }
+ ],
+ "build": {
+ "content": [
+ {
+ "files": [
+ "api/**.yml"
+ ],
+ "cwd": "obj"
+ },
+ {
+ "files": [
+ "api/*.md",
+ "articles/**.md",
+ "toc.yml",
+ "*.md"
+ ],
+ "exclude": [
+ "obj/**",
+ "_site/**"
+ ]
+ }
+ ],
+ "resource": [
+ {
+ "files": [
+ "images/**"
+ ],
+ "exclude": [
+ "obj/**",
+ "_site/**"
+ ]
+ }
+ ],
+ "overwrite": [
+ {
+ "files": [
+ "apidoc/**.md"
+ ],
+ "exclude": [
+ "obj/**",
+ "_site/**"
+ ]
+ }
+ ],
+ "dest": "_site",
+ "template": [
+ "default"
+ ]
+ }
+}
\ No newline at end of file
diff --git a/EgwProxy.Ftp.Test/index.md b/EgwProxy.Ftp.Test/index.md
new file mode 100644
index 00000000..2610c657
--- /dev/null
+++ b/EgwProxy.Ftp.Test/index.md
@@ -0,0 +1,17 @@
+# EgwProxy.Ftp Library
+
+Documentazione relativa alla libreria di interfaccia via FTP con server generici.
+
+Disponibile in forma di pacchetto nuget sul repo aziendale nexus.steamware.net: i pacchetti sono disponibili all'indirizzo
+
+https://nexus.steamware.net/#browse/browse:nuget-hosted
+
+Vedere la sezione Articles per maggiori informazioni sulle definizioni, l'impiego ed esempi.
+
+## Articles
+
+Per maggiori dettagli, definizioni e demo funzionamento si rimanda alla sezione Articles
+
+## Api
+
+Per ogni dettaglio e riferimento alla libreria si rimanda alla sezione Api Documentation
\ No newline at end of file
diff --git a/EgwProxy.Ftp.Test/index.pdf b/EgwProxy.Ftp.Test/index.pdf
new file mode 100644
index 00000000..7d2af5fc
Binary files /dev/null and b/EgwProxy.Ftp.Test/index.pdf differ
diff --git a/EgwProxy.Ftp.Test/packages.config b/EgwProxy.Ftp.Test/packages.config
new file mode 100644
index 00000000..657b8280
--- /dev/null
+++ b/EgwProxy.Ftp.Test/packages.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/EgwProxy.Ftp.Test/test/FileProva.txt b/EgwProxy.Ftp.Test/test/FileProva.txt
new file mode 100644
index 00000000..94a4fa6c
--- /dev/null
+++ b/EgwProxy.Ftp.Test/test/FileProva.txt
@@ -0,0 +1 @@
+File di prova
\ No newline at end of file
diff --git a/EgwProxy.Ftp.Test/toc.yml b/EgwProxy.Ftp.Test/toc.yml
new file mode 100644
index 00000000..7eee9ffb
--- /dev/null
+++ b/EgwProxy.Ftp.Test/toc.yml
@@ -0,0 +1,6 @@
+
+- name: Articles
+ href: articles/
+- name: API Documentation
+ href: obj/api/
+ homepage: api/index.md
diff --git a/EgwProxy.Ftp/EgwProxy.Ftp.csproj b/EgwProxy.Ftp/EgwProxy.Ftp.csproj
new file mode 100644
index 00000000..760b0985
--- /dev/null
+++ b/EgwProxy.Ftp/EgwProxy.Ftp.csproj
@@ -0,0 +1,57 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {35D95ED8-E48A-434D-A305-A83E48C8FC6F}
+ Library
+ Properties
+ EgwProxy.Ftp
+ EgwProxy.Ftp
+ v4.6.2
+ 512
+ true
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+ ..\packages\FluentFTP.41.0.0\lib\net462\FluentFTP.dll
+
+
+ ..\packages\Microsoft.Extensions.Logging.Abstractions.2.1.0\lib\netstandard2.0\Microsoft.Extensions.Logging.Abstractions.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/EgwProxy.Ftp/Manager.cs b/EgwProxy.Ftp/Manager.cs
new file mode 100644
index 00000000..389e0105
--- /dev/null
+++ b/EgwProxy.Ftp/Manager.cs
@@ -0,0 +1,325 @@
+using FluentFTP;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net.Security;
+
+namespace EgwProxy.Ftp
+{
+ ///
+ /// Client per operazioni FTP, basato su FluentFTP: https://github.com/robinrodricks/FluentFTP/wiki/Quick-Start-Example
+ ///
+ public class Manager
+ {
+ #region Public Constructors
+
+ ///
+ /// Inizializzazione di oggetto per comunicazione FTP
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Manager(string server, string userName, string passwd, string rawCert, bool skipCert)
+ {
+ _server = server;
+ _userName = userName;
+ _passwd = passwd;
+ _skipCert = skipCert;
+ _rawCert = rawCert;
+ if (!string.IsNullOrEmpty(server))
+ {
+ // se ho user/pwd è autenticato...
+ if (!string.IsNullOrEmpty(userName) && !string.IsNullOrEmpty(passwd))
+ {
+ client = new FtpClient(server, userName, passwd);
+ }
+ //.. altrimenti anonimo...
+ else
+ {
+ client = new FtpClient(server);
+ }
+ }
+ }
+
+ #endregion Public Constructors
+
+ #region Public Methods
+
+ ///
+ /// Creazione directory remota
+ ///
+ /// Nome directory remota da creare (ad es: @"/public_html/videos")
+ public bool createDir(string remoteDir)
+ {
+ tryConnect();
+ // upload della folder + files, cancellazione extra files = mirroring
+ bool answ = client.CreateDirectory(remoteDir);
+ // chiudo!
+ client.Disconnect();
+ return answ;
+ }
+
+ ///
+ /// Eliminazionedirectory remota
+ ///
+ /// Nome directory remota da eliminare
+ public bool deleteDir(string remoteDir)
+ {
+ tryConnect();
+ bool answ = false;
+ try
+ {
+ // Elimina folder
+ client.DeleteDirectory(remoteDir);
+ answ = true;
+ }
+ catch
+ { }
+ // chiudo!
+ client.Disconnect();
+ return answ;
+ }
+
+ ///
+ /// Eliminazionedirectory remota
+ ///
+ /// Nome file remoto da eliminare
+ public bool deleteFile(string remoteFile)
+ {
+ tryConnect();
+ bool answ = false;
+ try
+ {
+ // Elimina folder
+ client.DeleteFile(remoteFile);
+ answ = true;
+ }
+ catch
+ { }
+ // chiudo!
+ client.Disconnect();
+ return answ;
+ }
+
+ ///
+ /// Verifica esistenza directory su server FTP remoto
+ ///
+ /// Percorso remoto da testare (ad es "/htdocs/extras/")
+ ///
+ public bool dirExists(string remotePath)
+ {
+ tryConnect();
+ bool answ = client.DirectoryExists(remotePath);
+ // chiudo!
+ client.Disconnect();
+ return answ;
+ }
+
+ ///
+ /// Verifica esistenza file su server FTP remoto
+ ///
+ /// Percorso remoto da testare (ad es "/htdocs/big2.txt")
+ ///
+ public bool fileExists(string remotePath)
+ {
+ tryConnect();
+ bool answ = client.FileExists(remotePath);
+ // chiudo!
+ client.Disconnect();
+ return answ;
+ }
+
+ ///
+ /// Scaricamento intera directory, modalità MIRROR
+ ///
+ /// Path directory da inviare (ad es:@"C:\website\videos\")
+ /// Nome remoto file per caricamento (ad es: @"/public_html/videos")
+ public bool getDir(string dirPath, string remoteDir)
+ {
+ bool answ = false;
+ tryConnect();
+ try
+ {
+ // upload della folder + files, cancellazione extra files = mirroring
+ var result = client.DownloadDirectory(dirPath, remoteDir, FtpFolderSyncMode.Mirror);
+ answ = (result != null && result.Count > 0);
+ }
+ catch
+ { }
+ // chiudo!
+ client.Disconnect();
+ return answ;
+ }
+
+ ///
+ /// Download singolo file
+ ///
+ /// Path locale del file da inviare (ad es: @"C:\MyVideo.mp4")
+ /// NOme remoto file per caricamento (ad es: "/htdocs/MyVideo.mp4")
+ public bool getFile(string fileName, string remoteName)
+ {
+ bool answ = false;
+ tryConnect();
+ // effettuo caricamento puntuale
+ var result = client.DownloadFile(fileName, remoteName);
+ answ = result == FtpStatus.Success;
+ // chiudo!
+ client.Disconnect();
+ return answ;
+ }
+
+ ///
+ /// Mostra contenuto directory remota
+ ///
+ /// Nome directory remota da leggere (ad es: @"/public_html/videos")
+ /// Indica se fare search ricorsivo
+ public List listDir(string remoteDir, bool recurse)
+ {
+ tryConnect();
+ // upload della folder + files, cancellazione extra files = mirroring
+ FtpListItem[] dirContent;
+ if (recurse)
+ {
+ dirContent = client.GetListing(remoteDir, FtpListOption.Recursive);
+ }
+ else
+ {
+ dirContent = client.GetListing(remoteDir);
+ }
+ client.Disconnect();
+ var answ = dirContent.Select(x => $"{x.Type} - {x.Name}").ToList();
+ // chiudo!
+ return answ;
+ }
+
+ ///
+ /// Caricamento intera directory, modalità MIRROR
+ ///
+ /// Path directory da inviare (ad es:@"C:\website\videos\")
+ /// Nome remoto file per caricamento (ad es: @"/public_html/videos")
+ public bool sendDir(string dirPath, string remoteDir)
+ {
+ bool answ = false;
+ tryConnect();
+ // upload della folder + files, cancellazione extra files = mirroring
+ var result = client.UploadDirectory(dirPath, remoteDir, FtpFolderSyncMode.Mirror);
+ answ = (result != null && result.Count > 0);
+ // chiudo!
+ client.Disconnect();
+ return answ;
+ }
+
+ ///
+ /// Caricamento singolo file
+ ///
+ /// Path locale del file da inviare (ad es: @"C:\MyVideo.mp4")
+ /// NOme remoto file per caricamento (ad es: "/htdocs/MyVideo.mp4")
+ public bool sendFile(string fileName, string remoteName)
+ {
+ bool answ = false;
+ tryConnect();
+ // effettuo caricamento puntuale
+ var result = client.UploadFile(fileName, remoteName);
+ answ = result == FtpStatus.Success;
+ // se insuccesso --> controllo se ci sia file...
+ if (!answ)
+ {
+ answ = fileExists(remoteName);
+ }
+ // chiudo!
+ client.Disconnect();
+ return answ;
+ }
+
+ ///
+ /// Verifica connessione con server FTP remoto
+ ///
+ ///
+ public bool serverOk()
+ {
+ tryConnect();
+ bool answ = client.IsConnected;
+ // chiudo!
+ client.Disconnect();
+ return answ;
+ }
+
+ ///
+ /// Restituisce tipo server remoto
+ ///
+ ///
+ public string serverType()
+ {
+ tryConnect();
+ FtpServer srvType = client.ServerType;
+ // chiudo!
+ client.Disconnect();
+ return $"{srvType}";
+ }
+
+ #endregion Public Methods
+
+ #region Protected Fields
+
+ protected bool _skipCert = false;
+
+ #endregion Protected Fields
+
+ #region Protected Properties
+
+ protected string _passwd { get; set; } = "";
+
+ protected string _rawCert { get; set; } = "";
+ protected string _server { get; set; } = "";
+
+ protected string _userName { get; set; } = "";
+
+ #endregion Protected Properties
+
+ #region Private Properties
+
+ private FtpClient client { get; set; }
+
+ #endregion Private Properties
+
+ #region Private Methods
+
+ private void Client_ValidateCertificate(FluentFTP.Client.BaseClient.BaseFtpClient control, FtpSslValidationEventArgs e)
+ {
+ if (e.PolicyErrors == SslPolicyErrors.None || _skipCert || e.Certificate.GetRawCertDataString() == _rawCert)
+ {
+ e.Accept = true;
+ }
+ else
+ {
+ Console.WriteLine($"{e.PolicyErrors}");
+ Console.WriteLine($"Cert:{Environment.NewLine}{e.Certificate}");
+ Console.WriteLine($"RawString:{Environment.NewLine}{e.Certificate.GetRawCertDataString()}");
+ throw new Exception($"{e.PolicyErrors}{Environment.NewLine}{e.Certificate.GetRawCertDataString()}");
+ }
+ }
+
+ private void tryConnect()
+ {
+ // connect to the server and automatically detect working FTP settings
+ if (!client.IsConnected)
+ {
+ var profiles = client.AutoDetect();
+#if false
+ // if any profiles are found, print the code to the console
+ if (profiles.Count > 0)
+ {
+ var code = profiles[0].ToCode();
+ Console.WriteLine(code);
+ }
+#endif
+ client.ValidateCertificate += Client_ValidateCertificate;
+ client.AutoConnect();
+ }
+ }
+
+ #endregion Private Methods
+ }
+}
\ No newline at end of file
diff --git a/EgwProxy.Ftp/Properties/AssemblyInfo.cs b/EgwProxy.Ftp/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000..abba72de
--- /dev/null
+++ b/EgwProxy.Ftp/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("EgwProxy.Ftp")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("EgwProxy.Ftp")]
+[assembly: AssemblyCopyright("Copyright © 2022")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("35d95ed8-e48a-434d-a305-a83e48c8fc6f")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/EgwProxy.Ftp/packages.config b/EgwProxy.Ftp/packages.config
new file mode 100644
index 00000000..e11a86c4
--- /dev/null
+++ b/EgwProxy.Ftp/packages.config
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/EgwProxy.Icoel.Test/EgwProxy.Icoel.Test.csproj b/EgwProxy.Icoel.Test/EgwProxy.Icoel.Test.csproj
index fcdfd69f..37efc51e 100644
--- a/EgwProxy.Icoel.Test/EgwProxy.Icoel.Test.csproj
+++ b/EgwProxy.Icoel.Test/EgwProxy.Icoel.Test.csproj
@@ -56,16 +56,6 @@
PreserveNewest
-
-
- {E36544CB-D699-48D8-9F81-C2758E7C7D19}
- EgwProxy.Icoel.DataLayer
-
-
- {c45f5e6e-866b-4a34-a598-29aab2d178ad}
- EgwProxy.Icoel
-
-
diff --git a/IOB-MAN/IOBManPanel.cs b/IOB-MAN/IOBManPanel.cs
index a7c211e8..80737f82 100644
--- a/IOB-MAN/IOBManPanel.cs
+++ b/IOB-MAN/IOBManPanel.cs
@@ -1116,9 +1116,6 @@ namespace IOB_MAN
{
try
{
- //Task result = checkProcessStatusAsync();
- //result.Wait();
-
Task result = Task.Run(() => checkProcessStatusAsync().ConfigureAwait(false));
result.Wait();
}