From 5cf8636e49cf0bba6aa2dbd676abe8ec30fdd1f9 Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Wed, 30 Aug 2023 16:09:32 +0200 Subject: [PATCH] 30-08-2023 --- .../Config.vb | 3 +- Connectors.Common/Connectors.Common.vbproj | 145 ++++++++++++++++++ .../Modules/BaseModule.vb | 29 +++- .../Modules/ISync.vb | 0 .../Modules/Sharepoint/Constants.vb | 0 .../Sharepoint/Entities/SharepointDocument.vb | 0 .../Modules/Sharepoint/SharepointException.vb | 0 .../Modules/Sharepoint/SharepointSync.vb | 9 +- .../Modules/slt/Constants.vb | 0 .../slt/Entities/sltAvailableSystem.vb | 0 .../Modules/slt/Entities/sltDocument.vb | 0 .../slt/Responses/sltDocumentResponse.vb | 0 .../Modules/slt/Responses/sltLoginResponse.vb | 0 .../slt/Responses/sltLogoutResponse.vb | 0 .../slt/Responses/sltMandatorResponse.vb | 0 .../Modules/slt/Responses/sltResponse.vb | 0 .../Modules/slt/sltException.vb | 0 .../Modules/slt/sltSync.vb | 10 +- .../My Project/Application.Designer.vb | 13 ++ .../My Project/Application.myapp | 11 ++ Connectors.Common/My Project/AssemblyInfo.vb | 36 +++++ .../My Project/Resources.Designer.vb | 63 ++++++++ Connectors.Common/My Project/Resources.resx | 117 ++++++++++++++ .../My Project/Settings.Designer.vb | 73 +++++++++ .../My Project/Settings.settings | 7 + Connectors.Common/app.config | 41 +++++ Connectors.Common/packages.config | 5 + Connectors.Form/Connectors.Form.vbproj | 23 +-- Connectors.Form/frmMain.Designer.vb | 86 ++++++----- Connectors.Form/frmMain.resx | 20 ++- Connectors.Form/frmMain.vb | 26 +++- Connectors.Test/AuthTest.vb | 4 +- Connectors.Test/Connectors.Test.vbproj | 12 +- Connectors.sln | 6 + 34 files changed, 649 insertions(+), 90 deletions(-) rename {Connectors.Form => Connectors.Common}/Config.vb (95%) create mode 100644 Connectors.Common/Connectors.Common.vbproj rename {Connectors.Form => Connectors.Common}/Modules/BaseModule.vb (86%) rename {Connectors.Form => Connectors.Common}/Modules/ISync.vb (100%) rename {Connectors.Form => Connectors.Common}/Modules/Sharepoint/Constants.vb (100%) rename {Connectors.Form => Connectors.Common}/Modules/Sharepoint/Entities/SharepointDocument.vb (100%) rename {Connectors.Form => Connectors.Common}/Modules/Sharepoint/SharepointException.vb (100%) rename {Connectors.Form => Connectors.Common}/Modules/Sharepoint/SharepointSync.vb (96%) rename {Connectors.Form => Connectors.Common}/Modules/slt/Constants.vb (100%) rename {Connectors.Form => Connectors.Common}/Modules/slt/Entities/sltAvailableSystem.vb (100%) rename {Connectors.Form => Connectors.Common}/Modules/slt/Entities/sltDocument.vb (100%) rename {Connectors.Form => Connectors.Common}/Modules/slt/Responses/sltDocumentResponse.vb (100%) rename {Connectors.Form => Connectors.Common}/Modules/slt/Responses/sltLoginResponse.vb (100%) rename {Connectors.Form => Connectors.Common}/Modules/slt/Responses/sltLogoutResponse.vb (100%) rename {Connectors.Form => Connectors.Common}/Modules/slt/Responses/sltMandatorResponse.vb (100%) rename {Connectors.Form => Connectors.Common}/Modules/slt/Responses/sltResponse.vb (100%) rename {Connectors.Form => Connectors.Common}/Modules/slt/sltException.vb (100%) rename {Connectors.Form => Connectors.Common}/Modules/slt/sltSync.vb (98%) create mode 100644 Connectors.Common/My Project/Application.Designer.vb create mode 100644 Connectors.Common/My Project/Application.myapp create mode 100644 Connectors.Common/My Project/AssemblyInfo.vb create mode 100644 Connectors.Common/My Project/Resources.Designer.vb create mode 100644 Connectors.Common/My Project/Resources.resx create mode 100644 Connectors.Common/My Project/Settings.Designer.vb create mode 100644 Connectors.Common/My Project/Settings.settings create mode 100644 Connectors.Common/app.config create mode 100644 Connectors.Common/packages.config diff --git a/Connectors.Form/Config.vb b/Connectors.Common/Config.vb similarity index 95% rename from Connectors.Form/Config.vb rename to Connectors.Common/Config.vb index 3ee3852..eb4083b 100644 --- a/Connectors.Form/Config.vb +++ b/Connectors.Common/Config.vb @@ -1,5 +1,5 @@ Public Class Config - Public Property ActiveModule As String = "slt" + Public Property ActiveModule As String = "NONE" ''' ''' This connection string needs to point to the database where the document data will be written to @@ -25,6 +25,7 @@ Public Property OutputDirectory As String = "" Public Property AddDateSubDirectory As Boolean = False + Public Property AddImportSubDirectory As Boolean = False Public Property TimerIntervalMin As Integer = 0 diff --git a/Connectors.Common/Connectors.Common.vbproj b/Connectors.Common/Connectors.Common.vbproj new file mode 100644 index 0000000..9add4c6 --- /dev/null +++ b/Connectors.Common/Connectors.Common.vbproj @@ -0,0 +1,145 @@ + + + Debug + x86 + 8.0.30703 + 2.0 + {8F0AC45C-C610-4432-9078-82DD26EA3E8F} + Library + Connectors.Common + Connectors.Common + v4.6.2 + 512 + On + Binary + Off + On + + + AnyCPU + true + full + false + bin\Debug\ + true + true + prompt + + + AnyCPU + pdbonly + true + bin\Release\ + false + true + prompt + + + Windows + + + + + + + + ..\..\DDModules\Base\bin\Debug\DigitalData.Modules.Base.dll + + + ..\..\DDModules\Database\bin\Debug\DigitalData.Modules.Database.dll + + + ..\..\DDModules\Logging\bin\Debug\DigitalData.Modules.Logging.dll + + + ..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll + + + ..\packages\NLog.5.0.5\lib\net46\NLog.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + True + Application.myapp + True + + + + VbMyResourcesResXFileCodeGenerator + Resources.Designer.vb + My.Resources + Designer + + + True + Resources.resx + True + + + SettingsSingleFileGenerator + Settings.Designer.vb + + + + True + Settings.settings + True + + + + + + MyApplicationCodeGenerator + Application.Designer.vb + + + + + \ No newline at end of file diff --git a/Connectors.Form/Modules/BaseModule.vb b/Connectors.Common/Modules/BaseModule.vb similarity index 86% rename from Connectors.Form/Modules/BaseModule.vb rename to Connectors.Common/Modules/BaseModule.vb index 7f574f0..3011118 100644 --- a/Connectors.Form/Modules/BaseModule.vb +++ b/Connectors.Common/Modules/BaseModule.vb @@ -1,7 +1,5 @@ Imports System.IO -Imports System.Runtime.Remoting.Messaging Imports System.Threading.Tasks -Imports DevExpress.DocumentView Imports DigitalData.Modules.Base Imports DigitalData.Modules.Database Imports DigitalData.Modules.Logging @@ -81,16 +79,31 @@ Public MustInherit Class BaseModule End Function Friend Function GetFinalFilePath(pFileName As String) As String - If Config.AddDateSubDirectory Then - Dim oSubPath = FileEx.CreateDateDirectory(Config.OutputDirectory) + Dim oFinalDirectoryPath = Config.OutputDirectory + + If Config.AddDateSubDirectory = True Then + Dim oSubPath = FileEx.CreateDateDirectory(oFinalDirectoryPath) If oSubPath Is Nothing Then Throw New ApplicationException("Output sub path could not be created!") End If - Logger.Debug("Subdirectory [{0}] created.", oSubPath) - Return Path.Combine(oSubPath, pFileName) - Else - Return Path.Combine(Config.OutputDirectory, pFileName) + Logger.Debug("Date Subdirectory [{0}] created.", oSubPath) + oFinalDirectoryPath = oSubPath + End If + + If Config.AddImportSubDirectory = True Then + Dim oGuid = Guid.NewGuid.ToString() + Dim oSubPath = Path.Combine(oFinalDirectoryPath, oGuid) + Try + Directory.CreateDirectory(oSubPath) + Catch ex As Exception + Throw New ApplicationException("Output subpath could not be created!") + End Try + + Logger.Debug("Import Subdirectory [{0}] created", oSubPath) + oFinalDirectoryPath = oSubPath End If + + Return Path.Combine(oFinalDirectoryPath, pFileName) End Function Friend Function CopyFileToOutputPath(pFileContents As Byte(), pFilePath As String) As Boolean diff --git a/Connectors.Form/Modules/ISync.vb b/Connectors.Common/Modules/ISync.vb similarity index 100% rename from Connectors.Form/Modules/ISync.vb rename to Connectors.Common/Modules/ISync.vb diff --git a/Connectors.Form/Modules/Sharepoint/Constants.vb b/Connectors.Common/Modules/Sharepoint/Constants.vb similarity index 100% rename from Connectors.Form/Modules/Sharepoint/Constants.vb rename to Connectors.Common/Modules/Sharepoint/Constants.vb diff --git a/Connectors.Form/Modules/Sharepoint/Entities/SharepointDocument.vb b/Connectors.Common/Modules/Sharepoint/Entities/SharepointDocument.vb similarity index 100% rename from Connectors.Form/Modules/Sharepoint/Entities/SharepointDocument.vb rename to Connectors.Common/Modules/Sharepoint/Entities/SharepointDocument.vb diff --git a/Connectors.Form/Modules/Sharepoint/SharepointException.vb b/Connectors.Common/Modules/Sharepoint/SharepointException.vb similarity index 100% rename from Connectors.Form/Modules/Sharepoint/SharepointException.vb rename to Connectors.Common/Modules/Sharepoint/SharepointException.vb diff --git a/Connectors.Form/Modules/Sharepoint/SharepointSync.vb b/Connectors.Common/Modules/Sharepoint/SharepointSync.vb similarity index 96% rename from Connectors.Form/Modules/Sharepoint/SharepointSync.vb rename to Connectors.Common/Modules/Sharepoint/SharepointSync.vb index fb27fe1..b4c5062 100644 --- a/Connectors.Form/Modules/Sharepoint/SharepointSync.vb +++ b/Connectors.Common/Modules/Sharepoint/SharepointSync.vb @@ -1,8 +1,5 @@ -Imports System.ComponentModel -Imports System.IO -Imports System.Threading.Tasks +Imports System.Threading.Tasks Imports DigitalData.Modules.Base -Imports DigitalData.Modules.Config Imports DigitalData.Modules.Database Imports DigitalData.Modules.Logging Namespace Sharepoint @@ -89,8 +86,6 @@ Namespace Sharepoint Return oComplete End Function - - Private Async Function GetDocumentContent(pDocumentId As String) As Task(Of Entities.SharepointDocument) Try Dim oSql As String = $"SELECT T.LeafName, T.DirName, T2.Content @@ -98,7 +93,7 @@ Namespace Sharepoint INNER JOIN {Config.SharepointConfiguration.SharepointDatabase}.[AllDocStreams] T2 ON T.Id = T2.Id AND T.InternalVersion = T2.InternalVersion AND T.SiteId = T2.SiteId WHERE T.Id = '{pDocumentId}'" - Dim oTable As DataTable = Database.GetDatatable(oSql) + Dim oTable As DataTable = Await Database.GetDatatableAsync(oSql) If oTable Is Nothing OrElse oTable.Rows.Count = 0 Then Logger.Warn("Document with Id [{0}] was not found in SharePoint Database!", pDocumentId) diff --git a/Connectors.Form/Modules/slt/Constants.vb b/Connectors.Common/Modules/slt/Constants.vb similarity index 100% rename from Connectors.Form/Modules/slt/Constants.vb rename to Connectors.Common/Modules/slt/Constants.vb diff --git a/Connectors.Form/Modules/slt/Entities/sltAvailableSystem.vb b/Connectors.Common/Modules/slt/Entities/sltAvailableSystem.vb similarity index 100% rename from Connectors.Form/Modules/slt/Entities/sltAvailableSystem.vb rename to Connectors.Common/Modules/slt/Entities/sltAvailableSystem.vb diff --git a/Connectors.Form/Modules/slt/Entities/sltDocument.vb b/Connectors.Common/Modules/slt/Entities/sltDocument.vb similarity index 100% rename from Connectors.Form/Modules/slt/Entities/sltDocument.vb rename to Connectors.Common/Modules/slt/Entities/sltDocument.vb diff --git a/Connectors.Form/Modules/slt/Responses/sltDocumentResponse.vb b/Connectors.Common/Modules/slt/Responses/sltDocumentResponse.vb similarity index 100% rename from Connectors.Form/Modules/slt/Responses/sltDocumentResponse.vb rename to Connectors.Common/Modules/slt/Responses/sltDocumentResponse.vb diff --git a/Connectors.Form/Modules/slt/Responses/sltLoginResponse.vb b/Connectors.Common/Modules/slt/Responses/sltLoginResponse.vb similarity index 100% rename from Connectors.Form/Modules/slt/Responses/sltLoginResponse.vb rename to Connectors.Common/Modules/slt/Responses/sltLoginResponse.vb diff --git a/Connectors.Form/Modules/slt/Responses/sltLogoutResponse.vb b/Connectors.Common/Modules/slt/Responses/sltLogoutResponse.vb similarity index 100% rename from Connectors.Form/Modules/slt/Responses/sltLogoutResponse.vb rename to Connectors.Common/Modules/slt/Responses/sltLogoutResponse.vb diff --git a/Connectors.Form/Modules/slt/Responses/sltMandatorResponse.vb b/Connectors.Common/Modules/slt/Responses/sltMandatorResponse.vb similarity index 100% rename from Connectors.Form/Modules/slt/Responses/sltMandatorResponse.vb rename to Connectors.Common/Modules/slt/Responses/sltMandatorResponse.vb diff --git a/Connectors.Form/Modules/slt/Responses/sltResponse.vb b/Connectors.Common/Modules/slt/Responses/sltResponse.vb similarity index 100% rename from Connectors.Form/Modules/slt/Responses/sltResponse.vb rename to Connectors.Common/Modules/slt/Responses/sltResponse.vb diff --git a/Connectors.Form/Modules/slt/sltException.vb b/Connectors.Common/Modules/slt/sltException.vb similarity index 100% rename from Connectors.Form/Modules/slt/sltException.vb rename to Connectors.Common/Modules/slt/sltException.vb diff --git a/Connectors.Form/Modules/slt/sltSync.vb b/Connectors.Common/Modules/slt/sltSync.vb similarity index 98% rename from Connectors.Form/Modules/slt/sltSync.vb rename to Connectors.Common/Modules/slt/sltSync.vb index 985416c..51eb886 100644 --- a/Connectors.Form/Modules/slt/sltSync.vb +++ b/Connectors.Common/Modules/slt/sltSync.vb @@ -1,15 +1,13 @@ -Imports System.IO -Imports System.Net.Http +Imports System.Net.Http Imports Newtonsoft.Json Imports DigitalData.Modules.Base Imports DigitalData.Modules.Base.ModuleExtensions Imports DigitalData.Modules.Database Imports DigitalData.Modules.Logging -Imports Connectors.Form.slt.Constants -Imports Connectors.Form.slt.Responses -Imports Connectors.Form.slt.Entities +Imports Connectors.Common.slt.Constants +Imports Connectors.Common.slt.Responses +Imports Connectors.Common.slt.Entities Imports System.Threading.Tasks -Imports DigitalData.Modules.Config Namespace slt Public Class sltSync diff --git a/Connectors.Common/My Project/Application.Designer.vb b/Connectors.Common/My Project/Application.Designer.vb new file mode 100644 index 0000000..8ab460b --- /dev/null +++ b/Connectors.Common/My Project/Application.Designer.vb @@ -0,0 +1,13 @@ +'------------------------------------------------------------------------------ +' +' Dieser Code wurde von einem Tool generiert. +' Laufzeitversion:4.0.30319.42000 +' +' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn +' der Code erneut generiert wird. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + diff --git a/Connectors.Common/My Project/Application.myapp b/Connectors.Common/My Project/Application.myapp new file mode 100644 index 0000000..1243847 --- /dev/null +++ b/Connectors.Common/My Project/Application.myapp @@ -0,0 +1,11 @@ + + + true + Form1 + false + 0 + true + 0 + 0 + true + diff --git a/Connectors.Common/My Project/AssemblyInfo.vb b/Connectors.Common/My Project/AssemblyInfo.vb new file mode 100644 index 0000000..5e964c0 --- /dev/null +++ b/Connectors.Common/My Project/AssemblyInfo.vb @@ -0,0 +1,36 @@ +Imports System.Reflection +Imports System.Runtime.CompilerServices +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + + + + + + + + + +' Setting ComVisible to false makes the types in this assembly not visible +' to COM components. If you need to access a type in this assembly from +' COM, set the ComVisible attribute to true on that type. + + +' The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: +' [assembly: AssemblyVersion("1.0.*")] + + diff --git a/Connectors.Common/My Project/Resources.Designer.vb b/Connectors.Common/My Project/Resources.Designer.vb new file mode 100644 index 0000000..3167781 --- /dev/null +++ b/Connectors.Common/My Project/Resources.Designer.vb @@ -0,0 +1,63 @@ +'------------------------------------------------------------------------------ +' +' Dieser Code wurde von einem Tool generiert. +' Laufzeitversion:4.0.30319.42000 +' +' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn +' der Code erneut generiert wird. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Imports System + +Namespace My.Resources + + 'Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert + '-Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. + 'Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen + 'mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. + ''' + ''' Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. + ''' + _ + Friend Module Resources + + Private resourceMan As Global.System.Resources.ResourceManager + + Private resourceCulture As Global.System.Globalization.CultureInfo + + ''' + ''' Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. + ''' + _ + Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager + Get + If Object.ReferenceEquals(resourceMan, Nothing) Then + Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("Connectors.Common.Resources", GetType(Resources).Assembly) + resourceMan = temp + End If + Return resourceMan + End Get + End Property + + ''' + ''' Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle + ''' Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. + ''' + _ + Friend Property Culture() As Global.System.Globalization.CultureInfo + Get + Return resourceCulture + End Get + Set + resourceCulture = value + End Set + End Property + End Module +End Namespace diff --git a/Connectors.Common/My Project/Resources.resx b/Connectors.Common/My Project/Resources.resx new file mode 100644 index 0000000..901f10d --- /dev/null +++ b/Connectors.Common/My Project/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Connectors.Common/My Project/Settings.Designer.vb b/Connectors.Common/My Project/Settings.Designer.vb new file mode 100644 index 0000000..6a43715 --- /dev/null +++ b/Connectors.Common/My Project/Settings.Designer.vb @@ -0,0 +1,73 @@ +'------------------------------------------------------------------------------ +' +' Dieser Code wurde von einem Tool generiert. +' Laufzeitversion:4.0.30319.42000 +' +' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn +' der Code erneut generiert wird. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My + + _ + Partial Friend NotInheritable Class Settings + Inherits Global.System.Configuration.ApplicationSettingsBase + + Private Shared defaultInstance As Settings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New Settings()),Settings) + +#Region "Automatische My.Settings-Speicherfunktion" +#If _MyType = "WindowsForms" Then + Private Shared addedHandler As Boolean + + Private Shared addedHandlerLockObject As New Object + + _ + Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs) + If My.Application.SaveMySettingsOnExit Then + My.Settings.Save() + End If + End Sub +#End If +#End Region + + Public Shared ReadOnly Property [Default]() As Settings + Get + +#If _MyType = "WindowsForms" Then + If Not addedHandler Then + SyncLock addedHandlerLockObject + If Not addedHandler Then + AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings + addedHandler = True + End If + End SyncLock + End If +#End If + Return defaultInstance + End Get + End Property + End Class +End Namespace + +Namespace My + + _ + Friend Module MySettingsProperty + + _ + Friend ReadOnly Property Settings() As Global.Connectors.Common.My.Settings + Get + Return Global.Connectors.Common.My.Settings.Default + End Get + End Property + End Module +End Namespace diff --git a/Connectors.Common/My Project/Settings.settings b/Connectors.Common/My Project/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Connectors.Common/My Project/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Connectors.Common/app.config b/Connectors.Common/app.config new file mode 100644 index 0000000..917d596 --- /dev/null +++ b/Connectors.Common/app.config @@ -0,0 +1,41 @@ + + + + +
+ + + + + + System + + + True + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Connectors.Common/packages.config b/Connectors.Common/packages.config new file mode 100644 index 0000000..0ddda56 --- /dev/null +++ b/Connectors.Common/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/Connectors.Form/Connectors.Form.vbproj b/Connectors.Form/Connectors.Form.vbproj index 5521b7d..15e7f15 100644 --- a/Connectors.Form/Connectors.Form.vbproj +++ b/Connectors.Form/Connectors.Form.vbproj @@ -97,35 +97,18 @@ - - - - - - - - - Form frmMain.vb - True Application.myapp True - - - - - - - frmMain.vb @@ -161,6 +144,12 @@ + + + {8f0ac45c-c610-4432-9078-82dd26ea3e8f} + Connectors.Common + +