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 _WriteAllValuesToUserConfig = ForceUserConfig
Config = LoadConfig() _Config = LoadConfig()
End Sub End Sub
''' <summary> ''' <summary>
@ -145,6 +145,20 @@ Public Class ConfigManager(Of T)
End Try End Try
End Function 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> ''' <summary>
''' Copies all properties from Source to Target, except those who have an attribute ''' Copies all properties from Source to Target, except those who have an attribute
''' listed in ExcludedAttributeTypes ''' listed in ExcludedAttributeTypes