Compare commits

...

3 Commits

Author SHA1 Message Date
0064eee9d5 FileMOve 2024-03-06 09:15:02 +01:00
d4aa3ec82e MS Encryption 2024-03-06 09:14:04 +01:00
55f2a6a775 MS Config 2024-02-27 16:18:00 +01:00
12 changed files with 217 additions and 28 deletions

View File

@@ -4,7 +4,10 @@
Public Property ExportPath As String = ""
Public Property DocumentPath_DMZ As String = ""
Public Property ExportPath_DMZ As String = ""
Public Property DOCUMENT_PATH_MOVE_AFTSEND As String = ""
Public Property SignedMail_Path As String = ""
Public Property SendingProfile As Integer = 0
Public Property SignatureHost As String = ""
End Class

View File

@@ -23,7 +23,8 @@ Public Class ConfigModel
.SendingProfile = oRow.ItemEx("SENDING_PROFILE", 0),
.SignatureHost = oRow.ItemEx("SIGNATURE_HOST", ""),
.ExternalProgramName = oRow.ItemEx("EXTERNAL_PROGRAM_NAME", ""),
.SignedMail_Path = oRow.ItemEx("SIGNED_MAIL_PATH", "")
.SignedMail_Path = oRow.ItemEx("SIGNED_MAIL_PATH", ""),
.DOCUMENT_PATH_MOVE_AFTSEND = oRow.ItemEx("DOCUMENT_PATH_MOVE_AFTSEND", "")
}
Catch ex As Exception
Logger.Error(ex)

View File

@@ -156,10 +156,12 @@
<Compile Include="frmSplashScreen.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="Helper\Encryption.vb" />
<Compile Include="Helper\RefreshHelper.vb" />
<Compile Include="Helper\TempFiles.vb" />
<Compile Include="Helper\Thumbnail.vb" />
<Compile Include="Helper\Validator.vb" />
<Compile Include="ModuleSettings.vb" />
<Compile Include="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Application.myapp</DependentUpon>

View File

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

View File

@@ -0,0 +1,3 @@
Module ModuleSettings
Public DOCUMENT_PATH_MOVE_AFTSEND As String = ""
End Module

View File

@@ -1,26 +1,89 @@
'------------------------------------------------------------------------------
' <auto-generated>
' 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.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.3.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
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
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
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
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("dd-san01\Administrator")> _
Public ReadOnly Property NetUse_Usr() As String
Get
Return CType(Me("NetUse_Usr"),String)
End Get
End Property
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("sY4vnATDXwosbTJGip6SqA==")> _
Public ReadOnly Property NetUse_PW() As String
Get
Return CType(Me("NetUse_PW"),String)
End Get
End Property
End Class
Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")>
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
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
Friend Module MySettingsProperty
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
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

View File

@@ -1,7 +1,12 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="NetUse_Usr" Type="System.String" Scope="Application">
<Value Profile="(Default)">dd-san01\Administrator</Value>
</Setting>
<Setting Name="NetUse_PW" Type="System.String" Scope="Application">
<Value Profile="(Default)">sY4vnATDXwosbTJGip6SqA==</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@@ -2,10 +2,19 @@
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System">
<section name="EnvelopeGenerator.Form.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<section name="DevExpress.LookAndFeel.Design.AppSettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<applicationSettings>
<EnvelopeGenerator.Form.Settings>
<setting name="NetUse_Usr" serializeAs="String">
<value>dd-san01\Administrator</value>
</setting>
<setting name="NetUse_PW" serializeAs="String">
<value>sY4vnATDXwosbTJGip6SqA==</value>
</setting>
</EnvelopeGenerator.Form.Settings>
<DevExpress.LookAndFeel.Design.AppSettings>
<setting name="DPIAwarenessMode" serializeAs="String">
<value>System</value>

View File

@@ -95,6 +95,8 @@ Partial Public Class frmEnvelopeEditor
Me.EnvelopeDocumentBindingSource = New System.Windows.Forms.BindingSource(Me.components)
Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
Me.txtEnvelopeIdLabel = New DevExpress.XtraBars.BarStaticItem()
Me.RibbonPageGroup2 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
Me.BarButtonItem1 = New DevExpress.XtraBars.BarButtonItem()
CType(Me.SplitContainerControl1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.SplitContainerControl1.Panel1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SplitContainerControl1.Panel1.SuspendLayout()
@@ -237,9 +239,9 @@ Partial Public Class frmEnvelopeEditor
'RibbonControl1
'
Me.RibbonControl1.ExpandCollapseItem.Id = 0
Me.RibbonControl1.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl1.ExpandCollapseItem, Me.RibbonControl1.SearchEditItem, Me.btnSave, Me.btnCancel, Me.btnNewFile, Me.btnDeleteFile, Me.btnSendEnvelope, Me.btnEditFields, Me.btnDeleteReceiver, Me.btnEditData, Me.txtCreatorEmailLabel, Me.txtEnvelopeIdLabel2})
Me.RibbonControl1.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl1.ExpandCollapseItem, Me.RibbonControl1.SearchEditItem, Me.btnSave, Me.btnCancel, Me.btnNewFile, Me.btnDeleteFile, Me.btnSendEnvelope, Me.btnEditFields, Me.btnDeleteReceiver, Me.btnEditData, Me.txtCreatorEmailLabel, Me.txtEnvelopeIdLabel2, Me.BarButtonItem1})
resources.ApplyResources(Me.RibbonControl1, "RibbonControl1")
Me.RibbonControl1.MaxItemId = 12
Me.RibbonControl1.MaxItemId = 13
Me.RibbonControl1.Name = "RibbonControl1"
Me.RibbonControl1.Pages.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPage() {Me.RibbonPage1})
Me.RibbonControl1.ShowApplicationButton = DevExpress.Utils.DefaultBoolean.[False]
@@ -324,7 +326,7 @@ Partial Public Class frmEnvelopeEditor
'
'RibbonPage1
'
Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroup1, Me.RibbonPageGroupDocuments, Me.RibbonPageGroupInvitation, Me.RibbonPageGroupAddSignature, Me.RibbonPageGroupReceiver})
Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroup1, Me.RibbonPageGroupDocuments, Me.RibbonPageGroupInvitation, Me.RibbonPageGroupAddSignature, Me.RibbonPageGroupReceiver, Me.RibbonPageGroup2})
Me.RibbonPage1.Name = "RibbonPage1"
resources.ApplyResources(Me.RibbonPage1, "RibbonPage1")
'
@@ -638,6 +640,18 @@ Partial Public Class frmEnvelopeEditor
Me.txtEnvelopeIdLabel.PaintStyle = DevExpress.XtraBars.BarItemPaintStyle.CaptionGlyph
Me.txtEnvelopeIdLabel.Tag = "Envelope-ID: {0}"
'
'RibbonPageGroup2
'
Me.RibbonPageGroup2.ItemLinks.Add(Me.BarButtonItem1)
Me.RibbonPageGroup2.Name = "RibbonPageGroup2"
resources.ApplyResources(Me.RibbonPageGroup2, "RibbonPageGroup2")
'
'BarButtonItem1
'
resources.ApplyResources(Me.BarButtonItem1, "BarButtonItem1")
Me.BarButtonItem1.Id = 12
Me.BarButtonItem1.Name = "BarButtonItem1"
'
'frmEnvelopeEditor
'
resources.ApplyResources(Me, "$this")
@@ -759,6 +773,8 @@ Partial Public Class frmEnvelopeEditor
Friend WithEvents txtEnvelopeIdLabel As DevExpress.XtraBars.BarStaticItem
Friend WithEvents txtEnvelopeIdLabel2 As DevExpress.XtraBars.BarStaticItem
Friend WithEvents colPageCount As DevExpress.XtraGrid.Columns.TileViewColumn
Friend WithEvents BarButtonItem1 As DevExpress.XtraBars.BarButtonItem
Friend WithEvents RibbonPageGroup2 As DevExpress.XtraBars.Ribbon.RibbonPageGroup
#End Region

View File

@@ -408,6 +408,9 @@
ICA8L2c+DQo8L3N2Zz4L
</value>
</data>
<data name="BarButtonItem1.Caption" xml:space="preserve">
<value>BarButtonItem1</value>
</data>
<data name="RibbonControl1.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value>
</data>
@@ -426,6 +429,9 @@
<data name="RibbonPageGroupReceiver.Text" xml:space="preserve">
<value>Empfänger</value>
</data>
<data name="RibbonPageGroup2.Text" xml:space="preserve">
<value>RibbonPageGroup2</value>
</data>
<data name="RibbonPage1.Text" xml:space="preserve">
<value>Start</value>
</data>
@@ -1226,6 +1232,18 @@
<data name="&gt;&gt;txtEnvelopeIdLabel.Type" xml:space="preserve">
<value>DevExpress.XtraBars.BarStaticItem, DevExpress.XtraBars.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;RibbonPageGroup2.Name" xml:space="preserve">
<value>RibbonPageGroup2</value>
</data>
<data name="&gt;&gt;RibbonPageGroup2.Type" xml:space="preserve">
<value>DevExpress.XtraBars.Ribbon.RibbonPageGroup, DevExpress.XtraBars.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;BarButtonItem1.Name" xml:space="preserve">
<value>BarButtonItem1</value>
</data>
<data name="&gt;&gt;BarButtonItem1.Type" xml:space="preserve">
<value>DevExpress.XtraBars.BarButtonItem, DevExpress.XtraBars.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>frmEnvelopeEditor</value>
</data>

View File

@@ -63,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)
@@ -329,11 +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 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
End If
Me.Close()
End If
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.Move(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
@@ -471,4 +510,10 @@ Partial Public Class frmEnvelopeEditor
End If
End If
End Sub
Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem1.ItemClick
For Each odoc In Envelope.Documents
MsgBox(odoc.Filename & vbNewLine & odoc.Filepath)
Next
End Sub
End Class

View File

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