Add constructor to Config Manager which accepts only a userpath for ui settings which will be saved in Roaming
This commit is contained in:
@@ -71,6 +71,24 @@ Public Class ConfigManager(Of T)
|
||||
_Config = LoadConfig()
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' Creates a new instance of the ConfigManager.
|
||||
''' </summary>
|
||||
''' <example>
|
||||
''' Public Class Config
|
||||
''' Public Property StringEntry As String = "TEST"
|
||||
''' Public Property BoolEntry As Boolean = True
|
||||
''' Public Property IntEntry As Integer = 123
|
||||
''' End Class
|
||||
'''
|
||||
''' Dim oConfigManager = New ConfigManager(Of Config)(_LogConfig, Application.UserAppDataPath)
|
||||
''' </example>
|
||||
''' <param name="LogConfig">LogConfig instance</param>
|
||||
''' <param name="ConfigPath">The path to check for a config file, eg. AppData</param>
|
||||
Public Sub New(LogConfig As LogConfig, ConfigPath As String)
|
||||
MyClass.New(LogConfig, ConfigPath, ConfigPath)
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' Save the current config object to `UserConfigPath`
|
||||
''' </summary>
|
||||
@@ -87,11 +105,11 @@ Public Class ConfigManager(Of T)
|
||||
Private Function LoadConfig() As T
|
||||
Dim oConfig As T
|
||||
|
||||
If IO.File.Exists(_UserPath) Then
|
||||
If File.Exists(_UserPath) Then
|
||||
_Logger.Debug("Loading config from UserPath: {0}", _UserPath)
|
||||
_CurrentDataPath = _UserPath
|
||||
oConfig = ReadFromFile(_UserPath)
|
||||
ElseIf IO.File.Exists(_ComputerPath) Then
|
||||
ElseIf File.Exists(_ComputerPath) Then
|
||||
_Logger.Debug("Loading config from ComputerPath: {0}", _ComputerPath)
|
||||
_CurrentDataPath = _ComputerPath
|
||||
oConfig = ReadFromFile(_ComputerPath)
|
||||
|
||||
Reference in New Issue
Block a user