Functional in Mono

This commit is contained in:
Michael J. Seiferling
2016-03-01 23:27:42 -06:00
parent 4c7d36baef
commit 7a7fa65ce6
17 changed files with 132 additions and 2970 deletions
-1
View File
@@ -630,7 +630,6 @@ Partial Class frmGameManager
Me.lstGames.Name = "lstGames"
Me.lstGames.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended
Me.lstGames.Size = New System.Drawing.Size(228, 381)
Me.lstGames.Sorted = True
Me.lstGames.TabIndex = 1
'
'btnCancel
+17 -10
View File
@@ -34,7 +34,7 @@ Public Class frmGameManager
Property BackupFolder As String
Get
Return sBackupFolder & "\"
Return sBackupFolder & Path.DirectorySeparatorChar
End Get
Set(value As String)
sBackupFolder = value
@@ -175,7 +175,7 @@ Public Class frmGameManager
sFileName = BackupFolder & oBackupItem.FileName
'Rename Backup File
sNewFileName = Path.GetDirectoryName(sFileName) & "\" & Path.GetFileName(sFileName).Replace(oOriginalApp.Name, oNewApp.Name)
sNewFileName = Path.GetDirectoryName(sFileName) & Path.DirectorySeparatorChar & Path.GetFileName(sFileName).Replace(oOriginalApp.Name, oNewApp.Name)
If File.Exists(sFileName) Then
FileSystem.Rename(sFileName, sNewFileName)
End If
@@ -265,7 +265,7 @@ Public Class frmGameManager
Next
End If
lstGames.Items.Clear()
lstGames.DataSource = Nothing
FormatAndFillList()
End Sub
@@ -365,23 +365,30 @@ Public Class frmGameManager
End Function
Public Shared Function CompareByName(sItem1 As KeyValuePair(Of String, String), sItem2 As KeyValuePair(Of String, String)) As Integer
Return String.Compare(sItem1.Value, sItem2.value)
End Function
Private Sub FormatAndFillList()
IsLoading = True
Dim oApp As clsGame
Dim oData As KeyValuePair(Of String, String)
Dim oList As New List(Of KeyValuePair(Of String, String))
lstGames.ValueMember = "Key"
lstGames.DisplayMember = "Value"
lstGames.BeginUpdate()
For Each de As DictionaryEntry In AppData
oApp = DirectCast(de.Value, clsGame)
oData = New KeyValuePair(Of String, String)(oApp.ID, oApp.Name)
lstGames.Items.Add(oData)
oList.Add(oData)
Next
oList.Sort(AddressOf CompareByName)
lstGames.BeginUpdate()
lstGames.DataSource = oList
lstGames.EndUpdate()
IsLoading = False
@@ -979,13 +986,11 @@ Public Class frmGameManager
End Select
If bSuccess Then
Dim iSelected As Integer
IsDirty = False
LoadData()
iSelected = lstGames.Items.IndexOf(New KeyValuePair(Of String, String)(oApp.ID, oApp.Name))
If iSelected = -1 Then eCurrentMode = eModes.Disabled
ModeChange()
If eCurrentMode = eModes.View Then lstGames.SelectedIndex = iSelected
lstGames.ClearSelected()
If eCurrentMode = eModes.View Then lstGames.SelectedValue = oApp.ID
End If
End Sub
@@ -1293,6 +1298,8 @@ Public Class frmGameManager
AssignDirtyHandlers(grpExtra.Controls)
AssignDirtyHandlers(grpStats.Controls)
AssignDirtyHandlersMisc()
LoadData(False)
End Sub
Private Sub lstGames_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lstGames.SelectedIndexChanged
+10 -18
View File
@@ -47,9 +47,9 @@ Partial Class frmMain
Me.bwMonitor = New System.ComponentModel.BackgroundWorker()
Me.txtLog = New System.Windows.Forms.TextBox()
Me.gMonStatusStrip = New System.Windows.Forms.StatusStrip()
Me.gMonStripAdminButton = New System.Windows.Forms.ToolStripSplitButton()
Me.gMonStripAdminButton = New System.Windows.Forms.ToolStripStatusLabel()
Me.gMonStripTxtStatus = New System.Windows.Forms.ToolStripStatusLabel()
Me.gMonStripStatusButton = New System.Windows.Forms.ToolStripSplitButton()
Me.gMonStripStatusButton = New System.Windows.Forms.ToolStripStatusLabel()
Me.gMonMainMenu = New System.Windows.Forms.MenuStrip()
Me.gMonFile = New System.Windows.Forms.ToolStripMenuItem()
Me.gMonFileMonitor = New System.Windows.Forms.ToolStripMenuItem()
@@ -238,7 +238,7 @@ Partial Class frmMain
'
Me.gMonStatusStrip.Font = New System.Drawing.Font("Segoe UI", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.gMonStatusStrip.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.gMonStripAdminButton, Me.gMonStripTxtStatus, Me.gMonStripStatusButton})
Me.gMonStatusStrip.Location = New System.Drawing.Point(0, 364)
Me.gMonStatusStrip.Location = New System.Drawing.Point(0, 379)
Me.gMonStatusStrip.Name = "gMonStatusStrip"
Me.gMonStatusStrip.ShowItemToolTips = True
Me.gMonStatusStrip.Size = New System.Drawing.Size(524, 22)
@@ -248,33 +248,25 @@ Partial Class frmMain
'gMonStripAdminButton
'
Me.gMonStripAdminButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
Me.gMonStripAdminButton.DropDownButtonWidth = 0
Me.gMonStripAdminButton.Image = Global.GBM.My.Resources.Resources.Icon_User
Me.gMonStripAdminButton.ImageTransparentColor = System.Drawing.Color.Magenta
Me.gMonStripAdminButton.Name = "gMonStripAdminButton"
Me.gMonStripAdminButton.Size = New System.Drawing.Size(21, 20)
Me.gMonStripAdminButton.Text = "Elevation"
Me.gMonStripAdminButton.ToolTipText = "Elevation"
Me.gMonStripAdminButton.Size = New System.Drawing.Size(16, 17)
Me.gMonStripAdminButton.TextImageRelation = System.Windows.Forms.TextImageRelation.TextBeforeImage
'
'gMonStripTxtStatus
'
Me.gMonStripTxtStatus.Name = "gMonStripTxtStatus"
Me.gMonStripTxtStatus.Size = New System.Drawing.Size(395, 17)
Me.gMonStripTxtStatus.Size = New System.Drawing.Size(405, 17)
Me.gMonStripTxtStatus.Spring = True
Me.gMonStripTxtStatus.Text = "Monitor Status"
Me.gMonStripTxtStatus.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
'
'gMonStripStatusButton
'
Me.gMonStripStatusButton.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right
Me.gMonStripStatusButton.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center
Me.gMonStripStatusButton.DropDownButtonWidth = 0
Me.gMonStripStatusButton.ImageTransparentColor = System.Drawing.Color.Magenta
Me.gMonStripStatusButton.Name = "gMonStripStatusButton"
Me.gMonStripStatusButton.Size = New System.Drawing.Size(93, 20)
Me.gMonStripStatusButton.Size = New System.Drawing.Size(88, 17)
Me.gMonStripStatusButton.Text = "Monitor Status:"
Me.gMonStripStatusButton.TextImageRelation = System.Windows.Forms.TextImageRelation.TextBeforeImage
Me.gMonStripStatusButton.ToolTipText = "Click to toggle monitoring on or off."
'
'gMonMainMenu
'
@@ -531,7 +523,7 @@ Partial Class frmMain
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(524, 386)
Me.ClientSize = New System.Drawing.Size(524, 401)
Me.Controls.Add(Me.pbTime)
Me.Controls.Add(Me.lblStatus3)
Me.Controls.Add(Me.lblStatus2)
@@ -593,7 +585,6 @@ Partial Class frmMain
Friend WithEvents gMonHelpAbout As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents gMonTraySetupGameManager As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents gMonTraySetupCustomVariables As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents gMonStripStatusButton As System.Windows.Forms.ToolStripSplitButton
Friend WithEvents pbIcon As System.Windows.Forms.PictureBox
Friend WithEvents btnLogToggle As System.Windows.Forms.Button
Friend WithEvents lblGameTitle As System.Windows.Forms.Label
@@ -611,7 +602,6 @@ Partial Class frmMain
Friend WithEvents gMonHelpManual As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents gMonHelpCheckforUpdates As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents btnCancelOperation As System.Windows.Forms.Button
Friend WithEvents gMonStripAdminButton As ToolStripSplitButton
Friend WithEvents gMonTraySetupTags As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents gMonSetupTags As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents lblStatus1 As Label
@@ -629,4 +619,6 @@ Partial Class frmMain
Friend WithEvents gMonTrayToolsLog As ToolStripMenuItem
Friend WithEvents gMonTrayLogClear As ToolStripMenuItem
Friend WithEvents gMonTrayLogSave As ToolStripMenuItem
Friend WithEvents gMonStripAdminButton As System.Windows.Forms.ToolStripStatusLabel
Friend WithEvents gMonStripStatusButton As System.Windows.Forms.ToolStripStatusLabel
End Class
+38 -2899
View File
File diff suppressed because it is too large Load Diff
+5 -7
View File
@@ -798,14 +798,14 @@ Public Class frmMain
Private Sub ToggleLog()
If bLogToggle = False Then
txtLog.Visible = True
Me.Size = New System.Drawing.Size(540, 425)
Me.Size = New System.Drawing.Size(Me.Size.Width, 440)
bLogToggle = True
btnLogToggle.Text = frmMain_btnToggleLog_Hide
txtLog.Select(txtLog.TextLength, 0)
txtLog.ScrollToCaret()
Else
txtLog.Visible = False
Me.Size = New System.Drawing.Size(540, 245)
Me.Size = New System.Drawing.Size(Me.Size.Width, 245)
bLogToggle = False
btnLogToggle.Text = frmMain_btnToggleLog_Show
End If
@@ -1080,7 +1080,7 @@ Public Class frmMain
lblLastAction.Text = String.Empty
pbTime.SizeMode = PictureBoxSizeMode.AutoSize
pbTime.Image = Icon_Clock
Me.Size = New System.Drawing.Size(540, 245)
Me.Size = New System.Drawing.Size(Me.Size.Width, 245)
AddHandler mgrMonitorList.UpdateLog, AddressOf UpdateLog
ResetGameInfo()
End Sub
@@ -1386,7 +1386,7 @@ Public Class frmMain
ToggleLog()
End Sub
Private Sub gMonStripSplitButton_ButtonClick(sender As Object, e As EventArgs) Handles gMonStripStatusButton.ButtonClick
Private Sub gMonStripSplitStatusButton_ButtonClick(sender As Object, e As EventArgs) Handles gMonStripStatusButton.Click
ScanToggle()
End Sub
@@ -1406,7 +1406,7 @@ Public Class frmMain
OperationCancel()
End Sub
Private Sub gMonStripAdminButton_ButtonClick(sender As Object, e As EventArgs) Handles gMonStripAdminButton.ButtonClick
Private Sub gMonStripAdminButton_ButtonClick(sender As Object, e As EventArgs) Handles gMonStripAdminButton.Click
RestartAsAdmin()
End Sub
@@ -1534,7 +1534,6 @@ Public Class frmMain
End Sub
Private Sub Main_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
'Init
Try
SetForm()
@@ -1565,7 +1564,6 @@ Public Class frmMain
End Sub
Private Sub frmMain_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown
If bFirstRun And Not bInitFail Then
OpenStartupWizard()
End If
+8 -11
View File
@@ -91,12 +91,12 @@
<CodeAnalysisRuleSet>ManagedMinimumRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Mono.Data.Sqlite, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>References\Mono.Data.Sqlite.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Data.SQLite, Version=1.0.94.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>References\System.Data.SQLite.dll</HintPath>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
@@ -320,7 +320,7 @@
<Content Include="License\credits.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="References\System.Data.SQLite.dll" />
<Content Include="References\Mono.Data.Sqlite.dll" />
<None Include="Resources\gbm.ico" />
<Content Include="Resources\Admin.png" />
<Content Include="Resources\Clock.png" />
@@ -332,6 +332,9 @@
<Content Include="Resources\Inbox.png" />
<Content Include="Resources\type.ico" />
<Content Include="Resources\User.png" />
<Content Include="sqlite3.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Utilities\x64\7za.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@@ -350,12 +353,6 @@
<Content Include="Utilities\x86\7zxa.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="x64\SQLite.Interop.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="x86\SQLite.Interop.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="Resources\Stopped.png" />
<None Include="Resources\Detected.png" />
<None Include="Resources\Ready.png" />
+3 -2
View File
@@ -117,7 +117,7 @@ Public Class mgrBackup
End If
If oSettings.CreateSubFolder Then
sBackupFile = sBackupFile & "\" & oGame.Name
sBackupFile = sBackupFile & Path.DirectorySeparatorChar & oGame.Name
Try
If Not Directory.Exists(sBackupFile) Then
Directory.CreateDirectory(sBackupFile)
@@ -168,7 +168,8 @@ Public Class mgrBackup
End If
If Directory.Exists(sSavePath) Then
prs7z.StartInfo.Arguments = "a -bb1 -bt -t7z -mx" & oSettings.CompressionLevel & " -i@""" & mgrPath.IncludeFileLocation & """ -x@""" & mgrPath.ExcludeFileLocation & """ """ & sBackupFile & """ -r"
'prs7z.StartInfo.Arguments = "a -bb1 -bt -t7z -mx" & oSettings.CompressionLevel & " -i@""" & mgrPath.IncludeFileLocation & """ -x@""" & mgrPath.ExcludeFileLocation & """ """ & sBackupFile & """ -r"
prs7z.StartInfo.Arguments = "a -t7z -mx" & oSettings.CompressionLevel & " -i@""" & mgrPath.IncludeFileLocation & """ -x@""" & mgrPath.ExcludeFileLocation & """ """ & sBackupFile & """ -r"
prs7z.StartInfo.FileName = mgrPath.Utility7zLocation
prs7z.StartInfo.UseShellExecute = False
prs7z.StartInfo.RedirectStandardOutput = True
+11
View File
@@ -108,7 +108,18 @@ Public Class mgrCommon
End If
End Function
Public Shared Function IsUnix() As Boolean
If Path.DirectorySeparatorChar = "/" Then
Return True
End If
Return False
End Function
Public Shared Function IsElevated() As Boolean
If IsUnix() Then
Return True
End If
If My.User.IsInRole(ApplicationServices.BuiltInRole.Administrator) Then
Return True
Else
+20 -9
View File
@@ -39,6 +39,10 @@ Public Class mgrPath
Shared ReadOnly Property Utility7zLocation As String
Get
If mgrCommon.IsUnix Then
Return "/usr/bin/7za"
End If
Select Case oReleaseType
Case ProcessorArchitecture.Amd64
Return Application.StartupPath & "/Utilities/x64/7za.exe"
@@ -91,7 +95,7 @@ Public Class mgrPath
Return sRemoteDatabaseLocation
End Get
Set(value As String)
sRemoteDatabaseLocation = value & "\gbm.s3db"
sRemoteDatabaseLocation = value & "/gbm.s3db"
End Set
End Property
@@ -191,14 +195,11 @@ Public Class mgrPath
Dim sCurrentUser As String = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)
Dim oCustomVariable As clsPathVariable
If sValue.Contains("*mydocs*") Then
Return sValue.Replace("*mydocs*", sMyDocs)
End If
If sValue.Contains("*publicdocs*") Then
Return sValue.Replace("*publicdocs*", sPublicDocs)
End If
If sValue.Contains("*appdatalocal*") Then
Return sValue.Replace("*appdatalocal*", sAppDataLocal)
End If
@@ -207,9 +208,16 @@ Public Class mgrPath
Return sValue.Replace("*appdataroaming*", sAppDataRoaming)
End If
'These don't work on Unix OS
If Not mgrCommon.IsUnix Then
If sValue.Contains("*publicdocs*") Then
Return sValue.Replace("*publicdocs*", sPublicDocs)
End If
If sValue.Contains("*currentuser*") Then
Return sValue.Replace("*currentuser*", sCurrentUser)
End If
End If
For Each oCustomVariable In hshCustomVariables.Values
If sValue.Contains(oCustomVariable.FormattedName) Then
@@ -232,10 +240,6 @@ Public Class mgrPath
Return sValue.Replace(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), sMyDocs)
End If
If sValue.Contains(Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments)) Then
Return sValue.Replace(Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments), sPublicDocs)
End If
If sValue.Contains(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)) Then
Return sValue.Replace(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), sAppDataLocal)
End If
@@ -244,9 +248,16 @@ Public Class mgrPath
Return sValue.Replace(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), sAppDataRoaming)
End If
'These don't work on Unix OS
If Not mgrCommon.IsUnix Then
If sValue.Contains(Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments)) Then
Return sValue.Replace(Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments), sPublicDocs)
End If
If sValue.Contains(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)) Then
Return sValue.Replace(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), sCurrentUser)
End If
End If
For Each oCustomVariable In hshCustomVariables.Values
If sValue.Contains(oCustomVariable.Path) Then
+6
View File
@@ -90,7 +90,11 @@ Public Class mgrProcesses
Dim sProcessCheck As String = String.Empty
For Each prsCurrent As Process In prsList
Try
sProcessCheck = prsCurrent.ProcessName
Catch ex As Exception
'Do Nothing
End Try
If hshScanList.ContainsKey(sProcessCheck) Then
prsFoundProcess = prsCurrent
@@ -117,10 +121,12 @@ Public Class mgrProcesses
bNeedsPath = True
iErrorCode = 299
Else
MsgBox(exWin32.Message & vbCrLf & exWin32.StackTrace)
'A different failure occured, drop out and continue to scan.
Return False
End If
Catch exAll As Exception
MsgBox(exAll.Message & vbCrLf & exAll.StackTrace)
'A different failure occured, drop out and continue to scan.
Return False
End Try
+1 -1
View File
@@ -232,7 +232,7 @@ Public Class mgrRestore
If bDoRestore Then
Try
If File.Exists(sBackupFile) Then
prs7z.StartInfo.Arguments = "x """ & sBackupFile & """ -o""" & sExtractPath & "\"" -aoa -r"
prs7z.StartInfo.Arguments = "x """ & sBackupFile & """ -o""" & sExtractPath & Path.DirectorySeparatorChar & """ -aoa -r"
prs7z.StartInfo.FileName = mgrPath.Utility7zLocation
prs7z.StartInfo.UseShellExecute = False
prs7z.StartInfo.RedirectStandardOutput = True
+3 -2
View File
@@ -1,6 +1,6 @@
Imports GBM.My.Resources
Imports System.IO
Imports System.Data.SQLite
Imports Mono.Data.Sqlite
Public Class mgrSQLite
@@ -232,7 +232,8 @@ Public Class mgrSQLite
BuildParams(command, hshParams)
Try
adapter = New SQLiteDataAdapter(command)
adapter = New SqliteDataAdapter()
adapter.SelectCommand = command
adapter.Fill(oData)
Catch ex As Exception
mgrCommon.ShowMessage(mgrSQLite_ErrorQueryFailure, New String() {sSQL, ex.Message}, MsgBoxStyle.Exclamation)
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.