diff --git a/GBM/Forms/frmMain.Designer.vb b/GBM/Forms/frmMain.Designer.vb index 7164289..469e726 100644 --- a/GBM/Forms/frmMain.Designer.vb +++ b/GBM/Forms/frmMain.Designer.vb @@ -224,7 +224,7 @@ Partial Class frmMain ' Me.txtLog.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.txtLog.Location = New System.Drawing.Point(12, 184) - Me.txtLog.MaxLength = 16777216 + Me.txtLog.MaxLength = 524288 Me.txtLog.Multiline = True Me.txtLog.Name = "txtLog" Me.txtLog.ReadOnly = True diff --git a/GBM/Forms/frmMain.vb b/GBM/Forms/frmMain.vb index 29dd14b..3f3792f 100644 --- a/GBM/Forms/frmMain.vb +++ b/GBM/Forms/frmMain.vb @@ -1050,12 +1050,17 @@ Public Class frmMain Dim d As New UpdateLogCallBack(AddressOf UpdateLog) Me.Invoke(d, New Object() {sLogUpdate, bTrayUpdate, objIcon, bTimeStamp}) Else - 'Auto save and clear the log if we are approaching the limit - If txtLog.TextLength > 16770000 Then - Dim sLogFile As String = mgrPath.LogFileLocation - mgrCommon.SaveText(txtLog.Text, sLogFile) - txtLog.Clear() - txtLog.AppendText("[" & Date.Now & "] " & mgrCommon.FormatString(frmMain_LogAutoSave, sLogFile)) + 'Auto save and/or clear the log if we are approaching the limit + If txtLog.TextLength > 262144 Then + If oSettings.AutoSaveLog Then + Dim sLogFile As String = mgrPath.LogFileLocation + mgrCommon.SaveText(txtLog.Text, sLogFile) + txtLog.Clear() + txtLog.AppendText("[" & Date.Now & "] " & mgrCommon.FormatString(frmMain_LogAutoSave, sLogFile)) + Else + txtLog.Clear() + txtLog.AppendText("[" & Date.Now & "] " & frmMain_LogAutoClear) + End If End If 'We shouldn't allow any one message to be greater than 255 characters if that same message is pushed to the tray icon diff --git a/GBM/Forms/frmSettings.Designer.vb b/GBM/Forms/frmSettings.Designer.vb index eeac30d..a733900 100644 --- a/GBM/Forms/frmSettings.Designer.vb +++ b/GBM/Forms/frmSettings.Designer.vb @@ -26,6 +26,8 @@ Partial Class frmSettings Me.chkMonitorOnStartup = New System.Windows.Forms.CheckBox() Me.chkBackupConfirm = New System.Windows.Forms.CheckBox() Me.grpGeneral = New System.Windows.Forms.GroupBox() + Me.chkAutoSaveLog = New System.Windows.Forms.CheckBox() + Me.btnOptionalFields = New System.Windows.Forms.Button() Me.chkTimeTracking = New System.Windows.Forms.CheckBox() Me.chkSync = New System.Windows.Forms.CheckBox() Me.chkStartWindows = New System.Windows.Forms.CheckBox() @@ -58,7 +60,6 @@ Partial Class frmSettings Me.lbl7zProduct = New System.Windows.Forms.Label() Me.btnDefaults = New System.Windows.Forms.Button() Me.ttUtilityStatus = New System.Windows.Forms.ToolTip(Me.components) - Me.btnOptionalFields = New System.Windows.Forms.Button() Me.grpGeneral.SuspendLayout() Me.grpPaths.SuspendLayout() Me.grpBackup.SuspendLayout() @@ -89,6 +90,7 @@ Partial Class frmSettings ' 'grpGeneral ' + Me.grpGeneral.Controls.Add(Me.chkAutoSaveLog) Me.grpGeneral.Controls.Add(Me.btnOptionalFields) Me.grpGeneral.Controls.Add(Me.chkTimeTracking) Me.grpGeneral.Controls.Add(Me.chkSync) @@ -98,15 +100,35 @@ Partial Class frmSettings Me.grpGeneral.Controls.Add(Me.chkMonitorOnStartup) Me.grpGeneral.Location = New System.Drawing.Point(12, 12) Me.grpGeneral.Name = "grpGeneral" - Me.grpGeneral.Size = New System.Drawing.Size(360, 165) + Me.grpGeneral.Size = New System.Drawing.Size(360, 187) Me.grpGeneral.TabIndex = 0 Me.grpGeneral.TabStop = False Me.grpGeneral.Text = "General" ' + 'chkAutoSaveLog + ' + Me.chkAutoSaveLog.AutoSize = True + Me.chkAutoSaveLog.Location = New System.Drawing.Point(6, 111) + Me.chkAutoSaveLog.Name = "chkAutoSaveLog" + Me.chkAutoSaveLog.Size = New System.Drawing.Size(231, 17) + Me.chkAutoSaveLog.TabIndex = 7 + Me.chkAutoSaveLog.Text = "Autosave log when max length is exceeded" + Me.chkAutoSaveLog.UseVisualStyleBackColor = True + ' + 'btnOptionalFields + ' + Me.btnOptionalFields.DialogResult = System.Windows.Forms.DialogResult.OK + Me.btnOptionalFields.Location = New System.Drawing.Point(110, 153) + Me.btnOptionalFields.Name = "btnOptionalFields" + Me.btnOptionalFields.Size = New System.Drawing.Size(134, 23) + Me.btnOptionalFields.TabIndex = 6 + Me.btnOptionalFields.Text = "Choose &Optional Fields..." + Me.btnOptionalFields.UseVisualStyleBackColor = True + ' 'chkTimeTracking ' Me.chkTimeTracking.AutoSize = True - Me.chkTimeTracking.Location = New System.Drawing.Point(6, 111) + Me.chkTimeTracking.Location = New System.Drawing.Point(6, 134) Me.chkTimeTracking.Name = "chkTimeTracking" Me.chkTimeTracking.Size = New System.Drawing.Size(122, 17) Me.chkTimeTracking.TabIndex = 4 @@ -116,7 +138,7 @@ Partial Class frmSettings 'chkSync ' Me.chkSync.AutoSize = True - Me.chkSync.Location = New System.Drawing.Point(6, 134) + Me.chkSync.Location = New System.Drawing.Point(6, 157) Me.chkSync.Name = "chkSync" Me.chkSync.Size = New System.Drawing.Size(98, 17) Me.chkSync.TabIndex = 5 @@ -158,7 +180,7 @@ Partial Class frmSettings Me.grpPaths.Controls.Add(Me.btnBackupFolder) Me.grpPaths.Controls.Add(Me.lblBackupFolder) Me.grpPaths.Controls.Add(Me.txtBackupFolder) - Me.grpPaths.Location = New System.Drawing.Point(378, 183) + Me.grpPaths.Location = New System.Drawing.Point(12, 205) Me.grpPaths.Name = "grpPaths" Me.grpPaths.Size = New System.Drawing.Size(360, 60) Me.grpPaths.TabIndex = 3 @@ -306,7 +328,7 @@ Partial Class frmSettings Me.grp7z.Controls.Add(Me.cboCompression) Me.grp7z.Controls.Add(Me.lblCompression) Me.grp7z.Controls.Add(Me.lbl7zProduct) - Me.grp7z.Location = New System.Drawing.Point(12, 183) + Me.grp7z.Location = New System.Drawing.Point(378, 183) Me.grp7z.Name = "grp7z" Me.grp7z.Size = New System.Drawing.Size(360, 137) Me.grp7z.TabIndex = 1 @@ -408,16 +430,6 @@ Partial Class frmSettings Me.btnDefaults.Text = "Set &Defaults" Me.btnDefaults.UseVisualStyleBackColor = True ' - 'btnOptionalFields - ' - Me.btnOptionalFields.DialogResult = System.Windows.Forms.DialogResult.OK - Me.btnOptionalFields.Location = New System.Drawing.Point(110, 130) - Me.btnOptionalFields.Name = "btnOptionalFields" - Me.btnOptionalFields.Size = New System.Drawing.Size(134, 23) - Me.btnOptionalFields.TabIndex = 6 - Me.btnOptionalFields.Text = "Choose &Optional Fields..." - Me.btnOptionalFields.UseVisualStyleBackColor = True - ' 'frmSettings ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) @@ -487,4 +499,5 @@ Partial Class frmSettings Friend WithEvents pbUtilityStatus As PictureBox Friend WithEvents ttUtilityStatus As ToolTip Friend WithEvents btnOptionalFields As Button + Friend WithEvents chkAutoSaveLog As CheckBox End Class diff --git a/GBM/Forms/frmSettings.vb b/GBM/Forms/frmSettings.vb index 75ac4a0..8b67139 100644 --- a/GBM/Forms/frmSettings.vb +++ b/GBM/Forms/frmSettings.vb @@ -44,6 +44,7 @@ Public Class frmSettings oSettings.MonitorOnStartup = chkMonitorOnStartup.Checked oSettings.StartToTray = chkStartToTray.Checked oSettings.ShowDetectionToolTips = chkShowDetectionTips.Checked + oSettings.AutoSaveLog = chkAutoSaveLog.Checked oSettings.DisableConfirmation = chkBackupConfirm.Checked oSettings.CreateSubFolder = chkCreateFolder.Checked oSettings.ShowOverwriteWarning = chkOverwriteWarning.Checked @@ -167,6 +168,7 @@ Public Class frmSettings chkMonitorOnStartup.Checked = oSettings.MonitorOnStartup chkStartToTray.Checked = oSettings.StartToTray chkShowDetectionTips.Checked = oSettings.ShowDetectionToolTips + chkAutoSaveLog.Checked = oSettings.AutoSaveLog chkBackupConfirm.Checked = oSettings.DisableConfirmation chkCreateFolder.Checked = oSettings.CreateSubFolder chkOverwriteWarning.Checked = oSettings.ShowOverwriteWarning @@ -253,6 +255,7 @@ Public Class frmSettings chkStartWindows.Text = frmSettings_chkStartWindows chkSync.Text = frmSettings_chkSync chkShowDetectionTips.Text = frmSettings_chkShowDetectionTips + chkAutoSaveLog.Text = frmSettings_chkAutoSaveLog chkStartToTray.Text = frmSettings_chkStartToTray chkMonitorOnStartup.Text = frmSettings_chkMonitorOnStartup grp7z.Text = frmSettings_grp7z diff --git a/GBM/Managers/mgrPath.vb b/GBM/Managers/mgrPath.vb index 7be3d47..0457065 100644 --- a/GBM/Managers/mgrPath.vb +++ b/GBM/Managers/mgrPath.vb @@ -5,11 +5,11 @@ Imports System.Reflection Public Class mgrPath 'Important Note: Any changes to sSettingsRoot & sDBLocation need to be mirrored in frmMain.vb -> VerifyGameDataPath - Private Shared sSettingsRoot As String = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) & "/gbm" - Private Shared sDBLocation As String = sSettingsRoot & "/gbm.s3db" - Private Shared sIncludeFile As String = sSettingsRoot & "/gbm_include.txt" - Private Shared sExcludeFile As String = sSettingsRoot & "/gbm_exclude.txt" - Private Shared sLogFile As String = sSettingsRoot & "/gbm_log_" & Date.Now.ToString("dd-MM-yyyy-HH-mm-ss") & ".txt" + Private Shared sSettingsRoot As String = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) & Path.DirectorySeparatorChar & "gbm" + Private Shared sDBLocation As String = sSettingsRoot & Path.DirectorySeparatorChar & "gbm.s3db" + Private Shared sIncludeFile As String = sSettingsRoot & Path.DirectorySeparatorChar & "gbm_include.txt" + Private Shared sExcludeFile As String = sSettingsRoot & Path.DirectorySeparatorChar & "gbm_exclude.txt" + Private Shared sLogFile As String = sSettingsRoot & Path.DirectorySeparatorChar & "gbm_log_" & Date.Now.ToString("dd-MM-yyyy-HH-mm-ss") & ".txt" Private Shared sRemoteDatabaseLocation As String Private Shared hshCustomVariables As Hashtable Private Shared oReleaseType As ProcessorArchitecture = AssemblyName.GetAssemblyName(Application.ExecutablePath()).ProcessorArchitecture @@ -45,18 +45,18 @@ Public Class mgrPath Select Case oReleaseType Case ProcessorArchitecture.Amd64 - Return Application.StartupPath & "/Utilities/x64/7za.exe" + Return Application.StartupPath & "\Utilities\x64\7za.exe" Case ProcessorArchitecture.IA64 - Return Application.StartupPath & "/Utilities/x64/7za.exe" + Return Application.StartupPath & "\Utilities\x64\7za.exe" Case ProcessorArchitecture.MSIL - Return Application.StartupPath & "/Utilities/x86/7za.exe" + Return Application.StartupPath & "\Utilities\x86\7za.exe" Case ProcessorArchitecture.X86 - Return Application.StartupPath & "/Utilities/x86/7za.exe" + Return Application.StartupPath & "\Utilities\x86\7za.exe" Case ProcessorArchitecture.None - Return Application.StartupPath & "/Utilities/x86/7za.exe" + Return Application.StartupPath & "\Utilities\x86\7za.exe" End Select - Return Application.StartupPath & "/Utilities/x86/7za.exe" + Return Application.StartupPath & "\Utilities\x86\7za.exe" End Get End Property @@ -95,7 +95,7 @@ Public Class mgrPath Return sRemoteDatabaseLocation End Get Set(value As String) - sRemoteDatabaseLocation = value & "/gbm.s3db" + sRemoteDatabaseLocation = value & Path.DirectorySeparatorChar & "gbm.s3db" End Set End Property diff --git a/GBM/Managers/mgrSQLite.vb b/GBM/Managers/mgrSQLite.vb index 2f2fb1a..1de4ad0 100644 --- a/GBM/Managers/mgrSQLite.vb +++ b/GBM/Managers/mgrSQLite.vb @@ -74,7 +74,7 @@ Public Class mgrSQLite "DisableConfirmation BOOLEAN NOT NULL, CreateSubFolder BOOLEAN NOT NULL, ShowOverwriteWarning BOOLEAN NOT NULL, RestoreOnLaunch BOOLEAN NOT NULL, " & "BackupFolder TEXT NOT NULL, Sync BOOLEAN NOT NULL, CheckSum BOOLEAN NOT NULL, StartWithWindows BOOLEAN NOT NULL, TimeTracking BOOLEAN NOT NULL, " & "SupressBackup BOOLEAN NOT NULL, SupressBackupThreshold INTEGER NOT NULL, CompressionLevel INTEGER NOT NULL, Custom7zArguments TEXT, " & - "Custom7zLocation TEXT, SyncFields INTEGER NOT NULL);" + "Custom7zLocation TEXT, SyncFields INTEGER NOT NULL, AutoSaveLog BOOLEAN NOT NULL);" 'Add Tables (Monitor List) sSql &= "CREATE TABLE monitorlist (MonitorID TEXT NOT NULL UNIQUE, Name TEXT NOT NULL, Process TEXT NOT NULL, Path TEXT, " & @@ -541,6 +541,7 @@ Public Class mgrSQLite sSQL = "ALTER TABLE settings ADD COLUMN Custom7zArguments TEXT;" sSQL &= "ALTER TABLE settings ADD COLUMN Custom7zLocation TEXT;" sSQL &= "ALTER TABLE settings ADD COLUMN SyncFields INTEGER NOT NULL DEFAULT 32;" + sSQL &= "ALTER TABLE settings ADD COLUMN AutoSaveLog BOOLEAN NOT NULL DEFAULT 0;" sSQL &= "PRAGMA user_version=97" RunParamQuery(sSQL, New Hashtable) diff --git a/GBM/Managers/mgrSettings.vb b/GBM/Managers/mgrSettings.vb index 6db1bff..9ccd8f6 100644 --- a/GBM/Managers/mgrSettings.vb +++ b/GBM/Managers/mgrSettings.vb @@ -19,6 +19,7 @@ Public Class mgrSettings Private s7zLocation As String = String.Empty Private sBackupFolder As String = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments).TrimEnd(New Char() {"\", "/"}) Private eSyncFields As clsGame.eOptionalSyncFields = clsGame.eOptionalSyncFields.None Or clsGame.eOptionalSyncFields.TimeStamp + Private bAutoSaveLog As Boolean = False Property StartWithWindows As Boolean Get @@ -230,6 +231,15 @@ Public Class mgrSettings End Set End Property + Property AutoSaveLog As Boolean + Get + Return bAutoSaveLog + End Get + Set(value As Boolean) + bAutoSaveLog = value + End Set + End Property + Private Sub SaveFromClass() Dim oDatabase As New mgrSQLite(mgrSQLite.Database.Local) Dim sSQL As String @@ -241,7 +251,7 @@ Public Class mgrSettings sSQL = "INSERT INTO settings VALUES (1, @MonitorOnStartup, @StartToTray, @ShowDetectionToolTips, @DisableConfirmation, " sSQL &= "@CreateSubFolder, @ShowOverwriteWarning, @RestoreOnLaunch, @BackupFolder, @Sync, @CheckSum, @StartWithWindows, " sSQL &= "@TimeTracking, @SupressBackup, @SupressBackupThreshold, @CompressionLevel, @Custom7zArguments, @Custom7zLocation, " - sSQL &= "@SyncFields)" + sSQL &= "@SyncFields,@AutoSaveLog)" hshParams.Add("MonitorOnStartup", MonitorOnStartup) hshParams.Add("StartToTray", StartToTray) @@ -261,6 +271,7 @@ Public Class mgrSettings hshParams.Add("Custom7zArguments", Custom7zArguments) hshParams.Add("Custom7zLocation", Custom7zLocation) hshParams.Add("SyncFields", SyncFields) + hshParams.Add("AutoSaveLog", AutoSaveLog) oDatabase.RunParamQuery(sSQL, hshParams) End Sub @@ -293,6 +304,7 @@ Public Class mgrSettings If Not IsDBNull(dr("Custom7zArguments")) Then Custom7zArguments = CStr(dr("Custom7zArguments")) If Not IsDBNull(dr("Custom7zLocation")) Then Custom7zLocation = CStr(dr("Custom7zLocation")) SyncFields = CInt(dr("SyncFields")) + AutoSaveLog = CBool(dr("AutoSaveLog")) Next oDatabase.Disconnect() diff --git a/GBM/My Project/Resources.Designer.vb b/GBM/My Project/Resources.Designer.vb index 9bb462d..384f952 100644 --- a/GBM/My Project/Resources.Designer.vb +++ b/GBM/My Project/Resources.Designer.vb @@ -2842,7 +2842,16 @@ Namespace My.Resources End Property ''' - ''' Looks up a localized string similar to The session log has been cleared due to size and auto-saved to [PARAM].. + ''' Looks up a localized string similar to The session log reached maximum length and has been cleared .. + ''' + Friend ReadOnly Property frmMain_LogAutoClear() As String + Get + Return ResourceManager.GetString("frmMain_LogAutoClear", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to The session log reached maximum length and has been auto-saved to [PARAM].. ''' Friend ReadOnly Property frmMain_LogAutoSave() As String Get @@ -3219,6 +3228,15 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to Autosave log when max length is exceeded. + ''' + Friend ReadOnly Property frmSettings_chkAutoSaveLog() As String + Get + Return ResourceManager.GetString("frmSettings_chkAutoSaveLog", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to Disable backup confirmation. ''' diff --git a/GBM/My Project/Resources.resx b/GBM/My Project/Resources.resx index a0a4ea7..0ee2de8 100644 --- a/GBM/My Project/Resources.resx +++ b/GBM/My Project/Resources.resx @@ -1499,7 +1499,7 @@ &Log - The session log has been cleared due to size and auto-saved to [PARAM]. + The session log reached maximum length and has been auto-saved to [PARAM]. Text @@ -1693,4 +1693,10 @@ Available Fields + + The session log reached maximum length and has been cleared . + + + Autosave log when max length is exceeded + \ No newline at end of file