System.IO, Zugferd
This commit is contained in:
@@ -169,7 +169,7 @@ Public Class cDATENSERVER
|
||||
' My.Computer.FileSystem.RenameDirectory(oldDIR, newname)
|
||||
For Each li In DATA_LIST.LIST
|
||||
Dim newPfad = li.coll_pfad.Replace(oldDIR, newDIR)
|
||||
If Not IO.Directory.Exists(newDIR) Then IO.Directory.CreateDirectory(newDIR)
|
||||
If Not System.IO.Directory.Exists(newDIR) Then System.IO.Directory.CreateDirectory(newDIR)
|
||||
My.Computer.FileSystem.CopyFile(li.coll_pfad, newPfad, True)
|
||||
My.Computer.FileSystem.DeleteFile(li.coll_pfad)
|
||||
li.coll_pfad = newPfad
|
||||
@@ -197,11 +197,11 @@ Public Class cDATENSERVER
|
||||
Dim newPfad = li.coll_pfad.Replace(oldDIR, newDIR)
|
||||
'MsgBox(li.coll_pfad)
|
||||
' MsgBox(newPfad)
|
||||
If Not IO.Directory.Exists(newDIR) Then IO.Directory.CreateDirectory(newDIR)
|
||||
If Not System.IO.Directory.Exists(newDIR) Then System.IO.Directory.CreateDirectory(newDIR)
|
||||
Try
|
||||
If Not li.coll_pfad.ToLower.StartsWith("\\stor01.verag.ost.dmn\datenarchivarchiv") Then
|
||||
If Not li.coll_pfad.Contains("?") Then
|
||||
If IO.File.Exists(li.coll_pfad) Then
|
||||
If System.IO.File.Exists(li.coll_pfad) Then
|
||||
My.Computer.FileSystem.CopyFile(li.coll_pfad, newPfad, True)
|
||||
My.Computer.FileSystem.DeleteFile(li.coll_pfad)
|
||||
li.coll_pfad = newPfad
|
||||
@@ -301,7 +301,7 @@ Public Class cDATENSERVER
|
||||
|
||||
Public Function uploadDataToDATENSERVER(srcPath, Optional bezeichnung = "", Optional endung = "", Optional allowMsg = True, Optional coll_archiv = False, Optional delteFromFileSystem = True, Optional enableOverwritting = False) As Boolean
|
||||
'LAST_ID = -1
|
||||
If endung = "" Then Dim fi As New IO.DirectoryInfo(srcPath) : endung = fi.Extension
|
||||
If endung = "" Then Dim fi As New System.IO.DirectoryInfo(srcPath) : endung = fi.Extension
|
||||
' If bezeichnung = "" Then bezeichnung = System.IO.Path.GetFileName(srcPath) : endung = ""
|
||||
If bezeichnung = "" Then bezeichnung = da_name
|
||||
|
||||
@@ -328,7 +328,7 @@ Public Class cDATENSERVER
|
||||
Public Function insertDataToDATENSERVER(srcPath, Optional bezeichnung = "", Optional endung = "", Optional allowMsg = True, Optional coll_archiv = False) As Boolean
|
||||
'Datei musss schon am Datenserver liegen, wird nciht mehr kopiert!!!!!
|
||||
|
||||
If endung = "" Then Dim fi As New IO.DirectoryInfo(srcPath) : endung = fi.Extension
|
||||
If endung = "" Then Dim fi As New System.IO.DirectoryInfo(srcPath) : endung = fi.Extension
|
||||
' If bezeichnung = "" Then bezeichnung = System.IO.Path.GetFileName(srcPath) : endung = ""
|
||||
If bezeichnung = "" Then bezeichnung = da_name
|
||||
replaceInvalidCahr(bezeichnung)
|
||||
@@ -552,15 +552,15 @@ Public Class cDATENSERVER
|
||||
|
||||
|
||||
' Dim srcPath = SQL.getValueTxtBySql("SELECT TOP 1 isnull([coll_pfad],'') FROM [tblDatenarchiv] INNER JOIN [tblDatenarchiv_Collection] ON [da_id]=[coll_daId] WHERE da_id='" & da_id & "' ", "FMZOLL")
|
||||
' If Not IO.File.Exists(srcPath) Then MsgBox("Die Datei existiert nicht") : Exit Function
|
||||
' If Not System.IO.File.Exists(srcPath) Then MsgBox("Die Datei existiert nicht") : Exit Function
|
||||
|
||||
' Dim fi As New IO.DirectoryInfo(srcPath)
|
||||
' Dim fi As New System.IO.DirectoryInfo(srcPath)
|
||||
' Dim destPath = DATENVERVER_OPTIONS.getTMPPath(fi.Name, fi.Extension)
|
||||
|
||||
|
||||
|
||||
|
||||
' IO.File.Copy(srcPath, destPath, True)
|
||||
' System.IO.File.Copy(srcPath, destPath, True)
|
||||
|
||||
' Process.Start(destPath)
|
||||
|
||||
@@ -578,7 +578,7 @@ Public Class cDATENSERVER
|
||||
' Dim path = SQL.getValueTxtBySql("SELECT TOP 1 isnull([coll_pfad],'') FROM [tblDatenarchiv] INNER JOIN [tblDatenarchiv_Collection] ON [da_id]=[coll_daId] WHERE da_id='" & da_id & "' ", "FMZOLL")
|
||||
'If path.Contains(rootDir) Then 'Um sicher zu gehen, dass der pfad im richtigem VZ ist.
|
||||
' saveFileToDel(path)
|
||||
' IO.File.Delete(path)
|
||||
' System.IO.File.Delete(path)
|
||||
'End If
|
||||
SQL.doSQL("DELETE FROM [tblDatenarchiv] WHERE [da_id]=" & Me.da_id & " ", "FMZOLL")
|
||||
'SQL.doSQL("DELETE FROM [tblDatenarchiv_Collection] WHERE [coll_daId]=" & id & " ", "FMZOLL")
|
||||
@@ -857,7 +857,7 @@ Public Class cFormularManager
|
||||
Dim path_src = DS.OPEN_SINGLE(False)
|
||||
If path_src = "" Then Return ""
|
||||
|
||||
Dim fi As New IO.DirectoryInfo(path_src)
|
||||
Dim fi As New System.IO.DirectoryInfo(path_src)
|
||||
Dim destPath = DATENVERVER_OPTIONS.getTMPPath(fi.Name, fi.Extension, True, False)
|
||||
Dim pdf As iTextSharp.text.pdf.PdfReader = New iTextSharp.text.pdf.PdfReader(path_src)
|
||||
Using fw As New FileStream(destPath, FileMode.OpenOrCreate)
|
||||
@@ -981,7 +981,7 @@ Public Class cFormularManager
|
||||
Dim path_src = DS.OPEN_SINGLE(False)
|
||||
If path_src = "" Then Return list
|
||||
|
||||
Dim fi As New IO.DirectoryInfo(path_src)
|
||||
Dim fi As New System.IO.DirectoryInfo(path_src)
|
||||
Dim destPath = DATENVERVER_OPTIONS.getTMPPath(fi.Name, fi.Extension, True, False)
|
||||
Dim pdf As iTextSharp.text.pdf.PdfReader = New iTextSharp.text.pdf.PdfReader(path_src)
|
||||
|
||||
@@ -1037,7 +1037,7 @@ Public Class cFormularManager
|
||||
path_src = vorhandenesLokalesPDF_Path
|
||||
End If
|
||||
|
||||
Dim fi As New IO.DirectoryInfo(path_src)
|
||||
Dim fi As New System.IO.DirectoryInfo(path_src)
|
||||
Dim destPath = ""
|
||||
destPath = DATENVERVER_OPTIONS.getTMPPath(fi.Name, fi.Extension, True, False)
|
||||
|
||||
@@ -1730,7 +1730,7 @@ Public Class cDatenarchiv_Collection
|
||||
If My.Computer.FileSystem.FileExists(coll_pfad) Then
|
||||
saveFileToDel(coll_pfad)
|
||||
Try
|
||||
IO.File.Delete(coll_pfad)
|
||||
System.IO.File.Delete(coll_pfad)
|
||||
Catch : End Try
|
||||
Return SQL.doSQL("DELETE FROM [tblDatenarchiv_Collection] WHERE [coll_id]=" & coll_id & " ", "FMZOLL")
|
||||
Else
|
||||
@@ -1751,8 +1751,8 @@ Public Class cDatenarchiv_Collection
|
||||
delPath = path.Replace("\DATENARCHIV\", "\DATENARCHIV\DELETE\")
|
||||
'\\192.168.0.91\Datenarchiv\DOKUMENTE\VORLAGEN\FISKALSCHREIBEN
|
||||
End If
|
||||
If Not IO.Directory.Exists(delPath.Substring(0, delPath.LastIndexOf("\"))) Then IO.Directory.CreateDirectory(delPath.Substring(0, delPath.LastIndexOf("\")))
|
||||
If IO.File.Exists(delPath) Then
|
||||
If Not System.IO.Directory.Exists(delPath.Substring(0, delPath.LastIndexOf("\"))) Then System.IO.Directory.CreateDirectory(delPath.Substring(0, delPath.LastIndexOf("\")))
|
||||
If System.IO.File.Exists(delPath) Then
|
||||
If delPath.Contains(".") Then
|
||||
Dim commaIndex = delPath.LastIndexOf(".")
|
||||
delPath = delPath.Substring(0, commaIndex) + Now.ToString("_del_ddMMyyyy_HHmmss") + delPath.Substring(commaIndex) ' + 1)
|
||||
@@ -1761,7 +1761,7 @@ Public Class cDatenarchiv_Collection
|
||||
' delPath.Replace(".", Now.ToString("_ddMMyyyy_HHmmss") & ".")
|
||||
End If
|
||||
End If
|
||||
IO.File.Copy(path, delPath)
|
||||
System.IO.File.Copy(path, delPath)
|
||||
End Sub
|
||||
|
||||
Function INSERT() As Integer
|
||||
@@ -1816,9 +1816,9 @@ Public Class cDatenarchiv_Collection
|
||||
End Function
|
||||
|
||||
Public Function OPEN(Optional openFILE As Boolean = True, Optional useBezeichnung As Boolean = False) As String
|
||||
If Not IO.File.Exists(coll_pfad) Then MsgBox("Die Datei existiert nicht") : Return ""
|
||||
If Not System.IO.File.Exists(coll_pfad) Then MsgBox("Die Datei existiert nicht") : Return ""
|
||||
|
||||
Dim fi As New IO.DirectoryInfo(coll_pfad)
|
||||
Dim fi As New System.IO.DirectoryInfo(coll_pfad)
|
||||
Dim destPath = ""
|
||||
If useBezeichnung Then
|
||||
destPath = DATENVERVER_OPTIONS.copyToTmp_KeepFilename(coll_pfad, coll_bezeichnung)
|
||||
@@ -1826,14 +1826,14 @@ Public Class cDatenarchiv_Collection
|
||||
destPath = DATENVERVER_OPTIONS.getTMPPath(fi.Name, fi.Extension, , False)
|
||||
End If
|
||||
' MsgBox(destPath)
|
||||
IO.File.Copy(coll_pfad, destPath, True)
|
||||
System.IO.File.Copy(coll_pfad, destPath, True)
|
||||
If openFILE Then Process.Start(destPath)
|
||||
Return destPath
|
||||
End Function
|
||||
|
||||
|
||||
Public Function OPEN_ORIG(Optional openFILE As Boolean = True) As String
|
||||
If Not IO.File.Exists(coll_pfad) Then MsgBox("Die Datei existiert nicht") : Return ""
|
||||
If Not System.IO.File.Exists(coll_pfad) Then MsgBox("Die Datei existiert nicht") : Return ""
|
||||
|
||||
If openFILE Then Process.Start(coll_pfad)
|
||||
Return coll_pfad
|
||||
@@ -1944,7 +1944,7 @@ Public Class cDatenserverIDCollectionList
|
||||
Function COPY_FILE(srcPath, destPath, ByRef errorMsg) As Boolean
|
||||
For i = 1 To 3 '3 Versuche
|
||||
Try
|
||||
IO.File.Copy(srcPath, destPath, True) ' Kopiert die Dateien Next
|
||||
System.IO.File.Copy(srcPath, destPath, True) ' Kopiert die Dateien Next
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
errorMsg = ex.Message
|
||||
@@ -2014,7 +2014,7 @@ Public Class DATENVERVER_OPTIONS
|
||||
TMP_PATH = Path.GetTempPath() & "\VERAG\DatenTMP\"
|
||||
End If
|
||||
|
||||
' If Not IO.Directory.Exists(TMP_PATH) Then IO.Directory.CreateDirectory(TMP_PATH)
|
||||
' If Not System.IO.Directory.Exists(TMP_PATH) Then System.IO.Directory.CreateDirectory(TMP_PATH)
|
||||
|
||||
Dim TMP_PATH2 = TMP_PATH & If(unterOrdner <> "", "\" & unterOrdner & "\", "")
|
||||
TMP_PATH2 = TMP_PATH2.replace("\\", "\")
|
||||
@@ -2035,7 +2035,7 @@ Public Class DATENVERVER_OPTIONS
|
||||
Dim destPath = TMP_PATH2 & name
|
||||
If special Then destPath = TMP_PATH2 & name & "_" & Now.ToString("yyyyMMddHHmmssfff") & extension
|
||||
|
||||
While IO.File.Exists(destPath)
|
||||
While System.IO.File.Exists(destPath)
|
||||
destPath = TMP_PATH2 & name & "_" & Now.ToString("yyyyMMddHHmmssfff") & extension
|
||||
End While
|
||||
|
||||
@@ -2046,11 +2046,11 @@ Public Class DATENVERVER_OPTIONS
|
||||
Dim DS As New cDATENSERVER(dId)
|
||||
Dim pfad As String = DS.GET_TOP1_PATH
|
||||
If pfad = "" Then Return ""
|
||||
Dim fi As New IO.FileInfo(pfad)
|
||||
Dim fi As New System.IO.FileInfo(pfad)
|
||||
|
||||
Dim tmpPath = VERAG_PROG_ALLGEMEIN.DATENVERVER_OPTIONS.getTMPPath(bezeichnung, fi.Extension,, False, "ClipBoard_TMP\ClipBoard_" & Now.ToString("ddMMyyyyHHmmss_sss") & "\")
|
||||
Try
|
||||
IO.File.Copy(pfad, tmpPath)
|
||||
System.IO.File.Copy(pfad, tmpPath)
|
||||
Return tmpPath
|
||||
Catch ex As Exception
|
||||
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||
@@ -2059,10 +2059,10 @@ Public Class DATENVERVER_OPTIONS
|
||||
End Function
|
||||
|
||||
Shared Function copyToTmp_KeepFilename(pfad As String, bezeichnung As String) As String
|
||||
Dim fi As New IO.FileInfo(pfad)
|
||||
Dim fi As New System.IO.FileInfo(pfad)
|
||||
Dim tmpPath = VERAG_PROG_ALLGEMEIN.DATENVERVER_OPTIONS.getTMPPath(bezeichnung, fi.Extension,, False, "ClipBoard_TMP\ClipBoard_" & Now.ToString("ddMMyyyyHHmmss_sss") & "\")
|
||||
Try
|
||||
IO.File.Copy(pfad, tmpPath)
|
||||
System.IO.File.Copy(pfad, tmpPath)
|
||||
Return tmpPath
|
||||
Catch ex As Exception
|
||||
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||
@@ -2073,12 +2073,12 @@ Public Class DATENVERVER_OPTIONS
|
||||
Shared Function getTMPAbsolutePath(AbsolutePath As String, extension As String, Optional special As Boolean = False, Optional delete As Boolean = True) As String
|
||||
|
||||
If delete Then
|
||||
Try : IO.File.Delete(AbsolutePath) : Catch ex As Exception : End Try
|
||||
Try : System.IO.File.Delete(AbsolutePath) : Catch ex As Exception : End Try
|
||||
End If
|
||||
Dim destPath = AbsolutePath
|
||||
If special Then destPath = AbsolutePath.Replace(extension, "") & "_" & Now.ToString("yyyyMMddHHmmssfff") & extension
|
||||
|
||||
While IO.File.Exists(destPath)
|
||||
While System.IO.File.Exists(destPath)
|
||||
destPath = AbsolutePath.Replace(extension, "") & "_" & Now.ToString("yyyyMMddHHmmssfff") & extension
|
||||
End While
|
||||
|
||||
@@ -2090,11 +2090,11 @@ Public Class DATENVERVER_OPTIONS
|
||||
Dim TMP_PATH2 As String = TMP_PATH & If(unterOrdner <> "", "\" & unterOrdner & "\", "")
|
||||
TMP_PATH2 = TMP_PATH2.Replace("\\", "\")
|
||||
If My.Computer.FileSystem.DirectoryExists(TMP_PATH2) Then
|
||||
For Each file As String In IO.Directory.GetFiles(TMP_PATH2) ' Ermittelt alle Dateien des Ordners und löscht diese (sind tmp)
|
||||
Try : IO.File.Delete(file) : Catch : End Try
|
||||
For Each file As String In System.IO.Directory.GetFiles(TMP_PATH2) ' Ermittelt alle Dateien des Ordners und löscht diese (sind tmp)
|
||||
Try : System.IO.File.Delete(file) : Catch : End Try
|
||||
Next
|
||||
For Each dir As String In IO.Directory.GetDirectories(TMP_PATH2) ' Ermittelt alle Dateien des Ordners und löscht diese (sind tmp)
|
||||
Try : IO.Directory.Delete(dir, True) : Catch : End Try
|
||||
For Each dir As String In System.IO.Directory.GetDirectories(TMP_PATH2) ' Ermittelt alle Dateien des Ordners und löscht diese (sind tmp)
|
||||
Try : System.IO.Directory.Delete(dir, True) : Catch : End Try
|
||||
Next
|
||||
End If
|
||||
End Sub
|
||||
@@ -2111,7 +2111,7 @@ Public Class DATENVERVER_OPTIONS
|
||||
|
||||
'Dim oldDIR = getDescPath(initRootDir(), kategorie, ordner, da_uOrdner1, da_uOrdner2, da_uOrdner3, kdnr, "", "", True)
|
||||
' Dim DS As New cDATENSERVER(kategorie, ordner, da_uOrdner1, da_uOrdner2, da_uOrdner3, da_name, kdnr)
|
||||
'If IO.Directory.Exists(oldDIR) Then
|
||||
'If System.IO.Directory.Exists(oldDIR) Then
|
||||
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
|
||||
Dim dt As DataTable = Nothing
|
||||
|
||||
@@ -2209,11 +2209,11 @@ Public Class DATENVERVER_OPTIONS
|
||||
dir &= If(da_uOrdner2 IsNot Nothing AndAlso da_uOrdner2 <> "", da_uOrdner2 & "\", "")
|
||||
dir &= If(da_uOrdner3 IsNot Nothing AndAlso da_uOrdner3 <> "", da_uOrdner3 & "\", "")
|
||||
If Not onlyordner Then
|
||||
If Not IO.Directory.Exists(dir) Then
|
||||
IO.Directory.CreateDirectory(dir)
|
||||
If Not System.IO.Directory.Exists(dir) Then
|
||||
System.IO.Directory.CreateDirectory(dir)
|
||||
End If
|
||||
Dim zusatz = "" : Dim zusatzcnt = 1
|
||||
While IO.File.Exists(dir & dateiName & zusatz & If(bezeichnung.ToString.EndsWith(endung), "", endung))
|
||||
While System.IO.File.Exists(dir & dateiName & zusatz & If(bezeichnung.ToString.EndsWith(endung), "", endung))
|
||||
zusatz = "_" & zusatzcnt
|
||||
zusatzcnt += 1
|
||||
End While
|
||||
@@ -2224,7 +2224,7 @@ Public Class DATENVERVER_OPTIONS
|
||||
Return dir
|
||||
Else
|
||||
If Not onlyordner Then
|
||||
If Not IO.Directory.Exists(rootDir & "DOKUMENTE\KEINE_ZUORDNUNG\" & kdnr_path & "\") Then IO.Directory.CreateDirectory(rootDir & "DOKUMENTE\KEINE_ZUORDNUNG\" & kdnr_path & "\")
|
||||
If Not System.IO.Directory.Exists(rootDir & "DOKUMENTE\KEINE_ZUORDNUNG\" & kdnr_path & "\") Then System.IO.Directory.CreateDirectory(rootDir & "DOKUMENTE\KEINE_ZUORDNUNG\" & kdnr_path & "\")
|
||||
End If
|
||||
Return rootDir & "DOKUMENTE\KEINE_ZUORDNUNG\" & kdnr_path & "\" & dateiName
|
||||
End If
|
||||
@@ -2235,11 +2235,11 @@ Public Class DATENVERVER_OPTIONS
|
||||
End Function
|
||||
Shared Function OPEN_PATH(path As String) As Boolean
|
||||
Try
|
||||
If Not IO.File.Exists(path) Then MsgBox("Die Datei existiert nicht") : Return False
|
||||
Dim fi As New IO.DirectoryInfo(path)
|
||||
If Not System.IO.File.Exists(path) Then MsgBox("Die Datei existiert nicht") : Return False
|
||||
Dim fi As New System.IO.DirectoryInfo(path)
|
||||
Dim destPath = DATENVERVER_OPTIONS.getTMPPath(fi.Name, fi.Extension, , False)
|
||||
|
||||
IO.File.Copy(path, destPath, True)
|
||||
System.IO.File.Copy(path, destPath, True)
|
||||
Process.Start(destPath)
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
|
||||
Reference in New Issue
Block a user