Config: Add Reload Function

This commit is contained in:
Jonathan Jenne 2021-04-06 16:36:15 +02:00
parent 858ac7d312
commit 686b5bc0ec

View File

@ -118,7 +118,7 @@ Public Class ConfigManager(Of T)
_WriteAllValuesToUserConfig = ForceUserConfig
Config = LoadConfig()
_Config = LoadConfig()
End Sub
''' <summary>
@ -145,6 +145,20 @@ Public Class ConfigManager(Of T)
End Try
End Function
''' <summary>
''' Reloads the config object from file.
''' </summary>
''' <returns>True if reload was successful, False otherwise</returns>
Public Function Reload() As Boolean
Try
_Config = LoadConfig()
Return True
Catch ex As Exception
_Logger.Error(ex)
Return False
End Try
End Function
''' <summary>
''' Copies all properties from Source to Target, except those who have an attribute
''' listed in ExcludedAttributeTypes