From d8081ab12205f61245a9a0749a219ac4efd6b152 Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Wed, 28 Jul 2021 15:34:46 +0200 Subject: [PATCH] Fix typo, same config for both projects --- WIDigConsoleApp/Module1.vb | 14 ++------------ WIDigForm/frmMain.vb | 14 ++++---------- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/WIDigConsoleApp/Module1.vb b/WIDigConsoleApp/Module1.vb index 8b9a4d1..b4c855d 100644 --- a/WIDigConsoleApp/Module1.vb +++ b/WIDigConsoleApp/Module1.vb @@ -21,9 +21,7 @@ Module Module1 oReturnResult = CODE_SUCCESS ' Console.WriteLine("Starting up WIDig...") Dim opath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) - Dim oLogConfig As New LogConfig(LogConfig.PathType.AppData, Nothing, Nothing, - "Digital Data", - "WIDig") + Dim oLogConfig As New LogConfig(LogConfig.PathType.AppData, Nothing, "Console", "Digital Data", "WIDig") LOGCONFIG = oLogConfig LOGGER = LOGCONFIG.GetLogger @@ -34,7 +32,7 @@ Module Module1 System.Console.WriteLine($"Starting up WIDig...") - If Connect2Windream(oUserPW) = True Then + If Connect2Windream(oUserPW) = False Then Throw New ApplicationException("Could not initialize windream") End If @@ -82,17 +80,9 @@ Module Module1 End Function Public Sub InitUserConfig() - Dim oProgramDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Digital Data", "WIDig") Dim oUserAppDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Digital Data", "WIDig") CONFIG = New ConfigManager(Of ClassConfig)(LOGCONFIG, oUserAppDataPath, oProgramDataPath) - - 'oUserAppDataPath = oUserAppDataPath & "\Digital Data\WIDigDat" - 'Dim oCommonAppDataPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) - 'CONFIG = New ConfigManager(Of ClassConfig)(LOGCONFIG, oUserAppDataPath, System.AppDomain.CurrentDomain.BaseDirectory, oCommonAppDataPath) - 'System.Console.WriteLine($"Config loaded!") - 'LOGGER.Info("Config loaded") - 'Settings_Load() End Sub Public Function InitDatabase() As Boolean If CONFIG.Config.ConnectionString.Length = 0 Then diff --git a/WIDigForm/frmMain.vb b/WIDigForm/frmMain.vb index 70ba354..58187df 100644 --- a/WIDigForm/frmMain.vb +++ b/WIDigForm/frmMain.vb @@ -8,11 +8,7 @@ Public Class frmMain Try Me.Hide() Me.Visible = False - Dim oLogConfig As New LogConfig(LogConfig.PathType.CustomPath, - Application.LocalUserAppDataPath & "\Log", - Nothing, - My.Application.Info.CompanyName, - My.Application.Info.ProductName) + Dim oLogConfig As New LogConfig(LogConfig.PathType.AppData, Nothing, "Form", "Digital Data", "WIDig") LOGCONFIG = oLogConfig LOGGER = LOGCONFIG.GetLogger @@ -55,11 +51,9 @@ Public Class frmMain End Sub Public Sub InitUserConfig() - CONFIG = New ConfigManager(Of ClassConfig)(LOGCONFIG, Application.UserAppDataPath, Application.CommonAppDataPath, Application.StartupPath) - LOGGER.Info("Config loaded") - - - 'Settings_Load() + Dim oProgramDataPath = IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Digital Data", "WIDig") + Dim oUserAppDataPath = IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Digital Data", "WIDig") + CONFIG = New ConfigManager(Of ClassConfig)(LOGCONFIG, oUserAppDataPath, oProgramDataPath) End Sub Private Function Connect2Windream(oPW As String) Try