Config: Add access to config paths, more logging

This commit is contained in:
Jonathan Jenne 2019-06-26 11:02:44 +02:00
parent 2c675b6181
commit e42638fb21

View File

@ -33,6 +33,18 @@ Public Class ConfigManager(Of T)
''' <returns></returns>
Public ReadOnly Property Config As T
Public ReadOnly Property UserConfigPath As String
Get
Return _UserPath
End Get
End Property
Public ReadOnly Property ComputerConfigPath As String
Get
Return _ComputerPath
End Get
End Property
''' <summary>
''' Creates a new instance of the ConfigManager
''' </summary>
@ -164,6 +176,7 @@ Public Class ConfigManager(Of T)
_Logger.Warn("Computer config could not be loaded!")
End Try
Else
_Logger.Debug("Computer config does not exist.")
_ForceUserConfig = True
End If
@ -190,6 +203,8 @@ Public Class ConfigManager(Of T)
_Logger.Error(ex)
_Logger.Warn("User config could not be loaded!")
End Try
Else
_Logger.Debug("User config does not exist.")
End If
Return Config
@ -246,6 +261,7 @@ Public Class ConfigManager(Of T)
oFileStream.Flush()
End Using
Catch ex As Exception
_Logger.Warn("Could not save config to {0}", Path)
_Logger.Error(ex)
Throw ex
End Try
@ -273,6 +289,7 @@ Public Class ConfigManager(Of T)
Return oConfig
Catch ex As Exception
_Logger.Warn("Could not load config from {0}", Path)
_Logger.Error(ex)
Throw ex
End Try