diff --git a/EnvelopeGenerator.Form/EnvelopeGenerator.Form.vbproj b/EnvelopeGenerator.Form/EnvelopeGenerator.Form.vbproj
index 8cccf8c3..7fb4c94d 100644
--- a/EnvelopeGenerator.Form/EnvelopeGenerator.Form.vbproj
+++ b/EnvelopeGenerator.Form/EnvelopeGenerator.Form.vbproj
@@ -156,10 +156,12 @@
Form
+
+
True
Application.myapp
diff --git a/EnvelopeGenerator.Form/Helper/Encryption.vb b/EnvelopeGenerator.Form/Helper/Encryption.vb
new file mode 100644
index 00000000..29ad7768
--- /dev/null
+++ b/EnvelopeGenerator.Form/Helper/Encryption.vb
@@ -0,0 +1,24 @@
+Imports System.Security.Cryptography
+Imports System.Text
+
+Public Class Decryption
+
+ Private Shared key As String = "$xzBvyPETUS&amm8)D8x#)f;4%;?[BPd" ' Passwort-Schlüssel (16, 24, or 32 bytes)
+ Private Shared iv As String = "1wN&e[zrQ6_B7X/0" ' Initialisierungsvektor (16 bytes)
+
+
+ ' Entschlüsselungsfunktion
+ Public Shared Function Decrypt(cipherText As String) As String
+ Dim aesAlg As Aes = Aes.Create()
+ aesAlg.Key = Encoding.UTF8.GetBytes(key)
+ aesAlg.IV = Encoding.UTF8.GetBytes(iv)
+ Dim decryptor As ICryptoTransform = aesAlg.CreateDecryptor(aesAlg.Key, aesAlg.IV)
+ Dim cipherBytes As Byte() = Convert.FromBase64String(cipherText)
+ Dim msDecrypt As New IO.MemoryStream(cipherBytes)
+ Using csDecrypt As New CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read)
+ Using srDecrypt As New IO.StreamReader(csDecrypt)
+ Return srDecrypt.ReadToEnd()
+ End Using
+ End Using
+ End Function
+End Class
diff --git a/EnvelopeGenerator.Form/ModuleSettings.vb b/EnvelopeGenerator.Form/ModuleSettings.vb
new file mode 100644
index 00000000..900e66eb
--- /dev/null
+++ b/EnvelopeGenerator.Form/ModuleSettings.vb
@@ -0,0 +1,3 @@
+Module ModuleSettings
+ Public DOCUMENT_PATH_MOVE_AFTSEND As String = ""
+End Module
diff --git a/EnvelopeGenerator.Form/My Project/Settings.Designer.vb b/EnvelopeGenerator.Form/My Project/Settings.Designer.vb
index 9b8067d9..00980999 100644
--- a/EnvelopeGenerator.Form/My Project/Settings.Designer.vb
+++ b/EnvelopeGenerator.Form/My Project/Settings.Designer.vb
@@ -1,26 +1,89 @@
'------------------------------------------------------------------------------
'
-' This code was generated by a tool.
-' Runtime Version:4.0.30319.18034
+' Dieser Code wurde von einem Tool generiert.
+' Laufzeitversion:4.0.30319.42000
'
-' Changes to this file may cause incorrect behavior and will be lost if
-' the code is regenerated.
+' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
+' der Code erneut generiert wird.
'
'------------------------------------------------------------------------------
+Option Strict On
+Option Explicit On
+
+
+
+ _
+Partial Friend NotInheritable Class Settings
+ Inherits Global.System.Configuration.ApplicationSettingsBase
+
+ Private Shared defaultInstance As Settings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New Settings()),Settings)
+
+#Region "Automatische My.Settings-Speicherfunktion"
+#If _MyType = "WindowsForms" Then
+ Private Shared addedHandler As Boolean
+
+ Private Shared addedHandlerLockObject As New Object
+
+ _
+ Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs)
+ If My.Application.SaveMySettingsOnExit Then
+ My.Settings.Save()
+ End If
+ End Sub
+#End If
+#End Region
+
+ Public Shared ReadOnly Property [Default]() As Settings
+ Get
+
+#If _MyType = "WindowsForms" Then
+ If Not addedHandler Then
+ SyncLock addedHandlerLockObject
+ If Not addedHandler Then
+ AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
+ addedHandler = True
+ End If
+ End SyncLock
+ End If
+#End If
+ Return defaultInstance
+ End Get
+ End Property
+
+ _
+ Public ReadOnly Property NetUse_Usr() As String
+ Get
+ Return CType(Me("NetUse_Usr"),String)
+ End Get
+ End Property
+
+ _
+ Public ReadOnly Property NetUse_PW() As String
+ Get
+ Return CType(Me("NetUse_PW"),String)
+ End Get
+ End Property
+End Class
+
Namespace My
-
-
-
- Friend NotInheritable Partial Class Settings
- Inherits System.Configuration.ApplicationSettingsBase
-
- Private Shared defaultInstance As Settings = (CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New Settings()), Settings))
-
- Public Shared ReadOnly Property [Default]() As Settings
+
+ _
+ Friend Module MySettingsProperty
+
+ _
+ Friend ReadOnly Property Settings() As Global.EnvelopeGenerator.Form.Settings
Get
- Return defaultInstance
+ Return Global.EnvelopeGenerator.Form.Settings.Default
End Get
End Property
- End Class
+ End Module
End Namespace
diff --git a/EnvelopeGenerator.Form/My Project/Settings.settings b/EnvelopeGenerator.Form/My Project/Settings.settings
index 39645652..de4d6d30 100644
--- a/EnvelopeGenerator.Form/My Project/Settings.settings
+++ b/EnvelopeGenerator.Form/My Project/Settings.settings
@@ -1,7 +1,12 @@
-
-
-
-
-
-
+
+
+
+
+ dd-san01\Administrator
+
+
+ sY4vnATDXwosbTJGip6SqA==
+
+
+
\ No newline at end of file
diff --git a/EnvelopeGenerator.Form/app.config b/EnvelopeGenerator.Form/app.config
index a5b30491..54b00a41 100644
--- a/EnvelopeGenerator.Form/app.config
+++ b/EnvelopeGenerator.Form/app.config
@@ -2,10 +2,19 @@
+
+
+
+ dd-san01\Administrator
+
+
+ sY4vnATDXwosbTJGip6SqA==
+
+
System
diff --git a/EnvelopeGenerator.Form/frmEnvelopeEditor.vb b/EnvelopeGenerator.Form/frmEnvelopeEditor.vb
index fe829102..9b2d1838 100644
--- a/EnvelopeGenerator.Form/frmEnvelopeEditor.vb
+++ b/EnvelopeGenerator.Form/frmEnvelopeEditor.vb
@@ -21,7 +21,6 @@ Partial Public Class frmEnvelopeEditor
Private Controller As EnvelopeEditorController
Private Logger As Logger
- Private Config As DbConfig
Private Const COL_NAME = "Name"
Private Const COL_EMAIL = "Email"
@@ -64,7 +63,7 @@ Partial Public Class frmEnvelopeEditor
Private Sub frmEditor_Load(sender As Object, e As EventArgs) Handles Me.Load
Logger = State.LogConfig.GetLogger()
-
+ Logger.Debug("Loading Configuration..")
If Envelope Is Nothing Then
Controller = New EnvelopeEditorController(State)
@@ -330,16 +329,50 @@ Partial Public Class frmEnvelopeEditor
MsgBox(Resources.Envelope.Envelope_could_not_be_sent, MsgBoxStyle.Critical, Text)
Else
If MsgBox(Resources.Envelope.Envelope_Invitations_Sent, MsgBoxStyle.Information Or MsgBoxStyle.OkOnly, Text) = MsgBoxResult.Ok Then
- If Config.DOCUMENT_PATH_MOVE_AFTSEND <> String.Empty Then
- For Each odoc In Envelope.Documents
+ If DOCUMENT_PATH_MOVE_AFTSEND <> String.Empty Then
+ If My.Settings.NetUse_PW <> String.Empty And My.Settings.NetUse_Usr <> String.Empty Then
+ Dim oDecrypted = Decryption.Decrypt(My.Settings.NetUse_PW)
+ For Each odoc In Controller.Envelope.Documents 'envelope ist leer!
+ MoveFileWithNetUse(odoc.Filepath, DOCUMENT_PATH_MOVE_AFTSEND, My.Settings.NetUse_Usr, My.Settings.NetUse_PW)
+ Next
+ End If
- Next
End If
Me.Close()
End If
End If
End Sub
+
+ Sub MoveFileWithNetUse(pSourcePath As String, pDestinationPath As String, pUsername As String, pPassword As String)
+ Dim oDectryptedPW = Decryption.Decrypt(pPassword)
+ Dim oFilename = System.IO.Path.GetFileName(pSourcePath)
+
+ Dim netUseCommand As String = $"net use {pDestinationPath} /user:{pUsername} {oDectryptedPW}"
+
+ Dim processInfo As New ProcessStartInfo("cmd.exe", $"/C {netUseCommand}")
+ processInfo.RedirectStandardOutput = True
+ processInfo.UseShellExecute = False
+ processInfo.CreateNoWindow = True
+
+ Using process As Process = Process.Start(processInfo)
+ process.WaitForExit()
+
+ ' Prüfe den Rückgabewert des net use Befehls
+ If process.ExitCode = 0 Then
+ ' Verschiebe die Datei
+ Try
+ pDestinationPath &= "\" + oFilename
+ System.IO.File.Copy(pSourcePath, pDestinationPath, True)
+ Catch ex As Exception
+ MsgBox(ex.Message, MsgBoxStyle.Critical)
+ End Try
+
+ Else
+ MsgBox("Fehler beim Verbinden mit dem Netzwerkziel.", MsgBoxStyle.Critical)
+ End If
+ End Using
+ End Sub
Private Sub btnCancel_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnCancel.ItemClick
' Speichern?
Dim oMessage = Resources.Envelope.Should_The_Envelope_Be_Saved
diff --git a/EnvelopeGenerator.Form/frmSplashScreen.vb b/EnvelopeGenerator.Form/frmSplashScreen.vb
index 4bdd816b..e125eb78 100644
--- a/EnvelopeGenerator.Form/frmSplashScreen.vb
+++ b/EnvelopeGenerator.Form/frmSplashScreen.vb
@@ -77,7 +77,7 @@ Public Class frmSplashScreen
Dim ConfigModel = New ConfigModel(oState)
oState.DbConfig = ConfigModel.LoadConfiguration()
-
+ DOCUMENT_PATH_MOVE_AFTSEND = oState.DbConfig.DOCUMENT_PATH_MOVE_AFTSEND
Worker.ReportProgress(60, "Initialize User")
Thread.Sleep(300)