MS Version 2.6.00 Removed CopytoDMZ

This commit is contained in:
SchreiberM 2024-04-15 14:08:47 +02:00
parent 83746abb1b
commit f51c500f90
6 changed files with 7 additions and 120 deletions

View File

@ -145,7 +145,10 @@ Public MustInherit Class BaseController
IO.File.Delete(pDocument.Filepath)
End If
Dim oFolder As String = Path.GetDirectoryName(pDocument.Filepath)
Directory.Delete(oFolder)
If Directory.Exists(oFolder) Then
Directory.Delete(oFolder)
End If
Return True
Catch ex As Exception

View File

@ -32,5 +32,5 @@ Imports System.Runtime.InteropServices
' 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("2.5.0.0")>
<Assembly: AssemblyVersion("2.6.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>

View File

@ -52,24 +52,6 @@ Partial Friend NotInheritable Class Settings
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

View File

@ -1,12 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="" GeneratedClassName="Settings">
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<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>
<Settings />
</SettingsFile>

View File

@ -2,19 +2,10 @@
<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

@ -357,88 +357,6 @@ Partial Public Class frmEnvelopeEditor
End If
End If
End Sub
Function CopyFileWithNetUse(pSourcePath As String, pDestinationPath As String, pUsername As String, pPassword As String) As Boolean
Logger.Debug("EXECUTING CopyFileWithNetUse for " & pDestinationPath)
Dim oDirectoryExists As Boolean = False
Try
If Directory.Exists(pDestinationPath) Then
oDirectoryExists = True
End If
Catch ex As Exception
Logger.Warn("CopyFileWithNetUse - path not accessible or existing: {0}", ex.Message)
End Try
Logger.Debug("CopyFileWithNetUse - Folder accessible [{0}]", oDirectoryExists.ToString)
If oDirectoryExists = False Then
Dim oDectryptedPW = Decryption.Decrypt(pPassword)
Dim netUseCommand As String = $"net use {pDestinationPath} /user:{pUsername} {oDectryptedPW}"
Logger.Debug("netUseCommand " & netUseCommand)
Dim processInfo As New ProcessStartInfo("cmd.exe", $"/C {netUseCommand}")
processInfo.RedirectStandardOutput = True
processInfo.RedirectStandardInput = True
processInfo.UseShellExecute = False
processInfo.CreateNoWindow = True
Using oProcess As Process = Process.Start(processInfo)
oProcess.WaitForExit()
' Prüfe den Rückgabewert des net use Befehls
If oProcess.ExitCode = 0 Then
' Verschiebe die Datei
Try
Dim oReturn = COPY_TO_DMZ(pSourcePath, pDestinationPath)
oProcess.Close()
Return oReturn
Catch ex As Exception
oProcess.Close()
Logger.Warn("Unexpected error in CopyFileWithNetUse " & pDestinationPath)
MsgBox(ex.Message, MsgBoxStyle.Critical, "Unexpected error in CopyFileWithNetUse")
Return False
End Try
Else
Logger.Warn("Error while connecting to network-path: " & pDestinationPath)
'MsgBox("Error while connecting to network: " & pDestinationPath, MsgBoxStyle.Critical, "Unexpected error in CopyFileWithNetUse")
Return False
End If
End Using
Else
Return COPY_TO_DMZ(pSourcePath, pDestinationPath)
End If
End Function
Private Function COPY_TO_DMZ(pSourcePath As String, pDestinationPath As String) As Boolean
Try
Dim oFilename = System.IO.Path.GetFileName(pSourcePath)
Dim oFilePath As String = pSourcePath
Dim oSourceDirectory As String = Path.GetDirectoryName(oFilePath)
Dim split As String() = oFilePath.Split("\")
Dim parentFolder As String = split(split.Length - 2)
pDestinationPath &= "\" + parentFolder
If Not System.IO.Directory.Exists(pDestinationPath) Then
System.IO.Directory.CreateDirectory(pDestinationPath)
End If
pDestinationPath &= "\" + oFilename
If File.Exists(pDestinationPath) Then
File.Delete(pDestinationPath)
End If
Logger.Debug("Now copying file ...")
Logger.Debug("from [{0}] ", pSourcePath)
Logger.Debug("to [{0}]... ", pDestinationPath)
System.IO.File.Copy(pSourcePath, pDestinationPath)
Logger.Debug("Successfully Copied!")
Directory2Delete = oSourceDirectory
Return True
Catch ex As Exception
Logger.Warn("COPY_TO_DMZ - Unexpected error {0}", ex.Message)
Return False
End Try
End Function
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