Unix fixes and feature lock outs

This commit is contained in:
Michael J. Seiferling
2016-03-02 01:07:27 -06:00
parent 7a7fa65ce6
commit e531ec5701
10 changed files with 3435 additions and 529 deletions
+5 -5
View File
@@ -178,11 +178,11 @@ Public Class frmAddWizard
Return False Return False
End If End If
If Path.GetExtension(strPath.ToLower) <> ".exe" Then 'If Path.GetExtension(strPath.ToLower) <> ".exe" Then
sErrorMessage = frmAddWizard_ErrorNotAProcess ' sErrorMessage = frmAddWizard_ErrorNotAProcess
txtProcessPath.Focus() ' txtProcessPath.Focus()
Return False ' Return False
End If 'End If
If Not Path.IsPathRooted(strPath) Then If Not Path.IsPathRooted(strPath) Then
sErrorMessage = frmAddWizard_ErrorBadProcessPath sErrorMessage = frmAddWizard_ErrorBadProcessPath
+24 -16
View File
@@ -395,13 +395,18 @@ Public Class frmGameManager
End Sub End Sub
Private Sub OpenBackupFile() Private Sub OpenBackupFile()
Dim sFileName As String 'Unix Hanlder
sFileName = BackupFolder & CurrentBackupItem.FileName If Not mgrCommon.IsUnix Then
Dim sFileName As String
sFileName = BackupFolder & CurrentBackupItem.FileName
If File.Exists(sFileName) Then If File.Exists(sFileName) Then
Process.Start("explorer.exe", "/select," & sFileName) Process.Start("explorer.exe", "/select," & sFileName)
Else
mgrCommon.ShowMessage(frmGameManager_ErrorNoBackupExists, MsgBoxStyle.Exclamation)
End If
Else Else
mgrCommon.ShowMessage(frmGameManager_ErrorNoBackupExists, MsgBoxStyle.Exclamation) mgrCommon.ShowMessage(App_ErrorUnixNotAvailable, MsgBoxStyle.Exclamation)
End If End If
End Sub End Sub
@@ -477,22 +482,25 @@ Public Class frmGameManager
End Function End Function
Private Sub OpenRestorePath() Private Sub OpenRestorePath()
Dim sPath As String = String.Empty If Not mgrCommon.IsUnix Then
Dim sPath As String = String.Empty
If CurrentBackupItem.AbsolutePath Then If CurrentBackupItem.AbsolutePath Then
sPath = CurrentBackupItem.RestorePath sPath = CurrentBackupItem.RestorePath
Else Else
If FindRestorePath() Then If FindRestorePath() Then
sPath = CurrentBackupItem.RelativeRestorePath sPath = CurrentBackupItem.RelativeRestorePath
End If
End If End If
End If
If Directory.Exists(sPath) Then If Directory.Exists(sPath) Then
Process.Start("explorer.exe", sPath) Process.Start("explorer.exe", sPath)
Else
mgrCommon.ShowMessage(frmGameManager_ErrorNoRestorePathExists, MsgBoxStyle.Exclamation)
End If
Else Else
mgrCommon.ShowMessage(frmGameManager_ErrorNoRestorePathExists, MsgBoxStyle.Exclamation) mgrCommon.ShowMessage(App_ErrorUnixNotAvailable, MsgBoxStyle.Exclamation)
End If End If
End Sub End Sub
Private Sub OpenTags() Private Sub OpenTags()
+4 -4
View File
@@ -30,7 +30,7 @@ Public Class frmIncludeExclude
Return sRootFolder Return sRootFolder
End Get End Get
Set(value As String) Set(value As String)
sRootFolder = value.TrimEnd("\") sRootFolder = value.TrimEnd(Path.DirectorySeparatorChar)
End Set End Set
End Property End Property
@@ -52,7 +52,7 @@ Public Class frmIncludeExclude
If sFolders.Length <> 0 Then If sFolders.Length <> 0 Then
For Each sFolder As String In sFolders For Each sFolder As String In sFolders
oChild = New TreeNode(sFolder.Replace(sDirectory, String.Empty).TrimStart("\"), 0, 0) oChild = New TreeNode(sFolder.Replace(sDirectory, String.Empty).TrimStart(Path.DirectorySeparatorChar), 0, 0)
oChild.Name = sFolder oChild.Name = sFolder
oChild.Tag = 0 oChild.Tag = 0
oNode.Nodes.Add(oChild) oNode.Nodes.Add(oChild)
@@ -64,7 +64,7 @@ Public Class frmIncludeExclude
If sFiles.Length <> 0 Then If sFiles.Length <> 0 Then
For Each sFile As String In sFiles For Each sFile As String In sFiles
oChild = New TreeNode(sFile.Replace(sDirectory, String.Empty).TrimStart("\"), 1, 1) oChild = New TreeNode(sFile.Replace(sDirectory, String.Empty).TrimStart(Path.DirectorySeparatorChar), 1, 1)
oChild.Tag = 1 oChild.Tag = 1
oNode.Nodes.Add(oChild) oNode.Nodes.Add(oChild)
Next Next
@@ -195,7 +195,7 @@ Public Class frmIncludeExclude
If Path.GetFileName(txtRootFolder.Text) = sNewLabel Then If Path.GetFileName(txtRootFolder.Text) = sNewLabel Then
sFolderCheck = txtRootFolder.Text sFolderCheck = txtRootFolder.Text
Else Else
sFolderCheck = txtRootFolder.Text & "\" & sNewLabel sFolderCheck = txtRootFolder.Text & Path.DirectorySeparatorChar & sNewLabel
End If End If
If Directory.Exists(sFolderCheck) Then If Directory.Exists(sFolderCheck) Then
iType = 0 iType = 0
+2 -1
View File
@@ -255,8 +255,9 @@ Partial Class frmMain
' '
'gMonStripTxtStatus 'gMonStripTxtStatus
' '
Me.gMonStripTxtStatus.Margin = New System.Windows.Forms.Padding(5, 0, 0, 0)
Me.gMonStripTxtStatus.Name = "gMonStripTxtStatus" Me.gMonStripTxtStatus.Name = "gMonStripTxtStatus"
Me.gMonStripTxtStatus.Size = New System.Drawing.Size(405, 17) Me.gMonStripTxtStatus.Size = New System.Drawing.Size(369, 22)
Me.gMonStripTxtStatus.Spring = True Me.gMonStripTxtStatus.Spring = True
Me.gMonStripTxtStatus.Text = "Monitor Status" Me.gMonStripTxtStatus.Text = "Monitor Status"
Me.gMonStripTxtStatus.TextAlign = System.Drawing.ContentAlignment.MiddleLeft Me.gMonStripTxtStatus.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
+2891 -30
View File
File diff suppressed because it is too large Load Diff
+30 -14
View File
@@ -1245,14 +1245,19 @@ Public Class frmMain
'Functions to handle other features 'Functions to handle other features
Private Sub RestartAsAdmin() Private Sub RestartAsAdmin()
If mgrCommon.IsElevated Then 'Unix Hanlder
mgrCommon.ShowMessage(frmMain_ErrorAlreadyAdmin, MsgBoxStyle.Information) If Not mgrCommon.IsUnix Then
Else If mgrCommon.IsElevated Then
If mgrCommon.ShowMessage(frmMain_ConfirmRunAsAdmin, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then mgrCommon.ShowMessage(frmMain_ErrorAlreadyAdmin, MsgBoxStyle.Information)
mgrCommon.RestartAsAdmin() Else
bShutdown = True If mgrCommon.ShowMessage(frmMain_ConfirmRunAsAdmin, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
ShutdownApp(False) mgrCommon.RestartAsAdmin()
bShutdown = True
ShutdownApp(False)
End If
End If End If
Else
mgrCommon.ShowMessage(App_ErrorUnixNotAvailable, MsgBoxStyle.Exclamation)
End If End If
End Sub End Sub
@@ -1416,11 +1421,18 @@ Public Class frmMain
End Sub End Sub
Private Sub Main_FormClosing(sender As System.Object, e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing Private Sub Main_FormClosing(sender As System.Object, e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
'Intercept Exit & Minimize 'Unix Handler
If mgrCommon.IsUnix And Not bShutdown Then
ShutdownApp()
End If
'Intercept Exit
If bShutdown = False Then If bShutdown = False Then
e.Cancel = True e.Cancel = True
Me.Visible = False If Not mgrCommon.IsUnix Then
Me.ShowInTaskbar = False Me.Visible = False
Me.ShowInTaskbar = False
End If
End If End If
End Sub End Sub
@@ -1541,7 +1553,7 @@ Public Class frmMain
LoadAndVerify() LoadAndVerify()
VerifyCustomPathVariables() VerifyCustomPathVariables()
If oSettings.StartToTray Then If oSettings.StartToTray And Not mgrCommon.IsUnix Then
Me.Visible = False Me.Visible = False
Me.ShowInTaskbar = False Me.ShowInTaskbar = False
End If End If
@@ -1553,14 +1565,18 @@ Public Class frmMain
End If End If
HandleScan() HandleScan()
CheckForNewBackups() CheckForNewBackups()
Catch niex As NotImplementedException
'Ignore for Mono runtime tests
Catch ex As Exception Catch ex As Exception
mgrCommon.ShowMessage(frmMain_ErrorInitFailure, ex.Message, MsgBoxStyle.Critical) mgrCommon.ShowMessage(frmMain_ErrorInitFailure, ex.Message, MsgBoxStyle.Critical)
bInitFail = True bInitFail = True
End Try End Try
'Unix Handler
If mgrCommon.IsUnix Then
gMonTray.Visible = False
Me.MinimizeBox = True
End If
End Sub End Sub
Private Sub frmMain_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown Private Sub frmMain_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown
+12
View File
@@ -113,6 +113,12 @@ Public Class frmSettings
nudSupressBackupThreshold.Value = oSettings.SupressBackupThreshold nudSupressBackupThreshold.Value = oSettings.SupressBackupThreshold
nudSupressBackupThreshold.Enabled = chkSupressBackup.Checked nudSupressBackupThreshold.Enabled = chkSupressBackup.Checked
cboCompression.SelectedValue = oSettings.CompressionLevel cboCompression.SelectedValue = oSettings.CompressionLevel
'Unix Handler
If mgrCommon.IsUnix Then
chkStartToTray.Checked = False
chkStartWindows.Checked = False
End If
End Sub End Sub
Private Sub LoadCombos() Private Sub LoadCombos()
@@ -159,6 +165,12 @@ Public Class frmSettings
chkMonitorOnStartup.Text = frmSettings_chkMonitorOnStartup chkMonitorOnStartup.Text = frmSettings_chkMonitorOnStartup
grp7z.Text = frmSettings_grp7z grp7z.Text = frmSettings_grp7z
lblCompression.Text = frmSettings_lblCompression lblCompression.Text = frmSettings_lblCompression
'Unix Handler
If mgrCommon.IsUnix Then
chkStartToTray.Enabled = False
chkStartWindows.Enabled = False
End If
End Sub End Sub
Private Sub btnSave_Click(sender As System.Object, e As System.EventArgs) Handles btnSave.Click Private Sub btnSave_Click(sender As System.Object, e As System.EventArgs) Handles btnSave.Click
+4 -8
View File
@@ -1,6 +1,7 @@
Imports GBM.My.Resources Imports GBM.My.Resources
Imports System.Net Imports System.Net
Imports System.IO Imports System.IO
Imports System.Security.Principal
Public Class mgrCommon Public Class mgrCommon
@@ -117,14 +118,9 @@ Public Class mgrCommon
End Function End Function
Public Shared Function IsElevated() As Boolean Public Shared Function IsElevated() As Boolean
If IsUnix() Then Dim oID As WindowsIdentity = WindowsIdentity.GetCurrent
Return True Dim oPrincipal As New WindowsPrincipal(oID)
End If Return oPrincipal.IsInRole(WindowsBuiltInRole.Administrator)
If My.User.IsInRole(ApplicationServices.BuiltInRole.Administrator) Then
Return True
Else
Return False
End If
End Function End Function
Public Shared Sub RestartAsAdmin() Public Shared Sub RestartAsAdmin()
+459 -450
View File
File diff suppressed because it is too large Load Diff
+4 -1
View File
@@ -1355,7 +1355,7 @@
<value>Generating SHA-256 hash for [PARAM] backup file.</value> <value>Generating SHA-256 hash for [PARAM] backup file.</value>
</data> </data>
<data name="mgrCommon_FilesFilter" xml:space="preserve"> <data name="mgrCommon_FilesFilter" xml:space="preserve">
<value>[PARAM] files (*.[PARAM])|*.[PARAM]</value> <value>[PARAM] files (*.[PARAM])|*.[PARAM]|All files (*.*)|*.*</value>
</data> </data>
<data name="mgrCommon_No" xml:space="preserve"> <data name="mgrCommon_No" xml:space="preserve">
<value>No</value> <value>No</value>
@@ -1561,4 +1561,7 @@
<data name="frmMain_ErrorInitFailure" xml:space="preserve"> <data name="frmMain_ErrorInitFailure" xml:space="preserve">
<value>An unexpected error occured while initializing GBM.[BR][BR][PARAM][BR][BR]The application will now exit.</value> <value>An unexpected error occured while initializing GBM.[BR][BR][PARAM][BR][BR]The application will now exit.</value>
</data> </data>
<data name="App_ErrorUnixNotAvailable" xml:space="preserve">
<value>This function is currently not available on a Unix based operating system.</value>
</data>
</root> </root>