Imports System.Configuration

Public Class AppConfig
    Public Shared FirebirdDataSource As String
    Public Shared FirebirdDatabase As String
    Public Shared FirebirdUser As String
    Public Shared FirebirdPassword As String
    Public Shared ContainerPath As String
    Public Shared ContainerPassword As String
    Public Shared DatastorePath As String
    Public Shared MSSQLConnectionString As String

    Public Shared Sub Load()
        With ConfigurationManager.AppSettings
            FirebirdDataSource = .Item("FIREBIRD_DATASOURCE")
            FirebirdDatabase = .Item("FIREBIRD_DATABASE_NAME")
            FirebirdUser = .Item("FIREBIRD_DATABASE_USER")
            FirebirdPassword = .Item("FIREBIRD_DATABASE_PASS")

            MSSQLConnectionString = .Item("MSSQL_CONNECTION_STRING")

            ContainerPath = .Item("CONTAINER_PATH")
            ContainerPassword = .Item("CONTAINER_PASSWORD")

            DatastorePath = .Item("DATASTORE_PATH")
        End With
    End Sub

    Public Shared Function IsFirebirdConfigured() As Boolean
        Dim oProps As New List(Of String) From {FirebirdDataSource, FirebirdDatabase, FirebirdUser, FirebirdPassword}
        Return Not oProps.Any(Function(Prop) String.IsNullOrWhiteSpace(Prop))
    End Function

    Public Shared Function IsMSSQLConfigured() As Boolean
        Return Not String.IsNullOrWhiteSpace(MSSQLConnectionString)
    End Function
End Class
