More compatability updates

This commit is contained in:
Michael J. Seiferling
2016-03-02 19:15:32 -06:00
parent ca8798a460
commit d46360b244
11 changed files with 115 additions and 23 deletions
+27 -1
View File
@@ -134,12 +134,38 @@ Public Class mgrCommon
oProcess.Start()
End Sub
'Delete file based on OS type
Public Shared Sub DeleteFile(ByVal sPath As String, Optional ByVal bRecycle As Boolean = True)
If File.Exists(sPath) Then
If IsUnix() Then
File.Delete(sPath)
Else
If bRecycle Then
My.Computer.FileSystem.DeleteFile(sPath, FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.SendToRecycleBin)
Else
File.Delete(sPath)
End If
End If
End If
End Sub
'Delete directory based on OS type
Public Shared Sub DeleteDirectory(ByVal sPath As String, Optional ByVal bRecursive As Boolean = False)
If Directory.Exists(sPath) Then
If IsUnix() Then
Directory.Delete(sPath, bRecursive)
Else
My.Computer.FileSystem.DeleteDirectory(sPath, FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.SendToRecycleBin)
End If
End If
End Sub
'Save string as text file
Public Shared Sub SaveText(ByVal sText As String, ByVal sPath As String)
Dim oStream As StreamWriter
Try
If File.Exists(sPath) Then My.Computer.FileSystem.DeleteFile(sPath, FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.SendToRecycleBin)
If File.Exists(sPath) Then DeleteFile(sPath, False)
oStream = New StreamWriter(sPath)
oStream.Write(sText)
oStream.Flush()
+10 -4
View File
@@ -85,13 +85,17 @@ Public Class mgrProcesses
Next
End Sub
Public Function SearchRunningProcesses(ByVal hshScanList As Hashtable, ByRef bNeedsPath As Boolean, ByRef iErrorCode As Integer) As Boolean
Public Function SearchRunningProcesses(ByVal hshScanList As Hashtable, ByRef bNeedsPath As Boolean, ByRef iErrorCode As Integer, ByVal bDebugMode As Boolean) As Boolean
Dim prsList() As Process = Process.GetProcesses
Dim sProcessCheck As String = String.Empty
Dim sProcessList As String = String.Empty
For Each prsCurrent As Process In prsList
'This needs to be wrapped due to issues with Mono.
Try
sProcessCheck = prsCurrent.ProcessName
sProcessCheck = prsCurrent.ProcessName
If bDebugMode Then sProcessList &= sProcessCheck & vbCrLf
Catch ex As Exception
'Do Nothing
End Try
@@ -121,12 +125,12 @@ Public Class mgrProcesses
bNeedsPath = True
iErrorCode = 299
Else
MsgBox(exWin32.Message & vbCrLf & exWin32.StackTrace)
If bDebugMode Then mgrCommon.ShowMessage(exWin32.NativeErrorCode & " " & exWin32.Message & vbCrLf & vbCrLf & exWin32.StackTrace, MsgBoxStyle.Critical)
'A different failure occured, drop out and continue to scan.
Return False
End If
Catch exAll As Exception
MsgBox(exAll.Message & vbCrLf & exAll.StackTrace)
If bDebugMode Then mgrCommon.ShowMessage(exAll.Message & vbCrLf & vbCrLf & exAll.StackTrace, MsgBoxStyle.Critical)
'A different failure occured, drop out and continue to scan.
Return False
End Try
@@ -143,6 +147,8 @@ Public Class mgrProcesses
End If
Next
If bDebugMode Then mgrCommon.SaveText(sProcessList, mgrPath.SettingsRoot & "/gbm_process_list.txt")
Return False
End Function