MS_21.01.2016

This commit is contained in:
SchreiberM
2016-01-21 17:05:06 +01:00
parent 9df213f39f
commit bed11c3d80
14 changed files with 376 additions and 241 deletions

View File

@@ -27,4 +27,27 @@ Public Class ClassHelper
End If
Return tempName
End Function
Public Shared Function CheckFileIsInUse(ByVal filename) As Boolean
Dim fs As Integer = FreeFile()
Dim inuse As Boolean = False
If File.Exists(filename) Then
Try
Using f As New IO.FileStream(filename, FileMode.Open, FileAccess.ReadWrite, FileShare.None)
' thisFileInUse = False
End Using
Catch
inuse = True
End Try
Try
FileOpen(fs, filename, OpenMode.Binary, OpenAccess.ReadWrite, OpenShare.LockReadWrite)
Catch ex As Exception
ClassLogger.Add("File " & filename & " inuse or not able to open - message: " & ex.Message, True)
inuse = True
Finally
FileClose(fs)
End Try
End If
Return inuse
End Function
End Class