MS Encryption

This commit is contained in:
2024-03-06 09:14:04 +01:00
parent 55f2a6a775
commit d4aa3ec82e
8 changed files with 166 additions and 27 deletions

View File

@@ -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