diff --git a/Jenkinsfile b/Jenkinsfile
index a39bfba..b6c0048 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -11,7 +11,7 @@ pipeline {
steps {
/* calcolo numero versione... diverso x branch MASTER/DEVELOP */
script {
- withEnv(['NEXT_BUILD_NUMBER=677']) {
+ withEnv(['NEXT_BUILD_NUMBER=678']) {
// env.versionNumber = VersionNumber(versionNumberString : '3.3.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
env.versionNumber = VersionNumber(versionNumberString : '3.3.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
env.versionNumberBeta = VersionNumber(versionNumberString : '3.3.${BUILD_DATE_FORMATTED, "yyMM"}-beta.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
diff --git a/SteamWareLib/NetworkConnection.cs b/SteamWareLib/NetworkConnection.cs
new file mode 100644
index 0000000..03fa1a3
--- /dev/null
+++ b/SteamWareLib/NetworkConnection.cs
@@ -0,0 +1,110 @@
+using System;
+using System.ComponentModel;
+using System.Net;
+using System.Runtime.InteropServices;
+
+namespace SteamWare
+{
+ public class NetworkConnection : IDisposable
+ {
+ string _networkName;
+
+ public NetworkConnection(string networkName, NetworkCredential credentials)
+ {
+ _networkName = networkName;
+
+ var netResource = new NetResource()
+ {
+ Scope = ResourceScope.GlobalNetwork,
+ ResourceType = ResourceType.Disk,
+ DisplayType = ResourceDisplaytype.Share,
+ RemoteName = networkName
+ };
+
+ var userName = string.IsNullOrEmpty(credentials.Domain)
+ ? credentials.UserName
+ : string.Format(@"{0}\{1}", credentials.Domain, credentials.UserName);
+
+ var result = WNetAddConnection2(
+ netResource,
+ credentials.Password,
+ userName,
+ 0);
+
+ if (result != 0)
+ {
+ throw new Win32Exception(result);
+ }
+ }
+
+ ~NetworkConnection()
+ {
+ Dispose(false);
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ protected virtual void Dispose(bool disposing)
+ {
+ WNetCancelConnection2(_networkName, 0, true);
+ }
+
+ [DllImport("mpr.dll")]
+ private static extern int WNetAddConnection2(NetResource netResource,
+ string password, string username, int flags);
+
+ [DllImport("mpr.dll")]
+ private static extern int WNetCancelConnection2(string name, int flags,
+ bool force);
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ public class NetResource
+ {
+ public ResourceScope Scope;
+ public ResourceType ResourceType;
+ public ResourceDisplaytype DisplayType;
+ public int Usage;
+ public string LocalName;
+ public string RemoteName;
+ public string Comment;
+ public string Provider;
+ }
+
+ public enum ResourceScope : int
+ {
+ Connected = 1,
+ GlobalNetwork,
+ Remembered,
+ Recent,
+ Context
+ };
+
+ public enum ResourceType : int
+ {
+ Any = 0,
+ Disk = 1,
+ Print = 2,
+ Reserved = 8,
+ }
+
+ public enum ResourceDisplaytype : int
+ {
+ Generic = 0x0,
+ Domain = 0x01,
+ Server = 0x02,
+ Share = 0x03,
+ File = 0x04,
+ Group = 0x05,
+ Network = 0x06,
+ Root = 0x07,
+ Shareadmin = 0x08,
+ Directory = 0x09,
+ Tree = 0x0a,
+ Ndscontainer = 0x0b
+ }
+}
diff --git a/SteamWareLib/SteamWare.csproj b/SteamWareLib/SteamWare.csproj
index b0c04ad..b2d9413 100644
--- a/SteamWareLib/SteamWare.csproj
+++ b/SteamWareLib/SteamWare.csproj
@@ -201,6 +201,7 @@
+
SteamWare.tt
True
diff --git a/SteamWareLib/fileMover.cs b/SteamWareLib/fileMover.cs
index c4cefdb..2d996d4 100644
--- a/SteamWareLib/fileMover.cs
+++ b/SteamWareLib/fileMover.cs
@@ -634,6 +634,36 @@ namespace SteamWare
}
return fatto;
}
+ ///
+ /// Effettua copia files via rete con auth...
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public bool copiaFileNetwork(string pathSource, string pathDest, NetworkCredential credentialsSource, NetworkCredential credentialsDest, string fileSource, string fileDest)
+ {
+ bool fatto = false;
+ logger.lg.scriviLog($"Richiesta trasferimento files: {pathSource}\\{fileSource} --> {pathDest}\\{fileDest}", tipoLog.INFO);
+ try
+ {
+ using (new NetworkConnection(pathSource, credentialsSource))
+ using (new NetworkConnection(pathDest, credentialsDest))
+ {
+ File.Copy($"{pathSource}\\{fileSource}", $"{pathDest}\\{fileDest}");
+ fatto = true;
+ }
+ }
+ catch (Exception exc)
+ {
+ logger.lg.scriviLog($"Eccezione durante trasferimento files: {pathSource}\\{fileSource} --> {pathDest}\\{fileDest}{Environment.NewLine}{exc}", tipoLog.EXCEPTION);
+ }
+ return fatto;
+ }
+
///
/// imposta la dir di lavoro
///