rename project to ClientSuite, add application timer
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
Imports System.Xml.Serialization
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Filesystem
|
||||
Imports System.Xml
|
||||
|
||||
Public Class ConfigManager(Of T)
|
||||
Private Const USER_CONFIG_NAME As String = "UserConfig.xml"
|
||||
@@ -14,11 +15,15 @@ Public Class ConfigManager(Of T)
|
||||
Private ReadOnly _ComputerPath As String
|
||||
Private _CurrentDataPath As String
|
||||
|
||||
Private ReadOnly _Schema As T
|
||||
''' <summary>
|
||||
''' The blueprint class from which the default config is created
|
||||
''' </summary>
|
||||
Private ReadOnly _Blueprint As T
|
||||
Private ReadOnly _Serializer As XmlSerializer
|
||||
|
||||
Public ReadOnly Property Config As T
|
||||
|
||||
|
||||
''' <summary>
|
||||
''' Creates a new instance of the ConfigManager
|
||||
''' </summary>
|
||||
@@ -42,8 +47,8 @@ Public Class ConfigManager(Of T)
|
||||
_UserPath = Path.Combine(UserConfigPath, USER_CONFIG_NAME)
|
||||
_ComputerPath = Path.Combine(ComputerConfigPath, COMPUTER_CONFIG_NAME)
|
||||
|
||||
_Schema = Activator.CreateInstance(Of T)
|
||||
_Serializer = New XmlSerializer(_Schema.GetType)
|
||||
_Blueprint = Activator.CreateInstance(Of T)
|
||||
_Serializer = New XmlSerializer(_Blueprint.GetType)
|
||||
|
||||
If Not Directory.Exists(UserConfigPath) Then
|
||||
Throw New DirectoryNotFoundException($"Path {UserConfigPath} does not exist!")
|
||||
@@ -91,7 +96,7 @@ Public Class ConfigManager(Of T)
|
||||
Else
|
||||
_Logger.Debug("Creating default config in UserPath: {0}", _UserPath)
|
||||
_CurrentDataPath = _UserPath
|
||||
oConfig = Activator.CreateInstance(_Schema.GetType)
|
||||
oConfig = Activator.CreateInstance(_Blueprint.GetType)
|
||||
|
||||
WriteToFile(_Config, _UserPath)
|
||||
End If
|
||||
|
||||
Reference in New Issue
Block a user