From b611e3eeda220a5ee3f6a65c2f06eefdd60ce299 Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Tue, 1 Mar 2022 15:09:30 +0100 Subject: [PATCH] Zooflow: Add ClassModules --- .../Administration/ClassDetailForm.vb | 3 +- GUIs.ZooFlow/ClassConstants.vb | 1 + GUIs.ZooFlow/ClassModules.vb | 116 ++++++++++++++++++ GUIs.ZooFlow/Config/ClassConfig.vb | 11 ++ GUIs.ZooFlow/Modules/Globix/ClassUserFiles.vb | 2 +- GUIs.ZooFlow/ZooFlow.vbproj | 1 + GUIs.ZooFlow/frmFlowForm.Designer.vb | 18 +-- GUIs.ZooFlow/frmFlowForm.resx | 2 +- GUIs.ZooFlow/frmFlowForm.vb | 21 +++- Modules.Base/Base/Base.vbproj | 1 + Modules.Base/Base/ECM.vb | 7 ++ 11 files changed, 166 insertions(+), 17 deletions(-) create mode 100644 GUIs.ZooFlow/ClassModules.vb create mode 100644 Modules.Base/Base/ECM.vb diff --git a/GUIs.ZooFlow/Administration/ClassDetailForm.vb b/GUIs.ZooFlow/Administration/ClassDetailForm.vb index 67d22f31..42c0eff1 100644 --- a/GUIs.ZooFlow/Administration/ClassDetailForm.vb +++ b/GUIs.ZooFlow/Administration/ClassDetailForm.vb @@ -1,6 +1,7 @@ Imports DigitalData.GUIs.ZooFlow.Administration.ClassConstants Imports DigitalData.Modules.Base Imports DigitalData.Modules.Language +Imports DigitalData.Modules.Logging Public Class ClassDetailForm Inherits BaseClass @@ -71,7 +72,7 @@ Public Class ClassDetailForm }} } - Public Sub New(LogConfig As Modules.Logging.LogConfig) + Public Sub New(LogConfig As LogConfig) MyBase.New(LogConfig) End Sub diff --git a/GUIs.ZooFlow/ClassConstants.vb b/GUIs.ZooFlow/ClassConstants.vb index 35682897..1125fe88 100644 --- a/GUIs.ZooFlow/ClassConstants.vb +++ b/GUIs.ZooFlow/ClassConstants.vb @@ -16,6 +16,7 @@ Public Const MODULE_CLIPBOARDWATCHER = "CW" Public Const MODULE_GLOBAL_INDEXER = "GLOBIX" Public Const MODULE_ZOOFLOW = "ZOOFLOW" + Public Const MODULE_PROCESS_MANAGER = "PM" Public Const ATTR_TYPE_STRING = "VARCHAR" Public Const ATTR_TYPE_INTEGER = "BIG INTEGER" diff --git a/GUIs.ZooFlow/ClassModules.vb b/GUIs.ZooFlow/ClassModules.vb new file mode 100644 index 00000000..33dc972c --- /dev/null +++ b/GUIs.ZooFlow/ClassModules.vb @@ -0,0 +1,116 @@ +Imports DigitalData.Modules.Base +Imports DigitalData.Modules.Logging +Imports DigitalData.Modules.Base.ECM +Imports Microsoft.Win32 + +Public Class ClassModules + Inherits BaseClass + + Private Const PM_REGNODE = "Process Manager" + Private Const PM_EXENAME = "DD_ProcessManager.exe" + + Private Const CW_REGNODE = "Clipboard Watcher" + Private Const CW_EXENAME = "DD_Clipboard_Watcher.exe" + + Private Const GLOBIX_REGNODE = "Global Indexer" + Private Const GLOBIX_EXENAME = "Global_Indexer.exe" + + Private Const REGNODE_MANUFACTURER = "Digital Data" + Private Const REGPATH_BASE = "SOFTWARE\\WOW6432Node" + + Private Config As ClassConfig + + Public Sub New(pLogConfig As LogConfig, pConfig As ClassConfig) + MyBase.New(pLogConfig) + Config = pConfig + End Sub + + Public Function GetProductProgramPath(pProduct As Product) As String + Dim oApplicationName As String = Nothing + Dim oPath = GetProductPath(pProduct) + + If oPath Is Nothing Then + Return Nothing + End If + + Select Case pProduct + Case Product.GlobalIndexer + oApplicationName = PM_EXENAME + + Case Product.ClipboardWatcher + oApplicationName = CW_EXENAME + + Case Product.ProcessManager + oApplicationName = GLOBIX_EXENAME + + End Select + + If oApplicationName Is Nothing Then + Return Nothing + End If + + Return IO.Path.Combine(oPath, oApplicationName) + End Function + + Public Function GetProductPath(pProduct As Product) As String + Select Case pProduct + Case Product.ProcessManager + Return GetProductPathFor(pProduct, PM_REGNODE) + + Case Product.GlobalIndexer + Return GetProductPathFor(pProduct, GLOBIX_REGNODE) + + Case Product.ClipboardWatcher + Return GetProductPathFor(pProduct, CW_REGNODE) + + Case Else + Return Nothing + End Select + End Function + + Private Function GetProductPathFor(pProduct As Product, pSubKey As String) As String + Dim oPathFromRegistry = GetProductPathFromRegistryFor(pSubKey) + + If oPathFromRegistry IsNot Nothing Then + Return pSubKey + Else + Return GetProductPathFromConfig(pProduct) + End If + End Function + + Private Function GetProductPathFromConfig(pProduct As Product) + Select Case pProduct + Case Product.ProcessManager + Return Config.ProductPaths.ProcessManagerPath + + Case Product.GlobalIndexer + Return Config.ProductPaths.GlobalIndexerPath + + Case Product.ClipboardWatcher + Return Config.ProductPaths.ClipboardWatcherPath + + Case Else + Return Nothing + End Select + End Function + + Private Function GetProductPathFromRegistryFor(pSubKey As String) As String + Try + Dim oPathParts As New List(Of String) From {REGPATH_BASE, REGNODE_MANUFACTURER, pSubKey} + Dim oRegistryPath = String.Join("\\", oPathParts) + Dim oRoot = Registry.LocalMachine + Dim oProduct = oRoot.OpenSubKey(oRegistryPath, RegistryKeyPermissionCheck.ReadSubTree) + + If oProduct Is Nothing Then + Return Nothing + End If + + Return oProduct.GetValue("Path") + Catch ex As Exception + Logger.Warn("Could not read [Process Manager] path from registry!") + Logger.Error(ex) + Return Nothing + End Try + End Function + +End Class diff --git a/GUIs.ZooFlow/Config/ClassConfig.vb b/GUIs.ZooFlow/Config/ClassConfig.vb index 8dbda2aa..3093ff17 100644 --- a/GUIs.ZooFlow/Config/ClassConfig.vb +++ b/GUIs.ZooFlow/Config/ClassConfig.vb @@ -42,11 +42,22 @@ Public Class ClassConfig Public Property AppServerConfig As String = String.Empty + Public Property ConnectionStringAppServer As String = "" + ' === Logging Configuration Public Property LogDebug As Boolean = False ' === User Configuration === Public Property UserLanguage As String = "de-DE" + + ' === Product Configuration === + Public Property ProductPaths As ClassProductPaths + + Public Class ClassProductPaths + Public ProcessManagerPath As String + Public GlobalIndexerPath As String + Public ClipboardWatcherPath As String + End Class End Class diff --git a/GUIs.ZooFlow/Modules/Globix/ClassUserFiles.vb b/GUIs.ZooFlow/Modules/Globix/ClassUserFiles.vb index ff612404..6dc90677 100644 --- a/GUIs.ZooFlow/Modules/Globix/ClassUserFiles.vb +++ b/GUIs.ZooFlow/Modules/Globix/ClassUserFiles.vb @@ -6,7 +6,7 @@ Imports File = DigitalData.Modules.Filesystem.File Public Class ClassUserFiles Inherits BaseClass - Private Property FILESYSTEM As Modules.Filesystem.File + Private Property FILESYSTEM As File Public Sub New(pLogConfig As LogConfig) MyBase.New(pLogConfig) FILESYSTEM = New File(pLogConfig) diff --git a/GUIs.ZooFlow/ZooFlow.vbproj b/GUIs.ZooFlow/ZooFlow.vbproj index ae5953bc..0c0d1c1e 100644 --- a/GUIs.ZooFlow/ZooFlow.vbproj +++ b/GUIs.ZooFlow/ZooFlow.vbproj @@ -221,6 +221,7 @@ + diff --git a/GUIs.ZooFlow/frmFlowForm.Designer.vb b/GUIs.ZooFlow/frmFlowForm.Designer.vb index 171c0d43..9cc37292 100644 --- a/GUIs.ZooFlow/frmFlowForm.Designer.vb +++ b/GUIs.ZooFlow/frmFlowForm.Designer.vb @@ -54,10 +54,10 @@ Partial Class frmFlowForm Me.BarManager1 = New DevExpress.XtraBars.BarManager(Me.components) Me.Bar3 = New DevExpress.XtraBars.Bar() Me.BarSubItem1 = New DevExpress.XtraBars.BarSubItem() + Me.BarButtonItem8 = New DevExpress.XtraBars.BarButtonItem() Me.BarButtonItemGlobixGE = New DevExpress.XtraBars.BarButtonItem() Me.BarButtonItem6 = New DevExpress.XtraBars.BarButtonItem() Me.BarButtonItem7 = New DevExpress.XtraBars.BarButtonItem() - Me.BarButtonItem8 = New DevExpress.XtraBars.BarButtonItem() Me.BarButtonItem1 = New DevExpress.XtraBars.BarButtonItem() Me.buttonExitZooflow = New DevExpress.XtraBars.BarButtonItem() Me.barDockControlTop = New DevExpress.XtraBars.BarDockControl() @@ -323,11 +323,18 @@ Partial Class frmFlowForm Me.BarSubItem1.Name = "BarSubItem1" Me.BarSubItem1.PaintStyle = DevExpress.XtraBars.BarItemPaintStyle.CaptionGlyph ' + 'BarButtonItem8 + ' + Me.BarButtonItem8.Caption = "Grundeinstellungen" + Me.BarButtonItem8.Id = 9 + Me.BarButtonItem8.ImageOptions.SvgImage = Global.DigitalData.GUIs.ZooFlow.My.Resources.Resources.properties + Me.BarButtonItem8.Name = "BarButtonItem8" + ' 'BarButtonItemGlobixGE ' Me.BarButtonItemGlobixGE.Caption = "Grundeinstellungen Globix" Me.BarButtonItemGlobixGE.Id = 10 - Me.BarButtonItemGlobixGE.ImageOptions.SvgImage = CType(resources.GetObject("BarButtonItem9.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage) + Me.BarButtonItemGlobixGE.ImageOptions.SvgImage = CType(resources.GetObject("BarButtonItemGlobixGE.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage) Me.BarButtonItemGlobixGE.Name = "BarButtonItemGlobixGE" ' 'BarButtonItem6 @@ -344,13 +351,6 @@ Partial Class frmFlowForm Me.BarButtonItem7.ImageOptions.SvgImage = Global.DigitalData.GUIs.ZooFlow.My.Resources.Resources.managedatasource2 Me.BarButtonItem7.Name = "BarButtonItem7" ' - 'BarButtonItem8 - ' - Me.BarButtonItem8.Caption = "Grundeinstellungen" - Me.BarButtonItem8.Id = 9 - Me.BarButtonItem8.ImageOptions.SvgImage = Global.DigitalData.GUIs.ZooFlow.My.Resources.Resources.properties - Me.BarButtonItem8.Name = "BarButtonItem8" - ' 'BarButtonItem1 ' Me.BarButtonItem1.Caption = "Zooflow neustarten" diff --git a/GUIs.ZooFlow/frmFlowForm.resx b/GUIs.ZooFlow/frmFlowForm.resx index c1498dd6..7bc7faeb 100644 --- a/GUIs.ZooFlow/frmFlowForm.resx +++ b/GUIs.ZooFlow/frmFlowForm.resx @@ -2022,7 +2022,7 @@ LDIwLDE2LDIweiIgY2xhc3M9IkJsdWUiIC8+DQogIDwvZz4NCjwvc3ZnPgs= - + AAEAAAD/////AQAAAAAAAAAMAgAAAFlEZXZFeHByZXNzLkRhdGEudjIxLjIsIFZlcnNpb249MjEuMi40 LjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjg4ZDE3NTRkNzAwZTQ5YQUBAAAAHURl diff --git a/GUIs.ZooFlow/frmFlowForm.vb b/GUIs.ZooFlow/frmFlowForm.vb index f3d12b91..013f0849 100644 --- a/GUIs.ZooFlow/frmFlowForm.vb +++ b/GUIs.ZooFlow/frmFlowForm.vb @@ -152,10 +152,11 @@ Public Class frmFlowForm Private DTIDB_SEARCHES As DataTable ' Common Helpers Classes + Private Logger As Logger Private Init As ClassInit Private FileEx As Filesystem.File Private ErrorHandler As BaseErrorHandler - Private Logger As Logger + Private Modules As ClassModules ' Globix Helper Classes Private FileDropNew As FileDrop @@ -214,7 +215,7 @@ Public Class frmFlowForm Logger = My.LogConfig.GetLogger() Environment = My.Application.GetEnvironment() ErrorHandler = New BaseErrorHandler(My.LogConfig, Logger, Me) - + Modules = New ClassModules(My.LogConfig, My.SystemConfig) FileEx = New Filesystem.File(My.LogConfig) ' === Initialize Theming === @@ -316,6 +317,16 @@ Public Class frmFlowForm End If + Dim oPMPath = Modules.GetProductPath(ClassModules.Product.ProcessManager) + + + ' TODO: This needs an update of the function FNZF_GET_MODULE_INFO + If My.Application.ModulesActive.Contains(MODULE_PROCESS_MANAGER) Then + + End If + + + If IsNothing(My.Tables.DTIDB_CATALOG_USER) Then Exit Function End If @@ -1040,7 +1051,7 @@ Public Class frmFlowForm Dim oFormTitle = GetResultWindowString(oState.CurrentClipboardContents) ' For now we assume these are document results instead of data results - Dim oForm = Await oProfileSearches.GetDocResultForm(oProfile, oFormTitle, Modules.ZooFlow.Constants.OperationMode.ZooFlow) + Dim oForm = Await oProfileSearches.GetDocResultForm(oProfile, oFormTitle, DigitalData.Modules.ZooFlow.Constants.OperationMode.ZooFlow) AddHandler oForm.NeedsRefresh, AddressOf ProfileResultForm_NeedsRefresh oForm.Show() @@ -1052,7 +1063,7 @@ Public Class frmFlowForm .ClipboardContents = oState.CurrentClipboardContents, .MatchingProfiles = oProfiles, .MatchTreeView = oState.MatchTreeView, - .OperationModeOverride = Modules.ZooFlow.Constants.OperationMode.ZooFlow + .OperationModeOverride = DigitalData.Modules.ZooFlow.Constants.OperationMode.ZooFlow } Dim oForm As New frmMatch(My.LogConfig, oEnvironment, oParams) @@ -1125,7 +1136,7 @@ Public Class frmFlowForm Dim oParams = New DocumentResultList.Params() With { .WindowGuid = "QuickFlowSearch1", .WindowTitle = GetResultWindowString(pSearchText), - .OperationModeOverride = Modules.ZooFlow.Constants.OperationMode.ZooFlow, + .OperationModeOverride = DigitalData.Modules.ZooFlow.Constants.OperationMode.ZooFlow, .ProfileGuid = 354521 } diff --git a/Modules.Base/Base/Base.vbproj b/Modules.Base/Base/Base.vbproj index 48349b26..9a6697eb 100644 --- a/Modules.Base/Base/Base.vbproj +++ b/Modules.Base/Base/Base.vbproj @@ -66,6 +66,7 @@ + diff --git a/Modules.Base/Base/ECM.vb b/Modules.Base/Base/ECM.vb new file mode 100644 index 00000000..bf04d74b --- /dev/null +++ b/Modules.Base/Base/ECM.vb @@ -0,0 +1,7 @@ +Public Class ECM + Public Enum Product + ProcessManager + GlobalIndexer + ClipboardWatcher + End Enum +End Class