ZUGFeRDService: Integrate with Config Module, Remove My.Settings
This commit is contained in:
parent
a4b7cfd9ef
commit
2ae4c9a555
@ -1,53 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<configSections>
|
<configSections>
|
||||||
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
||||||
<section name="DDZUGFeRDService.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
|
||||||
</sectionGroup>
|
|
||||||
</configSections>
|
</configSections>
|
||||||
<startup>
|
<startup>
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
|
||||||
</startup>
|
</startup>
|
||||||
<applicationSettings>
|
|
||||||
<DDZUGFeRDService.My.MySettings>
|
|
||||||
<setting name="SERVICE_NAME" serializeAs="String">
|
|
||||||
<value>DDZUGFeRDService</value>
|
|
||||||
</setting>
|
|
||||||
<setting name="SERVICE_DISPLAY_NAME" serializeAs="String">
|
|
||||||
<value>DD ZUGFeRD Service</value>
|
|
||||||
</setting>
|
|
||||||
<setting name="DB_DATASOURCE" serializeAs="String">
|
|
||||||
<value>172.24.12.41</value>
|
|
||||||
</setting>
|
|
||||||
<setting name="DB_DATABASE" serializeAs="String">
|
|
||||||
<value>172.24.12.41:E:\DB\Firebird\Databases\EDMI_TEMPLATE\EDMI_MASTER.FDB</value>
|
|
||||||
</setting>
|
|
||||||
<setting name="DB_USER" serializeAs="String">
|
|
||||||
<value>sysdba</value>
|
|
||||||
</setting>
|
|
||||||
<setting name="DB_PASSWORD" serializeAs="String">
|
|
||||||
<value>dd</value>
|
|
||||||
</setting>
|
|
||||||
<setting name="JOB_INTERVAL" serializeAs="String">
|
|
||||||
<value>10</value>
|
|
||||||
</setting>
|
|
||||||
<setting name="MSSQL_CONNECTIONSTRING" serializeAs="String">
|
|
||||||
<value />
|
|
||||||
</setting>
|
|
||||||
<setting name="MSSQL_ENABLED" serializeAs="String">
|
|
||||||
<value>False</value>
|
|
||||||
</setting>
|
|
||||||
<setting name="GDPICTURE_KEY" serializeAs="String">
|
|
||||||
<value>1234567890_EXAMPLE_KEY</value>
|
|
||||||
</setting>
|
|
||||||
<setting name="MSSQLEmailOutAccountID" serializeAs="String">
|
|
||||||
<value>1</value>
|
|
||||||
</setting>
|
|
||||||
<setting name="DEBUG" serializeAs="String">
|
|
||||||
<value>False</value>
|
|
||||||
</setting>
|
|
||||||
</DDZUGFeRDService.My.MySettings>
|
|
||||||
</applicationSettings>
|
|
||||||
<runtime>
|
<runtime>
|
||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
|
|||||||
19
Services.ZUGFeRDService/Config.vb
Normal file
19
Services.ZUGFeRDService/Config.vb
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
Public Class Config
|
||||||
|
Public Property Firebird As FirebirdConfig
|
||||||
|
Public Property MSSQLConnectionString As String = ""
|
||||||
|
Public Property MSSQLEnabled As Boolean = False
|
||||||
|
Public Property MSSQLEmailOutAccountID As String = 1
|
||||||
|
|
||||||
|
Public Property JobInterval As Integer = 10
|
||||||
|
Public Property GDPictureKey As String = "1234567890_EXAMPLE_KEY"
|
||||||
|
|
||||||
|
Public Property Debug As Boolean = False
|
||||||
|
|
||||||
|
Public Class FirebirdConfig
|
||||||
|
Public Property DataSource As String = "172.24.12.41"
|
||||||
|
Public Property Database As String = "172.24.12.41:E:\DB\Firebird\Databases\EDMI_TEMPLATE\EDMI_MASTER.FDB"
|
||||||
|
Public Property User As String = "sysdba"
|
||||||
|
Public Property Password As String = "dd"
|
||||||
|
|
||||||
|
End Class
|
||||||
|
End Class
|
||||||
4
Services.ZUGFeRDService/Constants.vb
Normal file
4
Services.ZUGFeRDService/Constants.vb
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
Public Class Constants
|
||||||
|
Public Const SERVICE_NAME = "DDZUGFeRDService"
|
||||||
|
Public Const SERVICE_DISPLAY_NAME = "DigitalData ZUGFeRD Service"
|
||||||
|
End Class
|
||||||
@ -82,6 +82,8 @@
|
|||||||
<Import Include="System.Threading.Tasks" />
|
<Import Include="System.Threading.Tasks" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="Config.vb" />
|
||||||
|
<Compile Include="Constants.vb" />
|
||||||
<Compile Include="My Project\Application.Designer.vb">
|
<Compile Include="My Project\Application.Designer.vb">
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
<DependentUpon>Application.myapp</DependentUpon>
|
<DependentUpon>Application.myapp</DependentUpon>
|
||||||
@ -133,6 +135,10 @@
|
|||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Modules.Config\Config.vbproj">
|
||||||
|
<Project>{44982f9b-6116-44e2-85d0-f39650b1ef99}</Project>
|
||||||
|
<Name>Config</Name>
|
||||||
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\Modules.Database\Database.vbproj">
|
<ProjectReference Include="..\Modules.Database\Database.vbproj">
|
||||||
<Project>{eaf0ea75-5fa7-485d-89c7-b2d843b03a96}</Project>
|
<Project>{eaf0ea75-5fa7-485d-89c7-b2d843b03a96}</Project>
|
||||||
<Name>Database</Name>
|
<Name>Database</Name>
|
||||||
|
|||||||
110
Services.ZUGFeRDService/My Project/Settings.Designer.vb
generated
110
Services.ZUGFeRDService/My Project/Settings.Designer.vb
generated
@ -15,7 +15,7 @@ Option Explicit On
|
|||||||
Namespace My
|
Namespace My
|
||||||
|
|
||||||
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.4.0.0"), _
|
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.8.1.0"), _
|
||||||
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||||
Partial Friend NotInheritable Class MySettings
|
Partial Friend NotInheritable Class MySettings
|
||||||
Inherits Global.System.Configuration.ApplicationSettingsBase
|
Inherits Global.System.Configuration.ApplicationSettingsBase
|
||||||
@ -53,114 +53,6 @@ Namespace My
|
|||||||
Return defaultInstance
|
Return defaultInstance
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
|
||||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
|
||||||
Global.System.Configuration.DefaultSettingValueAttribute("DDZUGFeRDService")> _
|
|
||||||
Public ReadOnly Property SERVICE_NAME() As String
|
|
||||||
Get
|
|
||||||
Return CType(Me("SERVICE_NAME"),String)
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
|
||||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
|
||||||
Global.System.Configuration.DefaultSettingValueAttribute("DD ZUGFeRD Service")> _
|
|
||||||
Public ReadOnly Property SERVICE_DISPLAY_NAME() As String
|
|
||||||
Get
|
|
||||||
Return CType(Me("SERVICE_DISPLAY_NAME"),String)
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
|
||||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
|
||||||
Global.System.Configuration.DefaultSettingValueAttribute("172.24.12.41")> _
|
|
||||||
Public ReadOnly Property DB_DATASOURCE() As String
|
|
||||||
Get
|
|
||||||
Return CType(Me("DB_DATASOURCE"),String)
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
|
||||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
|
||||||
Global.System.Configuration.DefaultSettingValueAttribute("172.24.12.41:E:\DB\Firebird\Databases\EDMI_TEMPLATE\EDMI_MASTER.FDB")> _
|
|
||||||
Public ReadOnly Property DB_DATABASE() As String
|
|
||||||
Get
|
|
||||||
Return CType(Me("DB_DATABASE"),String)
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
|
||||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
|
||||||
Global.System.Configuration.DefaultSettingValueAttribute("sysdba")> _
|
|
||||||
Public ReadOnly Property DB_USER() As String
|
|
||||||
Get
|
|
||||||
Return CType(Me("DB_USER"),String)
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
|
||||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
|
||||||
Global.System.Configuration.DefaultSettingValueAttribute("dd")> _
|
|
||||||
Public ReadOnly Property DB_PASSWORD() As String
|
|
||||||
Get
|
|
||||||
Return CType(Me("DB_PASSWORD"),String)
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
|
||||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
|
||||||
Global.System.Configuration.DefaultSettingValueAttribute("10")> _
|
|
||||||
Public ReadOnly Property JOB_INTERVAL() As Integer
|
|
||||||
Get
|
|
||||||
Return CType(Me("JOB_INTERVAL"),Integer)
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
|
||||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
|
||||||
Global.System.Configuration.DefaultSettingValueAttribute("")> _
|
|
||||||
Public ReadOnly Property MSSQL_CONNECTIONSTRING() As String
|
|
||||||
Get
|
|
||||||
Return CType(Me("MSSQL_CONNECTIONSTRING"),String)
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
|
||||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
|
||||||
Global.System.Configuration.DefaultSettingValueAttribute("False")> _
|
|
||||||
Public ReadOnly Property MSSQL_ENABLED() As Boolean
|
|
||||||
Get
|
|
||||||
Return CType(Me("MSSQL_ENABLED"),Boolean)
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
|
||||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
|
||||||
Global.System.Configuration.DefaultSettingValueAttribute("1234567890_EXAMPLE_KEY")> _
|
|
||||||
Public ReadOnly Property GDPICTURE_KEY() As String
|
|
||||||
Get
|
|
||||||
Return CType(Me("GDPICTURE_KEY"),String)
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
|
||||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
|
||||||
Global.System.Configuration.DefaultSettingValueAttribute("1")> _
|
|
||||||
Public ReadOnly Property MSSQLEmailOutAccountID() As Integer
|
|
||||||
Get
|
|
||||||
Return CType(Me("MSSQLEmailOutAccountID"),Integer)
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
|
||||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
|
||||||
Global.System.Configuration.DefaultSettingValueAttribute("False")> _
|
|
||||||
Public ReadOnly Property DEBUG() As Boolean
|
|
||||||
Get
|
|
||||||
Return CType(Me("DEBUG"),Boolean)
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
End Class
|
End Class
|
||||||
End Namespace
|
End Namespace
|
||||||
|
|
||||||
|
|||||||
@ -1,42 +1,5 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="My" GeneratedClassName="MySettings" UseMySettingsClassName="true">
|
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
|
||||||
<Profiles />
|
<Profiles />
|
||||||
<Settings>
|
<Settings />
|
||||||
<Setting Name="SERVICE_NAME" Type="System.String" Scope="Application">
|
|
||||||
<Value Profile="(Default)">DDZUGFeRDService</Value>
|
|
||||||
</Setting>
|
|
||||||
<Setting Name="SERVICE_DISPLAY_NAME" Type="System.String" Scope="Application">
|
|
||||||
<Value Profile="(Default)">DD ZUGFeRD Service</Value>
|
|
||||||
</Setting>
|
|
||||||
<Setting Name="DB_DATASOURCE" Type="System.String" Scope="Application">
|
|
||||||
<Value Profile="(Default)">172.24.12.41</Value>
|
|
||||||
</Setting>
|
|
||||||
<Setting Name="DB_DATABASE" Type="System.String" Scope="Application">
|
|
||||||
<Value Profile="(Default)">172.24.12.41:E:\DB\Firebird\Databases\EDMI_TEMPLATE\EDMI_MASTER.FDB</Value>
|
|
||||||
</Setting>
|
|
||||||
<Setting Name="DB_USER" Type="System.String" Scope="Application">
|
|
||||||
<Value Profile="(Default)">sysdba</Value>
|
|
||||||
</Setting>
|
|
||||||
<Setting Name="DB_PASSWORD" Type="System.String" Scope="Application">
|
|
||||||
<Value Profile="(Default)">dd</Value>
|
|
||||||
</Setting>
|
|
||||||
<Setting Name="JOB_INTERVAL" Type="System.Int32" Scope="Application">
|
|
||||||
<Value Profile="(Default)">10</Value>
|
|
||||||
</Setting>
|
|
||||||
<Setting Name="MSSQL_CONNECTIONSTRING" Type="System.String" Scope="Application">
|
|
||||||
<Value Profile="(Default)" />
|
|
||||||
</Setting>
|
|
||||||
<Setting Name="MSSQL_ENABLED" Type="System.Boolean" Scope="Application">
|
|
||||||
<Value Profile="(Default)">False</Value>
|
|
||||||
</Setting>
|
|
||||||
<Setting Name="GDPICTURE_KEY" Type="System.String" Scope="Application">
|
|
||||||
<Value Profile="(Default)">1234567890_EXAMPLE_KEY</Value>
|
|
||||||
</Setting>
|
|
||||||
<Setting Name="MSSQLEmailOutAccountID" Type="System.Int32" Scope="Application">
|
|
||||||
<Value Profile="(Default)">1</Value>
|
|
||||||
</Setting>
|
|
||||||
<Setting Name="DEBUG" Type="System.Boolean" Scope="Application">
|
|
||||||
<Value Profile="(Default)">False</Value>
|
|
||||||
</Setting>
|
|
||||||
</Settings>
|
|
||||||
</SettingsFile>
|
</SettingsFile>
|
||||||
@ -15,8 +15,8 @@ Public Class ProjectInstaller
|
|||||||
.Account = ServiceAccount.LocalSystem
|
.Account = ServiceAccount.LocalSystem
|
||||||
}
|
}
|
||||||
service = New ServiceInstaller With {
|
service = New ServiceInstaller With {
|
||||||
.ServiceName = My.Settings.SERVICE_NAME,
|
.ServiceName = Constants.SERVICE_NAME,
|
||||||
.DisplayName = My.Settings.SERVICE_DISPLAY_NAME
|
.DisplayName = Constants.SERVICE_DISPLAY_NAME
|
||||||
}
|
}
|
||||||
Installers.Add(process)
|
Installers.Add(process)
|
||||||
Installers.Add(service)
|
Installers.Add(service)
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
Imports System.IO
|
Imports System.IO
|
||||||
Imports System.Timers
|
Imports System.Timers
|
||||||
Imports System.Xml.XPath
|
Imports System.Xml.XPath
|
||||||
|
Imports DigitalData.Modules.Config
|
||||||
Imports DigitalData.Modules.Database
|
Imports DigitalData.Modules.Database
|
||||||
Imports DigitalData.Modules.Interfaces
|
Imports DigitalData.Modules.Interfaces
|
||||||
Imports DigitalData.Modules.Jobs
|
Imports DigitalData.Modules.Jobs
|
||||||
@ -13,6 +14,7 @@ Public Class ThreadRunner
|
|||||||
Private WithEvents _workerThread As BackgroundWorker
|
Private WithEvents _workerThread As BackgroundWorker
|
||||||
Private WithEvents _workerTimer As Timer
|
Private WithEvents _workerTimer As Timer
|
||||||
|
|
||||||
|
Private _config As Config
|
||||||
Private _logConfig As LogConfig
|
Private _logConfig As LogConfig
|
||||||
Private _logger As Logger
|
Private _logger As Logger
|
||||||
Private _firebird As Firebird
|
Private _firebird As Firebird
|
||||||
@ -25,11 +27,11 @@ Public Class ThreadRunner
|
|||||||
Private _jobArguments As WorkerArgs
|
Private _jobArguments As WorkerArgs
|
||||||
Private _mssql As MSSQLServer
|
Private _mssql As MSSQLServer
|
||||||
|
|
||||||
Public Sub New(LogConfig As LogConfig, Firebird As Firebird, Optional MSSQL As MSSQLServer = Nothing)
|
Public Sub New(LogConfig As LogConfig, Config As ConfigManager(Of Config), Firebird As Firebird, Optional MSSQL As MSSQLServer = Nothing)
|
||||||
_logConfig = LogConfig
|
_logConfig = LogConfig
|
||||||
_logger = _logConfig.GetLogger()
|
_logger = _logConfig.GetLogger()
|
||||||
_logConfig.Debug = My.Settings.DEBUG
|
|
||||||
_firebird = Firebird
|
_firebird = Firebird
|
||||||
|
_config = Config
|
||||||
_mssql = MSSQL
|
_mssql = MSSQL
|
||||||
Try
|
Try
|
||||||
Dim directory As New IO.DirectoryInfo(_logConfig.LogDirectory)
|
Dim directory As New IO.DirectoryInfo(_logConfig.LogDirectory)
|
||||||
@ -138,7 +140,7 @@ Public Class ThreadRunner
|
|||||||
Dim args As WorkerArgs = e.Argument
|
Dim args As WorkerArgs = e.Argument
|
||||||
_logger.Debug("Background worker running..")
|
_logger.Debug("Background worker running..")
|
||||||
|
|
||||||
Dim job As New ImportZUGFeRDFiles(_logConfig, _firebird, My.Settings.MSSQLEmailOutAccountID, _mssql)
|
Dim job As New ImportZUGFeRDFiles(_logConfig, _firebird, _config.MSSQLEmailOutAccountID, _mssql)
|
||||||
job.Start(args)
|
job.Start(args)
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_logger.Warn("Background worker failed!")
|
_logger.Warn("Background worker failed!")
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
Imports System.IO
|
Imports System.IO
|
||||||
|
Imports DigitalData.Modules.Config
|
||||||
Imports DigitalData.Modules.Database
|
Imports DigitalData.Modules.Database
|
||||||
Imports DigitalData.Modules.Logging
|
Imports DigitalData.Modules.Logging
|
||||||
Imports DigitalData.Modules.Logging.LogConfig
|
Imports DigitalData.Modules.Logging.LogConfig
|
||||||
|
|
||||||
Public Class ZUGFeRDService
|
Public Class ZUGFeRDService
|
||||||
|
Private _config As ConfigManager(Of Config)
|
||||||
Private _logConfig As LogConfig
|
Private _logConfig As LogConfig
|
||||||
Private _logger As Logger
|
Private _logger As Logger
|
||||||
Private _firebird As Firebird
|
Private _firebird As Firebird
|
||||||
@ -11,9 +13,10 @@ Public Class ZUGFeRDService
|
|||||||
|
|
||||||
Private _threadRunner As ThreadRunner
|
Private _threadRunner As ThreadRunner
|
||||||
|
|
||||||
Protected Overrides Sub OnStart(ByVal args() As String)
|
Protected Overrides Sub OnStart(args() As String)
|
||||||
_logConfig = New LogConfig(PathType.CustomPath, Path.Combine(My.Application.Info.DirectoryPath, "Log"), Nothing, "Digital Data", "DDZUGFeRDService")
|
_logConfig = New LogConfig(PathType.CustomPath, Path.Combine(My.Application.Info.DirectoryPath, "Log"), Nothing, "Digital Data", "DDZUGFeRDService")
|
||||||
_logConfig.Debug = My.Settings.DEBUG
|
_config = New ConfigManager(Of Config)(_logConfig, My.Application.Info.DirectoryPath)
|
||||||
|
_logConfig.Debug = _config.Config.Debug
|
||||||
_logger = _logConfig.GetLogger()
|
_logger = _logConfig.GetLogger()
|
||||||
Try
|
Try
|
||||||
Dim directory As New IO.DirectoryInfo(_logConfig.LogDirectory)
|
Dim directory As New IO.DirectoryInfo(_logConfig.LogDirectory)
|
||||||
@ -24,22 +27,20 @@ Public Class ZUGFeRDService
|
|||||||
Else
|
Else
|
||||||
Exit For
|
Exit For
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
Next
|
Next
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
|
|
||||||
End Try
|
End Try
|
||||||
_logger.Info($"{My.Settings.SERVICE_NAME} is starting.")
|
_logger.Info($"{Constants.SERVICE_NAME} is starting.")
|
||||||
|
|
||||||
Dim oDataSource As String = My.Settings.DB_DATASOURCE
|
Dim oDataSource As String = _config.Config.Firebird.DataSource
|
||||||
Dim oDatabase As String = My.Settings.DB_DATABASE
|
Dim oDatabase As String = _config.Config.Firebird.Database
|
||||||
Dim oUser As String = My.Settings.DB_USER
|
Dim oUser As String = _config.Config.Firebird.User
|
||||||
Dim oPassword As String = My.Settings.DB_PASSWORD
|
Dim oPassword As String = _config.Config.Firebird.Password
|
||||||
Dim oJobInterval As Integer = My.Settings.JOB_INTERVAL
|
Dim oJobInterval As Integer = _config.Config.JobInterval
|
||||||
Dim oMSSQLConnectionString As String = My.Settings.MSSQL_CONNECTIONSTRING
|
Dim oMSSQLConnectionString As String = _config.Config.MSSQLConnectionString
|
||||||
Dim oMSSQLEnabled As Boolean = My.Settings.MSSQL_ENABLED
|
Dim oMSSQLEnabled As Boolean = _config.Config.MSSQLEnabled
|
||||||
Dim oGDPictureKey As String = My.Settings.GDPICTURE_KEY
|
Dim oGDPictureKey As String = _config.Config.GDPictureKey
|
||||||
|
|
||||||
_firebird = New Firebird(_logConfig, oDataSource, oDatabase, oUser, oPassword)
|
_firebird = New Firebird(_logConfig, oDataSource, oDatabase, oUser, oPassword)
|
||||||
|
|
||||||
@ -53,7 +54,7 @@ Public Class ZUGFeRDService
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
Try
|
Try
|
||||||
_threadRunner = New ThreadRunner(_logConfig, _firebird, _mssql)
|
_threadRunner = New ThreadRunner(_logConfig, _config, _firebird, _mssql)
|
||||||
_threadRunner.Start(oJobInterval)
|
_threadRunner.Start(oJobInterval)
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_logger.Error(ex)
|
_logger.Error(ex)
|
||||||
@ -61,7 +62,7 @@ Public Class ZUGFeRDService
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Protected Overrides Sub OnStop()
|
Protected Overrides Sub OnStop()
|
||||||
_logger.Info($"{My.Settings.SERVICE_NAME} is stopping.")
|
_logger.Info($"{Constants.SERVICE_NAME} is stopping.")
|
||||||
|
|
||||||
_threadRunner.Stop()
|
_threadRunner.Stop()
|
||||||
End Sub
|
End Sub
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user