diff --git a/Config/ConfigUtils.vb b/Config/ConfigUtils.vb index 9e2c91b0..8bb41351 100644 --- a/Config/ConfigUtils.vb +++ b/Config/ConfigUtils.vb @@ -1,4 +1,5 @@ Imports System.IO +Imports System.Windows.Forms Imports DigitalData.Modules.Base Imports DigitalData.Modules.Logging @@ -13,6 +14,28 @@ Public Class ConfigUtils _File = New FilesystemEx(LogConfig) End Sub + ''' + ''' Migrate a config file when the ProductName has changed + ''' + ''' The user config base path, should be Application.UserAppDataPath + ''' The current or new product name + ''' The old product name + ''' + Public Function MigrateUserAppDataConfig(pUserBasePath As String, pProductName As String, pOldProductName As String) + Return MigrateAppDataConfig(pUserBasePath, ConfigManager(Of ConfigSample).USER_CONFIG_NAME, pProductName, pOldProductName) + End Function + + ''' + ''' Migrate a config file when the ProductName has changed + ''' + ''' The config base path, should be Application.CommonAppDataPath + ''' The current or new product name + ''' The old product name + ''' + Public Function MigrateCommonAppDataConfig(pCommonBasePath As String, pProductName As String, pOldProductName As String) + Return MigrateAppDataConfig(pCommonBasePath, ConfigManager(Of ConfigSample).COMPUTER_CONFIG_NAME, pProductName, pOldProductName) + End Function + ''' ''' Migrate a config file when the ProductName has changed ''' @@ -20,7 +43,7 @@ Public Class ConfigUtils ''' The current or new product name ''' The old product name ''' - Public Function MigrateAppDataConfig(pBasePath As String, pConfigName As String, pProductName As String, pOldProductName As String) + Private Function MigrateAppDataConfig(pBasePath As String, pConfigName As String, pProductName As String, pOldProductName As String) Dim oNewDirPath = pBasePath Dim oOldDirPath = oNewDirPath.Replace(pProductName, pOldProductName) Dim oNewFilePath = Path.Combine(oNewDirPath, pConfigName)