MS Version 2.6.00 Removed CopytoDMZ
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user