Compare commits
171 Commits
f3eef04a09
...
Update-Net
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8b36459e85 | ||
|
|
09673ffd70 | ||
|
|
bff4ad10c9 | ||
|
|
a409e1fd44 | ||
|
|
c7bb645f94 | ||
|
|
e7a7c45430 | ||
|
|
c0054d41ae | ||
|
|
1d31298d8d | ||
|
|
0261d237b6 | ||
| ea7fe74e89 | |||
|
|
f7f4b05df5 | ||
|
|
766737b4b5 | ||
|
|
ffa8850bf1 | ||
|
|
2991b52c17 | ||
| df04b0a706 | |||
| ce65276084 | |||
| 17d5acee9d | |||
| c7afa2f754 | |||
| 4d5ab64904 | |||
| f4c3e9b3e1 | |||
| 9d76b17b1d | |||
| 2ec92511cb | |||
| 8e1b9d21f3 | |||
| 7ac596b930 | |||
| cf9650be50 | |||
|
|
fa00f2ab54 | ||
|
|
5774eb7686 | ||
|
|
ceb618dc57 | ||
|
|
66328bb243 | ||
|
|
ecfe669938 | ||
|
|
5af75cc553 | ||
|
|
c402467b38 | ||
|
|
a420c1a618 | ||
|
|
7ef808d221 | ||
|
|
d09d728f7f | ||
| 7602f2c870 | |||
|
|
c74b778227 | ||
|
|
11b7a196dd | ||
|
|
4c113f19e8 | ||
|
|
a6d3781781 | ||
|
|
d4ce8e2891 | ||
|
|
8c829d490f | ||
|
|
6fb82c20ee | ||
|
|
7c473b9a27 | ||
| b5c470e1b9 | |||
| 4ab924907a | |||
| 32f87e25f5 | |||
|
|
3d388362ec | ||
|
|
bbd97acfc5 | ||
| 35d8021278 | |||
| 7e9ed47ad9 | |||
| 13ff63d6e0 | |||
| 6bcb4dd609 | |||
| f3b370c26f | |||
|
|
bf8a2971ec | ||
|
|
67e6e68394 | ||
| 7100503c4f | |||
| 6c78d6bcc2 | |||
|
|
54ee51b0de | ||
|
|
70765af22b | ||
| c803b4532d | |||
| 47b54562c8 | |||
| 5290d442f9 | |||
| 83c2374b90 | |||
|
|
99f954d406 | ||
|
|
6515e1811b | ||
|
|
6a051f7a92 | ||
|
|
70febee15d | ||
| e420931351 | |||
| b7c172c382 | |||
| 3e2606a582 | |||
|
|
954df832ed | ||
|
|
ccba559f73 | ||
|
|
b572639805 | ||
| bb7ed1bdd8 | |||
| 9957465f59 | |||
| eab2fb0880 | |||
| 80d4efd8ba | |||
| b0bc5113ef | |||
| 976da9a153 | |||
| 3ddb98c3d8 | |||
| 4d7cb6ad4f | |||
| c9c6cc668d | |||
| d24ed1884f | |||
| 50e1cd0f1c | |||
|
|
34ffec6272 | ||
|
|
a17eccfb99 | ||
|
|
daadc7771a | ||
| f64ad40572 | |||
| ce7213146d | |||
|
|
6b92832dce | ||
|
|
41af4b0506 | ||
| 78667a83f1 | |||
| 9683ec9643 | |||
| 622538225c | |||
| b0d02497eb | |||
| c52c00ac04 | |||
| 237cad3a7a | |||
| 53768edb23 | |||
| 9ed521738b | |||
| acb7db6f9d | |||
| e911d97966 | |||
| 60ce9ab4f8 | |||
| 96c8ad7bf6 | |||
| 1aed9a51f7 | |||
| 5a9a30d6f1 | |||
| 30a6356565 | |||
| 3046b7d203 | |||
| 09b52f441b | |||
| 5fb0b2b817 | |||
| 03b374ba17 | |||
| d54001d73b | |||
| 948c499b9d | |||
| b7f7cd7e91 | |||
| 516f5040f6 | |||
| 80712801b3 | |||
| 82a4ddee1a | |||
| 3d01f24c1f | |||
| 7c93fa62fb | |||
| a478636ded | |||
| 3987634848 | |||
| a1609ee3c7 | |||
| 1784f69041 | |||
| 6d60327489 | |||
| fb801297c5 | |||
| 99b2a5a53b | |||
| c0d2e25437 | |||
| 93a3051027 | |||
| 15e67f1e4c | |||
| 35aa5a8975 | |||
| 7254ca24c8 | |||
| 32346c075a | |||
| f07fe32131 | |||
| c8d0cb184a | |||
| ed0fc3539d | |||
| 95a40c9f4d | |||
| 4814758a49 | |||
| cb0f32f809 | |||
| 6be92ae0f2 | |||
| c79707f1e1 | |||
| 76ce9c075d | |||
| 42b08eba7a | |||
| c83d24a086 | |||
| 36e8c8a9b9 | |||
| c30f11b82e | |||
| e22b108514 | |||
| 8d672b4b49 | |||
| ec876ca518 | |||
| cf2e2161cf | |||
| 180642bfb9 | |||
| 2350620223 | |||
|
|
21ec149baa | ||
|
|
6e5706acba | ||
|
|
9ac9895ed4 | ||
| 3a1678e742 | |||
| c968831209 | |||
|
|
c3fccc3c20 | ||
|
|
97c1fb4803 | ||
|
|
808cdea86a | ||
|
|
c048b6ad6b | ||
| a5b9579b79 | |||
| c2d87c3e25 | |||
|
|
0a6a2093d5 | ||
| c4df4a2f5c | |||
|
|
d040da3277 | ||
|
|
64e92f7a39 | ||
|
|
1d2aecf4fb | ||
|
|
b38a88d5f9 | ||
|
|
e85379dcf5 | ||
|
|
9f9feff2fd | ||
|
|
8362e1885d |
@@ -45,6 +45,9 @@
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="DigitalData.Modules.Logging">
|
||||
<HintPath>..\Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.5.0.5\lib\net46\NLog.dll</HintPath>
|
||||
@@ -79,6 +82,7 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="Base\BaseClass.vb" />
|
||||
<Compile Include="Base\BaseUtils.vb" />
|
||||
<Compile Include="ECM\ECM.vb" />
|
||||
<Compile Include="Encryption\Compression.vb" />
|
||||
<Compile Include="Encryption\Encryption.vb" />
|
||||
<Compile Include="Encryption\EncryptionLegacy.vb" />
|
||||
@@ -89,6 +93,7 @@
|
||||
<Compile Include="FileWatcher\FileWatcherProperties.vb" />
|
||||
<Compile Include="IDB\Constants.vb" />
|
||||
<Compile Include="MimeEx.vb" />
|
||||
<Compile Include="StringFunctions.vb" />
|
||||
<Compile Include="WindowsEx.vb" />
|
||||
<Compile Include="ModuleExtensions.vb" />
|
||||
<Compile Include="FileEx.vb" />
|
||||
@@ -138,12 +143,9 @@
|
||||
<ItemGroup>
|
||||
<Content Include="README.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Logging\Logging.vbproj">
|
||||
<Project>{903b2d7d-3b80-4be9-8713-7447b704e1b0}</Project>
|
||||
<Name>Logging</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>powershell.exe -command "& { &'$(SolutionDir)copy-binary.ps1' '$(TargetPath)' '$(TargetFileName)' '$(ConfigurationName)' '$(ProjectName)' }"</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
8
Base/ECM/ECM.vb
Normal file
8
Base/ECM/ECM.vb
Normal file
@@ -0,0 +1,8 @@
|
||||
Public Class ECM
|
||||
Public Enum Product
|
||||
taskFLOW
|
||||
easyFLOW
|
||||
fileFLOW
|
||||
signFLOW
|
||||
End Enum
|
||||
End Class
|
||||
@@ -177,7 +177,6 @@ Public Class FilesystemEx
|
||||
''' somestring~3 --> somestring~3 --> ['somestring', '3'] --> version 3
|
||||
''' </example>
|
||||
''' <param name="pString">The string to versioned</param>
|
||||
''' <param name="pSeparator">The character to split at</param>
|
||||
''' <returns>Tuple of string and version</returns>
|
||||
Public Function GetVersionedString(pString As String) As Tuple(Of String, Integer)
|
||||
Dim oSplitString = pString.Split(VERSION_SEPARATOR).ToList()
|
||||
@@ -265,7 +264,7 @@ Public Class FilesystemEx
|
||||
_Logger.Warn("Deleting files was aborted at file {0}.", oFile.FullName)
|
||||
Return False
|
||||
End If
|
||||
oUnableToDeleteCounter = oUnableToDeleteCounter + 1
|
||||
oUnableToDeleteCounter += 1
|
||||
_Logger.Warn("File {0} could not be deleted!")
|
||||
End Try
|
||||
Next
|
||||
|
||||
@@ -65,6 +65,30 @@ Public Module ModuleExtensions
|
||||
Return (pString.Trim().ToLower() = "true") OrElse (pString.Trim() = "1")
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Checks if a string is null or empty
|
||||
''' </summary>
|
||||
''' <param name="pString">The input string</param>
|
||||
''' <returns>True string is null or empty, otherwise false.</returns>
|
||||
<Extension()>
|
||||
Public Function IsNullOrEmpty(pString As String) As Boolean
|
||||
Return String.IsNullOrEmpty(pString)
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Checks if a string is NOT null or empty
|
||||
''' </summary>
|
||||
''' <param name="pString">The input string</param>
|
||||
''' <returns>True string is null or empty, otherwise false.</returns>
|
||||
<Extension()>
|
||||
Public Function IsNotNullOrEmpty(pString As String) As Boolean
|
||||
If String.IsNullOrEmpty(pString) Then
|
||||
Return False
|
||||
Else
|
||||
Return True
|
||||
End If
|
||||
End Function
|
||||
|
||||
' ======================================================
|
||||
' === DICTIONARY
|
||||
' ======================================================
|
||||
|
||||
@@ -8,12 +8,12 @@ Imports System.Runtime.InteropServices
|
||||
|
||||
' Werte der Assemblyattribute überprüfen
|
||||
|
||||
<Assembly: AssemblyTitle("Base")>
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("")>
|
||||
<Assembly: AssemblyProduct("Base")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2023")>
|
||||
<Assembly: AssemblyTrademark("1.3.6.0")>
|
||||
<Assembly: AssemblyTitle("Modules.Base")>
|
||||
<Assembly: AssemblyDescription("basisfunktionalitäten für DigitalData Anwendungen")>
|
||||
<Assembly: AssemblyCompany("Digital Data GmbH")>
|
||||
<Assembly: AssemblyProduct("Modules.")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2025")>
|
||||
<Assembly: AssemblyTrademark("1.3.9.0")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' indem Sie "*" wie unten gezeigt eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.3.6.0")>
|
||||
<Assembly: AssemblyFileVersion("1.3.6.0")>
|
||||
<Assembly: AssemblyVersion("1.3.9.0")>
|
||||
<Assembly: AssemblyFileVersion("1.3.9.0")>
|
||||
|
||||
64
Base/StringFunctions.vb
Normal file
64
Base/StringFunctions.vb
Normal file
@@ -0,0 +1,64 @@
|
||||
Imports System.Globalization
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class StringFunctions
|
||||
Public Shared Function SplitText_Length(ByVal input As String, ByVal maxLength As Integer) As List(Of String)
|
||||
Dim result As New List(Of String)
|
||||
|
||||
For i As Integer = 0 To input.Length - 1 Step maxLength
|
||||
' Textabschnitt extrahieren
|
||||
Dim chunk As String = input.Substring(i, Math.Min(maxLength, input.Length - i))
|
||||
result.Add(chunk)
|
||||
Next
|
||||
|
||||
Return result
|
||||
End Function
|
||||
Public Shared Function SplitTextByNewLine(text As String) As List(Of String)
|
||||
If String.IsNullOrEmpty(text) Then
|
||||
Return New List(Of String)()
|
||||
End If
|
||||
|
||||
' Zerlege den Text anhand von Zeilenumbrüchen
|
||||
Dim lines As List(Of String) = text.Split({vbCrLf, vbLf, vbCr}, StringSplitOptions.None).ToList()
|
||||
Return lines
|
||||
End Function
|
||||
|
||||
Public Shared Function DatetimeStringToGermanStringConverter(pDatetimeString As String, pLogger As Logger) As String
|
||||
|
||||
If pDatetimeString.IsNullOrEmpty() = True Then
|
||||
' Wenn nichts kommt, kommt nichts zurueck
|
||||
Return String.Empty
|
||||
End If
|
||||
|
||||
Dim formatList As List(Of String) = New List(Of String) From {
|
||||
"yyyyMMdd",
|
||||
"MM/dd/yyyy", "M/d/yyyy", "MM/d/yyyy", "M/dd/yyyy",
|
||||
"yyyy-MM-dd", "yyyy-M-d", "yyyy-MM-d", "yyyy-M-dd",
|
||||
"dd.MM.yyyy", "d.M.yyyy", "d.MM.yyyy", "dd.M.yyyy"
|
||||
}
|
||||
|
||||
Dim dateStringResult As Date = Date.MinValue
|
||||
Dim oConvertResult As Boolean = False
|
||||
|
||||
For Each formatStringItem In formatList
|
||||
Try
|
||||
dateStringResult = DateTime.ParseExact(pDatetimeString, formatStringItem, CultureInfo.InvariantCulture)
|
||||
oConvertResult = True
|
||||
Exit For
|
||||
Catch ex As FormatException
|
||||
oConvertResult = False
|
||||
pLogger?.Debug("DatetimeStringToGermanStringConverter() - Could not parse date string {0} ({1})", pDatetimeString, formatStringItem)
|
||||
End Try
|
||||
Next
|
||||
|
||||
If oConvertResult = True Then
|
||||
' In deutsches Format umwandeln (dd.MM.yyyy)
|
||||
Dim germanDateFormat As String = dateStringResult.ToString("dd.MM.yyyy")
|
||||
Return germanDateFormat
|
||||
Else
|
||||
' Wenn nichts konvertiert werden konnte, geben wir den ursprünglichen Wert zurück
|
||||
Return pDatetimeString
|
||||
End If
|
||||
|
||||
End Function
|
||||
End Class
|
||||
@@ -1,4 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NLog" version="5.0.5" targetFramework="net461" />
|
||||
<package id="NuGet.CommandLine" version="6.13.2" targetFramework="net462" developmentDependency="true" />
|
||||
</packages>
|
||||
22
Config/App.config
Normal file
22
Config/App.config
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
|
||||
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
||||
</configSections>
|
||||
<entityFramework>
|
||||
<providers>
|
||||
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
|
||||
<provider invariantName="FirebirdSql.Data.FirebirdClient" type="EntityFramework.Firebird.FbProviderServices, EntityFramework.Firebird" />
|
||||
</providers>
|
||||
<defaultConnectionFactory type="EntityFramework.Firebird.FbConnectionFactory, EntityFramework.Firebird" />
|
||||
</entityFramework>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="FirebirdSql.Data.FirebirdClient" publicKeyToken="3750abcc3150b00c" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-7.5.0.0" newVersion="7.5.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\packages\EntityFramework.6.4.4\build\EntityFramework.props" Condition="Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.props')" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
@@ -12,6 +13,8 @@
|
||||
<MyType>Windows</MyType>
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile />
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -44,16 +47,41 @@
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="DigitalData.Modules.Base">
|
||||
<Reference Include="DigitalData.Modules.Base, Version=1.3.8.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Base\bin\Debug\DigitalData.Modules.Base.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Database, Version=2.3.5.4, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Logging, Version=2.6.5.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EntityFramework.Firebird, Version=6.4.0.0, Culture=neutral, PublicKeyToken=42d22d092898e5f8, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EntityFramework.Firebird.6.4.0\lib\net452\EntityFramework.Firebird.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="FirebirdSql.Data.FirebirdClient, Version=7.5.0.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\FirebirdSql.Data.FirebirdClient.7.5.0\lib\net452\FirebirdSql.Data.FirebirdClient.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.5.0.5\lib\net46\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Data.Odbc, Version=6.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Data.Odbc.6.0.1\lib\net461\System.Data.Odbc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.IO.Compression" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
@@ -78,6 +106,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ConfigAttributes.vb" />
|
||||
<Compile Include="ConfigDbFunct.vb" />
|
||||
<Compile Include="ConfigManager.vb" />
|
||||
<Compile Include="ConfigSample.vb" />
|
||||
<Compile Include="ConfigUtils.vb" />
|
||||
@@ -107,6 +136,7 @@
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="My Project\Application.myapp">
|
||||
<Generator>MyApplicationCodeGenerator</Generator>
|
||||
<LastGenOutput>Application.Designer.vb</LastGenOutput>
|
||||
@@ -118,15 +148,16 @@
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Encryption\Encryption.vbproj">
|
||||
<Project>{8a8f20fc-c46e-41ac-bee7-218366cfff99}</Project>
|
||||
<Name>Encryption</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Logging\Logging.vbproj">
|
||||
<Project>{903b2d7d-3b80-4be9-8713-7447b704e1b0}</Project>
|
||||
<Name>Logging</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>powershell.exe -command "& { &'$(SolutionDir)copy-binary.ps1' '$(TargetPath)' '$(TargetFileName)' '$(ConfigurationName)' '$(ProjectName)' }"</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}".</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\EntityFramework.6.4.4\build\EntityFramework.props'))" />
|
||||
<Error Condition="!Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\EntityFramework.6.4.4\build\EntityFramework.targets'))" />
|
||||
</Target>
|
||||
<Import Project="..\packages\EntityFramework.6.4.4\build\EntityFramework.targets" Condition="Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.targets')" />
|
||||
</Project>
|
||||
52
Config/ConfigDbFunct.vb
Normal file
52
Config/ConfigDbFunct.vb
Normal file
@@ -0,0 +1,52 @@
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Database
|
||||
|
||||
|
||||
Public Class ConfigDbFunct
|
||||
|
||||
''' <summary>
|
||||
''' Ermittelt die aktuelle Lizenz für das gewünschte Produkt
|
||||
''' aus der DB-Tabelle TBDD_3RD_PARTY_MODULES
|
||||
''' </summary>
|
||||
'''
|
||||
''' <param name="pLogConfig">An instance of LogConfig</param>
|
||||
''' <param name="pConnectionString">Initial connectionstring for connecting to DD_ECM database.</param>
|
||||
''' <returns>LicenseKey, if found, otherwise String.Empty</returns>
|
||||
Public Shared Function GetProductLicense(pProductName As String, pVersion As String, pLogConfig As LogConfig, pConnectionString As String) As String
|
||||
|
||||
Dim oLogger As Logger = pLogConfig.GetLogger()
|
||||
|
||||
If (String.IsNullOrEmpty(pProductName)) Then
|
||||
oLogger.Error("Parameter pProductName is null or empty")
|
||||
Return String.Empty
|
||||
End If
|
||||
|
||||
If (String.IsNullOrEmpty(pVersion)) Then
|
||||
oLogger.Error("Parameter pVersion is null or empty")
|
||||
Return String.Empty
|
||||
End If
|
||||
|
||||
If (String.IsNullOrEmpty(pConnectionString)) Then
|
||||
oLogger.Error("Parameter pConnectionString is null or empty")
|
||||
Return String.Empty
|
||||
End If
|
||||
|
||||
Try
|
||||
Dim oDecryptedConnectionString As String = MSSQLServer.DecryptConnectionString(pConnectionString)
|
||||
Dim oDatabase As MSSQLServer = New MSSQLServer(pLogConfig, oDecryptedConnectionString)
|
||||
|
||||
Dim oSql As String = "SELECT LICENSE FROM TBDD_3RD_PARTY_MODULES WHERE NAME = '" + pProductName + "' AND ACTIVE = 1 AND VERSION = '" + pVersion + "'"
|
||||
Dim oLicenseString As String = oDatabase.GetScalarValue(oSql)
|
||||
|
||||
Return oLicenseString
|
||||
|
||||
Catch ex As Exception
|
||||
oLogger.Error("Exception occured in ConfigDbFunct.GetProductLicense()")
|
||||
oLogger.Error(ex)
|
||||
End Try
|
||||
|
||||
Return String.Empty
|
||||
|
||||
End Function
|
||||
|
||||
End Class
|
||||
@@ -9,10 +9,10 @@ Imports System.Runtime.InteropServices
|
||||
' Werte der Assemblyattribute überprüfen
|
||||
|
||||
<Assembly: AssemblyTitle("Modules.Config")>
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("")>
|
||||
<Assembly: AssemblyDescription("Stellt Module für die Konfiguration von Produkten bereit")>
|
||||
<Assembly: AssemblyCompany("Digital Data GmbH, Heuchelheim")>
|
||||
<Assembly: AssemblyProduct("Modules.Config")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2023")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2025")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.2.2.0")>
|
||||
<Assembly: AssemblyFileVersion("1.2.2.0")>
|
||||
<Assembly: AssemblyVersion("1.3.0.0")>
|
||||
<Assembly: AssemblyFileVersion("1.3.0.0")>
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="EntityFramework" version="6.4.4" targetFramework="net462" />
|
||||
<package id="EntityFramework.Firebird" version="6.4.0" targetFramework="net462" />
|
||||
<package id="FirebirdSql.Data.FirebirdClient" version="7.5.0" targetFramework="net462" />
|
||||
<package id="NLog" version="5.0.5" targetFramework="net461" />
|
||||
<package id="System.Data.Odbc" version="6.0.1" targetFramework="net462" />
|
||||
</packages>
|
||||
@@ -148,7 +148,24 @@ Public Class MSSQLServer
|
||||
Public Function GetConnectionStringForId(pConnectionId As Integer) As String
|
||||
Return Get_ConnectionStringforID(pConnectionId)
|
||||
End Function
|
||||
|
||||
Public Function GetGDPictureString() As String
|
||||
Using oConnection As SqlConnection = GetSQLConnection()
|
||||
Dim oSQL = Queries.DD_ECM.ThirdPartyModules.GdPictureLicense
|
||||
Dim oGDPicture = GetScalarValueWithConnectionObject(oSQL, oConnection)
|
||||
If oGDPicture = String.Empty Then
|
||||
oSQL = Queries.DD_ECM.ThirdPartyModules.GdPictureLicense_REGULAR
|
||||
oGDPicture = GetScalarValueWithConnectionObject(oSQL, oConnection)
|
||||
End If
|
||||
Return oGDPicture
|
||||
End Using
|
||||
End Function
|
||||
Public Function GetDDCatalog() As DataTable
|
||||
Using oConnection As SqlConnection = GetSQLConnection()
|
||||
Dim oSQL = Queries.DD_ECM.DD_SELECTS.TBDD_CATALOG
|
||||
Dim oDT_CATALOG As DataTable = GetDatatable(oSQL)
|
||||
Return oDT_CATALOG
|
||||
End Using
|
||||
End Function
|
||||
Public Function Get_ConnectionStringforID(pConnectionId As Integer) As String
|
||||
Dim oConnectionString As String = String.Empty
|
||||
|
||||
@@ -453,6 +470,7 @@ Public Class MSSQLServer
|
||||
Dim oTransaction As SqlTransaction = MaybeGetTransaction(pSqlConnection, pTransactionMode, pTransaction)
|
||||
|
||||
Try
|
||||
|
||||
Logger.Debug("ExecuteNonQueryWithConnectionObject: Running Command [{0}] and Parameters [{1}]", pSqlCommandObject.CommandText, GetParameterListAsString(pSqlCommandObject))
|
||||
|
||||
pSqlCommandObject.Connection = pSqlConnection
|
||||
@@ -462,7 +480,8 @@ Public Class MSSQLServer
|
||||
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
Logger.Error("ExecuteNonQueryWithConnectionObject: Error in ExecuteNonQueryWithConnectionObject while executing command: [{0}]", pSqlCommandObject.CommandText)
|
||||
Dim omsg = $"Unexpected Error in ExecuteNonQueryWithConnectionObject while executing command: [{pSqlCommandObject.CommandText}]"
|
||||
Logger.Warn(omsg)
|
||||
Logger.Error(ex)
|
||||
|
||||
Return False
|
||||
@@ -633,7 +652,10 @@ Public Class MSSQLServer
|
||||
Cast(Of SqlParameter).
|
||||
Select(Function(p) $"({p.ParameterName}={p.Value})").
|
||||
ToList()
|
||||
|
||||
Return String.Join(",", oList)
|
||||
Dim oParamString = String.Join(",", oList)
|
||||
If oParamString.Length > 1000 Then
|
||||
oParamString = oParamString.Substring(1, 1000)
|
||||
End If
|
||||
Return oParamString
|
||||
End Function
|
||||
End Class
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
|
||||
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
|
||||
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
||||
</configSections>
|
||||
<entityFramework>
|
||||
<defaultConnectionFactory type="EntityFramework.Firebird.FbConnectionFactory, EntityFramework.Firebird"/>
|
||||
<defaultConnectionFactory type="EntityFramework.Firebird.FbConnectionFactory, EntityFramework.Firebird" />
|
||||
<providers>
|
||||
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
|
||||
<provider invariantName="FirebirdSql.Data.FirebirdClient" type="EntityFramework.Firebird.FbProviderServices, EntityFramework.Firebird"/>
|
||||
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
|
||||
<provider invariantName="FirebirdSql.Data.FirebirdClient" type="EntityFramework.Firebird.FbProviderServices, EntityFramework.Firebird" />
|
||||
</providers>
|
||||
</entityFramework>
|
||||
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="FirebirdSql.Data.FirebirdClient" publicKeyToken="3750abcc3150b00c" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-7.5.0.0" newVersion="7.5.0.0"/>
|
||||
<assemblyIdentity name="FirebirdSql.Data.FirebirdClient" publicKeyToken="3750abcc3150b00c" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-7.5.0.0" newVersion="7.5.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/></startup></configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" /></startup></configuration>
|
||||
|
||||
@@ -47,6 +47,12 @@
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="DigitalData.Modules.Encryption">
|
||||
<HintPath>..\Encryption\bin\Debug\DigitalData.Modules.Encryption.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Logging">
|
||||
<HintPath>..\Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -145,16 +151,6 @@
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Encryption\Encryption.vbproj">
|
||||
<Project>{8a8f20fc-c46e-41ac-bee7-218366cfff99}</Project>
|
||||
<Name>Encryption</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Logging\Logging.vbproj">
|
||||
<Project>{903b2d7d-3b80-4be9-8713-7447b704e1b0}</Project>
|
||||
<Name>Logging</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
@@ -164,4 +160,7 @@
|
||||
<Error Condition="!Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\EntityFramework.6.4.4\build\EntityFramework.targets'))" />
|
||||
</Target>
|
||||
<Import Project="..\packages\EntityFramework.6.4.4\build\EntityFramework.targets" Condition="Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.targets')" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>powershell.exe -command "& { &'$(SolutionDir)copy-binary.ps1' '$(TargetPath)' '$(TargetFileName)' '$(ConfigurationName)' '$(ProjectName)' }"</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -9,11 +9,11 @@ Imports System.Runtime.InteropServices
|
||||
' Werte der Assemblyattribute überprüfen
|
||||
|
||||
<Assembly: AssemblyTitle("Modules.Database")>
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyDescription("Stellt Funktionen für den Datenbankzugriff zur Verfügung")>
|
||||
<Assembly: AssemblyCompany("Digital Data")>
|
||||
<Assembly: AssemblyProduct("Modules.Database")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2024")>
|
||||
<Assembly: AssemblyTrademark("2.3.4.0")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2025")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("2.3.4.0")>
|
||||
<Assembly: AssemblyFileVersion("2.3.4.0")>
|
||||
<Assembly: AssemblyVersion("2.3.6.0")>
|
||||
<Assembly: AssemblyFileVersion("2.3.6.0")>
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
Public Class Queries
|
||||
Public Class DD_ECM
|
||||
Public Class ThirdPartyModules
|
||||
Public Const GdPictureLicense As String = "SELECT LICENSE FROM TBDD_3RD_PARTY_MODULES WHERE NAME = 'GDPICTURE'"
|
||||
Public Const GdPictureLicense As String = "SELECT COALESCE(MAX(LICENSE),'') FROM TBDD_3RD_PARTY_MODULES WHERE ACTIVE = 1 AND NAME = 'GDPICTURE' AND [VERSION] = '11.2024'"
|
||||
Public Const GdPictureLicense_REGULAR As String = "SELECT COALESCE(MAX(LICENSE),'') FROM TBDD_3RD_PARTY_MODULES WHERE NAME = 'GDPICTURE' AND ACTIVE = 1"
|
||||
End Class
|
||||
Public Class DD_SELECTS
|
||||
Public Const TBDD_CATALOG As String = "SELECT * FROM TBDD_CATALOG"
|
||||
End Class
|
||||
|
||||
Public Class Connections
|
||||
Public Const AllConnections As String = "SELECT * FROM TBDD_CONNECTION"
|
||||
Public Const AllConnections As String = "SELECT * FROM TBDD_CONNECTION AND AKTIV = 1"
|
||||
End Class
|
||||
End Class
|
||||
End Class
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="DigitalData.Modules.Encryption" version="1.3.1" targetFramework="net462" />
|
||||
<package id="DigitalData.Modules.Logging" version="2.6.5" targetFramework="net462" />
|
||||
<package id="EntityFramework" version="6.4.4" targetFramework="net461" />
|
||||
<package id="EntityFramework.Firebird" version="6.4.0" targetFramework="net461" />
|
||||
<package id="FirebirdSql.Data.FirebirdClient" version="7.5.0" targetFramework="net461" />
|
||||
|
||||
@@ -3,7 +3,6 @@ Imports DigitalData.Modules.EDMI.API
|
||||
Imports DigitalData.Modules.EDMI.API.Constants
|
||||
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Language.Utils
|
||||
|
||||
Public Class DatabaseWithFallback
|
||||
Private ReadOnly _Logger As Logger
|
||||
|
||||
@@ -44,6 +44,15 @@
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="DigitalData.Modules.Base">
|
||||
<HintPath>..\Base\bin\Debug\DigitalData.Modules.Base.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Database">
|
||||
<HintPath>..\Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Logging">
|
||||
<HintPath>..\Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.5.0.5\lib\net46\NLog.dll</HintPath>
|
||||
@@ -295,23 +304,8 @@
|
||||
<LastGenOutput>Reference.vb</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Base\Base.vbproj">
|
||||
<Project>{6ea0c51f-c2b1-4462-8198-3de0b32b74f8}</Project>
|
||||
<Name>Base</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Config\Config.vbproj">
|
||||
<Project>{44982f9b-6116-44e2-85d0-f39650b1ef99}</Project>
|
||||
<Name>Config</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Database\Database.vbproj">
|
||||
<Project>{eaf0ea75-5fa7-485d-89c7-b2d843b03a96}</Project>
|
||||
<Name>Database</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Logging\Logging.vbproj">
|
||||
<Project>{903b2d7d-3b80-4be9-8713-7447b704e1b0}</Project>
|
||||
<Name>Logging</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>powershell.exe -command "& { &'$(SolutionDir)copy-binary.ps1' '$(TargetPath)' '$(TargetFileName)' '$(ConfigurationName)' '$(ProjectName)' }"</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -1,21 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<system.diagnostics>
|
||||
<sources>
|
||||
<!-- Dieser Abschnitt definiert die Protokollierungskonfiguration für My.Application.Log -->
|
||||
<source name="DefaultSource" switchName="DefaultSwitch">
|
||||
<listeners>
|
||||
<add name="FileLog"/>
|
||||
<add name="FileLog" />
|
||||
<!-- Auskommentierung des nachfolgenden Abschnitts aufheben, um in das Anwendungsereignisprotokoll zu schreiben -->
|
||||
<!--<add name="EventLog"/>-->
|
||||
</listeners>
|
||||
</source>
|
||||
</sources>
|
||||
<switches>
|
||||
<add name="DefaultSwitch" value="Information"/>
|
||||
<add name="DefaultSwitch" value="Information" />
|
||||
</switches>
|
||||
<sharedListeners>
|
||||
<add name="FileLog" type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" initializeData="FileLogWriter"/>
|
||||
<add name="FileLog" type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" initializeData="FileLogWriter" />
|
||||
<!-- Auskommentierung des nachfolgenden Abschnitts aufheben und APPLICATION_NAME durch den Namen der Anwendung ersetzen, um in das Anwendungsereignisprotokoll zu schreiben -->
|
||||
<!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
|
||||
</sharedListeners>
|
||||
@@ -25,7 +25,7 @@
|
||||
<netTcpBinding>
|
||||
<binding name="NetTcpBinding_IEDMIService" transferMode="Streamed">
|
||||
<security>
|
||||
<transport sslProtocols="None"/>
|
||||
<transport sslProtocols="None" />
|
||||
</security>
|
||||
</binding>
|
||||
</netTcpBinding>
|
||||
@@ -33,7 +33,7 @@
|
||||
<client>
|
||||
<endpoint address="net.tcp://localhost:9000/DigitalData/Services/Main" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IEDMIService" contract="EDMIServiceReference.IEDMIService" name="NetTcpBinding_IEDMIService">
|
||||
<identity>
|
||||
<userPrincipalName value="Administrator@dd-san01.dd-gan.local.digitaldata.works"/>
|
||||
<userPrincipalName value="Administrator@dd-san01.dd-gan.local.digitaldata.works" />
|
||||
</identity>
|
||||
</endpoint>
|
||||
</client>
|
||||
@@ -41,9 +41,9 @@
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="FirebirdSql.Data.FirebirdClient" publicKeyToken="3750abcc3150b00c" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-7.5.0.0" newVersion="7.5.0.0"/>
|
||||
<assemblyIdentity name="FirebirdSql.Data.FirebirdClient" publicKeyToken="3750abcc3150b00c" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-7.5.0.0" newVersion="7.5.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/></startup></configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" /></startup></configuration>
|
||||
|
||||
@@ -45,6 +45,10 @@
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="DigitalData.Modules.Logging, Version=2.6.5.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.5.0.5\lib\net46\NLog.dll</HintPath>
|
||||
@@ -114,11 +118,5 @@
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Logging\Logging.vbproj">
|
||||
<Project>{903b2d7d-3b80-4be9-8713-7447b704e1b0}</Project>
|
||||
<Name>Logging</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
</Project>
|
||||
@@ -8,12 +8,12 @@ Imports System.Runtime.InteropServices
|
||||
|
||||
' Werte der Assemblyattribute überprüfen
|
||||
|
||||
<Assembly: AssemblyTitle("Encryption")>
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("")>
|
||||
<Assembly: AssemblyProduct("Encryption")>
|
||||
<Assembly: AssemblyTitle("DDModules.DDEncryption")>
|
||||
<Assembly: AssemblyDescription("Stellt Funktionen zur Entschlüsselung bereit")>
|
||||
<Assembly: AssemblyCompany("Digital Data Gmbh, Heuchelheim")>
|
||||
<Assembly: AssemblyProduct("DDModules.Encryption")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2021")>
|
||||
<Assembly: AssemblyTrademark("1.2.0.0")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' indem Sie "*" wie unten gezeigt eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.2.0.0")>
|
||||
<Assembly: AssemblyFileVersion("1.2.0.0")>
|
||||
<Assembly: AssemblyVersion("1.3.1.0")>
|
||||
<Assembly: AssemblyFileVersion("1.3.1.0")>
|
||||
|
||||
487
Filesystem/File.vb
Normal file
487
Filesystem/File.vb
Normal file
@@ -0,0 +1,487 @@
|
||||
Imports System.IO
|
||||
Imports System.Security.Cryptography
|
||||
Imports System.Text
|
||||
Imports System.Text.RegularExpressions
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
''' <module>File</module>
|
||||
''' <version>0.0.0.1</version>
|
||||
''' <date>11.10.2018</date>
|
||||
''' <summary>
|
||||
''' Module that provides variouse File operations
|
||||
''' </summary>
|
||||
''' <dependencies>
|
||||
''' NLog, >= 4.5.8
|
||||
''' </dependencies>
|
||||
''' <params>
|
||||
''' LogConfig, DigitalData.Module.Logging.LogConfig
|
||||
''' A LogConfig object
|
||||
''' </params>
|
||||
''' <props>
|
||||
''' </props>
|
||||
''' <example>
|
||||
''' </example>
|
||||
''' <remarks>
|
||||
''' </remarks>
|
||||
Public Class File
|
||||
Private ReadOnly _Logger As Logger
|
||||
Private ReadOnly _LogConfig As LogConfig
|
||||
|
||||
Private ReadOnly _invalidFilenameChars As String
|
||||
Private ReadOnly _invalidPathChars As String
|
||||
|
||||
Private Const REGEX_CLEAN_FILENAME As String = "[\\/:""<>|\b\0\r\n\t]"
|
||||
Private Const REGEX_CLEAN_PATH As String = "[""<>|\b\0\r\n\t]"
|
||||
|
||||
' The limit enforced by windows for filenpaths is 260,
|
||||
' so we use a slightly smaller number to have some Error margin.
|
||||
'
|
||||
' Source: https://docs.microsoft.com/de-de/windows/win32/fileio/naming-a-file?redirectedfrom=MSDN#maximum-path-length-limitation
|
||||
Private Const MAX_FILE_PATH_LENGTH = 250
|
||||
|
||||
Private Const FILE_NAME_ACCESS_TEST = "accessTest.txt"
|
||||
|
||||
Public Sub New(LogConfig As LogConfig)
|
||||
_LogConfig = LogConfig
|
||||
_Logger = LogConfig.GetLogger()
|
||||
|
||||
_invalidFilenameChars = String.Join("", Path.GetInvalidFileNameChars())
|
||||
_invalidPathChars = String.Join("", Path.GetInvalidPathChars())
|
||||
End Sub
|
||||
|
||||
Public Function GetCleanFilename(FileName As String) As String
|
||||
_Logger.Debug("Filename before cleaning: [{0}]", FileName)
|
||||
|
||||
Dim oCleanName As String = FileName
|
||||
oCleanName = Regex.Replace(oCleanName, _invalidFilenameChars, String.Empty)
|
||||
oCleanName = Regex.Replace(oCleanName, REGEX_CLEAN_FILENAME, String.Empty, RegexOptions.Singleline)
|
||||
oCleanName = Regex.Replace(oCleanName, "\s{2,}", " ")
|
||||
oCleanName = Regex.Replace(oCleanName, "\.{2,}", ".")
|
||||
|
||||
_Logger.Debug("Filename after cleaning: [{0}]", oCleanName)
|
||||
|
||||
Return oCleanName
|
||||
End Function
|
||||
|
||||
Public Function GetCleanPath(FilePath As String) As String
|
||||
_Logger.Debug("Path before cleaning: [{0}]", FilePath)
|
||||
|
||||
Dim oCleanName As String = FilePath
|
||||
oCleanName = Regex.Replace(oCleanName, _invalidPathChars, String.Empty)
|
||||
oCleanName = Regex.Replace(oCleanName, REGEX_CLEAN_PATH, String.Empty, RegexOptions.Singleline)
|
||||
|
||||
_Logger.Debug("Path after cleaning: [{0}]", oCleanName)
|
||||
|
||||
Return oCleanName
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Reads the file at `FilePath` and computes a SHA256 Hash from its contents
|
||||
''' </summary>
|
||||
''' <param name="FilePath"></param>
|
||||
''' <returns></returns>
|
||||
Public Function GetChecksum(FilePath As String) As String
|
||||
Try
|
||||
Using oFileStream = IO.File.OpenRead(FilePath)
|
||||
Using oStream As New BufferedStream(oFileStream, 1200000)
|
||||
Dim oChecksum() As Byte = SHA256.Create.ComputeHash(oStream)
|
||||
Return FormatHash(oChecksum)
|
||||
End Using
|
||||
End Using
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function GetChecksumFromString(pStringToCheck As String) As String
|
||||
Dim oBytes() As Byte = Encoding.UTF8.GetBytes(pStringToCheck)
|
||||
Dim oChecksum() As Byte = SHA256.Create.ComputeHash(oBytes)
|
||||
Return FormatHash(oChecksum)
|
||||
End Function
|
||||
|
||||
Private Function FormatHash(pChecksum)
|
||||
Return BitConverter.
|
||||
ToString(pChecksum).
|
||||
Replace("-", String.Empty)
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Adds file version string to given filename `Destination` if that file already exists.
|
||||
''' </summary>
|
||||
''' <param name="Destination"></param>
|
||||
''' <returns></returns>
|
||||
Public Function GetVersionedFilename(Destination As String) As String
|
||||
Try
|
||||
Dim oFileName As String = Destination
|
||||
Dim oFinalFileName = oFileName
|
||||
|
||||
Dim oDestinationDir = Path.GetDirectoryName(oFileName)
|
||||
Dim oExtension = Path.GetExtension(oFileName)
|
||||
|
||||
Dim oVersionSeparator As Char = "~"c
|
||||
|
||||
' Split Filename without extension at version separator to:
|
||||
' - Check if file is already versioned
|
||||
' - Get the file version of an already versioned file
|
||||
'
|
||||
' Example:
|
||||
' test1.pdf --> test1 --> ['test1'] --> no fileversion
|
||||
' test1~2.pdf --> test1~2 --> ['test1', '2'] --> version 2
|
||||
' test1~12345~2.pdf --> test1~12345~2 --> ['test1', '12345', '2'] --> still version 2
|
||||
'Dim oFileNameWithoutExtension = Path.GetFileNameWithoutExtension(oFileName)
|
||||
'Dim oSplitFilename = oFileNameWithoutExtension.Split(oVersionSeparator).ToList()
|
||||
|
||||
' if file is already versioned, extract file version
|
||||
' else just use the filename and set version to 1
|
||||
'If oSplitFilename.Count > 1 Then
|
||||
' Dim oVersion As Integer = 1
|
||||
' Try
|
||||
' oVersion = Integer.Parse(oSplitFilename.Last())
|
||||
' oFileNameWithoutExtension = String.Join("", oSplitFilename.Take(oSplitFilename.Count - 1))
|
||||
' Catch ex As Exception
|
||||
' ' oFilenameWithoutExtension does NOT change
|
||||
' oFileNameWithoutExtension = oFileNameWithoutExtension
|
||||
' Finally
|
||||
' oFileVersion = oVersion
|
||||
' End Try
|
||||
'Else
|
||||
' oFileVersion = 1
|
||||
'End If
|
||||
|
||||
Dim oFileNameWithoutExtension = Path.GetFileNameWithoutExtension(oFileName)
|
||||
Dim oSplitResult = GetVersionedString(oFileNameWithoutExtension, oVersionSeparator)
|
||||
|
||||
oFileNameWithoutExtension = oSplitResult.Item1
|
||||
Dim oFileVersion = oSplitResult.Item2
|
||||
|
||||
' Shorten the filename (only filename, without extension or version)
|
||||
' by cutting the length in half. This should work no matter how long the path and/or filename are.
|
||||
If oFileName.Length > MAX_FILE_PATH_LENGTH Then
|
||||
_Logger.Info("Filename is too long. Filename will be cut to prevent further errors.")
|
||||
_Logger.Info("Original Filename is: {0}", oFileNameWithoutExtension)
|
||||
Dim oNewLength As Integer = Math.Round(oFileNameWithoutExtension.Length / 2)
|
||||
Dim oNewFileNameWithoutExtension = oFileNameWithoutExtension.Substring(0, oNewLength)
|
||||
_Logger.Info("New Filename will be: {0}", oNewFileNameWithoutExtension)
|
||||
|
||||
oFileNameWithoutExtension = oNewFileNameWithoutExtension
|
||||
End If
|
||||
|
||||
' while file exists, increment version
|
||||
Do
|
||||
oFinalFileName = Path.Combine(oDestinationDir, GetFilenameWithVersion(oFileNameWithoutExtension, oVersionSeparator, oFileVersion, oExtension))
|
||||
_Logger.Debug("Intermediate Filename is {0}", oFinalFileName)
|
||||
_Logger.Debug("File version: {0}", oFileVersion)
|
||||
oFileVersion += 1
|
||||
Loop While (IO.File.Exists(oFinalFileName))
|
||||
|
||||
_Logger.Debug("Final Filename is {0}", oFinalFileName)
|
||||
|
||||
Return oFinalFileName
|
||||
Catch ex As Exception
|
||||
_Logger.Warn("Filename {0} could not be versioned. Original filename will be returned!", Destination)
|
||||
_Logger.Error(ex)
|
||||
Return Destination
|
||||
End Try
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Split String at version separator to:
|
||||
''' check if string is already versioned,
|
||||
''' get the string version of an already versioned string
|
||||
''' </summary>
|
||||
''' <example>
|
||||
''' Examples:
|
||||
''' test1.pdf --> test1 --> ['test1'] --> no fileversion
|
||||
''' test1~2.pdf --> test1~2 --> ['test1', '2'] --> version 2
|
||||
''' test1~12345~2.pdf --> test1~12345~2 --> ['test1', '12345', '2'] --> still version 2
|
||||
''' somestring~3 --> somestring~3 --> ['somestring', '3'] --> version 3
|
||||
''' </example>
|
||||
''' <param name="pString">The string to versioned</param>
|
||||
''' <param name="pSeparator">The character to split at</param>
|
||||
''' <returns>Tuple of string and version</returns>
|
||||
Public Function GetVersionedString(pString As String, pSeparator As Char) As Tuple(Of String, Integer)
|
||||
Dim oSplitString = pString.Split(pSeparator).ToList()
|
||||
Dim oStringVersion As Integer
|
||||
|
||||
' if string is already versioned, extract string version
|
||||
' else just use the string and set version to 1
|
||||
If oSplitString.Count > 1 Then
|
||||
Dim oVersion As Integer = 1
|
||||
Try
|
||||
oVersion = Integer.Parse(oSplitString.Last())
|
||||
pString = String.Join("", oSplitString.Take(oSplitString.Count - 1))
|
||||
Catch ex As Exception
|
||||
' pString does NOT change
|
||||
pString = pString
|
||||
Finally
|
||||
oStringVersion = oVersion
|
||||
End Try
|
||||
Else
|
||||
oStringVersion = 1
|
||||
End If
|
||||
|
||||
Return New Tuple(Of String, Integer)(pString, oStringVersion)
|
||||
End Function
|
||||
|
||||
Public Function GetAppDataPath(CompanyName As String, ProductName As String)
|
||||
Dim oLocalAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
|
||||
Return Path.Combine(oLocalAppData, CompanyName, ProductName)
|
||||
End Function
|
||||
|
||||
Private Function GetFilenameWithVersion(FileNameWithoutExtension As String, VersionSeparator As Char, FileVersion As Integer, Extension As String) As String
|
||||
If FileVersion <= 1 Then
|
||||
Return $"{FileNameWithoutExtension}{Extension}"
|
||||
Else
|
||||
Return $"{FileNameWithoutExtension}{VersionSeparator}{FileVersion}{Extension}"
|
||||
End If
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Removes files in a directory filtered by filename, extension and last write date
|
||||
''' </summary>
|
||||
''' <param name="Path">The directory in which files will be deleted</param>
|
||||
''' <param name="FileKeepTime">Only delete files which are older than x days. Must be between 0 and 1000 days.</param>
|
||||
''' <param name="FileBaseName">A filename filter which will be checked</param>
|
||||
''' <param name="FileExtension">A file extension which will be checked</param>
|
||||
''' <param name="ContinueOnError">Should the function continue with deleting when a file could not be deleted?</param>
|
||||
''' <returns>True if all files were deleted or if no files were deleted, otherwise false</returns>
|
||||
Public Function RemoveFiles(Path As String, FileKeepTime As Integer, FileBaseName As String, Optional FileExtension As String = "log", Optional ContinueOnError As Boolean = True) As Boolean
|
||||
If Not TestPathIsDirectory(Path) Then
|
||||
Throw New ArgumentException($"Path {Path} is not a directory!")
|
||||
End If
|
||||
|
||||
If Not Directory.Exists(Path) Then
|
||||
Throw New DirectoryNotFoundException($"Path {Path} does not exist!")
|
||||
End If
|
||||
|
||||
If FileKeepTime < 0 Or FileKeepTime > 1000 Then
|
||||
Throw New ArgumentOutOfRangeException("FileKeepTime must be an integer between 0 and 1000!")
|
||||
End If
|
||||
|
||||
Dim oUnableToDeleteCounter = 0
|
||||
Dim oDirectory As New DirectoryInfo(Path)
|
||||
Dim oDateLimit As DateTime = DateTime.Now.AddDays(FileKeepTime)
|
||||
Dim oFiles As List(Of FileInfo) = oDirectory.
|
||||
EnumerateFiles($"*{FileBaseName}*").
|
||||
Where(Function(oFileInfo As FileInfo)
|
||||
Return oFileInfo.Extension = FileExtension And oFileInfo.LastWriteTime < oDateLimit
|
||||
End Function).
|
||||
ToList()
|
||||
|
||||
If oFiles.Count = 0 Then
|
||||
_Logger.Debug("No files found that match the criterias.")
|
||||
Return True
|
||||
End If
|
||||
|
||||
_Logger.Debug("Deleting old files (Found {0}).", oFiles.Count)
|
||||
|
||||
For Each oFile As FileInfo In oFiles
|
||||
Try
|
||||
oFile.Delete()
|
||||
Catch ex As Exception
|
||||
If ContinueOnError = False Then
|
||||
_Logger.Warn("Deleting files was aborted at file {0}.", oFile.FullName)
|
||||
Return False
|
||||
End If
|
||||
oUnableToDeleteCounter = oUnableToDeleteCounter + 1
|
||||
_Logger.Warn("File {0} could not be deleted!")
|
||||
End Try
|
||||
Next
|
||||
|
||||
If oUnableToDeleteCounter > 0 Then
|
||||
_Logger.Debug("Old files partially removed. {0} files could not be removed.", oUnableToDeleteCounter)
|
||||
Else
|
||||
_Logger.Debug("Old files removed.")
|
||||
End If
|
||||
|
||||
Return True
|
||||
End Function
|
||||
|
||||
<DebuggerStepThrough>
|
||||
Public Sub MoveTo(FilePath As String, Directory As String)
|
||||
Dim oFileInfo As New FileInfo(FilePath)
|
||||
IO.File.Move(FilePath, Path.Combine(Directory, oFileInfo.Name))
|
||||
End Sub
|
||||
|
||||
<DebuggerStepThrough>
|
||||
Public Sub MoveTo(FilePath As String, NewFileName As String, Directory As String)
|
||||
IO.File.Move(FilePath, Path.Combine(Directory, NewFileName))
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' Copied from https://docs.microsoft.com/en-us/dotnet/standard/io/how-to-copy-directories
|
||||
''' </summary>
|
||||
''' <param name="SourceDirName"></param>
|
||||
''' <param name="DestDirName"></param>
|
||||
''' <param name="CopySubDirs"></param>
|
||||
Public Sub CopyDirectory(ByVal SourceDirName As String, ByVal DestDirName As String, ByVal CopySubDirs As Boolean)
|
||||
Dim oDirectory As DirectoryInfo = New DirectoryInfo(SourceDirName)
|
||||
|
||||
If Not oDirectory.Exists Then
|
||||
Throw New DirectoryNotFoundException("Source directory does not exist or could not be found: " & SourceDirName)
|
||||
End If
|
||||
|
||||
Dim oDirectories As DirectoryInfo() = oDirectory.GetDirectories()
|
||||
Directory.CreateDirectory(DestDirName)
|
||||
Dim oFiles As FileInfo() = oDirectory.GetFiles()
|
||||
|
||||
For Each oFile As FileInfo In oFiles
|
||||
Dim tempPath As String = Path.Combine(DestDirName, oFile.Name)
|
||||
oFile.CopyTo(tempPath, False)
|
||||
Next
|
||||
|
||||
If CopySubDirs Then
|
||||
For Each oSubDirectory As DirectoryInfo In oDirectories
|
||||
Dim oTempPath As String = Path.Combine(DestDirName, oSubDirectory.Name)
|
||||
CopyDirectory(oSubDirectory.FullName, oTempPath, CopySubDirs)
|
||||
Next
|
||||
End If
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' Tries to create a directory and returns its path.
|
||||
''' Returns a temp path if `DirectoryPath` can not be created or written to.
|
||||
''' </summary>
|
||||
''' <param name="DirectoryPath">The directory to create</param>
|
||||
''' <param name="TestWriteAccess">Should a write access test be performed?</param>
|
||||
''' <returns>The used path</returns>
|
||||
Public Function CreateDirectory(DirectoryPath As String, Optional TestWriteAccess As Boolean = True) As String
|
||||
Dim oFinalPath As String
|
||||
If Directory.Exists(DirectoryPath) Then
|
||||
_Logger.Debug("Directory {0} already exists. Skipping.", DirectoryPath)
|
||||
oFinalPath = DirectoryPath
|
||||
Else
|
||||
Try
|
||||
Directory.CreateDirectory(DirectoryPath)
|
||||
oFinalPath = DirectoryPath
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
_Logger.Warn("Directory {0} could not be created. Temp path will be used instead.", DirectoryPath)
|
||||
oFinalPath = Path.GetTempPath()
|
||||
End Try
|
||||
End If
|
||||
|
||||
If TestWriteAccess AndAlso Not TestPathIsWritable(DirectoryPath) Then
|
||||
_Logger.Warn("Directory {0} is not writable. Temp path will be used instead.", DirectoryPath)
|
||||
oFinalPath = Path.GetTempPath()
|
||||
Else
|
||||
oFinalPath = DirectoryPath
|
||||
End If
|
||||
|
||||
_Logger.Debug("Using path {0}", oFinalPath)
|
||||
|
||||
Return oFinalPath
|
||||
End Function
|
||||
|
||||
Public Function TestPathIsWritable(DirectoryPath As String) As Boolean
|
||||
Try
|
||||
Dim fileAccessPath = Path.Combine(DirectoryPath, FILE_NAME_ACCESS_TEST)
|
||||
Using fs As FileStream = IO.File.Create(fileAccessPath)
|
||||
fs.WriteByte(0)
|
||||
End Using
|
||||
|
||||
IO.File.Delete(fileAccessPath)
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Checks if a file is locked, ie. in use by another process.
|
||||
''' </summary>
|
||||
''' <remarks>
|
||||
''' https://docs.microsoft.com/en-us/dotnet/standard/io/handling-io-errors
|
||||
''' https://stackoverflow.com/questions/876473/is-there-a-way-to-check-if-a-file-is-in-use
|
||||
''' </remarks>
|
||||
Public Function TestFileIsLocked(pFilePath As String) As Boolean
|
||||
Try
|
||||
Using stream As FileStream = IO.File.Open(pFilePath, FileMode.Open, FileAccess.ReadWrite, FileShare.None)
|
||||
stream.Close()
|
||||
End Using
|
||||
Catch ex As Exception When ((ex.HResult And &HFFFF) = 32)
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
Return True
|
||||
End Try
|
||||
|
||||
Return False
|
||||
End Function
|
||||
|
||||
Public Function TestPathIsDirectory(Path As String) As Boolean
|
||||
If Not Directory.Exists(Path) Then
|
||||
Return False
|
||||
End If
|
||||
|
||||
Dim oIsDirectory As Boolean = (System.IO.File.GetAttributes(Path) And FileAttributes.Directory) = FileAttributes.Directory
|
||||
Return oIsDirectory
|
||||
End Function
|
||||
|
||||
Public Function GetDateDirectory(pBaseDirectory As String, pDate As Date) As String
|
||||
Dim oDateDirectory = GetDateString(pDate)
|
||||
Dim oFinalDirectory As String = IO.Path.Combine(pBaseDirectory, oDateDirectory)
|
||||
Return oFinalDirectory
|
||||
End Function
|
||||
|
||||
Public Function GetDateDirectory(pBaseDirectory As String) As String
|
||||
Return GetDateDirectory(pBaseDirectory, Now)
|
||||
End Function
|
||||
|
||||
Public Function CreateDateDirectory(pBaseDirectory As String, pDate As Date) As String
|
||||
Dim oDateDirectory = GetDateString(pDate)
|
||||
Dim oFinalDirectory As String = IO.Path.Combine(pBaseDirectory, oDateDirectory)
|
||||
|
||||
If IO.Directory.Exists(oFinalDirectory) = False Then
|
||||
_Logger.Debug("Path does not exist, creating: [{0}]", oFinalDirectory)
|
||||
Try
|
||||
Directory.CreateDirectory(oFinalDirectory)
|
||||
_Logger.Debug("Created folder [{0}]", oFinalDirectory)
|
||||
Catch ex As Exception
|
||||
_Logger.Warn("Final path [{0}] could not be created!", oFinalDirectory)
|
||||
_Logger.Error(ex)
|
||||
End Try
|
||||
End If
|
||||
|
||||
Return oFinalDirectory
|
||||
End Function
|
||||
|
||||
Public Function CreateDateDirectory(pBaseDirectory As String) As String
|
||||
Return CreateDateDirectory(pBaseDirectory, Now)
|
||||
End Function
|
||||
|
||||
Public Function GetDateString() As String
|
||||
Return $"{Now:yyyy\\MM\\dd}"
|
||||
End Function
|
||||
|
||||
Public Function GetDateString(pDate As Date) As String
|
||||
Return $"{pDate:yyyy\\MM\\dd}"
|
||||
End Function
|
||||
|
||||
Public Function GetDateTimeString() As String
|
||||
Return $"{Now:yyyy-MM-dd_hh-mm-ffff}"
|
||||
End Function
|
||||
|
||||
Public Function GetDateTimeString(pDate As Date) As String
|
||||
Return $"{pDate:yyyy-MM-dd_hh-mm-ffff}"
|
||||
End Function
|
||||
|
||||
Public Function GetFilenameWithSuffix(pFilePath As String, pSuffix As String)
|
||||
Dim oFileInfo = New IO.FileInfo(pFilePath)
|
||||
Return GetFilenameWithSuffix(IO.Path.GetFileNameWithoutExtension(pFilePath), pSuffix, oFileInfo.Extension.Substring(1))
|
||||
End Function
|
||||
|
||||
Public Function GetFilenameWithSuffix(pBaseString As String, pSuffix As String, pExtension As String)
|
||||
Return $"{pBaseString}-{pSuffix}.{pExtension}"
|
||||
End Function
|
||||
|
||||
Public Function GetFilenameWithPrefix(pFilePath As String, pPrefix As String)
|
||||
Dim oFileInfo = New IO.FileInfo(pFilePath)
|
||||
Return GetFilenameWithSuffix(IO.Path.GetFileNameWithoutExtension(pFilePath), pPrefix, oFileInfo.Extension.Substring(1))
|
||||
End Function
|
||||
|
||||
Public Function GetFilenameWithPrefix(pBaseString As String, pPrefix As String, pExtension As String)
|
||||
Return $"{pPrefix}-{pBaseString}.{pExtension}"
|
||||
End Function
|
||||
|
||||
End Class
|
||||
18
Filesystem/FileContainer/DocumentObject.vb
Normal file
18
Filesystem/FileContainer/DocumentObject.vb
Normal file
@@ -0,0 +1,18 @@
|
||||
Imports System.Runtime.Serialization
|
||||
|
||||
<Serializable>
|
||||
Public Class DocumentObject
|
||||
|
||||
<DataMember(Name:="FileName")>
|
||||
Public ReadOnly FileName As String
|
||||
<DataMember(Name:="ContainerId")>
|
||||
Public ReadOnly ContainerId As String
|
||||
<DataMember(Name:="DocumentId")>
|
||||
Public ReadOnly DocumentId As Int64
|
||||
|
||||
Public Sub New(ContainerId As String, DocumentId As Int64, FileName As String)
|
||||
Me.ContainerId = ContainerId
|
||||
Me.DocumentId = DocumentId
|
||||
Me.FileName = FileName
|
||||
End Sub
|
||||
End Class
|
||||
193
Filesystem/FileContainer/FileContainer.vb
Normal file
193
Filesystem/FileContainer/FileContainer.vb
Normal file
@@ -0,0 +1,193 @@
|
||||
Imports System.IO
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Encryption
|
||||
Imports ProtoBuf
|
||||
|
||||
''' <module>FileContainer</module>
|
||||
''' <version>0.0.0.2</version>
|
||||
''' <date>21.11.2018</date>
|
||||
''' <summary>
|
||||
''' File Container for securely saving files
|
||||
''' </summary>
|
||||
''' <dependencies>
|
||||
''' NLog, >= 4.5.8
|
||||
''' </dependencies>
|
||||
''' <params>
|
||||
''' LogConfig, DigitalData.Module.Logging.LogConfig
|
||||
''' A LogConfig object
|
||||
''' Password, String
|
||||
''' The Password to Encrypt
|
||||
''' Path, String
|
||||
''' The Path to save/load the container
|
||||
''' </params>
|
||||
''' <example>
|
||||
''' dim oContainer = Container.Create(logConfig, "pass", "E:\some.container")
|
||||
''' dim oContainer = Container.Load(logConfig, "pass", "E:\some.container")
|
||||
'''
|
||||
''' dim oContainer = new Container(logConfig, "pass", "E:\some.container")
|
||||
''' oContainer.Save()
|
||||
'''
|
||||
''' dim oContainer = new Container(logConfig, "pass", "E:\some.container")
|
||||
''' oContainer.Contents = oSomeData
|
||||
''' oContainer.Save()
|
||||
'''
|
||||
''' dim oContainer = new Container(logConfig, "pass", "E:\some.container")
|
||||
''' oContainer.Load()
|
||||
''' dim oContents = oContainer.Contents
|
||||
'''
|
||||
''' dim oContainer = new Container(logConfig, "pass", "E:\some.container")
|
||||
''' oContainer.Load()
|
||||
''' oContainer.Contents = oSomeOtherData
|
||||
''' oContainer.Save()
|
||||
''' oContainer.SaveAs("E:\some2.container")
|
||||
''' </example>
|
||||
Public Class FileContainer
|
||||
Private _crypto As Encryption.Encryption
|
||||
Private _compression As Compression
|
||||
Private _inner As FileContainerInner
|
||||
Private _logger As Logger
|
||||
Private _logConfig As LogConfig
|
||||
Private _path As String
|
||||
|
||||
Public Property Contents As Byte()
|
||||
Get
|
||||
Return _inner.Contents
|
||||
End Get
|
||||
Set(value As Byte())
|
||||
_inner.Contents = value
|
||||
End Set
|
||||
End Property
|
||||
Public ReadOnly Property ContainerId As String
|
||||
Get
|
||||
Return _inner.FileId
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property CreatedAt As String
|
||||
Get
|
||||
Return _inner.CreatedAt
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property UpdatedAt As String
|
||||
Get
|
||||
Return _inner.UpdatedAt
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Shared Function Create(LogConfig As LogConfig, Password As String) As FileContainer
|
||||
Dim oContainer = New FileContainer(LogConfig, Password)
|
||||
Return oContainer
|
||||
End Function
|
||||
|
||||
Public Shared Function Load(LogConfig As LogConfig, Password As String, Path As String) As FileContainer
|
||||
Dim oContainer = New FileContainer(LogConfig, Password, Path)
|
||||
oContainer.Load()
|
||||
Return oContainer
|
||||
End Function
|
||||
|
||||
Public Sub New(LogConfig As LogConfig, Password As String)
|
||||
_logger = LogConfig.GetLogger()
|
||||
_crypto = New Encryption.Encryption(LogConfig, Password)
|
||||
_compression = New Compression(LogConfig)
|
||||
_inner = New FileContainerInner()
|
||||
End Sub
|
||||
|
||||
Public Sub New(LogConfig As LogConfig, Password As String, Path As String)
|
||||
MyClass.New(LogConfig, Password)
|
||||
_path = Path
|
||||
End Sub
|
||||
|
||||
Public Sub SetFile(Contents As Byte(), FileName As String)
|
||||
_inner.Contents = Contents
|
||||
_inner.UpdatedAt = Date.Now
|
||||
_inner.FileName = FileName
|
||||
End Sub
|
||||
|
||||
Public Function GetFile() As FileContainerInner
|
||||
Return _inner
|
||||
End Function
|
||||
|
||||
Public Sub Save()
|
||||
If IsNothing(_path) Then
|
||||
Throw New ArgumentException("Path not set")
|
||||
End If
|
||||
|
||||
SaveAs(_path)
|
||||
End Sub
|
||||
|
||||
Public Sub SaveAs(Path As String)
|
||||
Try
|
||||
WriteBytesToFile(TransformToBytes(_inner), Path)
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Public Sub Load()
|
||||
If IsNothing(_path) Then
|
||||
Throw New ArgumentException("Path not set")
|
||||
End If
|
||||
|
||||
LoadFrom(_path)
|
||||
End Sub
|
||||
|
||||
Public Sub LoadFrom(Path As String)
|
||||
Try
|
||||
_inner = TransformToObject(ReadBytesFromFile(_path))
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Function TransformToBytes([Object] As FileContainerInner) As Byte()
|
||||
Dim oBytes = Serialize([Object])
|
||||
Dim oCompressed = _compression.Compress(oBytes)
|
||||
Dim oEncrypted = _crypto.Encrypt(oCompressed)
|
||||
Return oEncrypted
|
||||
End Function
|
||||
|
||||
Private Function TransformToObject(Bytes As Byte()) As FileContainerInner
|
||||
Dim oDecrypted = _crypto.Decrypt(Bytes)
|
||||
Dim oDecompressed = _compression.Decompress(oDecrypted)
|
||||
Dim oObject = Deserialize(oDecompressed)
|
||||
Return oObject
|
||||
End Function
|
||||
|
||||
Private Function Serialize(InnerData As FileContainerInner) As Byte()
|
||||
Dim oBinaryData As Byte()
|
||||
|
||||
Using oStream As New MemoryStream
|
||||
Serializer.Serialize(oStream, InnerData)
|
||||
oBinaryData = oStream.ToArray()
|
||||
End Using
|
||||
|
||||
Return oBinaryData
|
||||
End Function
|
||||
|
||||
Private Function Deserialize(InnerData As Byte()) As FileContainerInner
|
||||
Dim oObject As FileContainerInner
|
||||
|
||||
Using oStream As New MemoryStream(InnerData)
|
||||
oObject = Serializer.Deserialize(Of FileContainerInner)(oStream)
|
||||
End Using
|
||||
|
||||
Return oObject
|
||||
End Function
|
||||
|
||||
Private Sub WriteBytesToFile(Data As Byte(), FilePath As String)
|
||||
Using oSourceStream As New FileStream(FilePath, FileMode.OpenOrCreate, FileAccess.Write, FileShare.None)
|
||||
oSourceStream.Write(Data, 0, Data.Length)
|
||||
oSourceStream.Flush()
|
||||
End Using
|
||||
End Sub
|
||||
|
||||
Private Function ReadBytesFromFile(FilePath As String) As Byte()
|
||||
Using oFileStream = New FileStream(FilePath, FileMode.Open, FileAccess.Read, FileShare.Read, 4096)
|
||||
Dim oBuffer As Byte() = New Byte(oFileStream.Length - 1) {}
|
||||
oFileStream.Read(oBuffer, 0, oFileStream.Length)
|
||||
oFileStream.Close()
|
||||
Return oBuffer
|
||||
End Using
|
||||
End Function
|
||||
End Class
|
||||
23
Filesystem/FileContainer/FileContainerInner.vb
Normal file
23
Filesystem/FileContainer/FileContainerInner.vb
Normal file
@@ -0,0 +1,23 @@
|
||||
Imports ProtoBuf
|
||||
|
||||
<Serializable>
|
||||
<ProtoContract>
|
||||
Public Class FileContainerInner
|
||||
<ProtoMember(1)>
|
||||
Public FileId As String
|
||||
<ProtoMember(2)>
|
||||
Public Contents As Byte()
|
||||
<ProtoMember(3)>
|
||||
Public CreatedAt As DateTime
|
||||
<ProtoMember(4)>
|
||||
Public UpdatedAt As DateTime
|
||||
<ProtoMember(5)>
|
||||
Public FileName As String
|
||||
|
||||
Public Sub New()
|
||||
FileId = Guid.NewGuid().ToString
|
||||
CreatedAt = Date.Now
|
||||
UpdatedAt = Date.Now
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
132
Filesystem/FileWatcher/FileWatcher.vb
Normal file
132
Filesystem/FileWatcher/FileWatcher.vb
Normal file
@@ -0,0 +1,132 @@
|
||||
Imports System.IO
|
||||
Imports DigitalData.Modules.Filesystem
|
||||
Imports DigitalData.Modules.Filesystem.FileWatcherFilters
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
|
||||
Public Class FileWatcher
|
||||
' Internals
|
||||
Private ReadOnly _Logger As Logger
|
||||
Private ReadOnly _Watchers As List(Of FileSystemWatcher)
|
||||
Private ReadOnly _Files As Dictionary(Of String, FileWatcherProperties)
|
||||
Private ReadOnly _Filters As List(Of BaseFileFilter)
|
||||
|
||||
' Options
|
||||
Private _Path As String
|
||||
|
||||
' Public Events
|
||||
Public Event FileSaved(ByVal FullName As String, ByVal IsSpecial As Boolean)
|
||||
|
||||
Public Sub New(LogConfig As LogConfig, Path As String, Optional Filters As List(Of BaseFileFilter) = Nothing)
|
||||
_Logger = LogConfig.GetLogger()
|
||||
_Files = New Dictionary(Of String, FileWatcherProperties)
|
||||
_Watchers = New List(Of FileSystemWatcher)
|
||||
_Filters = IIf(IsNothing(Filters), GetDefaultFilters(), Filters)
|
||||
_Path = Path
|
||||
|
||||
For Each oFilePath In Directory.EnumerateFiles(_Path)
|
||||
Try
|
||||
If IO.File.Exists(oFilePath) Then
|
||||
_Files.Add(oFilePath, New FileWatcherProperties With {
|
||||
.CreatedAt = DateTime.Now,
|
||||
.ChangedAt = Nothing
|
||||
})
|
||||
End If
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
_Logger.Warn("File {0} cannot be watched!")
|
||||
End Try
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Public Sub Add(Filter As String)
|
||||
_Watchers.Add(CreateWatcher(Filter))
|
||||
End Sub
|
||||
|
||||
Public Sub Start()
|
||||
For Each oWatcher In _Watchers
|
||||
oWatcher.EnableRaisingEvents = True
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Public Sub [Stop]()
|
||||
For Each oWatcher In _Watchers
|
||||
If Not IsNothing(oWatcher) Then
|
||||
oWatcher.EnableRaisingEvents = False
|
||||
oWatcher.Dispose()
|
||||
End If
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Private Function GetDefaultFilters()
|
||||
Return New List(Of BaseFileFilter) From {
|
||||
New TempFileFilter,
|
||||
New OfficeFileFilter
|
||||
}
|
||||
End Function
|
||||
|
||||
Private Function CreateWatcher(Filter As String)
|
||||
Dim oWatcher = New FileSystemWatcher() With {
|
||||
.Path = _Path,
|
||||
.Filter = Filter,
|
||||
.NotifyFilter = NotifyFilters.LastAccess _
|
||||
Or NotifyFilters.LastWrite _
|
||||
Or NotifyFilters.FileName _
|
||||
Or NotifyFilters.Size _
|
||||
Or NotifyFilters.FileName _
|
||||
Or NotifyFilters.Attributes
|
||||
}
|
||||
|
||||
AddHandler oWatcher.Created, AddressOf HandleFileCreated
|
||||
AddHandler oWatcher.Changed, AddressOf HandleFileChanged
|
||||
AddHandler oWatcher.Deleted, AddressOf HandleFileDeleted
|
||||
AddHandler oWatcher.Renamed, AddressOf HandleFileRenamed
|
||||
|
||||
Return oWatcher
|
||||
End Function
|
||||
|
||||
Private Sub HandleFileCreated(sender As Object, e As FileSystemEventArgs)
|
||||
_Files.Add(e.FullPath, New FileWatcherProperties())
|
||||
_Logger.Debug("[Created] " & e.FullPath)
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' This may fire twice for a single save operation,
|
||||
''' see: https://blogs.msdn.microsoft.com/oldnewthing/20140507-00/?p=1053/
|
||||
''' </summary>
|
||||
Private Sub HandleFileChanged(sender As Object, e As FileSystemEventArgs)
|
||||
_Files.Item(e.FullPath).ChangedAt = DateTime.Now
|
||||
_Logger.Debug("[Changed] " & e.FullPath)
|
||||
|
||||
Dim oShouldRaiseSave As Boolean = Not _Filters.Any(Function(oFilter)
|
||||
Return oFilter.ShouldFilter(e)
|
||||
End Function)
|
||||
|
||||
If oShouldRaiseSave Then
|
||||
RaiseEvent FileSaved(e.FullPath, False)
|
||||
End If
|
||||
End Sub
|
||||
Private Sub HandleFileDeleted(sender As Object, e As FileSystemEventArgs)
|
||||
_Files.Remove(e.FullPath)
|
||||
_Logger.Debug("[Removed] " & e.FullPath)
|
||||
End Sub
|
||||
|
||||
Private Sub HandleFileRenamed(sender As Object, e As RenamedEventArgs)
|
||||
Dim oProperties = _Files.Item(e.OldFullPath)
|
||||
_Files.Remove(e.OldFullPath)
|
||||
_Files.Add(e.FullPath, oProperties)
|
||||
' Soll eine umbenannte datei als NEU gelten?
|
||||
|
||||
Dim oShouldRaiseSave = _Filters.Any(Function(oFilter)
|
||||
Return oFilter.ShouldRaiseSave(e)
|
||||
End Function)
|
||||
|
||||
If oShouldRaiseSave Then
|
||||
RaiseEvent FileSaved(e.OldFullPath, True)
|
||||
End If
|
||||
|
||||
_Logger.Debug("[Renamed] {0} --> {1}", e.OldFullPath, e.FullPath)
|
||||
End Sub
|
||||
|
||||
|
||||
End Class
|
||||
61
Filesystem/FileWatcher/FileWatcherFilters.vb
Normal file
61
Filesystem/FileWatcher/FileWatcherFilters.vb
Normal file
@@ -0,0 +1,61 @@
|
||||
Imports System.IO
|
||||
|
||||
''' <summary>
|
||||
''' Built-in filters for FileWatcher that are useful for correctly detecting changes on Office documents (currently Office 2016)
|
||||
''' </summary>
|
||||
Public Class FileWatcherFilters
|
||||
''' <summary>
|
||||
''' Base Filter that all filters must inherit from
|
||||
''' Provides two functions that may be overridden and some useful file extension lists
|
||||
''' </summary>
|
||||
Public MustInherit Class BaseFileFilter
|
||||
Public TempFiles As New List(Of String) From {".tmp", ""}
|
||||
|
||||
Public Overridable Function ShouldFilter(e As FileSystemEventArgs) As Boolean
|
||||
Return False
|
||||
End Function
|
||||
Public Overridable Function ShouldRaiseSave(e As RenamedEventArgs) As Boolean
|
||||
Return False
|
||||
End Function
|
||||
End Class
|
||||
|
||||
''' <summary>
|
||||
''' Simple Filter that filters changes made on temporary files
|
||||
''' </summary>
|
||||
Public Class TempFileFilter
|
||||
Inherits BaseFileFilter
|
||||
|
||||
Public Overrides Function ShouldFilter(e As FileSystemEventArgs) As Boolean
|
||||
Dim oFileInfo As New FileInfo(e.FullPath)
|
||||
Return TempFiles.Contains(oFileInfo.Extension)
|
||||
End Function
|
||||
End Class
|
||||
|
||||
''' <summary>
|
||||
''' Filter to detect changes on Office files
|
||||
''' </summary>
|
||||
Public Class OfficeFileFilter
|
||||
Inherits BaseFileFilter
|
||||
|
||||
Public OfficeFiles As New List(Of String) From {".docx", ".pptx", ".xlsx"}
|
||||
|
||||
Public Overrides Function ShouldFilter(e As FileSystemEventArgs) As Boolean
|
||||
Dim oFileInfo As New FileInfo(e.FullPath)
|
||||
Return OfficeFiles.Contains(oFileInfo.Extension) And oFileInfo.Name.StartsWith("~")
|
||||
End Function
|
||||
|
||||
Public Overrides Function ShouldRaiseSave(e As RenamedEventArgs) As Boolean
|
||||
Dim oIsTransform = OfficeFiles.Any(Function(Extension As String)
|
||||
Return e.OldName.EndsWith(Extension)
|
||||
End Function)
|
||||
|
||||
' Check if it is renamed to a temp file
|
||||
Dim oIsTempFile = TempFiles.Any(Function(Extension)
|
||||
Return e.Name.EndsWith(Extension)
|
||||
End Function)
|
||||
|
||||
|
||||
Return oIsTransform And oIsTempFile
|
||||
End Function
|
||||
End Class
|
||||
End Class
|
||||
10
Filesystem/FileWatcher/FileWatcherProperties.vb
Normal file
10
Filesystem/FileWatcher/FileWatcherProperties.vb
Normal file
@@ -0,0 +1,10 @@
|
||||
Public Class FileWatcherProperties
|
||||
Public Property CreatedAt As DateTime
|
||||
Public Property ChangedAt As DateTime
|
||||
Public ReadOnly Property HasChanged As Boolean
|
||||
Public Sub New()
|
||||
CreatedAt = DateTime.Now
|
||||
ChangedAt = Nothing
|
||||
HasChanged = False
|
||||
End Sub
|
||||
End Class
|
||||
@@ -4,13 +4,14 @@
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{7C3B0C7E-59FE-4E1A-A655-27AE119F9444}</ProjectGuid>
|
||||
<ProjectGuid>{991D0231-4623-496D-8BD0-9CA906029CBC}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>DigitalData.Modules.Patterns</RootNamespace>
|
||||
<AssemblyName>DigitalData.Modules.Patterns</AssemblyName>
|
||||
<RootNamespace>DigitalData.Modules.Filesystem</RootNamespace>
|
||||
<AssemblyName>DigitalData.Modules.Filesystem</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<MyType>Windows</MyType>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -18,7 +19,7 @@
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DocumentationFile>DigitalData.Modules.Patterns.xml</DocumentationFile>
|
||||
<DocumentationFile>DigitalData.Modules.Filesystem.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
@@ -27,7 +28,7 @@
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DocumentationFile>DigitalData.Modules.Patterns.xml</DocumentationFile>
|
||||
<DocumentationFile>DigitalData.Modules.Filesystem.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
@@ -43,16 +44,15 @@
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="DevExpress.Utils.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.XtraEditors.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.XtraGrid.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="Interop.WINDREAMLib">
|
||||
<HintPath>P:\Visual Studio Projekte\Bibliotheken\windream\Interop.WINDREAMLib.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
<Reference Include="DigitalData.Modules.Logging, Version=2.6.5.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\DigitalData.Modules.Logging.2.6.5\lib\net462\DigitalData.Modules.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.7.10\lib\net45\NLog.dll</HintPath>
|
||||
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.5.0.5\lib\net46\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="protobuf-net, Version=2.4.0.0, Culture=neutral, PublicKeyToken=257b51d87d2e4d67, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\protobuf-net.2.4.0\lib\net40\protobuf-net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
@@ -61,7 +61,6 @@
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.Transactions" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
@@ -80,24 +79,18 @@
|
||||
<Import Include="System.Threading.Tasks" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Constants.vb" />
|
||||
<Compile Include="Modules\FileInformation.vb" />
|
||||
<Compile Include="Modules\Globix\GlobixAutomatic.vb" />
|
||||
<Compile Include="Modules\IDB.vb" />
|
||||
<Compile Include="Modules\Globix\GlobixManual.vb" />
|
||||
<Compile Include="Modules\Windream.vb" />
|
||||
<Compile Include="Modules\User.vb" />
|
||||
<Compile Include="IModule.vb" />
|
||||
<Compile Include="Modules\Clipboard.vb" />
|
||||
<Compile Include="Modules\Controls.vb" />
|
||||
<Compile Include="Modules\Internal.vb" />
|
||||
<Compile Include="Modules\BaseModule.vb" />
|
||||
<Compile Include="Pattern.vb" />
|
||||
<Compile Include="Patterns.vb" />
|
||||
<Compile Include="FileContainer\DocumentObject.vb" />
|
||||
<Compile Include="FileContainer\FileContainer.vb" />
|
||||
<Compile Include="File.vb" />
|
||||
<Compile Include="FileContainer\FileContainerInner.vb" />
|
||||
<Compile Include="FileWatcher\FileWatcher.vb" />
|
||||
<Compile Include="FileWatcher\FileWatcherFilters.vb" />
|
||||
<Compile Include="FileWatcher\FileWatcherProperties.vb" />
|
||||
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||
<Compile Include="My Project\Application.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Application.myapp</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<Compile Include="My Project\Resources.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
@@ -109,7 +102,6 @@
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<Compile Include="Patterns2.vb" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="My Project\Resources.resx">
|
||||
@@ -120,7 +112,6 @@
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="My Project\Application.myapp">
|
||||
<Generator>MyApplicationCodeGenerator</Generator>
|
||||
<LastGenOutput>Application.Designer.vb</LastGenOutput>
|
||||
@@ -133,19 +124,10 @@
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Controls.LookupGrid\LookupControl.vbproj">
|
||||
<Project>{3dcd6d1a-c830-4241-b7e4-27430e7ea483}</Project>
|
||||
<Name>LookupControl</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Modules.Logging\Logging.vbproj">
|
||||
<Project>{903B2D7D-3B80-4BE9-8713-7447B704E1B0}</Project>
|
||||
<Name>Logging</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Modules.ZooFlow\ZooFlow.vbproj">
|
||||
<Project>{81cac44f-3711-4c8f-ae98-e02a7448782a}</Project>
|
||||
<Name>ZooFlow</Name>
|
||||
<ProjectReference Include="..\Encryption\Encryption.vbproj">
|
||||
<Project>{8a8f20fc-c46e-41ac-bee7-218366cfff99}</Project>
|
||||
<Name>Encryption</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
</Project>
|
||||
13
Filesystem/My Project/Application.Designer.vb
generated
Normal file
13
Filesystem/My Project/Application.Designer.vb
generated
Normal file
@@ -0,0 +1,13 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' 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.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
10
Filesystem/My Project/Application.myapp
Normal file
10
Filesystem/My Project/Application.myapp
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<MySubMain>false</MySubMain>
|
||||
<SingleInstance>false</SingleInstance>
|
||||
<ShutdownMode>0</ShutdownMode>
|
||||
<EnableVisualStyles>true</EnableVisualStyles>
|
||||
<AuthenticationMode>0</AuthenticationMode>
|
||||
<ApplicationType>1</ApplicationType>
|
||||
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
|
||||
</MyApplicationData>
|
||||
35
Filesystem/My Project/AssemblyInfo.vb
Normal file
35
Filesystem/My Project/AssemblyInfo.vb
Normal file
@@ -0,0 +1,35 @@
|
||||
Imports System
|
||||
Imports System.Reflection
|
||||
Imports System.Runtime.InteropServices
|
||||
|
||||
' Allgemeine Informationen über eine Assembly werden über die folgenden
|
||||
' Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
|
||||
' die einer Assembly zugeordnet sind.
|
||||
|
||||
' Werte der Assemblyattribute überprüfen
|
||||
|
||||
<Assembly: AssemblyTitle("Modules.Filesystem")>
|
||||
<Assembly: AssemblyDescription("Stellt Funktionen für das Filesystem und Container zur Verfügung")>
|
||||
<Assembly: AssemblyCompany("Digital Data")>
|
||||
<Assembly: AssemblyProduct("Modules.Filesystem")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2022")>
|
||||
<Assembly: AssemblyTrademark("1.3.1.0")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
'Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird.
|
||||
<Assembly: Guid("2787495c-e65f-4730-be0c-af87bede4b11")>
|
||||
|
||||
' Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
|
||||
'
|
||||
' Hauptversion
|
||||
' Nebenversion
|
||||
' Buildnummer
|
||||
' Revision
|
||||
'
|
||||
' Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.3.3.0")>
|
||||
<Assembly: AssemblyFileVersion("1.3.3.0")>
|
||||
63
Filesystem/My Project/Resources.Designer.vb
generated
Normal file
63
Filesystem/My Project/Resources.Designer.vb
generated
Normal file
@@ -0,0 +1,63 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' 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.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
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.
|
||||
'''<summary>
|
||||
''' Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
|
||||
'''</summary>
|
||||
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0"), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
|
||||
Friend Module Resources
|
||||
|
||||
Private resourceMan As Global.System.Resources.ResourceManager
|
||||
|
||||
Private resourceCulture As Global.System.Globalization.CultureInfo
|
||||
|
||||
'''<summary>
|
||||
''' Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
|
||||
'''</summary>
|
||||
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
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("DigitalData.Modules.Filesystem.Resources", GetType(Resources).Assembly)
|
||||
resourceMan = temp
|
||||
End If
|
||||
Return resourceMan
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'''<summary>
|
||||
''' Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
|
||||
''' Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
|
||||
'''</summary>
|
||||
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Friend Property Culture() As Global.System.Globalization.CultureInfo
|
||||
Get
|
||||
Return resourceCulture
|
||||
End Get
|
||||
Set
|
||||
resourceCulture = value
|
||||
End Set
|
||||
End Property
|
||||
End Module
|
||||
End Namespace
|
||||
117
Filesystem/My Project/Resources.resx
Normal file
117
Filesystem/My Project/Resources.resx
Normal file
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
73
Filesystem/My Project/Settings.Designer.vb
generated
Normal file
73
Filesystem/My Project/Settings.Designer.vb
generated
Normal file
@@ -0,0 +1,73 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' 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.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
|
||||
Namespace My
|
||||
|
||||
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.9.0.0"), _
|
||||
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Partial Friend NotInheritable Class MySettings
|
||||
Inherits Global.System.Configuration.ApplicationSettingsBase
|
||||
|
||||
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
|
||||
|
||||
#Region "Automatische My.Settings-Speicherfunktion"
|
||||
#If _MyType = "WindowsForms" Then
|
||||
Private Shared addedHandler As Boolean
|
||||
|
||||
Private Shared addedHandlerLockObject As New Object
|
||||
|
||||
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
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 MySettings
|
||||
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
|
||||
|
||||
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
|
||||
Friend Module MySettingsProperty
|
||||
|
||||
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
|
||||
Friend ReadOnly Property Settings() As Global.DigitalData.Modules.Filesystem.My.MySettings
|
||||
Get
|
||||
Return Global.DigitalData.Modules.Filesystem.My.MySettings.Default
|
||||
End Get
|
||||
End Property
|
||||
End Module
|
||||
End Namespace
|
||||
7
Filesystem/My Project/Settings.settings
Normal file
7
Filesystem/My Project/Settings.settings
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
7
Filesystem/packages.config
Normal file
7
Filesystem/packages.config
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="DigitalData.Modules.Logging" version="2.6.5" targetFramework="net48" />
|
||||
<package id="NLog" version="5.0.5" targetFramework="net48" />
|
||||
<package id="NuGet.CommandLine" version="6.13.2" targetFramework="net48" developmentDependency="true" />
|
||||
<package id="protobuf-net" version="2.4.0" targetFramework="net461" />
|
||||
</packages>
|
||||
@@ -37,23 +37,22 @@ Public Class ActiveDirectoryInterface
|
||||
_logger.Info("Using RootPath {0}", _rootPath)
|
||||
End Sub
|
||||
|
||||
Public Function SyncUsersForGroup(GroupName As String, Firebird As Firebird, MSSQL As MSSQLServer) As List(Of ADUser)
|
||||
Public Function SyncUsersForGroup(GroupName As String, MSSQL As MSSQLServer) As List(Of ADUser)
|
||||
Try
|
||||
Return SyncUsersForGroup(GroupName, New List(Of AttributeMapping), Firebird, MSSQL)
|
||||
Return SyncUsersForGroup(GroupName, New List(Of AttributeMapping), MSSQL)
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function SyncUsersForGroup(GroupName As String, AttributeMappings As List(Of AttributeMapping), Firebird As Firebird, MSSQL As MSSQLServer, Optional Filter As String = DEFAULT_USER_FILTER) As List(Of ADUser)
|
||||
Public Function SyncUsersForGroup(GroupName As String, AttributeMappings As List(Of AttributeMapping), MSSQL As MSSQLServer, Optional Filter As String = DEFAULT_USER_FILTER) As List(Of ADUser)
|
||||
Dim oUsers As New List(Of ADUser)
|
||||
Dim oSyncedUsers As New List(Of ADUser)
|
||||
Dim oGroupId As Int64 = Nothing
|
||||
|
||||
Dim oFirebirdSync As New SyncUsers.SyncUsersFirebird(_logConfig, Firebird)
|
||||
Dim oSQLSync As New SyncUsers.SyncUsersMSSQL(_logConfig, MSSQL)
|
||||
Dim oSyncedUsersFirebird, oSyncedUsersMSSQL As List(Of ADUser)
|
||||
Dim oSyncedUsersMSSQL As List(Of ADUser)
|
||||
|
||||
Try
|
||||
_logger.Debug("Fetching users from ActiveDirectory")
|
||||
@@ -64,16 +63,6 @@ Public Class ActiveDirectoryInterface
|
||||
Return Nothing
|
||||
End Try
|
||||
|
||||
' Do the actual sync into firebird
|
||||
If Firebird IsNot Nothing Then
|
||||
oSyncedUsersFirebird = oFirebirdSync.SyncUsers(GroupName, oUsers, AttributeMappings)
|
||||
If oSyncedUsersFirebird.Count > 0 Then
|
||||
_logger.Debug("Synced {0} users to Firebird", oSyncedUsersFirebird.Count)
|
||||
End If
|
||||
Else
|
||||
_logger.Debug("SyncUsersForGroup: _firebird is nothing. ")
|
||||
End If
|
||||
|
||||
' Do the actual sync into MSSQL
|
||||
If MSSQL IsNot Nothing Then
|
||||
oSyncedUsersMSSQL = oSQLSync.SyncUsers(GroupName, oUsers, AttributeMappings)
|
||||
@@ -81,7 +70,7 @@ Public Class ActiveDirectoryInterface
|
||||
_logger.Debug("Synced {0} users to MSSQLServer", oSyncedUsersMSSQL.Count)
|
||||
End If
|
||||
Else
|
||||
_logger.Debug("SyncUsersForGroup: _mssql is nothing. ")
|
||||
_logger.Debug("SyncUsersForGroup: _mssql is nothing.")
|
||||
End If
|
||||
|
||||
Return oUsers
|
||||
@@ -231,10 +220,23 @@ Public Class ActiveDirectoryInterface
|
||||
Return oUsers
|
||||
End Try
|
||||
End Function
|
||||
Private Function GetPartFromFirstOU(dnString As String) As String
|
||||
Dim keyword As String = "OU="
|
||||
Dim index As Integer = dnString.IndexOf(keyword)
|
||||
|
||||
Public Function FindUserWithFilter(User As UserPrincipalEx, Filter As String) As Boolean
|
||||
If index <> -1 Then
|
||||
Return dnString.Substring(index)
|
||||
Else
|
||||
Return "No_Result_from_GetPartFromFirstOU"
|
||||
End If
|
||||
End Function
|
||||
Public Function FindUserWithFilter(pUser As UserPrincipalEx, pFilter As String) As Boolean
|
||||
Try
|
||||
Dim oRootPath = String.Join(","c, User.DistinguishedName.Split(","c).Skip(1))
|
||||
'Dim oRootPath = String.Join(","c, pUser.DistinguishedName.Split(","c).Skip(1))
|
||||
Dim oRootPath = GetPartFromFirstOU(pUser.DistinguishedName)
|
||||
_logger.Debug("FindUserWithFilter: pUser.DistinguishedName: [{0}]", pUser.DistinguishedName)
|
||||
_logger.Debug("FindUserWithFilter: oRootPath from User.DistinguishedName: [{0}]", oRootPath)
|
||||
|
||||
Dim oPlaceholder = "@SAMACCOUNTNAME"
|
||||
Dim oProtocol = "LDAP://"
|
||||
Dim oEntry As New DirectoryEntry(oProtocol & oRootPath) With {
|
||||
@@ -242,22 +244,25 @@ Public Class ActiveDirectoryInterface
|
||||
.Password = Nothing,
|
||||
.AuthenticationType = AuthenticationTypes.Secure
|
||||
}
|
||||
|
||||
If Filter = String.Empty Then
|
||||
_logger.Debug("FindUserWithFilter: Filter was empty, returning True for User [{0}]", User.SamAccountName)
|
||||
_logger.Debug("FindUserWithFilter: got oDirectoryEntry (Path): [{0}]", oProtocol & oRootPath)
|
||||
If pFilter = String.Empty Then
|
||||
_logger.Debug("FindUserWithFilter: Filter was empty, returning True for User [{0}]", pUser.SamAccountName)
|
||||
Return True
|
||||
End If
|
||||
|
||||
If Filter.Contains(oPlaceholder) Then
|
||||
Filter = Filter.Replace(oPlaceholder, User.SamAccountName)
|
||||
If pFilter.Contains(oPlaceholder) Then
|
||||
pFilter = pFilter.Replace(oPlaceholder, pUser.SamAccountName)
|
||||
_logger.Debug("FindUserWithFilter: Filter.Contains(oPlaceholder) [{0}]", pFilter)
|
||||
Else
|
||||
_logger.Warn("FindUserWithFilter: Placeholder [{0}] was not found in filter. Results may not be correct.")
|
||||
End If
|
||||
|
||||
Dim oSearcher As New DirectorySearcher(oEntry, Filter)
|
||||
Dim oSearcher As New DirectorySearcher(oEntry, pFilter)
|
||||
_logger.Debug("FindUserWithFilter: oSearcher created! Now executing DirectoryServices.SearchResult with .FindOne ...")
|
||||
Dim oResult As SearchResult = oSearcher.FindOne()
|
||||
|
||||
If oResult IsNot Nothing AndAlso oResult.Path.Replace(oProtocol, String.Empty) = User.DistinguishedName Then
|
||||
If oResult IsNot Nothing AndAlso oResult.Path.Replace(oProtocol, String.Empty) = pUser.DistinguishedName Then
|
||||
_logger.Debug("FindUserWithFilter: We have an oResult - oResult.Path: [{0}]", oResult.Path)
|
||||
Return True
|
||||
Else
|
||||
Return False
|
||||
|
||||
@@ -1,145 +0,0 @@
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Interfaces
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Namespace SyncUsers
|
||||
Public Class SyncUsersFirebird
|
||||
Implements ISyncUsers
|
||||
|
||||
Private ReadOnly _logConfig As LogConfig
|
||||
Private ReadOnly _logger As Logger
|
||||
Private ReadOnly _firebird As Database.Firebird
|
||||
|
||||
Public Sub New(LogConfig As LogConfig, Firebird As Database.Firebird)
|
||||
_logConfig = LogConfig
|
||||
_logger = LogConfig.GetLogger()
|
||||
_firebird = Firebird
|
||||
End Sub
|
||||
|
||||
Public Function SyncUsers(GroupName As String, Users As List(Of ADUser), PropertyMapping As List(Of AttributeMapping)) As List(Of ADUser) Implements ISyncUsers.SyncUsers
|
||||
Dim oGroupId As Integer
|
||||
Dim oSyncedUsers As New List(Of ADUser)
|
||||
|
||||
Try
|
||||
_logger.Debug("Getting group Id for group [{0}]", GroupName)
|
||||
oGroupId = GetGroupId(GroupName)
|
||||
|
||||
If oGroupId = 0 Then
|
||||
_logger.Debug("Group [{0}] does not exist in database or is not enabled for sync.", GroupName)
|
||||
Return oSyncedUsers
|
||||
End If
|
||||
|
||||
_logger.Debug("Using group Id [{0}]", oGroupId)
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Return oSyncedUsers
|
||||
End Try
|
||||
|
||||
For Each oUser In Users
|
||||
Dim oUserId As Int64
|
||||
Dim oUserExists As Boolean = False
|
||||
|
||||
' Check if user already exists
|
||||
Try
|
||||
_logger.Debug("Checking if user [{0}] exists", oUser)
|
||||
oUserId = GetUserId(oUser.samAccountName)
|
||||
oUserExists = Not IsNothing(oUserId)
|
||||
_logger.Debug("User [{0}] exists in database: ", oUser, oUserExists)
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
_logger.Warn("Could not get UserId for user. Skipping")
|
||||
Continue For
|
||||
End Try
|
||||
|
||||
' I user does not exist, create a new user
|
||||
Try
|
||||
If Not oUserExists Then
|
||||
_logger.Debug("Creating new user for [{0}]", oUser)
|
||||
oUserId = CreateUser(oUser)
|
||||
_logger.Debug("User created with Id [{0}]", oUserId)
|
||||
End If
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
_logger.Warn("Could not create user. Skipping")
|
||||
Continue For
|
||||
End Try
|
||||
|
||||
' Add the user to group
|
||||
Try
|
||||
AddUserToGroup(oUserId, oGroupId)
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
_logger.Warn("Could not add user to group. Skipping")
|
||||
Continue For
|
||||
End Try
|
||||
|
||||
oSyncedUsers.Add(oUser)
|
||||
Next
|
||||
|
||||
Return oSyncedUsers
|
||||
End Function
|
||||
|
||||
Private Function AddUserToGroup(UserId As Integer, GroupId As Integer) As Boolean Implements ISyncUsers.AddUserToGroup
|
||||
Try
|
||||
Dim oSQL = $"SELECT FNICM_RADM_NEW_USER2GROUP({UserId}, {GroupId}, 'AD-Sync') from RDB$DATABASE"
|
||||
Dim oRecordId = _firebird.GetScalarValue(oSQL)
|
||||
|
||||
If IsDBNull(oRecordId) Then
|
||||
_logger.Warn("UserId {0} - GroupId {1} relation already exists.", UserId, GroupId)
|
||||
Return False
|
||||
End If
|
||||
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
End Function
|
||||
Private Function GetGroupId(GroupName As String) As Integer Implements ISyncUsers.GetGroupId
|
||||
Try
|
||||
Dim oSQL As String = $"SELECT FNICM_GET_RECORD4SYSKEY('{GroupName}','002-NAME') from RDB$DATABASE"
|
||||
Dim oGroupId = _firebird.GetScalarValue(oSQL)
|
||||
|
||||
If IsDBNull(oGroupId) OrElse oGroupId = 0 Then
|
||||
_logger.Debug("Group {0} not found in database", GroupName)
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
Return oGroupId
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
End Function
|
||||
Private Function GetUserId(UserName As String) As Integer Implements ISyncUsers.GetUserId
|
||||
Try
|
||||
Dim oSQL As String = $"SELECT FNICM_GET_RECORD4SYSKEY('{UserName}','001-USRNAME') from RDB$DATABASE"
|
||||
Dim oResult = _firebird.GetScalarValue(oSQL)
|
||||
|
||||
If IsDBNull(oResult) Then
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
Return oResult
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
End Function
|
||||
Private Function CreateUser(User As ADUser) As Integer Implements ISyncUsers.CreateUser
|
||||
Try
|
||||
Dim oSQL = $"SELECT FNICM_RADM_NEW_USER('{User?.GivenName}', '{User?.Surname}', '{User?.samAccountName}', 'AD-Sync') from RDB$DATABASE"
|
||||
Dim oUserId As Integer = _firebird.GetScalarValue(oSQL)
|
||||
|
||||
Return oUserId
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Sub AddCustomAttributesToUser(User As ADUser, UserId As Integer) Implements ISyncUsers.AddCustomAttributesToUser
|
||||
Throw New NotImplementedException()
|
||||
End Sub
|
||||
End Class
|
||||
End Namespace
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -12,6 +12,8 @@
|
||||
<MyType>Windows</MyType>
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile />
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -44,30 +46,173 @@
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="GdPicture.NET.14">
|
||||
<HintPath>D:\ProgramFiles\GdPicture.NET 14\Redist\GdPicture.NET (.NET Framework 4.5)\GdPicture.NET.14.dll</HintPath>
|
||||
<Reference Include="BouncyCastle.Cryptography, Version=2.0.0.0, Culture=neutral, PublicKeyToken=072edcf4a5328938, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\BouncyCastle.Cryptography.2.5.0\lib\net461\BouncyCastle.Cryptography.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Base, Version=1.3.9.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Base\bin\Debug\DigitalData.Modules.Base.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Database, Version=2.3.5.4, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Logging, Version=2.6.5.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DocumentFormat.OpenXml, Version=3.2.0.0, Culture=neutral, PublicKeyToken=8fb06cb64d019a17, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\DocumentFormat.OpenXml.3.2.0\lib\net46\DocumentFormat.OpenXml.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DocumentFormat.OpenXml.Framework, Version=3.2.0.0, Culture=neutral, PublicKeyToken=8fb06cb64d019a17, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\DocumentFormat.OpenXml.Framework.3.2.0\lib\net46\DocumentFormat.OpenXml.Framework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14.barcode.1d.writer, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.barcode.1d.writer.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14.barcode.2d.writer, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.barcode.2d.writer.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14.CAD, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.CAD.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14.CAD.DWG, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.CAD.DWG.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14.Common, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.Common.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14.Document, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.Document.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14.Email, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.Email.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14.HTML, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.HTML.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14.Imaging, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.Imaging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14.Imaging.Formats, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.Imaging.Formats.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14.Imaging.Formats.Conversion, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.Imaging.Formats.Conversion.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14.Imaging.Rendering, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.Imaging.Rendering.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14.MSOfficeBinary, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.MSOfficeBinary.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14.OpenDocument, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.OpenDocument.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14.OpenXML, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.OpenXML.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14.OpenXML.Templating, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.OpenXML.Templating.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14.PDF, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.PDF.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14.RTF, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.RTF.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14.SVG, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.SVG.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14.wia.gateway, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6973b5c22dcf45f7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.wia.gateway.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json.Bson, Version=1.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.Bson.1.0.2\lib\net45\Newtonsoft.Json.Bson.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.5.0.5\lib\net46\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OpenMcdf, Version=2.4.1.0, Culture=neutral, PublicKeyToken=fdbb1629d7c00800, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OpenMcdf.2.4.1\lib\net40\OpenMcdf.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="protobuf-net, Version=3.0.0.0, Culture=neutral, PublicKeyToken=257b51d87d2e4d67, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\protobuf-net.3.2.46\lib\net462\protobuf-net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="protobuf-net.Core, Version=3.0.0.0, Culture=neutral, PublicKeyToken=257b51d87d2e4d67, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\protobuf-net.Core.3.2.46\lib\net462\protobuf-net.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="RtfPipe, Version=2.0.7677.4303, Culture=neutral, PublicKeyToken=5f6ab4ce530296d2, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\RtfPipe.2.0.7677.4303\lib\net45\RtfPipe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Buffers, Version=4.0.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Buffers.4.6.0\lib\net462\System.Buffers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.CodeDom, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.CodeDom.8.0.0\lib\net462\System.CodeDom.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Collections.Immutable, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Collections.Immutable.8.0.0\lib\net462\System.Collections.Immutable.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.DirectoryServices" />
|
||||
<Reference Include="System.DirectoryServices.AccountManagement" />
|
||||
<Reference Include="System.IO.Compression" />
|
||||
<Reference Include="System.IO.Packaging, Version=8.0.0.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.IO.Packaging.8.0.1\lib\net462\System.IO.Packaging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Management" />
|
||||
<Reference Include="System.Memory, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Memory.4.6.0\lib\net462\System.Memory.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http.Formatting, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebApi.Client.6.0.0\lib\net45\System.Net.Http.Formatting.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Numerics.Vectors, Version=4.1.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Numerics.Vectors.4.6.0\lib\net462\System.Numerics.Vectors.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.1.0\lib\net462\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.Security" />
|
||||
<Reference Include="System.Security.Cryptography.Pkcs, Version=8.0.0.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Security.Cryptography.Pkcs.8.0.1\lib\net462\System.Security.Cryptography.Pkcs.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.Text.Encodings.Web, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Text.Encodings.Web.8.0.0\lib\net462\System.Text.Encodings.Web.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Text.Json, Version=8.0.0.5, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Text.Json.8.0.5\lib\net462\System.Text.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Transactions" />
|
||||
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="WindowsBase" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Import Include="Microsoft.VisualBasic" />
|
||||
@@ -86,7 +231,6 @@
|
||||
<Compile Include="ActiveDirectoryInterface\ActiveDirectoryUser.vb" />
|
||||
<Compile Include="ActiveDirectoryInterface\AttributeMap.vb" />
|
||||
<Compile Include="ActiveDirectoryInterface\ISyncUsers.vb" />
|
||||
<Compile Include="ActiveDirectoryInterface\SyncUsers.Firebird.vb" />
|
||||
<Compile Include="ActiveDirectoryInterface\SyncUsers.MSSQL.vb" />
|
||||
<Compile Include="ActiveDirectoryInterface\UserEqualityComparer.vb" />
|
||||
<Compile Include="ActiveDirectoryInterface\UserPrincipalEx.vb" />
|
||||
@@ -94,6 +238,7 @@
|
||||
<Compile Include="GrapQLInterface\LoginData.vb" />
|
||||
<Compile Include="GrapQLInterface\LogoutData.vb" />
|
||||
<Compile Include="GrapQLInterface\QueryData.vb" />
|
||||
<Compile Include="ZUGFeRDInterface\Enums\Item_Types.vb" />
|
||||
<Compile Include="ZUGFeRDInterface\Exceptions.vb" />
|
||||
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||
<Compile Include="My Project\Application.Designer.vb">
|
||||
@@ -112,6 +257,8 @@
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<Compile Include="ZUGFeRDInterface\PDFConverter.vb" />
|
||||
<Compile Include="ZUGFeRDInterface\Peppol_UBL2.1\CreditNoteType.vb" />
|
||||
<Compile Include="ZUGFeRDInterface\Peppol_UBL2.1\InvoiceType.vb" />
|
||||
<Compile Include="ZUGFeRDInterface\Validator.vb" />
|
||||
<Compile Include="ZUGFeRDInterface\Version1.0\CrossIndustryDocumentType.vb" />
|
||||
<Compile Include="ZUGFeRDInterface.vb" />
|
||||
@@ -121,6 +268,8 @@
|
||||
<Compile Include="ZUGFeRDInterface\Version2.0\CrossIndustryInvoiceType.vb" />
|
||||
<Compile Include="ZUGFeRDInterface\Version2.1.1\CrossIndustryInvoiceType.vb" />
|
||||
<Compile Include="ZUGFeRDInterface\Version2.2_FacturX\CrossIndustryInvoiceType.vb" />
|
||||
<Compile Include="ZUGFeRDInterface\Version2.3_3_FacturX\CrossIndustryInvoiceType.vb" />
|
||||
<Compile Include="ZUGFeRDInterface\Version2.3_FacturX\CrossIndustryInvoiceType.vb" />
|
||||
<Compile Include="ZUGFeRDInterface\XmlItemProperty.vb" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -144,30 +293,16 @@
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AdditionalFiles Include="GdPicture.NET.14.filters.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</AdditionalFiles>
|
||||
<AdditionalFiles Include="GdPicture.NET.14.image.gdimgplug.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</AdditionalFiles>
|
||||
<AdditionalFiles Include="GdPicture.NET.14.Imaging.Rendering.Skia.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</AdditionalFiles>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Base\Base.vbproj">
|
||||
<Project>{6ea0c51f-c2b1-4462-8198-3de0b32b74f8}</Project>
|
||||
<Name>Base</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Database\Database.vbproj">
|
||||
<Project>{eaf0ea75-5fa7-485d-89c7-b2d843b03a96}</Project>
|
||||
<Name>Database</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Logging\Logging.vbproj">
|
||||
<Project>{903b2d7d-3b80-4be9-8713-7447b704e1b0}</Project>
|
||||
<Name>Logging</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>powershell.exe -command "& { &'$(SolutionDir)copy-binary.ps1' '$(TargetPath)' '$(TargetFileName)' '$(ConfigurationName)' '$(ProjectName)' }"</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<Import Project="..\packages\GdPicture.runtimes.windows.14.3.3\build\net462\GdPicture.runtimes.windows.targets" Condition="Exists('..\packages\GdPicture.runtimes.windows.14.3.3\build\net462\GdPicture.runtimes.windows.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}".</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\GdPicture.runtimes.windows.14.3.3\build\net462\GdPicture.runtimes.windows.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\GdPicture.runtimes.windows.14.3.3\build\net462\GdPicture.runtimes.windows.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -12,8 +12,8 @@ Imports System.Runtime.InteropServices
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("Digital Data")>
|
||||
<Assembly: AssemblyProduct("Modules.Interfaces")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2024")>
|
||||
<Assembly: AssemblyTrademark("1.12.1.0")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2025")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.12.1.0")>
|
||||
<Assembly: AssemblyFileVersion("1.12.1.0")>
|
||||
<Assembly: AssemblyVersion("2.3.0.0")>
|
||||
<Assembly: AssemblyFileVersion("2.3.0.0")>
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
Imports System.Collections.Generic
|
||||
Imports System.IO
|
||||
Imports System.Reflection.Emit
|
||||
Imports System.IO
|
||||
Imports System.Xml
|
||||
Imports System.Xml.Serialization
|
||||
Imports System.Xml.XPath
|
||||
Imports System.Xml.Xsl
|
||||
Imports DigitalData.Modules.Interfaces.Exceptions
|
||||
Imports DigitalData.Modules.Interfaces.PDFEmbeds
|
||||
Imports DigitalData.Modules.Interfaces.ZUGFeRD
|
||||
Imports DigitalData.Modules.Interfaces.ZUGFeRDInterface
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports GdPicture14
|
||||
|
||||
@@ -24,6 +20,20 @@ Public Class ZUGFeRDInterface
|
||||
Public Const ZUGFERD_SPEC_10 = "ZUGFERD_10"
|
||||
Public Const ZUGFERD_SPEC_2x = "ZUGFERD_2x"
|
||||
|
||||
Public Const UBL_SPEC_21 = "UBL_21"
|
||||
|
||||
Public Const XMLSCHEMA_ZUGFERD_10 = "Version1_0"
|
||||
Public Const XMLSCHEMA_ZUGFERD_20 = "Version2_0"
|
||||
Public Const XMLSCHEMA_ZUGFERD_211 = "Version2_1_1"
|
||||
Public Const XMLSCHEMA_ZUGFERD_22 = "Version2_2_FacturX"
|
||||
Public Const XMLSCHEMA_ZUGFERD_23 = "Version2_3_FacturX"
|
||||
Public Const XMLSCHEMA_ZUGFERD_233 = "Version2_3_3_FacturX"
|
||||
Public Const XMLSCHEMA_UBL_21_INVOICE = "UBL2_1_INVOICE"
|
||||
Public Const XMLSCHEMA_UBL_21_CREDITNOTE = "UBL2_1_CREDITNOTE"
|
||||
|
||||
Public Const RECEIPT_TYPE_XML = "XML"
|
||||
Public Const RECEIPT_TYPE_PDF = "PDF"
|
||||
|
||||
Private ReadOnly ValidFilenames As New List(Of String) From {
|
||||
PDFEmbeds.ZUGFERD_XML_FILENAME.ToUpper,
|
||||
PDFEmbeds.FACTUR_X_XML_FILENAME_DE.ToUpper,
|
||||
@@ -50,6 +60,7 @@ Public Class ZUGFeRDInterface
|
||||
Public Property AllowXRechnung_Filename As Boolean = True
|
||||
Public Property AllowZugferd_1_0_Schema As Boolean = True
|
||||
Public Property AllowZugferd_2_x_Schema As Boolean = True
|
||||
Public Property AllowPeppol_3_x_Schema As Boolean = False
|
||||
End Class
|
||||
|
||||
Public Class ZugferdResult
|
||||
@@ -57,6 +68,11 @@ Public Class ZUGFeRDInterface
|
||||
Public Property XElementObject As XElement
|
||||
Public Property SchemaObject As Object
|
||||
Public Property Specification As String
|
||||
Public Property UsedXMLSchema As String
|
||||
''' <summary>
|
||||
''' Dateityp des Belegs: PDF oder XML
|
||||
''' </summary>
|
||||
Public Property ReceiptFileType As String
|
||||
Public Property ValidationErrors As New List(Of ZugferdValidationError)
|
||||
End Class
|
||||
|
||||
@@ -64,6 +80,7 @@ Public Class ZUGFeRDInterface
|
||||
Public ElementName As String
|
||||
Public ElementValue As String
|
||||
Public ErrorMessage As String
|
||||
Public ErrorMessageDE As String
|
||||
End Class
|
||||
|
||||
''' <summary>
|
||||
@@ -129,6 +146,44 @@ Public Class ZUGFeRDInterface
|
||||
End If
|
||||
End Function
|
||||
|
||||
Public Function GetSerializedXMLContentFromFile(oFileInfo As FileInfo) As ZugferdResult
|
||||
Dim oResult = New ZugferdResult()
|
||||
|
||||
Try
|
||||
Dim oFileSize As Integer = oFileInfo.Length
|
||||
Dim oFileData As Byte() = File.ReadAllBytes(oFileInfo.FullName)
|
||||
|
||||
Dim oXmlFile As EmbeddedFile = New EmbeddedFile() With {
|
||||
.FileName = oFileInfo.Name,
|
||||
.FileContents = oFileData
|
||||
}
|
||||
|
||||
Using oStream As New MemoryStream(oXmlFile.FileContents)
|
||||
oResult = New ZugferdResult With {
|
||||
.DataFileName = oXmlFile.FileName,
|
||||
.XElementObject = XElement.Load(oStream)
|
||||
}
|
||||
End Using
|
||||
|
||||
Catch ex As ZUGFeRDExecption
|
||||
' Don't log ZUGFeRD Exceptions here, they should be handled by the calling code.
|
||||
' It also produces misleading error messages when checking if an attachment is a zugferd file.
|
||||
Throw ex
|
||||
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Throw New ZUGFeRDExecption(ErrorType.NoValidZugferd, "Datei ist eine ungültige XML Datei.")
|
||||
End Try
|
||||
|
||||
If oResult.ValidationErrors.Any() Then
|
||||
Throw New ValidationException() With {
|
||||
.ValidationErrors = oResult.ValidationErrors
|
||||
}
|
||||
End If
|
||||
|
||||
Return SerializeZUGFeRDDocument(oResult)
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Validates a ZUGFeRD File and extracts the XML Document from it
|
||||
''' </summary>
|
||||
@@ -278,6 +333,7 @@ Public Class ZUGFeRDInterface
|
||||
Private Class AllowedType
|
||||
Public SchemaType As Type
|
||||
Public Specification As String
|
||||
Public XMLSchema As String
|
||||
End Class
|
||||
|
||||
Public Function ValidateZUGFeRDDocument(pResult As ZugferdResult) As ZugferdResult
|
||||
@@ -290,13 +346,15 @@ Public Class ZUGFeRDInterface
|
||||
|
||||
Dim oObject As Object = Nothing
|
||||
Dim oSpecification As String = Nothing
|
||||
Dim oUsedXMLSchema As String = Nothing
|
||||
|
||||
Dim oAllowedTypes As New List(Of AllowedType)
|
||||
|
||||
If _Options.AllowZugferd_1_0_Schema Then
|
||||
oAllowedTypes.Add(New AllowedType With {
|
||||
.SchemaType = GetType(Version1_0.CrossIndustryDocumentType),
|
||||
.Specification = ZUGFERD_SPEC_10
|
||||
.Specification = ZUGFERD_SPEC_10,
|
||||
.XMLSchema = XMLSCHEMA_ZUGFERD_10
|
||||
})
|
||||
End If
|
||||
|
||||
@@ -304,15 +362,43 @@ Public Class ZUGFeRDInterface
|
||||
oAllowedTypes.AddRange(New List(Of AllowedType) From {
|
||||
New AllowedType With {
|
||||
.SchemaType = GetType(Version2_0.CrossIndustryInvoiceType),
|
||||
.Specification = ZUGFERD_SPEC_2x
|
||||
.Specification = ZUGFERD_SPEC_2x,
|
||||
.XMLSchema = XMLSCHEMA_ZUGFERD_20
|
||||
},
|
||||
New AllowedType With {
|
||||
.SchemaType = GetType(Version2_1_1.CrossIndustryInvoiceType),
|
||||
.Specification = ZUGFERD_SPEC_2x
|
||||
.Specification = ZUGFERD_SPEC_2x,
|
||||
.XMLSchema = XMLSCHEMA_ZUGFERD_211
|
||||
},
|
||||
New AllowedType With {
|
||||
.SchemaType = GetType(Version2_2_FacturX.CrossIndustryInvoiceType),
|
||||
.Specification = ZUGFERD_SPEC_2x
|
||||
.Specification = ZUGFERD_SPEC_2x,
|
||||
.XMLSchema = XMLSCHEMA_ZUGFERD_22
|
||||
},
|
||||
New AllowedType With {
|
||||
.SchemaType = GetType(Version2_3_FacturX.CrossIndustryInvoiceType),
|
||||
.Specification = ZUGFERD_SPEC_2x,
|
||||
.XMLSchema = XMLSCHEMA_ZUGFERD_23
|
||||
},
|
||||
New AllowedType With {
|
||||
.SchemaType = GetType(Version2_3_3_FacturX.CrossIndustryInvoiceType),
|
||||
.Specification = ZUGFERD_SPEC_2x,
|
||||
.XMLSchema = XMLSCHEMA_ZUGFERD_233
|
||||
}
|
||||
})
|
||||
End If
|
||||
|
||||
If _Options.AllowPeppol_3_x_Schema Then
|
||||
oAllowedTypes.AddRange(New List(Of AllowedType) From {
|
||||
New AllowedType With {
|
||||
.SchemaType = GetType(UBL_21_Invoice.InvoiceType),
|
||||
.Specification = UBL_SPEC_21,
|
||||
.XMLSchema = XMLSCHEMA_UBL_21_INVOICE
|
||||
},
|
||||
New AllowedType With {
|
||||
.SchemaType = GetType(UBL_21_CreditNote.CreditNoteType),
|
||||
.Specification = UBL_SPEC_21,
|
||||
.XMLSchema = XMLSCHEMA_UBL_21_CREDITNOTE
|
||||
}
|
||||
})
|
||||
End If
|
||||
@@ -326,6 +412,7 @@ Public Class ZUGFeRDInterface
|
||||
oReader = pResult.XElementObject.CreateReader()
|
||||
oObject = oSerializer.Deserialize(oReader)
|
||||
oSpecification = oType.Specification
|
||||
oUsedXMLSchema = oType.XMLSchema
|
||||
|
||||
_logger.Debug("Serializing with type [{0}] succeeded", oTypeName)
|
||||
Exit For
|
||||
@@ -344,6 +431,7 @@ Public Class ZUGFeRDInterface
|
||||
End If
|
||||
|
||||
pResult.Specification = oSpecification
|
||||
pResult.UsedXMLSchema = oUsedXMLSchema
|
||||
pResult.SchemaObject = oObject
|
||||
|
||||
Return pResult
|
||||
|
||||
7
Interfaces/ZUGFeRDInterface/Enums/Item_Types.vb
Normal file
7
Interfaces/ZUGFeRDInterface/Enums/Item_Types.vb
Normal file
@@ -0,0 +1,7 @@
|
||||
Public Enum Item_Types
|
||||
StringType '0
|
||||
DateType '1
|
||||
MoneyType '2
|
||||
FileType '3
|
||||
|
||||
End Enum
|
||||
@@ -1,7 +1,4 @@
|
||||
Imports System.Collections.Generic
|
||||
Imports System.IO
|
||||
Imports System.Reflection
|
||||
Imports System.Runtime.Remoting.Messaging
|
||||
Imports System.IO
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports GdPicture14
|
||||
|
||||
@@ -72,7 +69,8 @@ Public Class PDFEmbeds
|
||||
Public Function Extract(Stream As Stream, AllowedExtensions As List(Of String)) As List(Of EmbeddedFile)
|
||||
Dim oResults As New List(Of EmbeddedFile)
|
||||
Dim oExtensions = AllowedExtensions.Select(Function(ext) ext.ToUpper).ToList()
|
||||
|
||||
Dim oLicenseManager As New LicenseManager
|
||||
oLicenseManager.RegisterKEY("LICENSE_KEY")
|
||||
Logger.Debug("Extracting embedded files from stream")
|
||||
|
||||
Try
|
||||
@@ -149,6 +147,7 @@ Public Class PDFEmbeds
|
||||
GDPicturePDF.DeleteEmbeddedFile(0)
|
||||
End While
|
||||
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Function DoExtract(GDPicturePDF As GdPicturePDF, pExtensions As List(Of String)) As List(Of EmbeddedFile)
|
||||
@@ -184,7 +183,7 @@ Public Class PDFEmbeds
|
||||
|
||||
Dim oFileData As Byte() = New Byte(oFileSize) {}
|
||||
Dim oStatus As GdPictureStatus = GDPicturePDF.ExtractEmbeddedFile(oIndex, oFileData)
|
||||
|
||||
'MsgBox($"FileSize of filename: {oFileName} is bytes: {oFileData.Length}/Filesize: {oFileSize}")
|
||||
If oStatus = GdPictureStatus.OK Then
|
||||
Logger.Debug("Embedded file [{0}] extracted sucessfully!", oFileName)
|
||||
|
||||
|
||||
42562
Interfaces/ZUGFeRDInterface/Peppol_UBL2.1/CreditNoteType.vb
Normal file
42562
Interfaces/ZUGFeRDInterface/Peppol_UBL2.1/CreditNoteType.vb
Normal file
File diff suppressed because it is too large
Load Diff
42601
Interfaces/ZUGFeRDInterface/Peppol_UBL2.1/InvoiceType.vb
Normal file
42601
Interfaces/ZUGFeRDInterface/Peppol_UBL2.1/InvoiceType.vb
Normal file
File diff suppressed because it is too large
Load Diff
@@ -15,7 +15,7 @@ Public Class PropertyValues
|
||||
End Sub
|
||||
|
||||
Public Class CheckPropertyValuesResult
|
||||
Public MissingProperties As New List(Of String)
|
||||
Public MissingProperties As New List(Of MissingProperty)
|
||||
Public ValidProperties As New List(Of ValidProperty)
|
||||
End Class
|
||||
|
||||
@@ -29,9 +29,21 @@ Public Class PropertyValues
|
||||
|
||||
Public Description As String
|
||||
Public Value As String
|
||||
Public XMLPath As String
|
||||
|
||||
Public ItemType As Integer = 0
|
||||
End Class
|
||||
|
||||
Public Function CheckPropertyValues(Document As Object, PropertyMap As Dictionary(Of String, XmlItemProperty), MessageId As String) As CheckPropertyValuesResult
|
||||
Public Class MissingProperty
|
||||
Public Description As String
|
||||
Public XMLPath As String
|
||||
|
||||
Public Overrides Function ToString() As String
|
||||
Return XMLPath
|
||||
End Function
|
||||
End Class
|
||||
|
||||
Public Function CheckPropertyValues(pDocument As Object, PropertyMap As Dictionary(Of String, XmlItemProperty), MessageId As String) As CheckPropertyValuesResult
|
||||
Dim oGlobalGroupCounter = 0
|
||||
Dim oMissingProperties As New List(Of String)
|
||||
Dim oResult As New CheckPropertyValuesResult()
|
||||
@@ -65,23 +77,23 @@ Public Class PropertyValues
|
||||
Dim oPropertyValues As List(Of Object)
|
||||
_logger.Debug($"Fetching value for itemSpecification [{oProperty.Value.TableColumn}].")
|
||||
Try
|
||||
oPropertyValues = GetPropValue(Document, oProperty.Key)
|
||||
oPropertyValues = GetPropValue(pDocument, oProperty.Key)
|
||||
Catch ex As Exception
|
||||
_logger.Warn($"{MessageId} - Unknown error occurred while fetching property/TColumn [{0}] in group [{1}]:", oProperty.Value.TableColumn, oGroupScope)
|
||||
_logger.Error(ex)
|
||||
oPropertyValues = New List(Of Object)
|
||||
End Try
|
||||
|
||||
' check the first batch of values to determine the row count
|
||||
If oRowCount = 0 Then '08.04.2025 MS Added as Workaround for Positions Or oGroupScope = "POSITIONS" !
|
||||
oRowCount = oPropertyValues.Count
|
||||
End If
|
||||
|
||||
' Flatten result value
|
||||
oPropertyValues = GetFinalPropValue(oPropertyValues)
|
||||
|
||||
' Add to list
|
||||
oPropertyList.Add(oProperty.Value, oPropertyValues)
|
||||
|
||||
' check the first batch of values to determine the row count
|
||||
If oRowCount = 0 Then
|
||||
oRowCount = oPropertyValues.Count
|
||||
End If
|
||||
Next
|
||||
|
||||
' Structure of oPropertyList
|
||||
@@ -98,17 +110,28 @@ Public Class PropertyValues
|
||||
Dim oTableColumn As String = oColumn.Key.TableColumn
|
||||
Dim oIsRequired As Boolean = oColumn.Key.IsRequired
|
||||
Dim oPropertyDescription As String = oColumn.Key.Description
|
||||
Dim oPropertyPath As String = oColumn.Key.XMLPath
|
||||
Dim oItemType As Integer = oColumn.Key.ItemType
|
||||
|
||||
Dim oRowCounter = oRowIndex + oGlobalGroupCounter + 1
|
||||
|
||||
' Returns nothing if oColumn.Value contains an empty list
|
||||
Dim oPropertyValue = oColumn.Value.ElementAtOrDefault(oRowIndex)
|
||||
|
||||
_logger.Debug("Processing itemSpecification *TableColumn* [{0}].", oTableColumn)
|
||||
|
||||
If oTableColumn = "INVOICE_SELLER_EMAIL" Then
|
||||
Console.WriteLine("INVOICE_SELLER_EMAIL")
|
||||
ElseIf oTableColumn = "INVOICE_POSITION_ARTICLE" Then
|
||||
Console.WriteLine("INVOICE_POSITION_ARTICLE")
|
||||
End If
|
||||
If IsNothing(oPropertyValue) OrElse String.IsNullOrEmpty(oPropertyValue) Then
|
||||
If oColumn.Key.IsRequired Then
|
||||
_logger.Warn($"{MessageId} # oPropertyValue for specification [{oTableColumn}] is empty or not found but is required. Continuing with Empty String.")
|
||||
oResult.MissingProperties.Add(oPropertyDescription)
|
||||
Dim oMissingProperty = New MissingProperty() With {
|
||||
.Description = oPropertyDescription,
|
||||
.XMLPath = oPropertyPath
|
||||
}
|
||||
oResult.MissingProperties.Add(oMissingProperty)
|
||||
Else
|
||||
_logger.Debug($"{MessageId} # oPropertyValue for specification [{oTableColumn}] is empty or not found. Continuing with Empty String.")
|
||||
End If
|
||||
@@ -125,7 +148,9 @@ Public Class PropertyValues
|
||||
.GroupCounter = oRowCounter,
|
||||
.TableName = oTableName,
|
||||
.TableColumn = oTableColumn,
|
||||
.IsRequired = oIsRequired
|
||||
.IsRequired = oIsRequired,
|
||||
.XMLPath = oPropertyPath,
|
||||
.ItemType = oItemType
|
||||
})
|
||||
Next
|
||||
Next
|
||||
@@ -138,14 +163,18 @@ Public Class PropertyValues
|
||||
Dim oPropertyValueList As List(Of Object)
|
||||
Dim oTableColumn As String = oItem.Value.TableColumn
|
||||
Dim oPropertyDescription As String = oItem.Value.Description
|
||||
Dim oPropertyPath As String = oItem.Value.XMLPath
|
||||
Dim oPropertyValue As Object = Nothing
|
||||
Dim oTableName = oItem.Value.TableName
|
||||
Dim oIsRequired = oItem.Value.IsRequired
|
||||
Dim oDescription = oItem.Value.Description
|
||||
Dim oItemType = oItem.Value.ItemType
|
||||
|
||||
Try
|
||||
oPropertyValueList = GetPropValue(Document, oItem.Key)
|
||||
oPropertyValueList = GetPropValue(pDocument, oItem.Key)
|
||||
Catch ex As Exception
|
||||
_logger.Warn("{2} # Unknown error occurred while fetching specification [{0}] in group [{1}]:", oPropertyDescription, oItem.Value.GroupScope, MessageId)
|
||||
_logger.Warn("ERROR-MESSAGE [{0}]", ex.Message)
|
||||
_logger.Error(ex)
|
||||
oPropertyValueList = New List(Of Object)
|
||||
End Try
|
||||
@@ -177,7 +206,12 @@ Public Class PropertyValues
|
||||
If IsNothing(oPropertyValue) OrElse String.IsNullOrEmpty(oPropertyValue) Then
|
||||
If oItem.Value.IsRequired Then
|
||||
_logger.Warn("{0} # Specification [{1}] is empty, but marked as required! Skipping.", MessageId, oPropertyDescription)
|
||||
oResult.MissingProperties.Add(oPropertyDescription)
|
||||
Dim oMissingProperty = New MissingProperty With
|
||||
{
|
||||
.Description = oPropertyDescription,
|
||||
.XMLPath = oPropertyPath
|
||||
}
|
||||
oResult.MissingProperties.Add(oMissingProperty)
|
||||
Continue For
|
||||
Else
|
||||
_logger.Debug("{0} # oPropertyValue for specification [{1}] is empty or not found. Skipping.", MessageId, oPropertyDescription)
|
||||
@@ -186,13 +220,20 @@ Public Class PropertyValues
|
||||
End If
|
||||
End If
|
||||
|
||||
' Statt dem Zahlenwert des Enums, wollen wir die Währunsgbezeichnung
|
||||
If oTableColumn = "INVOICE_CURRENCY" Then
|
||||
oPropertyValue = oPropertyValue.ToString()
|
||||
End If
|
||||
|
||||
oResult.ValidProperties.Add(New ValidProperty() With {
|
||||
.MessageId = MessageId,
|
||||
.Description = oDescription,
|
||||
.Value = oPropertyValue,
|
||||
.TableName = oTableName,
|
||||
.TableColumn = oTableColumn,
|
||||
.IsRequired = oIsRequired
|
||||
.IsRequired = oIsRequired,
|
||||
.XMLPath = oPropertyPath,
|
||||
.ItemType = oItemType
|
||||
})
|
||||
Next
|
||||
|
||||
@@ -271,7 +312,6 @@ Public Class PropertyValues
|
||||
Return oResults
|
||||
End If
|
||||
|
||||
|
||||
Next
|
||||
|
||||
Return New List(Of Object) From {Obj}
|
||||
@@ -305,7 +345,13 @@ Public Class PropertyValues
|
||||
|
||||
Return DoGetFinalPropValue(Value)
|
||||
Else
|
||||
Return Value.ToString
|
||||
' Nothing kann auch der Default-Wert der Variablen bedeuten. Also auch 0.00
|
||||
If IsNothing(Value) Then
|
||||
Return String.Empty
|
||||
Else
|
||||
Return Value.ToString
|
||||
End If
|
||||
|
||||
End If
|
||||
End Function
|
||||
|
||||
|
||||
@@ -28,7 +28,8 @@ Public Class Validator
|
||||
pResult.ValidationErrors.Add(New ZugferdValidationError() With {
|
||||
.ElementName = oNode.Name.LocalName,
|
||||
.ElementValue = oNode.Value,
|
||||
.ErrorMessage = "Value could not be parsed as Decimal"
|
||||
.ErrorMessage = "Value could not be parsed as Decimal.",
|
||||
.ErrorMessageDE = "Der Wert konnte nicht in eine Dezimalzahl umgewandelt werden."
|
||||
})
|
||||
End If
|
||||
Next
|
||||
@@ -50,7 +51,8 @@ Public Class Validator
|
||||
pResult.ValidationErrors.Add(New ZugferdValidationError() With {
|
||||
.ElementName = oNode.Name.LocalName,
|
||||
.ElementValue = oNode.Value,
|
||||
.ErrorMessage = "Invalid CurrencyCode. Only 3-Character codes are allowed."
|
||||
.ErrorMessage = "Invalid CurrencyCode. Only 3-Character codes are allowed.",
|
||||
.ErrorMessageDE = "Ungültiger Währungscode. Es sind nur 3-stellige Codes erlaubt."
|
||||
})
|
||||
End If
|
||||
Next
|
||||
@@ -76,7 +78,8 @@ Public Class Validator
|
||||
pResult.ValidationErrors.Add(New ZugferdValidationError() With {
|
||||
.ElementName = oNode.Name.LocalName,
|
||||
.ElementValue = oCurrencyID,
|
||||
.ErrorMessage = "Invalid currencyID. Only 3-Character codes or empty values are allowed."
|
||||
.ErrorMessage = "Invalid currencyID. Only 3-Character codes or empty values are allowed.",
|
||||
.ErrorMessageDE = "Ungültige WährungsID. Es sind nur 3-Zeichen lange Codes oder ein leerer Wert erlaubt."
|
||||
})
|
||||
End If
|
||||
Next
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -11,4 +11,18 @@
|
||||
''' Document version, eg. ZUGFeRD Schema version
|
||||
''' </summary>
|
||||
Public Specification As String
|
||||
|
||||
''' <summary>
|
||||
''' XML Pfad, für Anzeige in Ablehnungsmail
|
||||
''' </summary>
|
||||
Public XMLPath As String
|
||||
|
||||
''' <summary>
|
||||
''' (Daten-)Typ des Knoten
|
||||
''' 0 = Default / Text
|
||||
''' 1 = Datum
|
||||
''' 2 = Gleitkomma
|
||||
''' 3 = Memo-Feld
|
||||
''' </summary>
|
||||
Public ItemType As Integer
|
||||
End Class
|
||||
@@ -1,11 +1,47 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="FirebirdSql.Data.FirebirdClient" publicKeyToken="3750abcc3150b00c" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-7.5.0.0" newVersion="7.5.0.0"/>
|
||||
<assemblyIdentity name="FirebirdSql.Data.FirebirdClient" publicKeyToken="3750abcc3150b00c" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-7.5.0.0" newVersion="7.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.1.0" newVersion="6.0.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.5.0" newVersion="4.1.5.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Security.Cryptography.Pkcs" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-8.0.0.1" newVersion="8.0.0.1" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.IO.Packaging" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-8.0.0.1" newVersion="8.0.0.1" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-8.0.0.5" newVersion="8.0.0.5" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/></startup></configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" /></startup></configuration>
|
||||
|
||||
@@ -1,5 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net461" />
|
||||
<package id="BouncyCastle.Cryptography" version="2.5.0" targetFramework="net462" />
|
||||
<package id="DocumentFormat.OpenXml" version="3.2.0" targetFramework="net462" />
|
||||
<package id="DocumentFormat.OpenXml.Framework" version="3.2.0" targetFramework="net462" />
|
||||
<package id="GdPicture" version="14.3.3" targetFramework="net462" />
|
||||
<package id="GdPicture.runtimes.windows" version="14.3.3" targetFramework="net462" />
|
||||
<package id="Microsoft.AspNet.WebApi.Client" version="6.0.0" targetFramework="net462" />
|
||||
<package id="Microsoft.Bcl.AsyncInterfaces" version="8.0.0" targetFramework="net462" />
|
||||
<package id="Microsoft.CSharp" version="4.7.0" targetFramework="net462" />
|
||||
<package id="Microsoft.VisualBasic" version="10.3.0" targetFramework="net462" />
|
||||
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net462" />
|
||||
<package id="Newtonsoft.Json.Bson" version="1.0.2" targetFramework="net462" />
|
||||
<package id="NLog" version="5.0.5" targetFramework="net461" />
|
||||
<package id="OpenMcdf" version="2.4.1" targetFramework="net462" />
|
||||
<package id="protobuf-net" version="3.2.46" targetFramework="net462" />
|
||||
<package id="protobuf-net.Core" version="3.2.46" targetFramework="net462" />
|
||||
<package id="RtfPipe" version="2.0.7677.4303" targetFramework="net462" />
|
||||
<package id="System.Buffers" version="4.6.0" targetFramework="net462" />
|
||||
<package id="System.CodeDom" version="8.0.0" targetFramework="net462" />
|
||||
<package id="System.Collections.Immutable" version="8.0.0" targetFramework="net462" />
|
||||
<package id="System.IO.Packaging" version="8.0.1" targetFramework="net462" />
|
||||
<package id="System.Management" version="8.0.0" targetFramework="net462" />
|
||||
<package id="System.Memory" version="4.6.0" targetFramework="net462" />
|
||||
<package id="System.Numerics.Vectors" version="4.6.0" targetFramework="net462" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="6.1.0" targetFramework="net462" />
|
||||
<package id="System.Security.Cryptography.Pkcs" version="8.0.1" targetFramework="net462" />
|
||||
<package id="System.Text.Encodings.Web" version="8.0.0" targetFramework="net462" />
|
||||
<package id="System.Text.Json" version="8.0.5" targetFramework="net462" />
|
||||
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net462" />
|
||||
<package id="System.ValueTuple" version="4.5.0" targetFramework="net462" />
|
||||
</packages>
|
||||
@@ -8,8 +8,8 @@ Public Class ADSyncJob
|
||||
Inherits JobBase
|
||||
Implements IJob(Of ADSyncArgs)
|
||||
|
||||
Public Sub New(LogConfig As LogConfig, Firebird As Firebird, MSSQL As MSSQLServer)
|
||||
MyBase.New(LogConfig, Firebird, MSSQL)
|
||||
Public Sub New(LogConfig As LogConfig, MSSQL As MSSQLServer)
|
||||
MyBase.New(LogConfig, MSSQL)
|
||||
End Sub
|
||||
|
||||
Public Sub Start(Arguments As ADSyncArgs) Implements IJob(Of ADSyncArgs).Start
|
||||
@@ -31,7 +31,7 @@ Public Class ADSyncJob
|
||||
|
||||
For Each oGroup In oGroups
|
||||
_Logger.Debug("Syncing Group [{0}]", oGroup)
|
||||
Dim oSyncedUsers = oSync.SyncUsersForGroup(oGroup, oAttributeMappings, _Firebird, _MSSQL, Arguments.UserFilter)
|
||||
Dim oSyncedUsers = oSync.SyncUsersForGroup(oGroup, oAttributeMappings, _MSSQL, Arguments.UserFilter)
|
||||
|
||||
If oSyncedUsers Is Nothing Then
|
||||
_Logger.Warn("Group [{0}] could not be synced!", oGroup)
|
||||
|
||||
@@ -1,13 +1,49 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
|
||||
</startup>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="FirebirdSql.Data.FirebirdClient" publicKeyToken="3750abcc3150b00c" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-7.5.0.0" newVersion="7.5.0.0"/>
|
||||
<assemblyIdentity name="FirebirdSql.Data.FirebirdClient" publicKeyToken="3750abcc3150b00c" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-7.5.0.0" newVersion="7.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.1.0" newVersion="6.0.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.5.0" newVersion="4.1.5.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Security.Cryptography.Pkcs" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-8.0.0.1" newVersion="8.0.0.1" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.IO.Packaging" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-8.0.0.1" newVersion="8.0.0.1" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-8.0.0.5" newVersion="8.0.0.5" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
Imports System.Collections.Generic
|
||||
Imports System.IO
|
||||
Imports DigitalData.Modules.Interfaces.PropertyValues
|
||||
Imports DigitalData.Modules.Interfaces.ZUGFeRDInterface
|
||||
|
||||
Public Class Exceptions
|
||||
@@ -7,9 +8,9 @@ Public Class Exceptions
|
||||
Inherits ApplicationException
|
||||
|
||||
Public ReadOnly File As FileInfo
|
||||
Public ReadOnly MissingProperties As List(Of String)
|
||||
Public ReadOnly MissingProperties As List(Of MissingProperty)
|
||||
|
||||
Public Sub New(pFile As FileInfo, pMissingProperties As List(Of String))
|
||||
Public Sub New(pFile As FileInfo, pMissingProperties As List(Of MissingProperty))
|
||||
MyBase.New($"Missing values in [{pFile.Name}]")
|
||||
|
||||
Me.File = pFile
|
||||
|
||||
@@ -1,28 +1,24 @@
|
||||
Option Explicit On
|
||||
|
||||
Imports System.Collections.Generic
|
||||
Imports System.Data
|
||||
Imports System.IO
|
||||
Imports System.Linq
|
||||
Imports DigitalData.Modules.Base
|
||||
Imports DigitalData.Modules.Config
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Interfaces
|
||||
Imports DigitalData.Modules.Jobs.GraphQL
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports Newtonsoft.Json.Linq
|
||||
|
||||
Public Class GraphQLJob
|
||||
Inherits JobBase
|
||||
Implements IJob(Of GraphQLArgs)
|
||||
|
||||
Private _GraphQL As GraphQLInterface = Nothing
|
||||
Private _Model As GraphQLModel
|
||||
Private _Writer As GraphQLWriter
|
||||
|
||||
Private Const PLACEHOLDER_STATIC = "STATIC:"
|
||||
Private Const JOB_NAME = "GraphQL Job"
|
||||
|
||||
Public Sub New(LogConfig As LogConfig, MSSQL As MSSQLServer)
|
||||
MyBase.New(LogConfig, Nothing, MSSQL)
|
||||
MyBase.New(LogConfig, MSSQL)
|
||||
End Sub
|
||||
|
||||
Public Sub Start(Args As GraphQLArgs) Implements IJob(Of GraphQLArgs).Start
|
||||
@@ -33,6 +29,9 @@ Public Class GraphQLJob
|
||||
With oConfigManager.Config
|
||||
_GraphQL = New GraphQLInterface(_LogConfig, .BaseUrl, .Email, .Password, .CertificateFingerprint)
|
||||
End With
|
||||
_Logger.Info($"baseUrl is: {oConfigManager.Config.BaseUrl}")
|
||||
_Model = New GraphQLModel(_LogConfig, _MSSQL)
|
||||
_Writer = New GraphQLWriter(_LogConfig, _MSSQL)
|
||||
|
||||
' Login to get cookie
|
||||
_Logger.Debug("Logging in")
|
||||
@@ -43,41 +42,7 @@ Public Class GraphQLJob
|
||||
|
||||
_Logger.Debug("Loading Queries")
|
||||
|
||||
' Load query data from TBCUST_JOBRUNNER_QUERY
|
||||
Dim oQueryTable As DataTable = _MSSQL.GetDatatable("SELECT * FROM TBCUST_JOBRUNNER_QUERY ORDER BY SEQUENCE")
|
||||
Dim oQueryList As New List(Of Query)
|
||||
|
||||
' Save query data to business objects
|
||||
For Each oRow As DataRow In oQueryTable.Rows
|
||||
Dim oQuery As New Query With {
|
||||
.Id = oRow.Item("GUID"),
|
||||
.Name = oRow.Item("TITLE"),
|
||||
.ClearBeforeFill = oRow.ItemEx("CLEAR_BEFORE_FILL", False),
|
||||
.ConnectionId = oRow.ItemEx("CON_ID", 1), ' TODO: Connection String?
|
||||
.DestinationTable = oRow.ItemEx("DESTINATION_TABLE", String.Empty),
|
||||
.OperationName = oRow.ItemEx("OPERATION_NAME", String.Empty),
|
||||
.MappingBasePath = oRow.ItemEx("MAPPING_BASE_PATH", String.Empty),
|
||||
.QueryString = oRow.ItemEx("QUERY_STRING", String.Empty)
|
||||
}
|
||||
|
||||
If oQuery.DestinationTable = String.Empty Then
|
||||
_Logger.Warn("Value [DestinationTable] could not be read. Configuration incomplete.")
|
||||
End If
|
||||
|
||||
If oQuery.OperationName = String.Empty Then
|
||||
_Logger.Warn("Value [OperationName] could not be read. Configuration incomplete.")
|
||||
End If
|
||||
|
||||
If oQuery.MappingBasePath = String.Empty Then
|
||||
_Logger.Warn("Value [MappingBasePath] could not be read. Configuration incomplete.")
|
||||
End If
|
||||
|
||||
If oQuery.QueryString = String.Empty Then
|
||||
_Logger.Warn("Value [QueryString] could not be read. Configuration incomplete.")
|
||||
End If
|
||||
|
||||
oQueryList.Add(oQuery)
|
||||
Next
|
||||
Dim oQueryList = _Model.GetQueryList()
|
||||
|
||||
_Logger.Debug("Running [{0}] queries.", oQueryList.Count)
|
||||
|
||||
@@ -119,13 +84,17 @@ Public Class GraphQLJob
|
||||
|
||||
' Clear Table before inserting
|
||||
If pQuery.ClearBeforeFill = True Then
|
||||
If DeleteWithQueryName(pQuery) = False Then
|
||||
If DeleteHistoryTable(pQuery) = False Then
|
||||
Throw New ApplicationException($"Error while dropping history table before fill for Query [{pQuery.Name}]")
|
||||
End If
|
||||
|
||||
If CreateHistoryTable(pQuery) = False Then
|
||||
Throw New ApplicationException($"Error while creating history table before fill for Query [{pQuery.Name}]")
|
||||
End If
|
||||
|
||||
If TruncateTable(pQuery) = False Then
|
||||
Throw New ApplicationException($"Error while truncating table before fill for Query [{pQuery.Name}]")
|
||||
End If
|
||||
End If
|
||||
|
||||
' Reset all records to status = 0
|
||||
@@ -137,31 +106,22 @@ Public Class GraphQLJob
|
||||
End If
|
||||
|
||||
' get the data from GraphQL
|
||||
_Logger.Info("Getting data..", pQuery.Name)
|
||||
_Logger.Info("Getting data from GraphQL..", pQuery.Name)
|
||||
Dim oDataResponse = _GraphQL.GetData(pQuery.QueryString, pQuery.OperationName)
|
||||
Dim oResult As String
|
||||
Dim oJsonResult As String
|
||||
|
||||
' write data to string
|
||||
Using oStream = oDataResponse.GetResponseStream()
|
||||
Using oReader As New StreamReader(oStream)
|
||||
oResult = oReader.ReadToEnd()
|
||||
oJsonResult = oReader.ReadToEnd()
|
||||
End Using
|
||||
End Using
|
||||
|
||||
' Fill the query object with field mapping data from TBCUST_JOBRUNNER_QUERY_MAPPING
|
||||
Dim oSQL As String = "SELECT t2.* FROM TBCUST_JOBRUNNER_QUERY_MAPPING t
|
||||
JOIN TBCUST_JOBRUNNER_MAPPING t2 ON t.MAPPING_ID = t2.GUID
|
||||
WHERE t.QUERY_ID = {0}"
|
||||
Dim oMappingTable As DataTable = _MSSQL.GetDatatable(String.Format(oSQL, pQuery.Id))
|
||||
For Each oMapping As DataRow In oMappingTable.Rows
|
||||
pQuery.MappingFields.Add(New GraphQL.FieldMapping With {
|
||||
.DestinationColumn = oMapping.Item("DestinationColumn"),
|
||||
.SourcePath = oMapping.Item("SourcePath")
|
||||
})
|
||||
Next
|
||||
_Logger.Debug("Writing JSON data to database..")
|
||||
|
||||
' Handle the response from GraphQL and insert Data
|
||||
Dim oWriteDataResult As GraphQL.Query = WriteNewQueryData(oResult, pQuery, oDatabase)
|
||||
'Dim oWriteDataResult As Query = WriteNewQueryData(oResult, pQuery, oDatabase)
|
||||
Dim oWriteDataResult As Query = _Writer.WriteNewQueryData(oJsonResult, pQuery, JOB_NAME)
|
||||
|
||||
If IsNothing(oWriteDataResult) Then
|
||||
Throw New ApplicationException($"Error while handling Result of Query [{pQuery.Name}]")
|
||||
@@ -200,7 +160,7 @@ Public Class GraphQLJob
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Function DeleteWithQueryName(pQuery As GraphQL.Query) As Boolean
|
||||
Private Function DeleteHistoryTable(pQuery As Query) As Boolean
|
||||
Dim oHistoryTableName = $"{pQuery.DestinationTable}_HISTORY"
|
||||
Dim oDeleteHistorySQL = $"
|
||||
IF (EXISTS (SELECT *
|
||||
@@ -214,6 +174,12 @@ Public Class GraphQLJob
|
||||
Return _MSSQL.ExecuteNonQuery(oDeleteHistorySQL)
|
||||
End Function
|
||||
|
||||
Private Function TruncateTable(pQuery As Query)
|
||||
Dim oDeleteTableSQL = $"TRUNCATE TABLE {pQuery.DestinationTable}"
|
||||
|
||||
Return _MSSQL.ExecuteNonQuery(oDeleteTableSQL)
|
||||
End Function
|
||||
|
||||
Private Function CreateHistoryTable(pQuery As Query) As Boolean
|
||||
Dim oHistoryTableName = $"{pQuery.DestinationTable}_HISTORY"
|
||||
Dim oFillHistorySQL = $"SELECT * INTO {oHistoryTableName} FROM {pQuery.DestinationTable}"
|
||||
@@ -231,72 +197,6 @@ Public Class GraphQLJob
|
||||
Return _MSSQL.ExecuteNonQuery(oResetSQL)
|
||||
End Function
|
||||
|
||||
Private Function WriteNewQueryData(JsonString As String, QueryData As GraphQL.Query, DB As Database.MSSQLServer) As GraphQL.Query
|
||||
Dim oObj As JObject = JObject.Parse(JsonString)
|
||||
Dim oResultList As JToken
|
||||
|
||||
If _GraphQL.ReadJSONPathFragmented(oObj, QueryData.MappingBasePath) = False Then
|
||||
_Logger.Warn("There is an error in the MappingBasePath [{1}] configuration of query [{0}]", QueryData.Name, QueryData.MappingBasePath)
|
||||
End If
|
||||
|
||||
Try
|
||||
oResultList = oObj.SelectToken(QueryData.MappingBasePath, errorWhenNoMatch:=True)
|
||||
Catch ex As Exception
|
||||
_Logger.Warn("WriteNewQueryData: Could not find BasePath: [{0}] for query [{1}]", QueryData.MappingBasePath, QueryData.Name)
|
||||
_Logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
|
||||
If oResultList Is Nothing Then
|
||||
_Logger.Warn("WriteNewQueryData: Could not find BasePath: [{0}] for query [{1}]", QueryData.MappingBasePath, QueryData.Name)
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
_Logger.Info("WriteNewQueryData: Processing Queue [{0}] with [{1}] Items", QueryData.Name, oResultList.Count)
|
||||
|
||||
For Each oResultItem As JToken In oResultList
|
||||
Try
|
||||
' ADDED_WHO, ADDED_QUERY_ID are system fields which are used to correctly fill
|
||||
' and delete rows in the destination table without touching rows from other queries
|
||||
Dim oKeys As New List(Of String) From {"ADDED_WHO", "ADDED_QUERY_ID", "STATUS"}
|
||||
Dim oValues As New List(Of String) From {JOB_NAME, QueryData.Id, "1"}
|
||||
|
||||
For Each oMapping In QueryData.MappingFields
|
||||
Dim oValue As String = String.Empty
|
||||
|
||||
If oMapping.SourcePath.StartsWith(PLACEHOLDER_STATIC) Then
|
||||
oValue = oMapping.SourcePath.Replace(PLACEHOLDER_STATIC, String.Empty)
|
||||
Else
|
||||
Dim oToken = oResultItem.SelectToken(oMapping.SourcePath)
|
||||
|
||||
If oToken Is Nothing Then
|
||||
_Logger.Warn("WriteNewQueryData: Could not find value at SourcePath: {0}", oMapping.SourcePath)
|
||||
oValue = String.Empty
|
||||
Else
|
||||
oValue = oToken.ToString
|
||||
End If
|
||||
End If
|
||||
|
||||
oValues.Add(oValue)
|
||||
oKeys.Add(oMapping.DestinationColumn)
|
||||
Next
|
||||
|
||||
Dim oColumnString = String.Join(",", oKeys.ToArray)
|
||||
|
||||
Dim oValueList = oValues.Select(Function(Value) $"'{Value.EscapeForSQL}'").ToList()
|
||||
Dim oValueString = String.Join(",", oValueList)
|
||||
|
||||
Dim oSQL As String = $"INSERT INTO {QueryData.DestinationTable} ({oColumnString}) VALUES ({oValueString})"
|
||||
|
||||
DB.ExecuteNonQuery(oSQL)
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
End Try
|
||||
Next
|
||||
|
||||
Return QueryData
|
||||
End Function
|
||||
|
||||
Public Function ShouldStart(Arguments As GraphQLArgs) As Boolean Implements IJob(Of GraphQLArgs).ShouldStart
|
||||
Return Arguments.Enabled
|
||||
End Function
|
||||
|
||||
86
Jobs/GraphQL/GraphQLModel.vb
Normal file
86
Jobs/GraphQL/GraphQLModel.vb
Normal file
@@ -0,0 +1,86 @@
|
||||
Imports System.Collections.Generic
|
||||
Imports System.Data
|
||||
Imports DigitalData.Modules.Base
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Jobs.GraphQL
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class GraphQLModel
|
||||
Private Database As MSSQLServer
|
||||
Private LogConfig As LogConfig
|
||||
Private Logger As Logger
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig, pDatabase As MSSQLServer)
|
||||
Database = pDatabase
|
||||
LogConfig = pLogConfig
|
||||
Logger = pLogConfig.GetLogger()
|
||||
End Sub
|
||||
|
||||
Public Function GetQueryList() As List(Of Query)
|
||||
Try
|
||||
Dim oQueryTable As DataTable = Database.GetDatatable("SELECT * FROM TBCUST_JOBRUNNER_QUERY WHERE ACTIVE = 1 ORDER BY SEQUENCE")
|
||||
Dim oQueryList As New List(Of Query)
|
||||
|
||||
For Each oRow As DataRow In oQueryTable.Rows
|
||||
Dim oQuery As New Query With {
|
||||
.Id = oRow.Item("GUID"),
|
||||
.Name = oRow.Item("TITLE"),
|
||||
.ClearBeforeFill = oRow.ItemEx("CLEAR_BEFORE_FILL", False),
|
||||
.ConnectionId = oRow.ItemEx("CON_ID", 1), ' TODO: Connection String?
|
||||
.DestinationTable = oRow.ItemEx("DESTINATION_TABLE", String.Empty),
|
||||
.OperationName = oRow.ItemEx("OPERATION_NAME", String.Empty),
|
||||
.MappingBasePath = oRow.ItemEx("MAPPING_BASE_PATH", String.Empty),
|
||||
.QueryString = oRow.ItemEx("QUERY_STRING", String.Empty)
|
||||
}
|
||||
|
||||
If oQuery.DestinationTable = String.Empty Then
|
||||
Logger.Warn("Value [DestinationTable] could not be read. Configuration incomplete.")
|
||||
End If
|
||||
|
||||
If oQuery.OperationName = String.Empty Then
|
||||
Logger.Warn("Value [OperationName] could not be read. Configuration incomplete.")
|
||||
End If
|
||||
|
||||
If oQuery.MappingBasePath = String.Empty Then
|
||||
Logger.Warn("Value [MappingBasePath] could not be read. Configuration incomplete.")
|
||||
End If
|
||||
|
||||
If oQuery.QueryString = String.Empty Then
|
||||
Logger.Warn("Value [QueryString] could not be read. Configuration incomplete.")
|
||||
End If
|
||||
|
||||
oQuery.MappingFields = GetQueryMapping(oQuery.Id)
|
||||
|
||||
oQueryList.Add(oQuery)
|
||||
Next
|
||||
|
||||
Return oQueryList
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return New List(Of Query)
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function GetQueryMapping(pQueryId As Integer) As List(Of FieldMapping)
|
||||
Try
|
||||
Dim oSQL As String = "SELECT t2.* FROM TBCUST_JOBRUNNER_QUERY_MAPPING t
|
||||
JOIN TBCUST_JOBRUNNER_MAPPING t2 ON t.MAPPING_ID = t2.GUID
|
||||
WHERE t.QUERY_ID = {0}"
|
||||
Dim oMappingTable As DataTable = Database.GetDatatable(String.Format(oSQL, pQueryId))
|
||||
Dim oMappings As New List(Of FieldMapping)
|
||||
|
||||
For Each oMapping As DataRow In oMappingTable.Rows
|
||||
oMappings.Add(New FieldMapping With {
|
||||
.DestinationColumn = oMapping.Item("DestinationColumn"),
|
||||
.SourcePath = oMapping.Item("SourcePath")
|
||||
})
|
||||
Next
|
||||
|
||||
Return oMappings
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return New List(Of FieldMapping)
|
||||
End Try
|
||||
End Function
|
||||
|
||||
End Class
|
||||
178
Jobs/GraphQL/GraphQLWriter.vb
Normal file
178
Jobs/GraphQL/GraphQLWriter.vb
Normal file
@@ -0,0 +1,178 @@
|
||||
Imports System
|
||||
Imports System.Collections.Generic
|
||||
Imports System.Data
|
||||
Imports System.Data.SqlClient
|
||||
Imports System.Linq
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Jobs.GraphQL
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports Newtonsoft.Json.Linq
|
||||
|
||||
Public Class GraphQLWriter
|
||||
Private ReadOnly Database As MSSQLServer
|
||||
Private ReadOnly LogConfig As LogConfig
|
||||
Private ReadOnly Logger As Logger
|
||||
|
||||
Private Const PLACEHOLDER_STATIC = "STATIC:"
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig, pDatabase As MSSQLServer)
|
||||
Database = pDatabase
|
||||
LogConfig = pLogConfig
|
||||
Logger = pLogConfig.GetLogger()
|
||||
End Sub
|
||||
|
||||
Public Function WriteNewQueryData(pJsonString As String, pQueryData As Query, pJobName As String) As GraphQL.Query
|
||||
Try
|
||||
Logger.Debug("Parsing JSON...")
|
||||
|
||||
Dim oObj As JObject = JObject.Parse(pJsonString)
|
||||
Dim oResultList As JToken
|
||||
|
||||
If ValidateJSONPath(oObj, pQueryData.MappingBasePath) = False Then
|
||||
Logger.Warn("There is an error in the MappingBasePath [{1}] configuration of query [{0}]", pQueryData.Name, pQueryData.MappingBasePath)
|
||||
End If
|
||||
|
||||
Try
|
||||
oResultList = oObj.SelectToken(pQueryData.MappingBasePath, errorWhenNoMatch:=True)
|
||||
Catch ex As Exception
|
||||
Logger.Warn("Could not find BasePath: [{0}] for query [{1}]", pQueryData.MappingBasePath, pQueryData.Name)
|
||||
Logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
|
||||
If oResultList Is Nothing Then
|
||||
Logger.Warn("Could not find BasePath: [{0}] for query [{1}]", pQueryData.MappingBasePath, pQueryData.Name)
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
Logger.Info("Processing Query [{0}] with [{1}] Items", pQueryData.Name, oResultList.Count)
|
||||
|
||||
Dim oTable As New DataTable
|
||||
Dim oColumnList = pQueryData.MappingFields.Select(Function(f) f.DestinationColumn).ToList()
|
||||
|
||||
For Each oColumnName In oColumnList
|
||||
oTable.Columns.Add(oColumnName)
|
||||
Next
|
||||
|
||||
oTable.Columns.Add("ADDED_WHO")
|
||||
oTable.Columns.Add("ADDED_QUERY_ID")
|
||||
oTable.Columns.Add("STATUS")
|
||||
|
||||
Logger.Debug("Creating DataTable..")
|
||||
|
||||
For Each oResultItem As JToken In oResultList
|
||||
Dim oRow = FillRowFromJson(pQueryData, oResultItem, pJobName, oTable)
|
||||
|
||||
If oRow Is Nothing Then
|
||||
Logger.Error("DataRow could not be created!")
|
||||
Continue For
|
||||
End If
|
||||
|
||||
oTable.Rows.Add(oRow)
|
||||
Next
|
||||
oTable.AcceptChanges()
|
||||
|
||||
Logger.Debug("Starting Bulk Insert..")
|
||||
|
||||
'Bulk insert
|
||||
Dim oBulkResult = BulkInsert(oTable, pQueryData.DestinationTable, oColumnList)
|
||||
|
||||
If oBulkResult = False Then
|
||||
Logger.Error("Bulk Insert for Query [{0}] failed!", pQueryData.Name)
|
||||
End If
|
||||
|
||||
Logger.Info("Bulk Insert finished. [{0}] rows inserted.", oTable.Rows.Count)
|
||||
|
||||
Return pQueryData
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return Nothing
|
||||
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Function FillRowFromJson(pQueryData As Query, pToken As JToken, pJobName As String, pTable As DataTable) As DataRow
|
||||
Try
|
||||
Dim oValuesNew As New Dictionary(Of String, String)
|
||||
Dim oRow As DataRow = pTable.NewRow()
|
||||
|
||||
For Each oMapping In pQueryData.MappingFields
|
||||
Dim oValue As String = String.Empty
|
||||
|
||||
If oMapping.SourcePath.StartsWith(PLACEHOLDER_STATIC) Then
|
||||
oValue = oMapping.SourcePath.Replace(PLACEHOLDER_STATIC, String.Empty)
|
||||
Else
|
||||
Dim oToken = pToken.SelectToken(oMapping.SourcePath)
|
||||
|
||||
If oToken Is Nothing Then
|
||||
Logger.Warn("WriteNewQueryData: Could not find value at SourcePath: {0}", oMapping.SourcePath)
|
||||
oValue = String.Empty
|
||||
Else
|
||||
oValue = oToken.ToString
|
||||
End If
|
||||
End If
|
||||
|
||||
oValuesNew.Add(oMapping.DestinationColumn, oValue)
|
||||
Next
|
||||
|
||||
oValuesNew.Add("ADDED_WHO", pJobName)
|
||||
oValuesNew.Add("ADDED_QUERY_ID", pQueryData.Id)
|
||||
oValuesNew.Add("STATUS", "1")
|
||||
|
||||
For Each oColumn As DataColumn In pTable.Columns
|
||||
oRow.Item(oColumn.ColumnName) = oValuesNew.Item(oColumn.ColumnName)
|
||||
Next
|
||||
|
||||
Return oRow
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Function BulkInsert(pTable As DataTable, pDestinationTable As String, pColumns As List(Of String)) As Boolean
|
||||
Using oConnection = Database.GetConnection()
|
||||
Using oBulkCopy = New SqlBulkCopy(oConnection)
|
||||
|
||||
oBulkCopy.DestinationTableName = pDestinationTable
|
||||
For Each oColumn In pColumns
|
||||
oBulkCopy.ColumnMappings.Add(New SqlBulkCopyColumnMapping(oColumn, oColumn))
|
||||
Next
|
||||
|
||||
Try
|
||||
oBulkCopy.WriteToServer(pTable)
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
End Using
|
||||
End Using
|
||||
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Public Function ValidateJSONPath(pObject As Newtonsoft.Json.Linq.JObject, pJsonPath As String) As Boolean
|
||||
Dim oSplitPath As List(Of String) = pJsonPath.Split(".").ToList()
|
||||
Dim oCurrentPath As String = String.Empty
|
||||
|
||||
For Each oPart In oSplitPath
|
||||
If oCurrentPath = String.Empty Then
|
||||
oCurrentPath = oPart
|
||||
Else
|
||||
oCurrentPath &= "." & oPart
|
||||
End If
|
||||
|
||||
Logger.Debug("Selecting Path Fragment [{0}]", oCurrentPath)
|
||||
|
||||
Try
|
||||
pObject.SelectToken(oCurrentPath, errorWhenNoMatch:=True)
|
||||
Catch ex As Exception
|
||||
Logger.Warn("Path Fragment [{0}] did not return a valid token", oCurrentPath)
|
||||
Return False
|
||||
End Try
|
||||
Next
|
||||
|
||||
Return True
|
||||
End Function
|
||||
End Class
|
||||
@@ -4,13 +4,11 @@ Imports DigitalData.Modules.Logging
|
||||
Public Class JobBase
|
||||
Protected _LogConfig As LogConfig
|
||||
Protected _Logger As Logger
|
||||
Protected _Firebird As Firebird
|
||||
Protected _MSSQL As MSSQLServer
|
||||
|
||||
Public Sub New(LogConfig As LogConfig, Firebird As Firebird, MSSQL As MSSQLServer)
|
||||
Public Sub New(LogConfig As LogConfig, MSSQL As MSSQLServer)
|
||||
_LogConfig = LogConfig
|
||||
_Logger = LogConfig.GetLogger()
|
||||
_Firebird = Firebird
|
||||
_MSSQL = MSSQL
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
@@ -4,6 +4,8 @@ Public Class JobConfig
|
||||
Public Property Name As JobType
|
||||
Public Property Enabled As Boolean = False
|
||||
Public Property StartWithoutDelay As Boolean = False
|
||||
|
||||
' https://www.quartz-scheduler.net/documentation/quartz-3.x/how-tos/crontrigger.html
|
||||
Public Property CronSchedule As String = ""
|
||||
|
||||
Public Property ArgsString As String = ""
|
||||
|
||||
181
Jobs/Jobs.vbproj
181
Jobs/Jobs.vbproj
@@ -14,6 +14,8 @@
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<TargetFrameworkProfile />
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@@ -65,18 +67,6 @@
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Base\Base.vbproj">
|
||||
<Project>{6ea0c51f-c2b1-4462-8198-3de0b32b74f8}</Project>
|
||||
<Name>Base</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Config\Config.vbproj">
|
||||
<Project>{44982f9b-6116-44e2-85d0-f39650b1ef99}</Project>
|
||||
<Name>Config</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Database\Database.vbproj">
|
||||
<Project>{eaf0ea75-5fa7-485d-89c7-b2d843b03a96}</Project>
|
||||
<Name>Database</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Interfaces\Interfaces.vbproj">
|
||||
<Project>{ab6f09bf-e794-4f6a-94bb-c97c0ba84d64}</Project>
|
||||
<Name>Interfaces</Name>
|
||||
@@ -92,7 +82,10 @@
|
||||
<Compile Include="GraphQL\GraphQLArgs.vb" />
|
||||
<Compile Include="GraphQL\GraphQLConfig.vb" />
|
||||
<Compile Include="GraphQL\GraphQLJob.vb" />
|
||||
<Compile Include="GraphQL\GraphQLModel.vb" />
|
||||
<Compile Include="GraphQL\GraphQLQuery.vb" />
|
||||
<Compile Include="GraphQL\GraphQLWriter.vb" />
|
||||
<Compile Include="ZUGFeRD\ErrorCode.vb" />
|
||||
<Compile Include="ZUGFeRD\EmailData.vb" />
|
||||
<Compile Include="ZUGFeRD\EmailFunctions.vb" />
|
||||
<Compile Include="ZUGFeRD\EmailStrings.vb" />
|
||||
@@ -113,27 +106,187 @@
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ZUGFeRD\XRechnungStrings.vb" />
|
||||
<Compile Include="ZUGFeRD\XRechnungViewDocument.vb" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="BouncyCastle.Cryptography, Version=2.0.0.0, Culture=neutral, PublicKeyToken=072edcf4a5328938, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\BouncyCastle.Cryptography.2.5.0\lib\net461\BouncyCastle.Cryptography.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Base, Version=1.3.9.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Base\bin\Debug\DigitalData.Modules.Base.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Config, Version=1.3.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Config\bin\Debug\DigitalData.Modules.Config.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Database, Version=2.3.5.4, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DocumentFormat.OpenXml, Version=3.2.0.0, Culture=neutral, PublicKeyToken=8fb06cb64d019a17, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\DocumentFormat.OpenXml.3.2.0\lib\net46\DocumentFormat.OpenXml.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DocumentFormat.OpenXml.Framework, Version=3.2.0.0, Culture=neutral, PublicKeyToken=8fb06cb64d019a17, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\DocumentFormat.OpenXml.Framework.3.2.0\lib\net46\DocumentFormat.OpenXml.Framework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="FirebirdSql.Data.FirebirdClient, Version=7.5.0.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\FirebirdSql.Data.FirebirdClient.7.5.0\lib\net452\FirebirdSql.Data.FirebirdClient.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14.barcode.1d.writer, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.barcode.1d.writer.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14.barcode.2d.writer, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.barcode.2d.writer.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14.CAD, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.CAD.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14.CAD.DWG, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.CAD.DWG.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14.Common, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.Common.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14.Document, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.Document.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14.Email, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.Email.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14.HTML, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.HTML.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14.Imaging, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.Imaging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14.Imaging.Formats, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.Imaging.Formats.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14.Imaging.Formats.Conversion, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.Imaging.Formats.Conversion.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14.Imaging.Rendering, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.Imaging.Rendering.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14.MSOfficeBinary, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.MSOfficeBinary.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14.OpenDocument, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.OpenDocument.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14.OpenXML, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.OpenXML.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14.OpenXML.Templating, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.OpenXML.Templating.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14.PDF, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.PDF.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14.RTF, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.RTF.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14.SVG, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.SVG.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14.wia.gateway, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6973b5c22dcf45f7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.wia.gateway.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json.Bson, Version=1.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.Bson.1.0.2\lib\net45\Newtonsoft.Json.Bson.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.5.0.5\lib\net46\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OpenMcdf, Version=2.4.1.0, Culture=neutral, PublicKeyToken=fdbb1629d7c00800, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OpenMcdf.2.4.1\lib\net40\OpenMcdf.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="protobuf-net, Version=3.0.0.0, Culture=neutral, PublicKeyToken=257b51d87d2e4d67, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\protobuf-net.3.2.46\lib\net462\protobuf-net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="protobuf-net.Core, Version=3.0.0.0, Culture=neutral, PublicKeyToken=257b51d87d2e4d67, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\protobuf-net.Core.3.2.46\lib\net462\protobuf-net.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="RtfPipe, Version=2.0.7677.4303, Culture=neutral, PublicKeyToken=5f6ab4ce530296d2, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\RtfPipe.2.0.7677.4303\lib\net45\RtfPipe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Buffers, Version=4.0.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Buffers.4.6.0\lib\net462\System.Buffers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.CodeDom, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.CodeDom.8.0.0\lib\net462\System.CodeDom.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Collections.Immutable, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Collections.Immutable.8.0.0\lib\net462\System.Collections.Immutable.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.IO.Compression" />
|
||||
<Reference Include="System.IO.Packaging, Version=8.0.0.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.IO.Packaging.8.0.1\lib\net462\System.IO.Packaging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Management" />
|
||||
<Reference Include="System.Memory, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Memory.4.6.0\lib\net462\System.Memory.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Net.Http.Formatting, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebApi.Client.6.0.0\lib\net45\System.Net.Http.Formatting.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Numerics.Vectors, Version=4.1.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Numerics.Vectors.4.6.0\lib\net462\System.Numerics.Vectors.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.1.0\lib\net462\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.Security" />
|
||||
<Reference Include="System.Security.Cryptography.Pkcs, Version=8.0.0.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Security.Cryptography.Pkcs.8.0.1\lib\net462\System.Security.Cryptography.Pkcs.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.Text.Encodings.Web, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Text.Encodings.Web.8.0.0\lib\net462\System.Text.Encodings.Web.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Text.Json, Version=8.0.0.5, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Text.Json.8.0.5\lib\net462\System.Text.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Transactions" />
|
||||
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.XML.Linq" />
|
||||
<Reference Include="WindowsBase" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>powershell.exe -command "& { &'$(SolutionDir)copy-binary.ps1' '$(TargetPath)' '$(TargetFileName)' '$(ConfigurationName)' '$(ProjectName)' }"</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<Import Project="..\packages\GdPicture.runtimes.windows.14.3.3\build\net462\GdPicture.runtimes.windows.targets" Condition="Exists('..\packages\GdPicture.runtimes.windows.14.3.3\build\net462\GdPicture.runtimes.windows.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}".</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\GdPicture.runtimes.windows.14.3.3\build\net462\GdPicture.runtimes.windows.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\GdPicture.runtimes.windows.14.3.3\build\net462\GdPicture.runtimes.windows.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -12,8 +12,8 @@ Imports System.Runtime.InteropServices
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("Digital Data")>
|
||||
<Assembly: AssemblyProduct("Modules.Jobs")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2024")>
|
||||
<Assembly: AssemblyTrademark("2.4.0.0")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2025")>
|
||||
<Assembly: AssemblyTrademark("2.9.3.0")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
@@ -30,5 +30,5 @@ Imports System.Runtime.InteropServices
|
||||
' Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
|
||||
<Assembly: AssemblyVersion("2.4.0.0")>
|
||||
<Assembly: AssemblyFileVersion("2.4.0.0")>
|
||||
<Assembly: AssemblyVersion("2.9.4.0")>
|
||||
<Assembly: AssemblyFileVersion("2.9.4.0")>
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Base
|
||||
Imports System.Collections.Generic
|
||||
Imports System.Data
|
||||
Imports System.IO
|
||||
Imports System.Data.SqlClient
|
||||
Imports System.Collections.Generic
|
||||
Imports System.IO
|
||||
Imports DigitalData.Modules.Base
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Interfaces.PropertyValues
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Namespace ZUGFeRD
|
||||
Public Class EmailFunctions
|
||||
@@ -18,7 +19,133 @@ Namespace ZUGFeRD
|
||||
_mssql = MSSQL
|
||||
End Sub
|
||||
|
||||
Public Sub AddToEmailQueueMSSQL(MessageId As String, BodyText As String, pEmailData As EmailData, SourceProcedure As String, pEmailAccountId As Integer, NamePortal As String)
|
||||
''' <summary>
|
||||
''' Method to decide wether we use the old or the new
|
||||
''' Rejection E-mail method.
|
||||
'''
|
||||
''' TODO we have no information about the language of the receiver at the moment
|
||||
''' </summary>
|
||||
''' <param name="pMessageId">E-Mail Message ID</param>
|
||||
''' <param name="pTransaction">DB Transaction</param>
|
||||
''' <param name="pBodyText">Body Text</param>
|
||||
''' <param name="pEmailData">Email Data object</param>
|
||||
''' <param name="pSourceProcedure">Exception Title</param>
|
||||
''' <param name="pEmailAccountId">Sending Profile from config</param>
|
||||
''' <param name="pNamePortal">Name of the Portal from config</param>
|
||||
''' <param name="pTemplateId">ID for E-Mail-Template from config</param>
|
||||
''' <param name="pErrorCode">Error Code</param>
|
||||
''' <param name="pParameter1">Zusätzlicher Parameter 1</param>
|
||||
''' <param name="pParameter2">Zusätzlicher Parameter 2</param>
|
||||
Public Sub AddToEmailQueueMSSQL(pMessageId As String, pTransaction As SqlTransaction, pBodyText As String, pEmailData As EmailData, pSourceProcedure As String,
|
||||
pEmailAccountId As Integer, pNamePortal As String, pTemplateId As Integer, pErrorCode As ErrorCode,
|
||||
pParameter1 As String, pParameter2 As String)
|
||||
|
||||
Dim useLegacyMethod = True
|
||||
Dim oErrorCode As String = String.Empty
|
||||
|
||||
' ErrorCode valid?
|
||||
If pErrorCode <> ErrorCode.Unknown Then
|
||||
Dim intCode As Integer = DirectCast(pErrorCode, Integer)
|
||||
oErrorCode = $"{EmailStrings.ErrorCodePraefix}{intCode}"
|
||||
|
||||
Dim oSQL = $"SELECT COUNT(*) FROM TBDD_GUI_LANGUAGE_PHRASE WHERE TITLE = '{oErrorCode}'"
|
||||
If _mssql.GetScalarValue(oSQL) > 0 Then
|
||||
useLegacyMethod = False
|
||||
Else
|
||||
_logger.Warn($"Rejection reason [{oErrorCode}] not found in TBDD_GUI_LANGUAGE_PHRASE!")
|
||||
End If
|
||||
End If
|
||||
|
||||
' Gibt es das Template in TBDD_EMAIL_TEMPLATE?
|
||||
If useLegacyMethod = False AndAlso pTemplateId > 0 Then
|
||||
Try
|
||||
Dim oSQL = $"SELECT COUNT(*) FROM TBDD_EMAIL_TEMPLATE WHERE GUID = {pTemplateId}"
|
||||
If _mssql.GetScalarValue(oSQL) <= 0 Then
|
||||
_logger.Warn($"EMAIL_TEMPLATE [{pTemplateId}] not found in TBDD_EMAIL_TEMPLATE!")
|
||||
useLegacyMethod = True
|
||||
End If
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
useLegacyMethod = True
|
||||
End Try
|
||||
|
||||
Else
|
||||
_logger.Debug($"RejectionTemplateId not configured!")
|
||||
useLegacyMethod = True
|
||||
End If
|
||||
|
||||
' Check if Stored Procedure PRDD_SEND_REJECTION_MAIL exists
|
||||
If useLegacyMethod = False Then
|
||||
Try
|
||||
Dim oSQL = $"SELECT COUNT(*) FROM sys.objects WHERE type = 'P' AND OBJECT_ID = OBJECT_ID('dbo.PRDD_SEND_REJECTION_MAIL')"
|
||||
If _mssql.GetScalarValue(oSQL) <= 0 Then
|
||||
_logger.Warn($"Procedure ['PRDD_SEND_REJECTION_MAIL'] not found in Database!")
|
||||
useLegacyMethod = True
|
||||
End If
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
useLegacyMethod = True
|
||||
End Try
|
||||
End If
|
||||
|
||||
If useLegacyMethod = True Then
|
||||
_logger.Warn("New rejection mail logic is not configured correctly, use legacy logic instead!")
|
||||
AddToEmailQueueMSSQL(pMessageId, pBodyText, pEmailData, pSourceProcedure, pEmailAccountId, pNamePortal)
|
||||
Else
|
||||
_logger.Debug("New rejection mail logic is configured!")
|
||||
AddToEmailQueueMSSQL(pMessageId, pTransaction, pTemplateId, oErrorCode, pEmailAccountId, pParameter1, pParameter2)
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
''' <summary>
|
||||
''' Function calls SP PRDD_SEND_REJECTION_MAIL
|
||||
''' for sending rejection mail.
|
||||
''' </summary>
|
||||
''' <param name="pMessageId">E-Mail Message ID</param>
|
||||
''' <param name="pTransaction">DB Transaction</param>
|
||||
''' <param name="pTemplateId">GUID for TBDD_EMAIL_TEMPLATE from config</param>
|
||||
''' <param name="pErrorCode">ErrorID (TBDD_GUI_LANGUAGE_PHRASE)</param>
|
||||
''' <param name="pEmailAccountId">Sending profile from config</param>
|
||||
''' <param name="pParameter1">Zusätzlicher Parameter 1</param>
|
||||
''' <param name="pParameter2">Zusätzlicher Parameter 2</param>
|
||||
Private Sub AddToEmailQueueMSSQL(pMessageId As String, pTransaction As SqlTransaction, pTemplateId As Integer, pErrorCode As String, pEmailAccountId As Integer,
|
||||
pParameter1 As String, pParameter2 As String)
|
||||
|
||||
If pParameter1.IsNullOrEmpty Then
|
||||
pParameter1 = ""
|
||||
Else
|
||||
pParameter1 = pParameter1.Replace("'", "''")
|
||||
End If
|
||||
|
||||
If pParameter2.IsNullOrEmpty Then
|
||||
pParameter2 = ""
|
||||
Else
|
||||
pParameter2 = pParameter2.Replace("'", "''")
|
||||
End If
|
||||
|
||||
Try
|
||||
Dim oExecute = $"EXECUTE dbo.PRDD_SEND_REJECTION_MAIL
|
||||
'{pMessageId}'
|
||||
, 0
|
||||
, {pEmailAccountId}
|
||||
, 'ZUGFeRD Service'
|
||||
, {pTemplateId}
|
||||
, '{pErrorCode}'
|
||||
, '{pParameter1}'
|
||||
, '{pParameter2}'
|
||||
, 77"
|
||||
|
||||
_mssql.ExecuteNonQuery(oExecute, pTransaction)
|
||||
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub AddToEmailQueueMSSQL(MessageId As String, BodyText As String, pEmailData As EmailData, SourceProcedure As String, pEmailAccountId As Integer, NamePortal As String)
|
||||
If pEmailData Is Nothing Then
|
||||
_logger.Warn("EmailData is empty. Email will not be sent!")
|
||||
Exit Sub
|
||||
@@ -146,7 +273,7 @@ Namespace ZUGFeRD
|
||||
Return oRandomValue
|
||||
End Function
|
||||
|
||||
Public Function CreateBodyForMissingProperties(OriginalFilename As String, MissingProperties As List(Of String)) As String
|
||||
Public Function CreateBodyForMissingProperties(OriginalFilename As String, MissingProperties As List(Of MissingProperty)) As String
|
||||
Dim oBody = String.Format(EmailStrings.EMAIL_MISSINGPROPERTIES_1, OriginalFilename)
|
||||
|
||||
If MissingProperties.Count > 0 Then
|
||||
@@ -155,7 +282,7 @@ Namespace ZUGFeRD
|
||||
oBody &= $"{vbNewLine}{vbNewLine}"
|
||||
|
||||
For Each prop In MissingProperties
|
||||
oBody &= $"- {prop}"
|
||||
oBody &= $"- {prop.Description}"
|
||||
Next
|
||||
End If
|
||||
|
||||
|
||||
@@ -3,31 +3,40 @@
|
||||
Public Const EMAIL_WRAPPING_TEXT = "<html><body style=''font-family:""Arial"";font-size:10.0pt''>Sehr geehrte Damen und Herren,<br/><br/>
|
||||
das @NAME_ZUGFERD_PORTAL zur Verarbeitung der Eingangsrechnungen im ZUGFeRD-Format konnte die von Ihnen gesandte Rechnung
|
||||
leider nicht verarbeiten! <br><br> Grund: {0}<p>Bitte prüfen Sie die Datei und nehmen Sie bei Bedarf mit uns Kontakt auf.<p>
|
||||
Vielen Dank für Ihr Verständnis.<br>Mit freundlichen Grüßen<br>Ihre IT-Abteilung</body></html>"
|
||||
Vielen Dank für Ihr Verständnis.<br>Mit freundlichen Grüßen<br>Ihre WISAG</body></html>"
|
||||
Public Const EMAIL_SUBJECT_TEXT = "<p>Der Betreff der Original-Email war: <em>{0}</em></p>"
|
||||
|
||||
Public Const EMAIL_SUBJECT_REJECTED = "@NAME_ZUGFERD_PORTAL: Beleg abgelehnt"
|
||||
Public Const EMAIL_SUBJECT_EXCEPTION = "@NAME_ZUGFERD_PORTAL: Unbehandelte Ausnahme"
|
||||
|
||||
' OutOfMemoryException = 20009
|
||||
' UnhandledException = 20010
|
||||
' FileMoveException = 200011
|
||||
Public Const EMAIL_UNHANDLED_EXCEPTION = """
|
||||
<p>Beim Verarbeiten der Datei mit der Message ID '{0}' ist ein schwerer Fehler aufgetreten.</p>
|
||||
<p>Fehlerbeschreibung: {1}</p>
|
||||
<pre>{2}</pre>
|
||||
"""
|
||||
|
||||
' MissingValueException = 20007
|
||||
Public Const EMAIL_MISSINGPROPERTIES_1 = "<p>Die angehängte Datei entspricht nicht dem WISAG ZUGFeRD-Format: {0}</p>"
|
||||
Public Const EMAIL_MISSINGPROPERTIES_2 = "<p>Die folgenden Eigenschaften wurden als ERFORDERLICH eingestuft, wurden aber nicht gefunden:<p/>"
|
||||
Public Const EMAIL_MISSINGPROPERTIES_2 = "<p>Die folgenden Eigenschaften wurden als ERFORDERLICH eingestuft, wurden aber nicht gefunden:</p>"
|
||||
|
||||
' MD5HashException = 20002
|
||||
Public Const EMAIL_MD5_ERROR = "<p>Die von Ihnen gesendete Rechnung ({0}) wurde bereits von unserem System verarbeitet.</p>"
|
||||
|
||||
' ValidationException = 20001
|
||||
Public Const EMAIL_VALIDATION_ERROR = "
|
||||
<p>Die von Ihnen gesendete Rechnung hat die ZUGFeRD Validierung nicht bestanden.</p>
|
||||
<p>Die folgenden Felder sind nicht korrekt:<ul>{0}</ul></p>"
|
||||
|
||||
' TooMuchFerdsException = 20005
|
||||
Public Const EMAIL_TOO_MUCH_FERDS = "<p>In Ihrer Email ({0}) sind mehr als ein ZUGFeRD Dokument enthalten. Bitte prüfen Sie die Rechnungsanhänge. Nur eine Rechnung darf das ZUGFeRD-Format enthalten.</p>"
|
||||
|
||||
' NoFerdsException = 20006
|
||||
Public Const EMAIL_NO_FERDS = "<p>Ihre Email ({0}) enthielt keine ZUGFeRD-Dokumente.</p>"
|
||||
|
||||
' FileSizeLimitReachedException = 20008
|
||||
Public Const EMAIL_FILE_SIZE_REACHED = "
|
||||
<p>Die von Ihnen gesendete Rechnung oder einer der Rechnungs-Anhänge überschreitet die erlaubte Größe von <strong>{0} MB</strong>.</p>
|
||||
<p>Die folgende Datei hat die erlaubte Größe überschritten:<ul>
|
||||
@@ -35,14 +44,23 @@
|
||||
</ul></p>
|
||||
"
|
||||
|
||||
' InvalidFerdException = 20004
|
||||
Public Const EMAIL_INVALID_DOCUMENT = "
|
||||
<p>Ihre Email ({0}) enthielt ein ZUGFeRD Dokument, welches aber inkorrekt formatiert wurde.</p>
|
||||
<p>Mögliche Gründe für ein inkorrektes Format:<ul>
|
||||
<li>Betrags-Werte weisen ungültiges Format auf (z.B. 25,01 anstatt 25.01)</li>
|
||||
<p>Mögliche Gründe für ein inkorrektes Format sind:<ul>
|
||||
<li>Betragswerte weisen ein ungültiges Format auf (z.B. 25,01 anstatt 25.01)</li>
|
||||
<li>Eins der folgenden Zeichen wird nicht XML-codiert verwendet: &, <, > oder ".</li>
|
||||
</ul></p>
|
||||
"
|
||||
|
||||
' UnsupportedFerdException = 20003
|
||||
Public Const EMAIL_UNSUPPORTED_DOCUMENT = "
|
||||
<p>Ihre Email ({0}) enthielt ein ZUGFeRD Format ({1}), welches zur Zeit noch nicht freigeschaltet ist.</p>
|
||||
"
|
||||
|
||||
''' <summary>
|
||||
''' Präfix für den verwendeten ErrorCode
|
||||
''' Beispiel: ZUGFERD_Rejection_20001
|
||||
''' </summary>
|
||||
Public Const ErrorCodePraefix = "ZUGFERD_Rejection_"
|
||||
End Class
|
||||
|
||||
14
Jobs/ZUGFeRD/ErrorCode.vb
Normal file
14
Jobs/ZUGFeRD/ErrorCode.vb
Normal file
@@ -0,0 +1,14 @@
|
||||
Public Enum ErrorCode
|
||||
Unknown = 0
|
||||
ValidationException = 20001
|
||||
MD5HashException = 20002
|
||||
UnsupportedFerdException = 20003
|
||||
InvalidFerdException = 20004
|
||||
TooMuchFerdsException = 20005
|
||||
NoFerdsException = 20006
|
||||
MissingValueException = 20007
|
||||
FileSizeLimitReachedException = 20008
|
||||
OutOfMemoryException = 20009
|
||||
UnhandledException = 20010
|
||||
FileMoveException = 200011
|
||||
End Enum
|
||||
@@ -80,7 +80,6 @@ Namespace ZUGFeRD
|
||||
For Each oFile In pAttachmentFiles
|
||||
Try
|
||||
Dim oFilePath = _filesystem.GetVersionedFilename(Path.Combine(oAttachmentDirectory, oFile.Name))
|
||||
|
||||
_filesystem.MoveTo(oFile.FullName, oFilePath, oAttachmentDirectory)
|
||||
_logger.Info("Attachment moved to {0}", oFilePath)
|
||||
Catch ex As Exception
|
||||
@@ -98,11 +97,22 @@ Namespace ZUGFeRD
|
||||
If Not File.Exists(oAttachmentDirectory) Then
|
||||
Directory.CreateDirectory(oAttachmentDirectory)
|
||||
End If
|
||||
System.IO.File.WriteAllBytes(oFilePath, oResult.FileContents)
|
||||
If CheckBytes(oFilePath, oResult.FileContents) = True Then
|
||||
If FileOpenwithError(oFilePath) Then
|
||||
_logger.Info("Embedded Attachment moved to {0}", oFilePath)
|
||||
Else
|
||||
_logger.Info("File is corrupt. Deleting the created file ...")
|
||||
File.Delete(oFilePath)
|
||||
End If
|
||||
Else
|
||||
_logger.Info("File is corrupt (CheckBytes). Deleting the created file ...")
|
||||
File.Delete(oFilePath)
|
||||
End If
|
||||
'Using oWriter As New FileStream(oFilePath, FileMode.Create)
|
||||
' oWriter.Write(oResult.FileContents, 0, oResult.FileContents.Length)
|
||||
|
||||
Using oWriter As New FileStream(oFilePath, FileMode.Create)
|
||||
oWriter.Write(oResult.FileContents, 0, oResult.FileContents.Length)
|
||||
_logger.Info("Embedded Attachment moved to {0}", oFilePath)
|
||||
End Using
|
||||
'End Using
|
||||
Catch ex As Exception
|
||||
_logger.Warn("Could not save embedded attachment {0}", oResult.FileName)
|
||||
_logger.Error(ex)
|
||||
@@ -111,7 +121,15 @@ Namespace ZUGFeRD
|
||||
|
||||
_logger.Info("Finished moving files")
|
||||
End Sub
|
||||
Private Function CheckBytes(oFilePath As String, oFileContents As IEnumerable(Of Byte)) As Boolean
|
||||
Dim savedBytes() As Byte = System.IO.File.ReadAllBytes(oFilePath)
|
||||
|
||||
If savedBytes.SequenceEqual(oFileContents) Then
|
||||
Return True
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
End Function
|
||||
Public Function MoveAndRenameEmailToRejected(pArgs As WorkerArgs, pMessageId As String) As EmailData
|
||||
_logger.Info("Moving Mail with MessageId [{0}] to Rejected folder", pMessageId)
|
||||
_logger.Debug("Fetching Email Data")
|
||||
@@ -122,6 +140,11 @@ Namespace ZUGFeRD
|
||||
Dim oSource = _email.GetOriginalEmailPath(pArgs.OriginalEmailDirectory, pMessageId)
|
||||
_logger.Debug("Original email path: [{0}]", oSource)
|
||||
|
||||
If oSource = String.Empty Then
|
||||
_logger.Warn("Original Email for [{0}] could not be found. Exiting.", pMessageId)
|
||||
Return New EmailData()
|
||||
End If
|
||||
|
||||
Dim oDateSubDirectoryName As String = Now.ToString("yyyy-MM-dd")
|
||||
Dim oDestination As String
|
||||
|
||||
@@ -137,11 +160,6 @@ Namespace ZUGFeRD
|
||||
End Try
|
||||
End If
|
||||
|
||||
If oSource = String.Empty Then
|
||||
_logger.Warn("Original Email for [{0}] could not be found. Exiting.", pMessageId)
|
||||
Return New EmailData()
|
||||
End If
|
||||
|
||||
' If oEmailData is Nothing, TBEDM_EMAIL_PROFILER_HISTORY for MessageId was not found.
|
||||
' This only should happen when testing and db-tables are deleted frequently
|
||||
If oEmailData Is Nothing Then
|
||||
@@ -177,7 +195,19 @@ Namespace ZUGFeRD
|
||||
|
||||
Return oEmailData
|
||||
End Function
|
||||
|
||||
Private Function FileOpenwithError(pFilePath As String) As Boolean
|
||||
Try
|
||||
Using fs As FileStream = File.Open(pFilePath, FileMode.Open, FileAccess.Read, FileShare.None)
|
||||
Return True ' Datei kann geöffnet werden
|
||||
End Using
|
||||
Catch ex As IOException
|
||||
_logger.Info("file [{0}] could not be opened! Error IOException: [{1}]", pFilePath, ex.Message)
|
||||
Return False ' Datei ist gesperrt oder existiert nicht
|
||||
Catch ex As Exception
|
||||
_logger.Info("file [{0}] could not be opened! Error: [{1}]", pFilePath, ex.Message)
|
||||
Return False ' Andere Fehler
|
||||
End Try
|
||||
End Function
|
||||
Public Function GetEmailPathWithSubjectAsName(RejectedEmailDirectory As String, UncleanedSubject As String) As String
|
||||
Dim oCleanSubject = String.Join("", UncleanedSubject.Split(Path.GetInvalidPathChars()))
|
||||
Dim oAttachmentDirectory = RejectedEmailDirectory
|
||||
|
||||
@@ -72,12 +72,7 @@ Public Class HashFunctions
|
||||
|
||||
End Try
|
||||
|
||||
' Try to get the original filename from Attachment table
|
||||
' If this fails, falls back to the new filename (<msgid>~Attm<i>.ext)
|
||||
Dim oSQL = $"SELECT EMAIL_ATTMT FROM TBEMLP_HISTORY_ATTACHMENT WHERE EMAIL_ATTMT_INDEX = '{pFile.Name}'"
|
||||
Dim oEmailAttachment = Database.GetScalarValue(oSQL, MSSQLServer.TransactionMode.NoTransaction)
|
||||
Dim oOriginalName = ObjectEx.NotNull(oEmailAttachment, pFile.Name)
|
||||
|
||||
Dim oOriginalName As Object = GetOriginalFilename(pFile.Name)
|
||||
Logger.Info("File with MessageId [{0}] and Filename [{1}] has already been processed.", pMessageId, oOriginalName)
|
||||
|
||||
' If the file was already rejected, it is allowed to be processed again,
|
||||
@@ -101,6 +96,15 @@ Public Class HashFunctions
|
||||
Return oMD5CheckSum
|
||||
End Function
|
||||
|
||||
Public Function GetOriginalFilename(pFilename As String) As String
|
||||
' Try to get the original filename from Attachment table
|
||||
' If this fails, falls back to the new filename (<msgid>~Attm<i>.ext)
|
||||
Dim oSQL = $"SELECT EMAIL_ATTMT FROM TBEMLP_HISTORY_ATTACHMENT WHERE EMAIL_ATTMT_INDEX = '{pFilename}'"
|
||||
Dim oEmailAttachment = Database.GetScalarValue(oSQL, MSSQLServer.TransactionMode.NoTransaction)
|
||||
Dim oOriginalName = ObjectEx.NotNull(oEmailAttachment, pFilename)
|
||||
Return oOriginalName
|
||||
End Function
|
||||
|
||||
Private Function CreateMD5(pFilename As String) As String
|
||||
Try
|
||||
Dim oMD5 As New MD5CryptoServiceProvider
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
Imports System.Data.SqlClient
|
||||
Imports System.ServiceModel.Channels
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports Microsoft.VisualBasic.FileIO
|
||||
|
||||
Namespace ZUGFeRD
|
||||
Public Class HistoryFunctions
|
||||
@@ -30,7 +27,8 @@ Namespace ZUGFeRD
|
||||
MD5HASH = '{pMD5Checksum}'
|
||||
WHERE EMAIL_MSGID = '{pMessageId}'"
|
||||
|
||||
If pMessage.Contains("REJECTED") Then
|
||||
'If pMessage.Contains("REJECTED") Then
|
||||
If pMessage.Contains(EmailStrings.ErrorCodePraefix) Then
|
||||
oSQL = $"UPDATE TBEMLP_HISTORY SET
|
||||
COMMENT = '{pMessage}',
|
||||
MD5HASH = '{pMD5Checksum}',
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
Imports System.Collections.Generic
|
||||
Imports System.Data
|
||||
Imports System.Data.SqlClient
|
||||
Imports System.IO
|
||||
Imports System.Linq
|
||||
Imports System.Security.Cryptography
|
||||
Imports DigitalData.Modules.Base
|
||||
Imports DigitalData.Modules.Config
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Interfaces
|
||||
Imports DigitalData.Modules.Interfaces.Exceptions
|
||||
Imports DigitalData.Modules.Interfaces.PropertyValues
|
||||
Imports DigitalData.Modules.Jobs.Exceptions
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports System.Data.SqlClient
|
||||
|
||||
Public Class ImportZUGFeRDFiles
|
||||
Implements IJob
|
||||
@@ -40,11 +41,15 @@ Public Class ImportZUGFeRDFiles
|
||||
Private ReadOnly _hash As HashFunctions
|
||||
Private ReadOnly _embeds As PDFEmbeds
|
||||
|
||||
Private ReadOnly _gdpictureLicenseKey As String
|
||||
Private SQL_xRechnung_ItemTemplate As String = ""
|
||||
|
||||
Private ReadOnly _gdpictureLicenseKey As String
|
||||
Private ReadOnly _xRechnungCreator As XRechnungViewDocument
|
||||
Private _zugferd As ZUGFeRDInterface
|
||||
Private _EmailOutAccountId As Integer
|
||||
|
||||
Private MyTemplateValues_xInvDT As DataTable
|
||||
|
||||
Private Class ProcessFileResult
|
||||
Public ZugferdFileFound As Boolean = False
|
||||
|
||||
@@ -70,11 +75,10 @@ Public Class ImportZUGFeRDFiles
|
||||
_history = New ZUGFeRD.HistoryFunctions(LogConfig, _mssql)
|
||||
_embeds = New PDFEmbeds(LogConfig)
|
||||
_hash = New HashFunctions(_logConfig, _mssql)
|
||||
|
||||
_xRechnungCreator = New XRechnungViewDocument(_logConfig, _mssql, _gdpictureLicenseKey)
|
||||
_logger.Debug("Registering GDPicture License")
|
||||
If _mssql IsNot Nothing Then
|
||||
Dim oSQL = "SELECT LICENSE FROM TBDD_3RD_PARTY_MODULES WHERE NAME = 'GDPICTURE'"
|
||||
_gdpictureLicenseKey = _mssql.GetScalarValue(oSQL)
|
||||
_gdpictureLicenseKey = ConfigDbFunct.GetProductLicense("GDPICTURE", "11.2024", _logConfig, _mssql.CurrentConnectionString)
|
||||
Else
|
||||
_logger.Warn("GDPicture License could not be registered! MSSQL is not enabled!")
|
||||
Throw New ArgumentNullException("MSSQL")
|
||||
@@ -83,17 +87,22 @@ Public Class ImportZUGFeRDFiles
|
||||
|
||||
Public Sub Start(Arguments As Object) Implements IJob.Start
|
||||
Dim oArgs As WorkerArgs = Arguments
|
||||
Dim oPropertyExtractor = New PropertyValues(_logConfig)
|
||||
Dim oAttachmentExtractor = New PDFEmbeds(_logConfig)
|
||||
|
||||
_EmailOutAccountId = oArgs.EmailOutProfileId
|
||||
|
||||
_zugferd = New ZUGFeRDInterface(_logConfig, _gdpictureLicenseKey, New ZUGFeRDInterface.ZugferdOptions() With {
|
||||
.AllowFacturX_Filename = oArgs.AllowFacturX,
|
||||
.AllowXRechnung_Filename = oArgs.AllowXRechnung
|
||||
.AllowXRechnung_Filename = oArgs.AllowXRechnung,
|
||||
.AllowPeppol_3_x_Schema = oArgs.AllowPeppolBISBill3x
|
||||
})
|
||||
|
||||
_logger.Debug("Starting Job {0}", [GetType].Name)
|
||||
If oArgs.AllowXRechnung Then
|
||||
' TODO - Config-Schalter hat NIX mit XRechnung-Dateien u. Sichtbelegen zu tun, sondern nur mit Dateinamen zu tun.
|
||||
Dim oSQL = "SELECT SQL_COMMAND FROM TBDD_SQL_COMMANDS WHERE TITLE = 'VWDD_ZUGFERD_VIEW_RECEIPT_TEMPLATE_ITEMS'"
|
||||
SQL_xRechnung_ItemTemplate = _mssql.GetScalarValue(oSQL)
|
||||
End If
|
||||
|
||||
Try
|
||||
'For Each oPath As String In oArgs.WatchDirectory
|
||||
@@ -123,14 +132,16 @@ Public Class ImportZUGFeRDFiles
|
||||
' Group files by messageId
|
||||
Dim oGrouped As Dictionary(Of String, List(Of FileInfo)) = _zugferd.FileGroup.GroupFiles(oFiles)
|
||||
|
||||
_logger.Info("Found {0} file groups", oGrouped.Count)
|
||||
_logger.Info("Found [{0}] file groups", oGrouped.Count)
|
||||
|
||||
' Process each file group together
|
||||
'Process each file group together
|
||||
'oGrouped equals one e-invoice
|
||||
For Each oFileGroup In oGrouped
|
||||
' Start a new transaction for each file group.
|
||||
' This way we can rollback database changes for the whole filegroup in case something goes wrong.
|
||||
|
||||
Dim oSQLConnection As SqlConnection = _mssql.GetConnection()
|
||||
|
||||
|
||||
Dim oSQLTransaction As SqlTransaction = oSQLConnection?.BeginTransaction()
|
||||
|
||||
Dim oConnections As New DatabaseConnections() With {
|
||||
@@ -153,7 +164,7 @@ Public Class ImportZUGFeRDFiles
|
||||
Dim oExpectedError As Boolean = True
|
||||
|
||||
' Create file lists
|
||||
Dim oFileGroupFiles As List(Of FileInfo) = oFileGroup.Value
|
||||
Dim oEInvoiceFileGroup As List(Of FileInfo) = oFileGroup.Value
|
||||
Dim oEmailAttachmentFiles As New List(Of FileInfo)
|
||||
Dim oEmbeddedAttachmentFiles As New List(Of PDFEmbeds.EmbeddedFile)
|
||||
|
||||
@@ -162,16 +173,25 @@ Public Class ImportZUGFeRDFiles
|
||||
|
||||
_logger.Info("START processing file group {0}", oMessageId)
|
||||
|
||||
If _file.CheckFileAge(oFileGroupFiles, oArgs.MinFileAgeInMinutes) Then
|
||||
If _file.CheckFileAge(oEInvoiceFileGroup, oArgs.MinFileAgeInMinutes) Then
|
||||
_logger.Info("At least one file was created less than [{0}] minutes ago. Skipping file group.", oArgs.MinFileAgeInMinutes)
|
||||
Continue For
|
||||
End If
|
||||
|
||||
Dim oEmailDataBase = _email.GetEmailDataForMessageId(oMessageId)
|
||||
Dim oFileCounter As Integer = 0
|
||||
|
||||
Try
|
||||
For Each oFile In oFileGroupFiles
|
||||
Dim oResult As ProcessFileResult = ProcessFile(oMessageId, oEmailDataBase, oZUGFeRDCount, oFile, oConnections, oArgs)
|
||||
|
||||
For Each oFile In oEInvoiceFileGroup
|
||||
oFileCounter += 1
|
||||
Dim oResult As ProcessFileResult
|
||||
|
||||
If oFileCounter = 1 AndAlso oFile.Name.ToUpper.EndsWith(".XML") Then
|
||||
oResult = ProcessXMLFile(oMessageId, oZUGFeRDCount, oFile, oConnections, oArgs)
|
||||
Else
|
||||
oResult = ProcessFile(oMessageId, oZUGFeRDCount, oFile, oConnections, oArgs)
|
||||
End If
|
||||
|
||||
If oResult.ZugferdFileFound = True Then
|
||||
_logger.Debug("Zugferd File found")
|
||||
@@ -217,114 +237,131 @@ Public Class ImportZUGFeRDFiles
|
||||
Catch ex As ValidationException
|
||||
_logger.Error(ex)
|
||||
|
||||
Dim oErrors = ex.ValidationErrors
|
||||
Dim oMessage = "REJECTED - ZUGFeRD yes but formal validation failed!"
|
||||
_history.Update_HistoryEntry(oMessageId, oMD5CheckSum, oMessage)
|
||||
Dim oRejectionCodeString = GetRejectionCodeString(oMessageId, ErrorCode.ValidationException)
|
||||
|
||||
'Dim oMessage = "REJECTED - ZUGFeRD yes but formal validation failed!"
|
||||
_history.Update_HistoryEntry(oMessageId, oMD5CheckSum, oRejectionCodeString)
|
||||
|
||||
Dim oErrors = ex.ValidationErrors
|
||||
Dim oErrorList As String = ""
|
||||
Dim oErrorListDE As String = ""
|
||||
For Each oError In oErrors
|
||||
oErrorList += $"<li>Element '{oError.ElementName}' mit Wert '{oError.ElementValue}': {oError.ErrorMessage}</li>"
|
||||
oErrorList += $"<li>Element '{oError.ElementName}' with Value '{oError.ElementValue}': {oError.ErrorMessage}</li>"
|
||||
oErrorListDE += $"<li>Element '{oError.ElementName}' mit Wert '{oError.ElementValue}': {oError.ErrorMessageDE}</li>"
|
||||
Next
|
||||
|
||||
Dim oBody = String.Format(EmailStrings.EMAIL_VALIDATION_ERROR, oErrorList)
|
||||
Dim oEmailData = _file.MoveAndRenameEmailToRejected(oArgs, oMessageId)
|
||||
_email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "ValidationException", _EmailOutAccountId, oArgs.NamePortal)
|
||||
AddRejectedState(oMessageId, "ValidationException", "Die Rechnungsvalidierung ist fehlgeschlagen!", "", oSQLTransaction)
|
||||
_email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "ValidationException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.ValidationException, oErrorListDE, oErrorList)
|
||||
AddRejectedState(oMessageId, oRejectionCodeString, "Die Rechnungsvalidierung ist fehlgeschlagen!", "", oSQLTransaction)
|
||||
|
||||
Catch ex As MD5HashException
|
||||
_logger.Error(ex)
|
||||
|
||||
Dim oRejectionCodeString = GetRejectionCodeString(oMessageId, ErrorCode.MD5HashException)
|
||||
|
||||
' When MD5HashException is thrown, we don't have a MD5Hash yet.
|
||||
' That 's why we set it to String.Empty here.
|
||||
Dim oMessage = "REJECTED - Already processed (MD5Hash)"
|
||||
_history.Update_HistoryEntry(oMessageId, String.Empty, oMessage)
|
||||
' Thats why we set it to String.Empty here.
|
||||
'Dim oMessage = "REJECTED - Already processed (MD5Hash)"
|
||||
_history.Update_HistoryEntry(oMessageId, String.Empty, oRejectionCodeString)
|
||||
|
||||
Dim oBody = String.Format(EmailStrings.EMAIL_MD5_ERROR, ex.FileName)
|
||||
Dim oEmailData = _file.MoveAndRenameEmailToRejected(oArgs, oMessageId)
|
||||
_email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "MD5HashException", _EmailOutAccountId, oArgs.NamePortal)
|
||||
AddRejectedState(oMessageId, "MD5HashException", "Die gesendete Rechnung wurde bereits verarbeitet!", "", oSQLTransaction)
|
||||
_email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "MD5HashException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.MD5HashException, ex.FileName, "")
|
||||
AddRejectedState(oMessageId, oRejectionCodeString, "Die gesendete Rechnung wurde bereits verarbeitet!", "", oSQLTransaction)
|
||||
|
||||
Catch ex As UnsupportedFerdException
|
||||
_logger.Error(ex)
|
||||
|
||||
Dim oRejectionCodeString = GetRejectionCodeString(oMessageId, ErrorCode.UnsupportedFerdException)
|
||||
|
||||
' When UnsupportedFerdException is thrown, we don't have a MD5Hash yet.
|
||||
' That 's why we set it to String.Empty here.
|
||||
_history.Update_HistoryEntry(oMessageId, String.Empty, "REJECTED - ZUGFeRD yes but unsupported format")
|
||||
' Thats why we set it to String.Empty here.
|
||||
_history.Update_HistoryEntry(oMessageId, String.Empty, oRejectionCodeString)
|
||||
|
||||
Dim oEmailData = _file.MoveAndRenameEmailToRejected(oArgs, oMessageId)
|
||||
Dim oBody As String = String.Format(EmailStrings.EMAIL_UNSUPPORTED_DOCUMENT, oEmailData.Subject, ex.XmlFile)
|
||||
|
||||
_email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "UnsupportedFerdException", _EmailOutAccountId, oArgs.NamePortal)
|
||||
AddRejectedState(oMessageId, "UnsupportedFerdException", "Nicht unterstütztes Datenformat", "", oSQLTransaction)
|
||||
_email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "UnsupportedFerdException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.UnsupportedFerdException, ex.XmlFile, "")
|
||||
AddRejectedState(oMessageId, oRejectionCodeString, "Nicht unterstütztes Datenformat", "", oSQLTransaction)
|
||||
|
||||
Catch ex As InvalidFerdException
|
||||
_logger.Error(ex)
|
||||
|
||||
Dim oRejectionCodeString = GetRejectionCodeString(oMessageId, ErrorCode.InvalidFerdException)
|
||||
|
||||
' When InvalidFerdException is thrown, we don't have a MD5Hash yet.
|
||||
' That 's why we set it to String.Empty here.
|
||||
_history.Update_HistoryEntry(oMessageId, String.Empty, "REJECTED - ZUGFeRD yes but incorrect format")
|
||||
' Thats why we set it to String.Empty here.
|
||||
_history.Update_HistoryEntry(oMessageId, String.Empty, oRejectionCodeString)
|
||||
|
||||
Dim oEmailData = _file.MoveAndRenameEmailToRejected(oArgs, oMessageId)
|
||||
Dim oBody = String.Format(EmailStrings.EMAIL_INVALID_DOCUMENT, oEmailData.Subject)
|
||||
|
||||
_email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "InvalidFerdException", _EmailOutAccountId, oArgs.NamePortal)
|
||||
AddRejectedState(oMessageId, "InvalidFerdException", "Inkorrekte Formate", "", oSQLTransaction)
|
||||
_email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "InvalidFerdException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.InvalidFerdException, "", "")
|
||||
AddRejectedState(oMessageId, oRejectionCodeString, "Inkorrektes Format", "", oSQLTransaction)
|
||||
|
||||
Catch ex As TooMuchFerdsException
|
||||
_logger.Error(ex)
|
||||
|
||||
_history.Update_HistoryEntry(oMessageId, oMD5CheckSum, "REJECTED - More than one ZUGFeRD-document in email")
|
||||
Dim oRejectionCodeString = GetRejectionCodeString(oMessageId, ErrorCode.TooMuchFerdsException)
|
||||
|
||||
_history.Update_HistoryEntry(oMessageId, oMD5CheckSum, oRejectionCodeString)
|
||||
|
||||
Dim oEmailData = _file.MoveAndRenameEmailToRejected(oArgs, oMessageId)
|
||||
Dim oBody = String.Format(EmailStrings.EMAIL_TOO_MUCH_FERDS, oEmailData.Subject)
|
||||
|
||||
_email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "TooMuchFerdsException", _EmailOutAccountId, oArgs.NamePortal)
|
||||
AddRejectedState(oMessageId, "TooMuchFerdsException", "Email enthielt mehr als ein ZUGFeRD-Dokument", "", oSQLTransaction)
|
||||
_email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "TooMuchFerdsException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.TooMuchFerdsException, "", "")
|
||||
AddRejectedState(oMessageId, oRejectionCodeString, "Email enthielt mehr als ein ZUGFeRD-Dokument", "", oSQLTransaction)
|
||||
|
||||
Catch ex As NoFerdsException
|
||||
_logger.Error(ex)
|
||||
|
||||
_history.Update_HistoryEntry(oMessageId, oMD5CheckSum, "REJECTED - no ZUGFeRD-Document in email")
|
||||
Dim oRejectionCodeString = GetRejectionCodeString(oMessageId, ErrorCode.NoFerdsException)
|
||||
|
||||
_history.Update_HistoryEntry(oMessageId, oMD5CheckSum, oRejectionCodeString)
|
||||
|
||||
Dim oEmailData = _file.MoveAndRenameEmailToRejected(oArgs, oMessageId)
|
||||
Dim oBody = String.Format(EmailStrings.EMAIL_NO_FERDS, oEmailData.Subject)
|
||||
|
||||
_email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "NoFerdsException", _EmailOutAccountId, oArgs.NamePortal)
|
||||
AddRejectedState(oMessageId, "NoFerdsException", " Email enthielt keine ZUGFeRD-Dokumente", "", oSQLTransaction)
|
||||
_email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "NoFerdsException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.NoFerdsException, "", "")
|
||||
AddRejectedState(oMessageId, oRejectionCodeString, "Email enthielt keine ZUGFeRD-Dokumente", "", oSQLTransaction)
|
||||
|
||||
Catch ex As MissingValueException
|
||||
_logger.Error(ex)
|
||||
|
||||
Dim oMessage As String = ""
|
||||
For Each prop In ex.MissingProperties
|
||||
oMessage &= $"- {prop}"
|
||||
Dim oRejectionCodeString = GetRejectionCodeString(oMessageId, ErrorCode.MissingValueException)
|
||||
|
||||
_history.Update_HistoryEntry(oMessageId, oMD5CheckSum, oRejectionCodeString)
|
||||
|
||||
Dim oMissingFieldList As String = ""
|
||||
For Each oMissingFieldDescription In ex.MissingProperties
|
||||
oMissingFieldList += $"<li>{oMissingFieldDescription.Description}<br/><em>{oMissingFieldDescription.XMLPath}</em></li>"
|
||||
Next
|
||||
|
||||
_history.Update_HistoryEntry(oMessageId, oMD5CheckSum, $"REJECTED - Missing Required Properties: [{oMessage}]")
|
||||
|
||||
Dim oOrgFilename = _hash.GetOriginalFilename(ex.File.Name)
|
||||
Dim oBody = _email.CreateBodyForMissingProperties(ex.File.Name, ex.MissingProperties)
|
||||
Dim oEmailData = _file.MoveAndRenameEmailToRejected(oArgs, oMessageId)
|
||||
_email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "MissingValueException", _EmailOutAccountId, oArgs.NamePortal)
|
||||
AddRejectedState(oMessageId, "MissingValueException", "Es fehlten ZugferdSpezifikationen", oMessage, oSQLTransaction)
|
||||
|
||||
_email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "MissingValueException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.MissingValueException, oOrgFilename, oMissingFieldList)
|
||||
AddRejectedState(oMessageId, oRejectionCodeString, "Es fehlten ZugferdSpezifikationen", "", oSQLTransaction)
|
||||
|
||||
Catch ex As FileSizeLimitReachedException
|
||||
_logger.Error(ex)
|
||||
|
||||
_history.Update_HistoryEntry(oMessageId, oMD5CheckSum, "REJECTED - File size limit reached")
|
||||
Dim oRejectionCodeString = GetRejectionCodeString(oMessageId, ErrorCode.FileSizeLimitReachedException)
|
||||
|
||||
_history.Update_HistoryEntry(oMessageId, oMD5CheckSum, oRejectionCodeString)
|
||||
|
||||
Dim oEmailData = _file.MoveAndRenameEmailToRejected(oArgs, oMessageId)
|
||||
|
||||
Dim oKey = FileSizeLimitReachedException.KEY_FILENAME
|
||||
Dim oFileExceedingThreshold As String = IIf(ex.Data.Contains(oKey), ex.Data.Item(oKey), "")
|
||||
Dim oFileWithoutMessageId = oFileExceedingThreshold.
|
||||
Replace(oMessageId, "").
|
||||
Replace("~", "")
|
||||
Dim oOrgFilename = _hash.GetOriginalFilename(oFileExceedingThreshold)
|
||||
|
||||
Dim oBody = String.Format(EmailStrings.EMAIL_FILE_SIZE_REACHED, oArgs.MaxAttachmentSizeInMegaBytes, oFileWithoutMessageId)
|
||||
|
||||
_email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "FileSizeLimitReachedException", _EmailOutAccountId, oArgs.NamePortal)
|
||||
AddRejectedState(oMessageId, "FileSizeLimitReachedException", "Erlaubte Dateigröße überschritten", "", oSQLTransaction)
|
||||
Dim oBody = String.Format(EmailStrings.EMAIL_FILE_SIZE_REACHED, oArgs.MaxAttachmentSizeInMegaBytes, oOrgFilename)
|
||||
|
||||
_email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "FileSizeLimitReachedException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.FileSizeLimitReachedException, oArgs.MaxAttachmentSizeInMegaBytes, oOrgFilename)
|
||||
AddRejectedState(oMessageId, oRejectionCodeString, "Erlaubte Dateigröße überschritten", "", oSQLTransaction)
|
||||
|
||||
Catch ex As NoFerdsAlternateException
|
||||
' TODO: Maybe dont even log this 'error', since it's not really an error and it might happen *A LOT*
|
||||
@@ -341,7 +378,7 @@ Public Class ImportZUGFeRDFiles
|
||||
.From = oArgs.ExceptionEmailAddress,
|
||||
.Subject = $"OutOfMemoryException im ZUGFeRD-Parser @ {oMessageId}"
|
||||
}
|
||||
_email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "OutOfMemoryException", _EmailOutAccountId, oArgs.NamePortal)
|
||||
_email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "OutOfMemoryException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.UnhandledException, ex.Message, ex.StackTrace)
|
||||
|
||||
' Rollback Transaction
|
||||
oSQLTransaction.Rollback()
|
||||
@@ -354,29 +391,63 @@ Public Class ImportZUGFeRDFiles
|
||||
_logger.Warn("Unknown Error occurred: {0}", ex.Message)
|
||||
_logger.Error(ex)
|
||||
|
||||
' Send Email to Digital Data
|
||||
Dim oBody = _email.CreateBodyForUnhandledException(oMessageId, ex)
|
||||
Dim oEmailData As New EmailData With {
|
||||
.From = oArgs.ExceptionEmailAddress,
|
||||
.Subject = $"UnhandledException im ZUGFeRD-Parser @ {oMessageId}"
|
||||
}
|
||||
_email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "UnhandledException", _EmailOutAccountId, oArgs.NamePortal)
|
||||
|
||||
' Rollback Transaction
|
||||
oSQLTransaction.Rollback()
|
||||
|
||||
oMoveDirectory = DIRECTORY_DONT_MOVE
|
||||
|
||||
oExpectedError = False
|
||||
|
||||
If oSQLConnection IsNot Nothing And oSQLTransaction IsNot Nothing Then
|
||||
' Send Email to Digital Data
|
||||
Dim oBody = _email.CreateBodyForUnhandledException(oMessageId, ex)
|
||||
Dim oEmailData As New EmailData With {
|
||||
.From = oArgs.ExceptionEmailAddress,
|
||||
.Subject = $"UnhandledException im ZUGFeRD-Parser @ {oMessageId}"
|
||||
}
|
||||
_email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "UnhandledException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.UnhandledException, ex.Message, ex.StackTrace)
|
||||
|
||||
' Rollback Transaction
|
||||
oSQLTransaction.Rollback()
|
||||
End If
|
||||
|
||||
Finally
|
||||
Dim oxRechnungHandle As Boolean = False
|
||||
Try
|
||||
Dim oRegularMove As Boolean = False
|
||||
' If an application error occurred, dont move files so they will be processed again later
|
||||
If oMoveDirectory = DIRECTORY_DONT_MOVE Then
|
||||
_logger.Info("Application Error occurred. Files for message Id {0} will not be moved.", oMessageId)
|
||||
|
||||
ElseIf oArgs.AllowXRechnung And oIsSuccess And oEInvoiceFileGroup.Item(0).Extension = ".xml" Then
|
||||
_logger.Debug("Before Creating the PDF-File from XML data / Before Commit")
|
||||
|
||||
oxRechnungHandle = True
|
||||
' Hier das neue PDF erzeugen
|
||||
'but before we need to get all Data we need
|
||||
MyTemplateValues_xInvDT = Nothing
|
||||
Dim oSQL_MsgIDReplace = SQL_xRechnung_ItemTemplate
|
||||
oSQL_MsgIDReplace = oSQL_MsgIDReplace.Replace("@MSG_ID", oFileGroup.Key)
|
||||
If oSQLTransaction IsNot Nothing Then
|
||||
' Commit Transaction
|
||||
oSQLTransaction.Commit()
|
||||
_logger.Debug("XML commit triggered")
|
||||
End If
|
||||
MyTemplateValues_xInvDT = _mssql.GetDatatable(oSQL_MsgIDReplace)
|
||||
|
||||
If Not IsNothing(MyTemplateValues_xInvDT) Then
|
||||
If MyTemplateValues_xInvDT.Rows.Count > 0 Then
|
||||
Dim oViewReceiptFileInfo As FileInfo = _xRechnungCreator.Create_PDFfromXML(oEInvoiceFileGroup.Item(0), MyTemplateValues_xInvDT)
|
||||
If Not IsNothing(oViewReceiptFileInfo) Then
|
||||
oEInvoiceFileGroup.Item(0) = oViewReceiptFileInfo
|
||||
oRegularMove = True
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Else
|
||||
oRegularMove = True
|
||||
End If
|
||||
If oRegularMove Then
|
||||
' Move all files of the current group
|
||||
_file.MoveFiles(oArgs, oMessageId, oFileGroupFiles, oEmailAttachmentFiles, oEmbeddedAttachmentFiles, oMoveDirectory, oIsSuccess)
|
||||
_file.MoveFiles(oArgs, oMessageId, oEInvoiceFileGroup, oEmailAttachmentFiles, oEmbeddedAttachmentFiles, oMoveDirectory, oIsSuccess)
|
||||
End If
|
||||
_logger.Info("END processing file group {0}", oMessageId)
|
||||
Catch ex As Exception
|
||||
@@ -386,7 +457,7 @@ Public Class ImportZUGFeRDFiles
|
||||
.From = oArgs.ExceptionEmailAddress,
|
||||
.Subject = $"FileMoveException im ZUGFeRD-Parser @ {oMessageId}"
|
||||
}
|
||||
_email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "FileMoveException", _EmailOutAccountId, oArgs.NamePortal)
|
||||
_email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "FileMoveException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.UnhandledException, ex.Message, ex.StackTrace)
|
||||
|
||||
_logger.Warn("Could not move files!")
|
||||
_logger.Error(ex)
|
||||
@@ -398,8 +469,14 @@ Public Class ImportZUGFeRDFiles
|
||||
' finally commit all changes To the Database
|
||||
' ==================================================================
|
||||
If oIsSuccess Or oExpectedError Then
|
||||
' Commit Transaction
|
||||
oSQLTransaction.Commit()
|
||||
|
||||
_logger.Debug("Before default sql commit: oxRechnungHandle [{0}]", oxRechnungHandle)
|
||||
|
||||
If oxRechnungHandle = False AndAlso oSQLTransaction IsNot Nothing Then
|
||||
' Commit Transaction
|
||||
oSQLTransaction.Commit()
|
||||
_logger.Debug("default commit triggered")
|
||||
End If
|
||||
End If
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
@@ -407,7 +484,10 @@ Public Class ImportZUGFeRDFiles
|
||||
End Try
|
||||
|
||||
Try
|
||||
oSQLConnection.Close()
|
||||
If oSQLConnection IsNot Nothing Then
|
||||
_logger.Debug("Before default sql close")
|
||||
oSQLConnection.Close()
|
||||
End If
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
_logger.Warn("Database Connections were not closed successfully.")
|
||||
@@ -423,35 +503,37 @@ Public Class ImportZUGFeRDFiles
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Function ProcessFile(pMessageId As String, pEmailData As EmailData, pZugferdFiles As Integer, oFile As FileInfo, oConnections As DatabaseConnections, pArgs As WorkerArgs) As ProcessFileResult
|
||||
Private Function GetRejectionCodeString(pMessageId As String, pRejectionCode As ErrorCode) As String
|
||||
|
||||
Dim intCode As Integer = DirectCast(pRejectionCode, Integer)
|
||||
Dim oRejectionCodeString = $"{EmailStrings.ErrorCodePraefix}{intCode}"
|
||||
|
||||
' Wir wollen im error-Log den Code und die MessageID haben, um die es geht
|
||||
Dim oInfoMessage = $"Rejection {oRejectionCodeString} triggered for '{pMessageId}'"
|
||||
_logger.Error(oInfoMessage)
|
||||
|
||||
Return oRejectionCodeString
|
||||
End Function
|
||||
|
||||
Private Function ProcessXMLFile(pMessageId As String, pZugferdFileCounter As Integer, pFile As FileInfo, pConnections As DatabaseConnections, pArgs As WorkerArgs) As ProcessFileResult
|
||||
Dim oDocument As ZUGFeRDInterface.ZugferdResult
|
||||
Dim oResult As New ProcessFileResult()
|
||||
Dim oMissingProperties As New List(Of String)
|
||||
|
||||
' Only pdf files are allowed from here on
|
||||
If Not oFile.Name.ToUpper.EndsWith(".PDF") Then
|
||||
_logger.Debug("Skipping non-pdf file {0}", oFile.Name)
|
||||
oResult.EmailAttachmentFiles.Add(oFile)
|
||||
|
||||
' Checking filesize for attachment files
|
||||
If _filesystem.TestFileSizeIsLessThanMaxFileSize(oFile.FullName, pArgs.MaxAttachmentSizeInMegaBytes) = False Then
|
||||
_logger.Warn("Filesize for File [{0}] exceeded limit of {1} MB", oFile.Name, pArgs.MaxAttachmentSizeInMegaBytes)
|
||||
Throw New FileSizeLimitReachedException(oFile.Name, pArgs.MaxAttachmentSizeInMegaBytes)
|
||||
End If
|
||||
|
||||
If pFile.Extension.Equals(".xml", StringComparison.OrdinalIgnoreCase) = False Then
|
||||
' Diese Methode ist nur für den xml-Beleg gedacht
|
||||
Return oResult
|
||||
End If
|
||||
|
||||
_logger.Info("Start processing file {0}", oFile.Name)
|
||||
_logger.Info("Start xml processing file {0}", pFile.Name)
|
||||
|
||||
' Checking filesize for pdf files
|
||||
If _filesystem.TestFileSizeIsLessThanMaxFileSize(oFile.FullName, pArgs.MaxAttachmentSizeInMegaBytes) = False Then
|
||||
_logger.Warn("Filesize for File [{0}] exceeded limit of {1} MB", oFile.Name, pArgs.MaxAttachmentSizeInMegaBytes)
|
||||
Throw New FileSizeLimitReachedException(oFile.Name, pArgs.MaxAttachmentSizeInMegaBytes)
|
||||
' Checking filesize
|
||||
If _filesystem.TestFileSizeIsLessThanMaxFileSize(pFile.FullName, pArgs.MaxAttachmentSizeInMegaBytes) = False Then
|
||||
_logger.Warn("Filesize for File [{0}] exceeded limit of {1} MB", pFile.Name, pArgs.MaxAttachmentSizeInMegaBytes)
|
||||
Throw New FileSizeLimitReachedException(pFile.Name, pArgs.MaxAttachmentSizeInMegaBytes)
|
||||
End If
|
||||
|
||||
Try
|
||||
oDocument = _zugferd.ExtractZUGFeRDFileWithGDPicture(oFile.FullName)
|
||||
oDocument = _zugferd.GetSerializedXMLContentFromFile(pFile)
|
||||
|
||||
Catch ex As ValidationException
|
||||
Throw ex
|
||||
@@ -459,125 +541,335 @@ Public Class ImportZUGFeRDFiles
|
||||
Catch ex As ZUGFeRDExecption
|
||||
Select Case ex.ErrorType
|
||||
Case ZUGFeRDInterface.ErrorType.NoZugferd
|
||||
_logger.Info("File [{0}] is not a valid ZUGFeRD document. Skipping.", oFile.Name)
|
||||
_logger.Info("File [{0}] is not a valid ZUGFeRD document. Skipping.", pFile.Name)
|
||||
|
||||
oResult.EmailAttachmentFiles.Add(oFile)
|
||||
oResult.EmailAttachmentFiles.Add(pFile)
|
||||
Return oResult
|
||||
|
||||
Case ZUGFeRDInterface.ErrorType.UnsupportedFormat
|
||||
_logger.Info("File [{0}/{1}] is an unsupported ZUFeRD document format!", oFile.Name, ex.XmlFile)
|
||||
_logger.Info("File [{0}/{1}] is an unsupported ZUFeRD document format!", pFile.Name, ex.XmlFile)
|
||||
Throw New UnsupportedFerdException(ex.XmlFile)
|
||||
|
||||
Case ZUGFeRDInterface.ErrorType.NoValidZugferd
|
||||
_logger.Info("File [{0}] is an Incorrectly formatted ZUGFeRD document!", oFile.Name)
|
||||
_logger.Info("File [{0}] is an Incorrectly formatted ZUGFeRD document!", pFile.Name)
|
||||
Throw New InvalidFerdException()
|
||||
|
||||
Case Else
|
||||
_logger.Warn("Unexpected Error occurred while extracting ZUGFeRD Information from file {0}", oFile.Name)
|
||||
_logger.Warn("Unexpected Error occurred while extracting ZUGFeRD Information from file {0}", pFile.Name)
|
||||
Throw ex
|
||||
End Select
|
||||
|
||||
End Try
|
||||
|
||||
Try
|
||||
oDocument.ReceiptFileType = ZUGFeRDInterface.RECEIPT_TYPE_XML
|
||||
Dim sqlResult As Boolean = StoreXMLItemsInDatabase(pMessageId, oDocument, pFile, pConnections, pArgs)
|
||||
Catch ex As Exception
|
||||
Throw ex
|
||||
End Try
|
||||
|
||||
_logger.Debug("File processed.")
|
||||
|
||||
Dim oMD5Checksum = _hash.GenerateAndCheck_MD5Sum(pFile, pMessageId, pArgs.IgnoreRejectionStatus)
|
||||
oResult.ZugferdFileFound = True
|
||||
oResult.MD5Checksum = oMD5Checksum
|
||||
oResult.ZugferdFileCount = 1 ' Es kann hier nur genau einen Treffer geben!
|
||||
|
||||
Return oResult
|
||||
End Function
|
||||
|
||||
Private Function ProcessFile(pMessageId As String, pZugferdFileCounter As Integer, pFile As FileInfo, pConnections As DatabaseConnections, pArgs As WorkerArgs) As ProcessFileResult
|
||||
Dim oDocument As ZUGFeRDInterface.ZugferdResult
|
||||
Dim oResult As New ProcessFileResult()
|
||||
|
||||
' Only pdf files are allowed from here on
|
||||
If Not pFile.Name.ToUpper.EndsWith(".PDF") Then
|
||||
_logger.Debug("Skipping non-pdf file {0}", pFile.Name)
|
||||
oResult.EmailAttachmentFiles.Add(pFile)
|
||||
|
||||
' Checking filesize for attachment files
|
||||
If _filesystem.TestFileSizeIsLessThanMaxFileSize(pFile.FullName, pArgs.MaxAttachmentSizeInMegaBytes) = False Then
|
||||
_logger.Warn("Filesize for File [{0}] exceeded limit of {1} MB", pFile.Name, pArgs.MaxAttachmentSizeInMegaBytes)
|
||||
Throw New FileSizeLimitReachedException(pFile.Name, pArgs.MaxAttachmentSizeInMegaBytes)
|
||||
End If
|
||||
|
||||
Return oResult
|
||||
End If
|
||||
|
||||
_logger.Info("Start processing file {0}", pFile.Name)
|
||||
|
||||
' Checking filesize for pdf files
|
||||
If _filesystem.TestFileSizeIsLessThanMaxFileSize(pFile.FullName, pArgs.MaxAttachmentSizeInMegaBytes) = False Then
|
||||
_logger.Warn("Filesize for File [{0}] exceeded limit of {1} MB", pFile.Name, pArgs.MaxAttachmentSizeInMegaBytes)
|
||||
Throw New FileSizeLimitReachedException(pFile.Name, pArgs.MaxAttachmentSizeInMegaBytes)
|
||||
End If
|
||||
|
||||
Try
|
||||
oDocument = _zugferd.ExtractZUGFeRDFileWithGDPicture(pFile.FullName)
|
||||
|
||||
Catch ex As ValidationException
|
||||
Throw ex
|
||||
|
||||
Catch ex As ZUGFeRDExecption
|
||||
Select Case ex.ErrorType
|
||||
Case ZUGFeRDInterface.ErrorType.NoZugferd
|
||||
_logger.Info("File [{0}] is not a valid ZUGFeRD document. Skipping.", pFile.Name)
|
||||
|
||||
oResult.EmailAttachmentFiles.Add(pFile)
|
||||
Return oResult
|
||||
|
||||
Case ZUGFeRDInterface.ErrorType.UnsupportedFormat
|
||||
_logger.Info("File [{0}/{1}] is an unsupported ZUFeRD document format!", pFile.Name, ex.XmlFile)
|
||||
Throw New UnsupportedFerdException(ex.XmlFile)
|
||||
|
||||
Case ZUGFeRDInterface.ErrorType.NoValidZugferd
|
||||
_logger.Info("File [{0}] is an Incorrectly formatted ZUGFeRD document!", pFile.Name)
|
||||
Throw New InvalidFerdException()
|
||||
|
||||
Case Else
|
||||
_logger.Warn("Unexpected Error occurred while extracting ZUGFeRD Information from file {0}", pFile.Name)
|
||||
Throw ex
|
||||
End Select
|
||||
End Try
|
||||
|
||||
' Check if there are more than one ZUGFeRD files
|
||||
If pZugferdFiles = 1 Then
|
||||
If pZugferdFileCounter = 1 Then
|
||||
Throw New TooMuchFerdsException()
|
||||
End If
|
||||
|
||||
' Since extraction went well, increase the amount of ZUGFeRD files
|
||||
pZugferdFiles += 1
|
||||
pZugferdFileCounter += 1
|
||||
_logger.Info("Zugferd file found. Increasing counter.")
|
||||
|
||||
' Extract all attachments with the extensions specified in `AllowedExtensions`.
|
||||
' If you need to extract and use embedded xml files, you need to filter out the zugferd-invoice.xml yourself.
|
||||
' Right now the zugferd-invoice.xml is filtered out because `AllowedExtensions` does not contain `xml`.
|
||||
Dim oAttachments = _embeds.Extract(oFile.FullName, AllowedExtensions)
|
||||
Dim oAttachments = _embeds.Extract(pFile.FullName, AllowedExtensions)
|
||||
If oAttachments Is Nothing Then
|
||||
_logger.Warn("Attachments for file [{0}] could not be extracted", oFile.FullName)
|
||||
_logger.Warn("Attachments for file [{0}] could not be extracted", pFile.FullName)
|
||||
Else
|
||||
oResult.EmbeddedAttachmentFiles.AddRange(oAttachments)
|
||||
End If
|
||||
|
||||
' Check the Checksum and rejection status
|
||||
Dim oMD5Checksum = _hash.GenerateAndCheck_MD5Sum(oFile, pMessageId, pArgs.IgnoreRejectionStatus)
|
||||
|
||||
' Check the document against the configured property map and return:
|
||||
' - a List of valid properties
|
||||
' - a List of missing properties
|
||||
|
||||
Dim oPropertyMap = _zugferd.FilterPropertyMap(pArgs.PropertyMap, oDocument.Specification)
|
||||
Dim oCheckResult = _zugferd.PropertyValues.CheckPropertyValues(oDocument.SchemaObject, oPropertyMap, pMessageId)
|
||||
|
||||
_logger.Info("Properties checked: [{0}] missing properties / [{1}] valid properties found.", oCheckResult.MissingProperties.Count, oCheckResult.ValidProperties.Count)
|
||||
|
||||
If oCheckResult.MissingProperties.Count > 0 Then
|
||||
_logger.Warn("[{0}] missing properties found. Exiting.", oCheckResult.MissingProperties.Count)
|
||||
oMissingProperties = oCheckResult.MissingProperties
|
||||
Throw New MissingValueException(oFile, oCheckResult.MissingProperties)
|
||||
Else
|
||||
_logger.Debug("No missing properties found. Continuing.")
|
||||
|
||||
End If
|
||||
|
||||
DeleteExistingPropertyValues(pMessageId, oConnections)
|
||||
|
||||
Dim oFirstProperty = oCheckResult.ValidProperties.FirstOrDefault()
|
||||
If oFirstProperty IsNot Nothing Then
|
||||
InsertPropertyValue(pMessageId, oConnections, New PropertyValues.ValidProperty() With {
|
||||
.MessageId = pMessageId,
|
||||
.Description = "ZUGFeRDSpezifikation",
|
||||
.GroupCounter = 0,
|
||||
.IsRequired = False,
|
||||
.Value = oDocument.Specification,
|
||||
.TableName = oFirstProperty.TableName,
|
||||
.TableColumn = "ZUGFERD_SPECIFICATION"
|
||||
})
|
||||
End If
|
||||
|
||||
For Each oProperty In oCheckResult.ValidProperties
|
||||
InsertPropertyValue(pMessageId, oConnections, oProperty)
|
||||
Next
|
||||
Try
|
||||
oDocument.ReceiptFileType = ZUGFeRDInterface.RECEIPT_TYPE_PDF
|
||||
Dim sqlResult As Boolean = StoreXMLItemsInDatabase(pMessageId, oDocument, pFile, pConnections, pArgs)
|
||||
Catch ex As Exception
|
||||
Throw ex
|
||||
End Try
|
||||
|
||||
_logger.Debug("File processed.")
|
||||
|
||||
' Check the Checksum and rejection status
|
||||
Dim oMD5Checksum = _hash.GenerateAndCheck_MD5Sum(pFile, pMessageId, pArgs.IgnoreRejectionStatus)
|
||||
oResult.ZugferdFileFound = True
|
||||
oResult.MD5Checksum = oMD5Checksum
|
||||
oResult.ZugferdFileCount = pZugferdFiles
|
||||
oResult.ZugferdFileCount = pZugferdFileCounter
|
||||
|
||||
Return oResult
|
||||
|
||||
End Function
|
||||
|
||||
Private Sub DeleteExistingPropertyValues(pMessageId As String, pConnections As DatabaseConnections)
|
||||
Dim oDelSQL = $"DELETE FROM TBEDMI_ITEM_VALUE where REFERENCE_GUID = '{pMessageId}'"
|
||||
Dim oStep As String
|
||||
Private Function StoreXMLItemsInDatabase(pMessageId As String, pDocument As ZUGFeRDInterface.ZugferdResult, pFile As FileInfo, pConnections As DatabaseConnections, pArgs As WorkerArgs) As Boolean
|
||||
' Check the document against the configured property map and return:
|
||||
' - a List of valid properties
|
||||
' - a List of missing properties
|
||||
|
||||
oStep = "TBEDMI_ITEM_VALUE Delete MessageID Items"
|
||||
Dim oPropertyMap = _zugferd.FilterPropertyMap(pArgs.PropertyMap, pDocument.Specification)
|
||||
Dim oCheckResult = _zugferd.PropertyValues.CheckPropertyValues(pDocument.SchemaObject, oPropertyMap, pMessageId)
|
||||
|
||||
_logger.Info("Properties checked: [{0}] missing properties / [{1}] valid properties found.", oCheckResult.MissingProperties.Count, oCheckResult.ValidProperties.Count)
|
||||
|
||||
If oCheckResult.MissingProperties.Count > 0 Then
|
||||
_logger.Warn("[{0}] missing properties found. Exiting.", oCheckResult.MissingProperties.Count)
|
||||
Throw New MissingValueException(pFile, oCheckResult.MissingProperties)
|
||||
Else
|
||||
_logger.Debug("No missing properties found. Continuing.")
|
||||
End If
|
||||
|
||||
' Daten in die Datenbank speichern
|
||||
If BulkInsertDataToDatabase(pMessageId, pDocument, pConnections, oCheckResult) = False Then
|
||||
_logger.Error("Bulk Insert for MessageId [{0}] failed!", pMessageId)
|
||||
Throw New Exception("Bulk Insert failed! Exiting.")
|
||||
End If
|
||||
|
||||
' TODO hier BAUSTELLE
|
||||
' Eingebettete Dateien speichern
|
||||
'If CreateEmbeddedFilesOnDisk(pMessageId, pDocument, pConnections, oCheckResult) = False Then
|
||||
' _logger.Debug("Files saving for MessageId [{0}] failed!", pMessageId)
|
||||
'End If
|
||||
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Function CreateEmbeddedFilesOnDisk(pMessageId As String, pDocument As ZUGFeRDInterface.ZugferdResult, pConnections As DatabaseConnections, pCheckResult As CheckPropertyValuesResult) As Boolean
|
||||
|
||||
' Finde alle Eintraege in pCheckResult mit Item_Type=3
|
||||
' Finde Dateinamen (Index nach ~attm) und Dateityp. Wir speichern nur PDF.
|
||||
' TODO Funktion aufrufen
|
||||
'SaveBase64ToDisk("", "") = False Then
|
||||
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Function SaveBase64ToDisk(pExportFilePath As String, pBase64String As String) As Boolean
|
||||
Try
|
||||
_mssql.ExecuteNonQueryWithConnectionObject(oDelSQL, pConnections.SQLServerConnection, MSSQLServer.TransactionMode.ExternalTransaction, pConnections.SQLServerTransaction)
|
||||
Dim base64BinaryDataString As String = pBase64String ' Hier Base64-String einfügen
|
||||
Dim binaryDataString As Byte() = System.Convert.FromBase64String(base64BinaryDataString)
|
||||
Dim oFilename As String = pExportFilePath
|
||||
Dim Stream As System.IO.FileStream = New System.IO.FileStream(oFilename, System.IO.FileMode.Create)
|
||||
Stream.Write(binaryDataString, 0, binaryDataString.Length)
|
||||
Stream.Close()
|
||||
Catch ex As Exception
|
||||
_logger.Error("Could NOT save File to Disk for MessageId [{0}] !", pExportFilePath)
|
||||
|
||||
End Try
|
||||
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Function BulkInsertDataToDatabase(pMessageId As String, pDocument As ZUGFeRDInterface.ZugferdResult, pConnections As DatabaseConnections, pCheckResults As CheckPropertyValuesResult) As Boolean
|
||||
If DeleteExistingPropertyValues(pMessageId, pConnections) = False Then
|
||||
Throw New Exception("Could not cleanup data. Exiting.")
|
||||
End If
|
||||
|
||||
' DataTable vorbereiten
|
||||
Dim oDataTable As DataTable = FillDataTable(pMessageId, pCheckResults, pDocument)
|
||||
|
||||
' ColumnList initialisieren
|
||||
Dim oColumnNames As List(Of String) = New List(Of String) From {
|
||||
"REFERENCE_GUID",
|
||||
"ITEM_DESCRIPTION",
|
||||
"ITEM_VALUE",
|
||||
"GROUP_COUNTER",
|
||||
"SPEC_NAME",
|
||||
"IS_REQUIRED"
|
||||
}
|
||||
|
||||
Dim oBulkResult = BulkInsert(pConnections, oDataTable, "TBEDMI_ITEM_VALUE", oColumnNames)
|
||||
|
||||
If oBulkResult = False Then
|
||||
_logger.Error("Bulk Insert for MessageId [{0}] failed!", pMessageId)
|
||||
Throw New Exception("Bulk Insert failed! Exiting.")
|
||||
End If
|
||||
|
||||
_logger.Info("Bulk Insert finished. [{0}] rows inserted for MessageId [{1}].", oDataTable.Rows.Count, pMessageId)
|
||||
Return True
|
||||
End Function
|
||||
|
||||
|
||||
Private Function FillDataTable(pMessageId As String, pCheckResult As PropertyValues.CheckPropertyValuesResult, pDocument As ZUGFeRDInterface.ZugferdResult) As DataTable
|
||||
|
||||
Dim oDataTable As DataTable = New DataTable()
|
||||
oDataTable.Columns.Add(New DataColumn("REFERENCE_GUID", GetType(String)))
|
||||
oDataTable.Columns.Add(New DataColumn("ITEM_DESCRIPTION", GetType(String)))
|
||||
oDataTable.Columns.Add(New DataColumn("ITEM_VALUE", GetType(String)))
|
||||
oDataTable.Columns.Add(New DataColumn("GROUP_COUNTER", GetType(Int32)))
|
||||
oDataTable.Columns.Add(New DataColumn("SPEC_NAME", GetType(String)))
|
||||
oDataTable.Columns.Add(New DataColumn("IS_REQUIRED", GetType(Boolean)))
|
||||
|
||||
' Erste Zeile enthält die Spezifikation
|
||||
Dim oFirstRow As DataRow = oDataTable.NewRow()
|
||||
oFirstRow("REFERENCE_GUID") = pMessageId
|
||||
oFirstRow("ITEM_DESCRIPTION") = "ZUGFeRDSpezifikation"
|
||||
oFirstRow("ITEM_VALUE") = pDocument.Specification
|
||||
oFirstRow("GROUP_COUNTER") = 0
|
||||
oFirstRow("SPEC_NAME") = "ZUGFERD_SPECIFICATION"
|
||||
oFirstRow("IS_REQUIRED") = False
|
||||
|
||||
_logger.Debug("Mapping Property [ZUGFERD_SPECIFICATION] with value [{0}]", pDocument.Specification)
|
||||
oDataTable.Rows.Add(oFirstRow)
|
||||
|
||||
' Zweite Zeile enthält das verwendete XML Schema
|
||||
Dim oSecondRow As DataRow = oDataTable.NewRow()
|
||||
oSecondRow("REFERENCE_GUID") = pMessageId
|
||||
oSecondRow("ITEM_DESCRIPTION") = "ZUGFeRDXMLSchema"
|
||||
oSecondRow("ITEM_VALUE") = pDocument.UsedXMLSchema
|
||||
oSecondRow("GROUP_COUNTER") = 0
|
||||
oSecondRow("SPEC_NAME") = "ZUGFERD_XML_SCHEMA"
|
||||
oSecondRow("IS_REQUIRED") = False
|
||||
|
||||
_logger.Debug("Mapping Property [ZUGFERD_XML_SCHEMA] with value [{0}]", pDocument.UsedXMLSchema)
|
||||
oDataTable.Rows.Add(oSecondRow)
|
||||
|
||||
' Dritte Zeile enthält das verwendete Datei-Format des Belegs (PDF/XML)
|
||||
Dim oThirdRow As DataRow = oDataTable.NewRow()
|
||||
oThirdRow("REFERENCE_GUID") = pMessageId
|
||||
oThirdRow("ITEM_DESCRIPTION") = "ReceiptFileType"
|
||||
oThirdRow("ITEM_VALUE") = pDocument.ReceiptFileType
|
||||
oThirdRow("GROUP_COUNTER") = 0
|
||||
oThirdRow("SPEC_NAME") = "RECEIPT_FILE_TYPE"
|
||||
oThirdRow("IS_REQUIRED") = False
|
||||
|
||||
_logger.Debug("Mapping Property [RECEIPT_FILE_TYPE] with value [{0}]", pDocument.ReceiptFileType)
|
||||
oDataTable.Rows.Add(oThirdRow)
|
||||
|
||||
For Each oProperty In pCheckResult.ValidProperties
|
||||
|
||||
' ItemType = 3 => eingebettete Datei, nicht den base64 speichern
|
||||
If oProperty.ItemType = 3 Then
|
||||
Continue For
|
||||
End If
|
||||
|
||||
' If GroupCounter is -1, it means this is a default property that can only occur once.
|
||||
' Set the actual inserted value to 0
|
||||
Dim oGroupCounterValue As Integer = oProperty.GroupCounter
|
||||
If oGroupCounterValue = -1 Then
|
||||
oGroupCounterValue = 0
|
||||
End If
|
||||
|
||||
If oProperty.Value.Length > 900 Then
|
||||
_logger.Warn("Value for field [{0}] is longer than 900 characters, will be truncated!", oProperty.TableColumn)
|
||||
End If
|
||||
|
||||
Dim oNewRow As DataRow = oDataTable.NewRow()
|
||||
oNewRow("REFERENCE_GUID") = pMessageId
|
||||
oNewRow("ITEM_DESCRIPTION") = oProperty.Description
|
||||
oNewRow("ITEM_VALUE") = oProperty.Value.Truncate(900).Replace("'", "''")
|
||||
oNewRow("GROUP_COUNTER") = oGroupCounterValue
|
||||
oNewRow("SPEC_NAME") = oProperty.TableColumn
|
||||
oNewRow("IS_REQUIRED") = oProperty.IsRequired
|
||||
|
||||
_logger.Debug("Mapping Property [{0}] with value [{1}]", oProperty.TableColumn, oProperty.Value.Replace("'", "''"))
|
||||
oDataTable.Rows.Add(oNewRow)
|
||||
Next
|
||||
|
||||
Return oDataTable
|
||||
End Function
|
||||
|
||||
Private Function DeleteExistingPropertyValues(pMessageId As String, pConnections As DatabaseConnections) As Boolean
|
||||
Dim oDelSQL = $"DELETE FROM TBEDMI_ITEM_VALUE where REFERENCE_GUID = '{pMessageId}'"
|
||||
Dim oStep As String = "TBEDMI_ITEM_VALUE Delete MessageID Items"
|
||||
|
||||
Try
|
||||
Dim retValue As Boolean = _mssql.ExecuteNonQueryWithConnectionObject(oDelSQL, pConnections.SQLServerConnection, MSSQLServer.TransactionMode.ExternalTransaction, pConnections.SQLServerTransaction)
|
||||
Return retValue
|
||||
Catch ex As Exception
|
||||
_logger.Warn("Step [{0}] with SQL [{1}] was not successful.", oStep, oDelSQL)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub InsertPropertyValue(pMessageId As String, pConnections As DatabaseConnections, pProperty As PropertyValues.ValidProperty)
|
||||
Dim oGroupCounterValue = pProperty.GroupCounter
|
||||
Return False
|
||||
End Function
|
||||
|
||||
' If GroupCounter is -1, it means this is a default property that can only occur once.
|
||||
' Set the actual inserted value to 0
|
||||
If oGroupCounterValue = -1 Then
|
||||
oGroupCounterValue = 0
|
||||
End If
|
||||
Private Function BulkInsert(pConnections As DatabaseConnections, pTable As DataTable, pDestinationTable As String, pColumns As List(Of String)) As Boolean
|
||||
|
||||
Dim oCommand = $"INSERT INTO {pProperty.TableName} (REFERENCE_GUID, ITEM_DESCRIPTION, ITEM_VALUE, GROUP_COUNTER, SPEC_NAME, IS_REQUIRED) VALUES
|
||||
('{pMessageId}', '{pProperty.Description}', '{pProperty.Value.Replace("'", "''")}', {oGroupCounterValue},'{pProperty.TableColumn}','{pProperty.IsRequired}')"
|
||||
_logger.Debug("Mapping Property [{0}] with value [{1}], Will be inserted into table [{2}]", pProperty.TableColumn, pProperty.Value.Replace("'", "''"), pProperty.TableName)
|
||||
Using oBulkCopy = New SqlBulkCopy(pConnections.SQLServerConnection, SqlBulkCopyOptions.Default, pConnections.SQLServerTransaction)
|
||||
|
||||
' Insert into SQL Server
|
||||
Dim oResult = _mssql.ExecuteNonQueryWithConnectionObject(oCommand, pConnections.SQLServerConnection, MSSQLServer.TransactionMode.ExternalTransaction, pConnections.SQLServerTransaction)
|
||||
If oResult = False Then
|
||||
_logger.Warn($"SQL Command [{oCommand}] was not successful. Check the log.")
|
||||
End If
|
||||
End Sub
|
||||
oBulkCopy.DestinationTableName = pDestinationTable
|
||||
For Each oColumn In pColumns
|
||||
oBulkCopy.ColumnMappings.Add(New SqlBulkCopyColumnMapping(oColumn, oColumn))
|
||||
Next
|
||||
|
||||
Try
|
||||
oBulkCopy.WriteToServer(pTable)
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
End Using
|
||||
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Sub AddRejectedState(pMessageID As String, pTitle As String, pTitle1 As String, pComment As String, pTransaction As SqlTransaction)
|
||||
Try
|
||||
|
||||
@@ -16,16 +16,21 @@ Public Class WorkerArgs
|
||||
|
||||
' Email Parameter
|
||||
Public EmailOutProfileId As Integer = 0
|
||||
Public RejectionTemplateId As Integer = 0
|
||||
|
||||
' Misc Flag Parameters
|
||||
' Misc Parameters
|
||||
Public ExceptionEmailAddress As String = Nothing
|
||||
Public IgnoreRejectionStatus As Boolean = False
|
||||
Public MaxAttachmentSizeInMegaBytes As Integer = -1
|
||||
Public MinFileAgeInMinutes As Integer = 5
|
||||
Public NamePortal As String = "NO PORTAL_NAME IN CONFIG"
|
||||
Public GDPictureVersion As String = String.Empty
|
||||
|
||||
' Feature Flags
|
||||
Public AllowFacturX As Boolean = True
|
||||
Public AllowXRechnung As Boolean = True
|
||||
Public AllowZugferd10 As Boolean = True
|
||||
Public AllowZugferd2x As Boolean = True
|
||||
Public AllowPeppolBISBill3x As Boolean = False
|
||||
|
||||
End Class
|
||||
6
Jobs/ZUGFeRD/XRechnungStrings.vb
Normal file
6
Jobs/ZUGFeRD/XRechnungStrings.vb
Normal file
@@ -0,0 +1,6 @@
|
||||
Public Class XRechnungStrings
|
||||
Public Const CommentSichtbeleg_DE_Row1 = "Achtung: dies ist ein technisch erstelltes Abbild einer digitalen Rechnung."
|
||||
Public Const CommentSichtbeleg_DE_Row2 = "Die Darstellung basiert auf den Inhalten der xml-Datei, welche als Anhang in diese PDF integriert wurde!"
|
||||
Public Const CommentSichtbeleg_EN_Row1 = "Please note: this is a technically created image of a digital invoice."
|
||||
Public Const CommentSichtbeleg_EN_Row2 = "The representation is based on the contents of the xml file, which has been integrated into this PDF as an attachment!"
|
||||
End Class
|
||||
504
Jobs/ZUGFeRD/XRechnungViewDocument.vb
Normal file
504
Jobs/ZUGFeRD/XRechnungViewDocument.vb
Normal file
@@ -0,0 +1,504 @@
|
||||
Imports System.Collections.Generic
|
||||
Imports System.Data
|
||||
Imports System.IO
|
||||
Imports DigitalData.Modules.Base
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports GdPicture14
|
||||
Imports System.Drawing
|
||||
Imports System.Linq
|
||||
Public Class XRechnungViewDocument
|
||||
Private ReadOnly _logger As Logger
|
||||
Private ReadOnly _logConfig As LogConfig
|
||||
Private ReadOnly _filesystem As FilesystemEx
|
||||
Private ReadOnly _file As ZUGFeRD.FileFunctions
|
||||
Private ReadOnly _gdpictureLicenseKey As String
|
||||
Private fontResName As String
|
||||
Private fontResNameBold As String
|
||||
Private fontResNameItalic As String
|
||||
Private MyGDPicturePDF As GdPicturePDF
|
||||
|
||||
Public Sub New(LogConfig As LogConfig, MSSQL As MSSQLServer, GDPictureLicenseKey As String)
|
||||
_logConfig = LogConfig
|
||||
_logger = LogConfig.GetLogger()
|
||||
_filesystem = New FilesystemEx(_logConfig)
|
||||
_file = New ZUGFeRD.FileFunctions(LogConfig, MSSQL)
|
||||
_gdpictureLicenseKey = GDPictureLicenseKey
|
||||
End Sub
|
||||
Public Function Create_PDFfromXML(oxmlFile As FileInfo, pDTItemValues As DataTable) As FileInfo
|
||||
|
||||
_logger.Debug("Create_PDFfromXML() Start")
|
||||
|
||||
Try
|
||||
Dim oXRechnungFile = oxmlFile.FullName
|
||||
Dim oNewFileinfo As FileInfo
|
||||
Dim oxmlFilePath = oxmlFile.FullName
|
||||
Dim oViewRecieptFilename = oxmlFile.Name
|
||||
Dim oTempFilePath = Path.GetDirectoryName(oxmlFilePath) + "\Temp"
|
||||
If Not Directory.Exists(oTempFilePath) Then
|
||||
Directory.CreateDirectory(oTempFilePath)
|
||||
End If
|
||||
|
||||
oTempFilePath = oTempFilePath + "\xrechnung.xml"
|
||||
If File.Exists(oTempFilePath) Then
|
||||
File.Delete(oTempFilePath)
|
||||
End If
|
||||
File.Move(oxmlFilePath, oTempFilePath)
|
||||
oxmlFile = New FileInfo(oTempFilePath)
|
||||
oViewRecieptFilename = oViewRecieptFilename.Replace("xml", "pdf")
|
||||
Dim oOutputPath = Path.GetDirectoryName(oxmlFilePath) + "\" + oViewRecieptFilename
|
||||
If File.Exists(oOutputPath) Then
|
||||
File.Delete(oOutputPath)
|
||||
End If
|
||||
|
||||
MyGDPicturePDF = New GdPicturePDF()
|
||||
MyGDPicturePDF.NewPDF(PdfConformance.PDF_A_2a)
|
||||
Dim oPDFStatus As GdPictureStatus = MyGDPicturePDF.NewPDF()
|
||||
If oPDFStatus <> GdPictureStatus.OK Then
|
||||
_logger.Warn($"Error initializing PDF: {oPDFStatus}")
|
||||
Return Nothing
|
||||
End If
|
||||
MyGDPicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft)
|
||||
MyGDPicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitMillimeter)
|
||||
MyGDPicturePDF.SetLineWidth(1)
|
||||
fontResName = MyGDPicturePDF.AddStandardFont(PdfStandardFont.PdfStandardFontHelvetica)
|
||||
fontResNameBold = MyGDPicturePDF.AddStandardFont(PdfStandardFont.PdfStandardFontHelveticaBold)
|
||||
fontResNameItalic = MyGDPicturePDF.AddStandardFont(PdfStandardFont.PdfStandardFontHelveticaBoldOblique)
|
||||
MyGDPicturePDF.SetTitle("xInvoice VisualReceipt")
|
||||
MyGDPicturePDF.SetAuthor("Digital Data GmbH, Ludwig Rinn Str. 16, 35452 Heuchelheim")
|
||||
'Create a New page
|
||||
MyGDPicturePDF.NewPage(PdfPageSizes.PdfPageSizeA4)
|
||||
' Dim oCurrent As Integer = MyGDPicturePDF.GetCurrentPage()
|
||||
|
||||
Dim yPosition As Single = Create_PageHeader(False)
|
||||
Create_PageFooter()
|
||||
|
||||
Dim oArea As String = ""
|
||||
Dim oIsPosition As Boolean = False
|
||||
Dim oPosCount = 0
|
||||
Dim oPosTerm As String = ""
|
||||
Dim oPosDesc As String = ""
|
||||
Dim oCurrencySymbol = "€"
|
||||
Dim oWidthLine = 200
|
||||
yPosition += 5
|
||||
|
||||
Dim font As New Font("Helvetica", 10)
|
||||
Dim xRight As Integer = 100
|
||||
Dim oIndex As Integer = 0
|
||||
Dim oYPlus As Integer = 0
|
||||
Dim oCreateTextBox As Boolean = False
|
||||
Dim oPosRowY As Integer = 0
|
||||
For Each oRow As DataRow In pDTItemValues.Rows
|
||||
Dim Y_eq_lastrow As Boolean = CBool(oRow.Item("Y_eq_lastrow"))
|
||||
Dim oRowCaption As String = oRow.Item("Row_Caption")
|
||||
Dim oItemSPECNAME As String = oRow.Item("SPEC_NAME")
|
||||
Dim oItemValue As String = oRow.Item("ITEM_VALUE")
|
||||
Dim oDisplay As Boolean = oRow.Item("Display")
|
||||
Dim oAreaSwitch As Boolean = False
|
||||
|
||||
If oRow.Item("Area") = "INTERNAL" Then
|
||||
If oItemSPECNAME = "STATIC_Y_SWITCH" Then
|
||||
yPosition = oItemValue
|
||||
End If
|
||||
End If
|
||||
If yPosition >= 270 Then
|
||||
oPDFStatus = MyGDPicturePDF.NewPage(PdfPageSizes.PdfPageSizeA4)
|
||||
If oPDFStatus <> GdPictureStatus.OK Then
|
||||
_logger.Warn($"Could not create a second page. The error was: {oPDFStatus}")
|
||||
Exit For
|
||||
Else
|
||||
yPosition = Create_PageHeader(True)
|
||||
Create_PageFooter()
|
||||
End If
|
||||
'oCurrent = MyGDPicturePDF.GetCurrentPage()
|
||||
End If
|
||||
|
||||
|
||||
If oRow.Item("Area") = "INTERNAL" Then
|
||||
_logger.Debug($"Next Item as Area is internal")
|
||||
Continue For
|
||||
End If
|
||||
_logger.Debug($"Working on SPEC_NAME: {oItemSPECNAME}")
|
||||
|
||||
If oArea <> oRow.Item("Area") Then
|
||||
'########## AREA WECHSEL ###########
|
||||
oAreaSwitch = True
|
||||
oCreateTextBox = False
|
||||
oArea = oRow.Item("Area")
|
||||
_logger.Debug($"Area-Switch to: {oArea}")
|
||||
Dim oAREACaption As String
|
||||
If oArea = "TYPE" Then
|
||||
oAREACaption = $"{Return_InvType(oItemValue)} [{oItemValue}]"
|
||||
ElseIf oArea = "SELLER" Then
|
||||
oAREACaption = "Verkäufer/Seller:"
|
||||
ElseIf oArea = "BUYER" Then
|
||||
oAREACaption = "Käufer/Buyer:"
|
||||
ElseIf oArea = "POSITION" Then
|
||||
oAREACaption = "Positionen/Positions:"
|
||||
oIsPosition = True
|
||||
ElseIf oArea = "AMOUNT" Then
|
||||
oAREACaption = "Beträge/Amounts:"
|
||||
oCreateTextBox = True
|
||||
ElseIf oArea = "TAXPOS" Then
|
||||
oAREACaption = "Steuerbeträge/Tax amounts:"
|
||||
oIsPosition = True
|
||||
ElseIf oArea = "PAYMENT" Then
|
||||
oAREACaption = "Zahlungsinformationen/Payment details:"
|
||||
ElseIf oArea = "EXEMPTION" Then
|
||||
oAREACaption = "USt.-Befreiungsgrund/Exemption reason:"
|
||||
Else
|
||||
oAREACaption = String.Empty
|
||||
End If
|
||||
|
||||
If Not oAREACaption = String.Empty Then
|
||||
If oArea = "AMOUNT" Then
|
||||
Dim oY = yPosition
|
||||
End If
|
||||
'erste Area-Linie
|
||||
yPosition += 5
|
||||
MyGDPicturePDF.DrawLine(10, yPosition, oWidthLine, yPosition)
|
||||
'gdpicturePDF.DrawText(fontResName, 10, yPosition, XRechnungStrings.Seperator_Line)
|
||||
yPosition += 5
|
||||
'Area caption
|
||||
MyGDPicturePDF.DrawText(fontResNameBold, 10, yPosition, oAREACaption)
|
||||
yPosition += 5
|
||||
If oArea = "TYPE" Then
|
||||
MyGDPicturePDF.DrawLine(10, yPosition, oWidthLine, yPosition)
|
||||
' gdpicturePDF.DrawText(fontResName, 10, yPosition, XRechnungStrings.Seperator_Line)
|
||||
yPosition += 5
|
||||
ElseIf oArea = "POSITION" Then
|
||||
'Tabellendarstellung
|
||||
MyGDPicturePDF.DrawText(fontResName, 10, yPosition, "Pos#")
|
||||
MyGDPicturePDF.DrawText(fontResName, 19, yPosition, "Anz./am.")
|
||||
MyGDPicturePDF.DrawText(fontResName, 35, yPosition, "Einh/unt")
|
||||
MyGDPicturePDF.DrawText(fontResName, 50, yPosition, "Pos.Text")
|
||||
MyGDPicturePDF.DrawText(fontResName, 164, yPosition, "Steuer/tax")
|
||||
MyGDPicturePDF.DrawText(fontResName, 181, yPosition, "Betrag/sum")
|
||||
yPosition += 5
|
||||
'Tabellendarstellung Ende
|
||||
ElseIf oArea = "EXEMPTION" Then
|
||||
|
||||
End If
|
||||
End If
|
||||
If oArea = "TYPE" Then
|
||||
If oItemSPECNAME = "INVOICE_CURRENCY" Then
|
||||
If oItemValue <> "EUR" Then
|
||||
oCurrencySymbol = oItemValue
|
||||
End If
|
||||
End If
|
||||
ElseIf oArea = "POSITION" Then
|
||||
oIsPosition = True
|
||||
If oItemSPECNAME = "INVOICE_POSITION_AMOUNT" Then
|
||||
oPosCount += 1
|
||||
oPosTerm = ""
|
||||
oPosRowY = yPosition
|
||||
MyGDPicturePDF.DrawText(fontResName, 10, yPosition, oPosCount)
|
||||
|
||||
MyGDPicturePDF.DrawText(fontResName, 19, yPosition, oItemValue)
|
||||
oDisplay = False
|
||||
End If
|
||||
ElseIf oArea = "TAXPOS" Then
|
||||
oIsPosition = True
|
||||
If oItemSPECNAME = "INVOICE_TAXPOS_RATE" Then
|
||||
oPosCount = 1
|
||||
oPosTerm = $"{oItemValue} %:"
|
||||
oItemValue = oPosTerm
|
||||
oDisplay = False
|
||||
yPosition -= 5
|
||||
End If
|
||||
|
||||
End If
|
||||
Else
|
||||
'INDIVIDUELLES VERHALTEN BEI Folge-ITEMS
|
||||
_logger.Debug($"FollowItem - Area: [{oArea}] - ItemSpecname: [{oItemSPECNAME}] - ItemValue: [{oItemValue}]")
|
||||
'Dim otextBoxYPos As Integer
|
||||
If oArea = "POSITION" Then
|
||||
If oItemSPECNAME = "INVOICE_POSITION_AMOUNT" Then
|
||||
oPosCount += 1
|
||||
yPosition += 5
|
||||
oYPlus = 0
|
||||
|
||||
oPosTerm = ""
|
||||
MyGDPicturePDF.DrawText(fontResName, 10, yPosition, oPosCount)
|
||||
oPosRowY = yPosition
|
||||
MyGDPicturePDF.DrawText(fontResName, 19, yPosition, oItemValue)
|
||||
oDisplay = False
|
||||
ElseIf oItemSPECNAME = "INVOICE_POSITION_UNIT_TYPE" Then
|
||||
oYPlus = 0
|
||||
Dim oUnit = Return_UnitType(oItemValue)
|
||||
MyGDPicturePDF.DrawText(fontResName, 35, yPosition, oUnit)
|
||||
oDisplay = False
|
||||
ElseIf oItemSPECNAME = "INVOICE_POSITION_ARTICLE" Then
|
||||
oYPlus = 0
|
||||
oPosDesc = ""
|
||||
oPosDesc = oItemValue
|
||||
Dim oYDyn As Integer = yPosition - 5
|
||||
|
||||
Dim oPartsNL As List(Of String) = StringFunctions.SplitTextByNewLine(oItemValue)
|
||||
For Each olinepart As String In oPartsNL
|
||||
Dim oParts As List(Of String) = StringFunctions.SplitText_Length(olinepart, 67)
|
||||
' Durchlaufen der einzelnen Teile in einer Schleife
|
||||
For Each part As String In oParts
|
||||
oYDyn += 5
|
||||
oYPlus += 5
|
||||
MyGDPicturePDF.DrawText(fontResName, 50, oYDyn, part)
|
||||
Next
|
||||
Next
|
||||
yPosition = oYDyn
|
||||
oDisplay = False
|
||||
ElseIf oItemSPECNAME = "INVOICE_POSITION_ARTICLE_DESCRIPTION" Or
|
||||
oItemSPECNAME = "INVOICE_POSITION_NOTE" Then
|
||||
_logger.Debug($"oItemSPECNAME: {oItemSPECNAME}")
|
||||
|
||||
'Dim cleanedText As String = RemoveNewlinesAndTabs(oItemValue)
|
||||
'Dim oParts As List(Of String) = StringFunctions.SplitText_Length(cleanedText, 70)
|
||||
'' Durchlaufen der einzelnen Teile in einer Schleife
|
||||
Dim oYDyn As Integer = yPosition
|
||||
Dim oPartsNL As List(Of String) = StringFunctions.SplitTextByNewLine(oItemValue)
|
||||
For Each olinepart As String In oPartsNL
|
||||
Dim oPartsPN As List(Of String) = StringFunctions.SplitText_Length(olinepart, 70)
|
||||
' Durchlaufen der einzelnen Teile in einer Schleife
|
||||
For Each part As String In oPartsPN
|
||||
oYDyn += 5
|
||||
oYPlus += 5
|
||||
MyGDPicturePDF.DrawText(fontResName, 50, oYDyn, part)
|
||||
Next
|
||||
Next
|
||||
yPosition = oYDyn
|
||||
|
||||
oDisplay = False
|
||||
|
||||
ElseIf oItemSPECNAME = "INVOICE_TAXPOS_TAX_RATE" Or oItemSPECNAME = "INVOICE_TAXPOS_RATE" Then
|
||||
|
||||
MyGDPicturePDF.DrawText(fontResName, 164, oPosRowY, $"{oItemValue} %")
|
||||
oDisplay = False
|
||||
ElseIf oItemSPECNAME = "INVOICE_POSITION_TAX_AMOUNT" Then
|
||||
|
||||
Dim oYPos = oPosRowY - 3.5
|
||||
Dim oBetrag As Decimal = oItemValue
|
||||
Dim oFormatiert As String = oBetrag.ToString("N2", New Globalization.CultureInfo("de-DE"))
|
||||
|
||||
Dim TAXTERM = $"{oFormatiert} {oCurrencySymbol}"
|
||||
MyGDPicturePDF.DrawTextBox(fontResName, 177, oYPos, 198, YCoo_TextBoxPlus5(oYPos),
|
||||
TextAlignment.TextAlignmentFar, TextAlignment.TextAlignmentNear,
|
||||
TAXTERM)
|
||||
oDisplay = False
|
||||
End If
|
||||
oItemValue = oPosTerm
|
||||
ElseIf oArea = "HEAD" Then
|
||||
If oItemSPECNAME = "INVOICE_DATE" Or oItemSPECNAME = "INVOICE_SERVICE_DATE" Then
|
||||
oItemValue = StringFunctions.DatetimeStringToGermanStringConverter(oItemValue, _logger)
|
||||
End If
|
||||
ElseIf oArea = "TAXPOS" Then
|
||||
If oItemSPECNAME = "INVOICE_TAXPOS_RATE" Then
|
||||
oPosCount += 1
|
||||
oPosTerm = $"{oItemValue} %:"
|
||||
oDisplay = False
|
||||
ElseIf oItemSPECNAME = "INVOICE_TAXPOS_AMOUNT" Then
|
||||
Dim oBetrag As Decimal = oItemValue
|
||||
Dim oFormatiert As String = oBetrag.ToString("N2", New Globalization.CultureInfo("de-DE"))
|
||||
oFormatiert += $" {oCurrencySymbol}"
|
||||
oPosTerm += $" {oFormatiert}"
|
||||
oDisplay = False
|
||||
ElseIf oItemSPECNAME = "INVOICE_TAXPOS_TYPE" Then
|
||||
oPosTerm += $" {oItemValue}"
|
||||
ElseIf oItemValue.Contains("EXEMPTION") Then
|
||||
_logger.Debug($"We got an Exemption: {oItemValue}")
|
||||
End If
|
||||
oItemValue = oPosTerm
|
||||
End If
|
||||
End If
|
||||
|
||||
If oDisplay = True And Len(oItemValue) > 0 Then
|
||||
If Y_eq_lastrow = False And oAreaSwitch = False Then
|
||||
yPosition += 5
|
||||
End If
|
||||
If oArea = "AMOUNT" Then
|
||||
If oItemSPECNAME = "INVOICE_TOTAL_TAX" Or oItemSPECNAME = "INVOICE_TOTAL_NET" Or oItemSPECNAME = "INVOICE_TOTAL_GROSS" Then
|
||||
Dim oBetrag As Decimal = oItemValue
|
||||
Dim oFormatiert As String = oBetrag.ToString("N2", New Globalization.CultureInfo("de-DE"))
|
||||
oFormatiert += $" {oCurrencySymbol}"
|
||||
oItemValue = oFormatiert
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
If oRowCaption <> String.Empty Then
|
||||
'Zuerst die RowCaption
|
||||
MyGDPicturePDF.DrawText(fontResName, 10, yPosition, oRowCaption)
|
||||
'Dann den Wert
|
||||
If oCreateTextBox Then
|
||||
Dim otextBoxYPos = yPosition - 3
|
||||
MyGDPicturePDF.DrawTextBox(fontResName, 70, otextBoxYPos, 90, YCoo_TextBoxPlus5(otextBoxYPos),
|
||||
TextAlignment.TextAlignmentFar, TextAlignment.TextAlignmentCenter,
|
||||
oItemValue)
|
||||
Else
|
||||
MyGDPicturePDF.DrawText(fontResName, 70, yPosition, oItemValue)
|
||||
End If
|
||||
|
||||
Else
|
||||
If Y_eq_lastrow = True Then
|
||||
MyGDPicturePDF.DrawText(fontResName, oRow.Item("xPosition"), yPosition, oItemValue)
|
||||
Else
|
||||
If oItemValue.Length > 112 Then
|
||||
' Liste zur Speicherung der Teilstrings
|
||||
Dim teilStrings As New List(Of String)
|
||||
' Schleife, um den String in Teilstrings zu zerlegen
|
||||
For i As Integer = 0 To oItemValue.Length - 1 Step 112
|
||||
' Sicherstellen, dass wir nicht über die Länge des Strings hinausgehen
|
||||
Dim laenge As Integer = Math.Min(112, oItemValue.Length - i)
|
||||
Dim teilString As String = oItemValue.Substring(i, laenge)
|
||||
teilStrings.Add(teilString)
|
||||
Next
|
||||
|
||||
' Ausgabe der Teilstrings
|
||||
For Each teilString As String In teilStrings
|
||||
MyGDPicturePDF.DrawText(fontResName, 10, yPosition, teilString)
|
||||
yPosition += 5
|
||||
Next
|
||||
Else
|
||||
MyGDPicturePDF.DrawText(fontResName, 10, yPosition, oItemValue)
|
||||
End If
|
||||
|
||||
End If
|
||||
End If
|
||||
'Else
|
||||
' 'Tabellendarstellung
|
||||
' If oItemSPECNAME = "INVOICE_POSITION_TAX_AMOUNT" And oYPlus > 0 Then
|
||||
' yPosition += oYPlus - 5
|
||||
' End If
|
||||
' 'Tabellendarstellung Ende
|
||||
End If
|
||||
oIndex += 1
|
||||
Next
|
||||
|
||||
Dim oeinv_Format As PdfInvoiceDataFormat = PdfInvoiceDataFormat.ZUGFeRD_2_0
|
||||
MyGDPicturePDF.EmbedFile(oTempFilePath, "Rechnungsdaten im ZUGFeRD-XML-Format")
|
||||
'Finalize And save the PDF
|
||||
oPDFStatus = MyGDPicturePDF.SaveToFile(oOutputPath)
|
||||
If oPDFStatus = GdPictureStatus.OK Then
|
||||
_logger.Info("PDF VisualReceipt generated successfully!")
|
||||
Else
|
||||
_logger.Warn($"Error generating PDF VisualReceipt: {oPDFStatus}")
|
||||
End If
|
||||
|
||||
'Release resources
|
||||
MyGDPicturePDF.CloseDocument()
|
||||
If oPDFStatus = GdPictureStatus.OK Then
|
||||
File.Delete(oXRechnungFile)
|
||||
oNewFileinfo = New FileInfo(oOutputPath)
|
||||
|
||||
_logger.Debug("Create_PDFfromXML() End successfully")
|
||||
Return oNewFileinfo
|
||||
Else
|
||||
_logger.Debug("Create_PDFfromXML() Ends with nothing")
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
Private Function RemoveNewlinesAndTabs(ByVal text As String) As String
|
||||
Return text.Replace(vbCr, " - ").Replace(vbLf, "").Replace(vbTab, " ")
|
||||
End Function
|
||||
Private Function YCoo_TextBoxMinus5(yPosition As Integer)
|
||||
Return yPosition - 5
|
||||
End Function
|
||||
Private Function YCoo_TextBoxPlus5(yPosition As Integer)
|
||||
Return yPosition + 5
|
||||
End Function
|
||||
|
||||
|
||||
Function SplitTextByNewLine(text As String) As List(Of String)
|
||||
If String.IsNullOrEmpty(text) Then
|
||||
Return New List(Of String)()
|
||||
End If
|
||||
|
||||
' Zerlege den Text anhand von Zeilenumbrüchen
|
||||
Dim lines As List(Of String) = text.Split({vbCrLf, vbLf, vbCr}, StringSplitOptions.None).ToList()
|
||||
Return lines
|
||||
End Function
|
||||
Public Function Create_PageHeader(pFollowPage As Boolean) As Integer
|
||||
'Draw content on the PDF
|
||||
Dim yPosition As Integer = 15
|
||||
MyGDPicturePDF.SetTextSize(18)
|
||||
MyGDPicturePDF.DrawText(fontResName, 10, yPosition, "xRechnung Sichtbeleg - xInvoice Visual Receipt")
|
||||
yPosition += 10
|
||||
MyGDPicturePDF.SetTextSize(10)
|
||||
MyGDPicturePDF.DrawText(fontResNameItalic, 10, yPosition, XRechnungStrings.CommentSichtbeleg_DE_Row1)
|
||||
yPosition += 5
|
||||
MyGDPicturePDF.DrawText(fontResNameItalic, 10, yPosition, XRechnungStrings.CommentSichtbeleg_DE_Row2)
|
||||
yPosition += 5
|
||||
MyGDPicturePDF.DrawText(fontResNameItalic, 10, yPosition, XRechnungStrings.CommentSichtbeleg_EN_Row1)
|
||||
yPosition += 5
|
||||
MyGDPicturePDF.DrawText(fontResNameItalic, 10, yPosition, XRechnungStrings.CommentSichtbeleg_EN_Row2)
|
||||
Return yPosition
|
||||
End Function
|
||||
|
||||
Public Sub Create_PageFooter()
|
||||
MyGDPicturePDF.DrawLine(10, 280, 200, 280)
|
||||
Dim oCreatedString = $"Maschinell erstellt durch / Automatically created by Digital Data E-Rechnung Parser: {Now.ToString}"
|
||||
MyGDPicturePDF.DrawText(fontResName, 10, 285, oCreatedString)
|
||||
End Sub
|
||||
|
||||
Private Function Return_InvType(pType As String) As String
|
||||
Dim oReturn As String = "Rechnung/invoice"
|
||||
If pType = "380" Then
|
||||
oReturn = "Handelsrechnung/Commercial invoice"
|
||||
ElseIf pType = "381" Then
|
||||
oReturn = "Gutschriftanzeige/Credit advice"
|
||||
ElseIf pType = "384" Then
|
||||
oReturn = "Rechnungskorrektur/Invoice correction"
|
||||
ElseIf pType = "386" Then
|
||||
oReturn = "Vorauszahlungsrechnung/Prepayment invoice"
|
||||
ElseIf pType = "326" Then
|
||||
oReturn = "Teilrechnung/Partial invoice"
|
||||
ElseIf pType = "84" Then
|
||||
oReturn = "Gutschrift/Credit note"
|
||||
ElseIf pType = "389" Then
|
||||
oReturn = "Gutschriftsverfahren/Credit note procedure"
|
||||
End If
|
||||
Return oReturn
|
||||
End Function
|
||||
|
||||
Private Function Return_UnitType(pType As String) As String
|
||||
Dim oReturn As String = "Stück/pc"
|
||||
If pType = "C62" Then
|
||||
oReturn = "Stück/pc"
|
||||
ElseIf pType = "DAY" Then
|
||||
oReturn = "Tag/day"
|
||||
ElseIf pType = "HAR" Then
|
||||
oReturn = "Hek/hec"
|
||||
ElseIf pType = "HUR" Then
|
||||
oReturn = "h"
|
||||
ElseIf pType = "KGM" Then
|
||||
oReturn = "kg"
|
||||
ElseIf pType = "KTM" Then
|
||||
oReturn = "km"
|
||||
ElseIf pType = "KWH" Then
|
||||
oReturn = pType
|
||||
ElseIf pType = "LS" Then
|
||||
oReturn = "pausch/flat"
|
||||
ElseIf pType = "MIN" Then
|
||||
oReturn = "minute"
|
||||
ElseIf pType = "MTK" Then
|
||||
oReturn = "QM/SM"
|
||||
ElseIf pType = "Kubik/CM" Then
|
||||
oReturn = "MTR"
|
||||
ElseIf pType = "Meter" Then
|
||||
oReturn = "minute"
|
||||
ElseIf pType = "P1" Then
|
||||
oReturn = "%"
|
||||
ElseIf pType = "SET" Then
|
||||
oReturn = "Set"
|
||||
ElseIf pType = "TNE" Then
|
||||
oReturn = "Tonne/ton"
|
||||
ElseIf pType = "WEE" Then
|
||||
oReturn = "Woche/week"
|
||||
End If
|
||||
Return oReturn
|
||||
End Function
|
||||
|
||||
End Class
|
||||
@@ -1,6 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="BouncyCastle.Cryptography" version="2.5.0" targetFramework="net462" />
|
||||
<package id="DocumentFormat.OpenXml" version="3.2.0" targetFramework="net462" />
|
||||
<package id="DocumentFormat.OpenXml.Framework" version="3.2.0" targetFramework="net462" />
|
||||
<package id="FirebirdSql.Data.FirebirdClient" version="7.5.0" targetFramework="net461" />
|
||||
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net461" />
|
||||
<package id="GdPicture" version="14.3.3" targetFramework="net462" />
|
||||
<package id="GdPicture.runtimes.windows" version="14.3.3" targetFramework="net462" />
|
||||
<package id="Microsoft.AspNet.WebApi.Client" version="6.0.0" targetFramework="net462" />
|
||||
<package id="Microsoft.Bcl.AsyncInterfaces" version="8.0.0" targetFramework="net462" />
|
||||
<package id="Microsoft.CSharp" version="4.7.0" targetFramework="net462" />
|
||||
<package id="Microsoft.VisualBasic" version="10.3.0" targetFramework="net462" />
|
||||
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net462" />
|
||||
<package id="Newtonsoft.Json.Bson" version="1.0.2" targetFramework="net462" />
|
||||
<package id="NLog" version="5.0.5" targetFramework="net461" />
|
||||
<package id="OpenMcdf" version="2.4.1" targetFramework="net462" />
|
||||
<package id="protobuf-net" version="3.2.46" targetFramework="net462" />
|
||||
<package id="protobuf-net.Core" version="3.2.46" targetFramework="net462" />
|
||||
<package id="RtfPipe" version="2.0.7677.4303" targetFramework="net462" />
|
||||
<package id="System.Buffers" version="4.6.0" targetFramework="net462" />
|
||||
<package id="System.CodeDom" version="8.0.0" targetFramework="net462" />
|
||||
<package id="System.Collections.Immutable" version="8.0.0" targetFramework="net462" />
|
||||
<package id="System.IO.Packaging" version="8.0.1" targetFramework="net462" />
|
||||
<package id="System.Management" version="8.0.0" targetFramework="net462" />
|
||||
<package id="System.Memory" version="4.6.0" targetFramework="net462" />
|
||||
<package id="System.Numerics.Vectors" version="4.6.0" targetFramework="net462" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="6.1.0" targetFramework="net462" />
|
||||
<package id="System.Security.Cryptography.Pkcs" version="8.0.1" targetFramework="net462" />
|
||||
<package id="System.Text.Encodings.Web" version="8.0.0" targetFramework="net462" />
|
||||
<package id="System.Text.Json" version="8.0.5" targetFramework="net462" />
|
||||
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net462" />
|
||||
<package id="System.ValueTuple" version="4.5.0" targetFramework="net462" />
|
||||
</packages>
|
||||
@@ -44,6 +44,10 @@
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="DigitalData.Modules.Logging, Version=2.6.3.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.5.0.5\lib\net46\NLog.dll</HintPath>
|
||||
@@ -121,11 +125,8 @@
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Logging\Logging.vbproj">
|
||||
<Project>{903b2d7d-3b80-4be9-8713-7447b704e1b0}</Project>
|
||||
<Name>Logging</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>powershell.exe -command "& { &'$(SolutionDir)copy-binary.ps1' '$(TargetPath)' '$(TargetFileName)' '$(ConfigurationName)' '$(ProjectName)' }"</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -87,7 +87,8 @@ Public Class LogConfig
|
||||
|
||||
Private Const LOG_FORMAT_BASE As String = "${time}|${logger:shortName=True}|${level:uppercase=true}"
|
||||
Private Const LOG_FORMAT_CALLSITE As String = "${callsite:className=false:fileName=true:includeSourcePath=false:methodName=true}"
|
||||
Private Const LOG_FORMAT_EXCEPTION As String = "${exception:format=Message,StackTrace:innerFormat=Message,StackTrace:maxInnerExceptionLevel=3}"
|
||||
'Private Const LOG_FORMAT_EXCEPTION As String = "${exception:format=Message,StackTrace:innerFormat=Message,StackTrace:maxInnerExceptionLevel=3}"
|
||||
Private Const LOG_FORMAT_EXCEPTION As String = "${message}${onexception:${newline}${exception:format=Message,StackTrace:innerFormat=Message,StackTrace:maxInnerExceptionLevel=3}}"
|
||||
|
||||
Private Const LOG_FORMAT_DEFAULT As String = LOG_FORMAT_BASE & " >> ${message}"
|
||||
Private Const LOG_FORMAT_ERROR As String = LOG_FORMAT_BASE & " >> " & LOG_FORMAT_EXCEPTION
|
||||
|
||||
@@ -116,4 +116,7 @@
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>powershell.exe -command "& { &'$(SolutionDir)copy-binary.ps1' '$(TargetPath)' '$(TargetFileName)' '$(ConfigurationName)' '$(ProjectName)' }"</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -9,11 +9,11 @@ Imports System.Runtime.InteropServices
|
||||
' Werte der Assemblyattribute überprüfen
|
||||
|
||||
<Assembly: AssemblyTitle("Modules.Logging")>
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("Digital Data")>
|
||||
<Assembly: AssemblyDescription("Logging Modul from DigitalData.Modules for logging Application-Events. Supports Error, Information and Debug")>
|
||||
<Assembly: AssemblyCompany("Digital Data GmbH, Heuchelheim")>
|
||||
<Assembly: AssemblyProduct("Modules.Logging")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2023")>
|
||||
<Assembly: AssemblyTrademark("2.6.3.0")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2025")>
|
||||
<Assembly: AssemblyTrademark("2.6.4.0")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("2.6.3.0")>
|
||||
<Assembly: AssemblyFileVersion("2.6.3.0")>
|
||||
<Assembly: AssemblyVersion("2.6.5.0")>
|
||||
<Assembly: AssemblyFileVersion("2.6.5.0")>
|
||||
|
||||
@@ -43,6 +43,7 @@ Public Class Limilab
|
||||
Password = oPassword
|
||||
AuthType = oAuthType
|
||||
Initialized = True
|
||||
|
||||
End Sub
|
||||
Public Function CloseImap() As Boolean
|
||||
Try
|
||||
@@ -65,9 +66,9 @@ Public Class Limilab
|
||||
|
||||
End Function
|
||||
|
||||
Private Function LOG_Limilab(Log_enabled As Boolean) As Boolean
|
||||
Private Sub LOG_Limilab(Log_enabled As Boolean)
|
||||
Log.Enabled = Log_enabled
|
||||
End Function
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' Tests connection to a given IMAP Server by connecting and doing a simple message query.
|
||||
@@ -75,7 +76,6 @@ Public Class Limilab
|
||||
''' <returns>True if connection and query were successful. False otherwise.</returns>
|
||||
Public Function IMAPTestLogin() As Boolean
|
||||
Logger.Debug("Starting IMAPTestLogin ...")
|
||||
|
||||
If Initialized = False Then
|
||||
Return False
|
||||
End If
|
||||
|
||||
@@ -5,11 +5,12 @@ Namespace Mail
|
||||
Public Class MailSender
|
||||
Inherits BaseClass
|
||||
|
||||
Private Property MailSession As MailSession
|
||||
Public Property MailSession As MailSession
|
||||
|
||||
Public ReadOnly Property Connected2Server As Boolean
|
||||
Get
|
||||
If MailSession IsNot Nothing AndAlso MailSession.Session IsNot Nothing Then
|
||||
|
||||
Return MailSession.Session.Connected
|
||||
Else
|
||||
Return False
|
||||
@@ -36,24 +37,41 @@ Namespace Mail
|
||||
End Function
|
||||
|
||||
Public Function SendMail(pSendTo As List(Of String), pSendFrom As String, pSubject As String, pBody As String, pCreationTime As Date, pAttachments As List(Of String), pTest As Boolean) As Boolean
|
||||
Dim oSuccessfulSends As New List(Of String)
|
||||
Dim oFailedSends As New List(Of String)
|
||||
Try
|
||||
Dim oSuccessfulSends As New List(Of String)
|
||||
Dim oFailedSends As New List(Of String)
|
||||
Dim oResult As Boolean
|
||||
For Each oSendToAddress In pSendTo
|
||||
|
||||
For Each oSendToAddress In pSendTo
|
||||
Dim oResult = SendMailTo(oSendToAddress, pSendFrom, pSubject, pBody, pCreationTime, pAttachments, pTest)
|
||||
If IsValidEmailAddress(oSendToAddress) Then
|
||||
oResult = SendMailTo(oSendToAddress, pSendFrom, pSubject, pBody, pCreationTime, pAttachments, pTest)
|
||||
Else
|
||||
Logger.Warn("EMail adress [{0}] is NOT valid!", oSendToAddress)
|
||||
oResult = False
|
||||
End If
|
||||
|
||||
If oResult = True Then
|
||||
oSuccessfulSends.Add(oSendToAddress)
|
||||
If oResult = True Then
|
||||
oSuccessfulSends.Add(oSendToAddress & "|" & pSubject)
|
||||
Else
|
||||
oFailedSends.Add(oSendToAddress & "|" & pSubject)
|
||||
End If
|
||||
Next
|
||||
|
||||
Logger.Debug("Sent [{0}] mails.", pSendTo.Count)
|
||||
Logger.Debug("Successful [{0}]", oSuccessfulSends.Count)
|
||||
Logger.Debug("Failed [{0}]", oFailedSends.Count)
|
||||
If oFailedSends.Count > 0 Then
|
||||
Return False
|
||||
Else
|
||||
oFailedSends.Add(oSendToAddress)
|
||||
Return True
|
||||
End If
|
||||
Next
|
||||
Catch ex As Exception
|
||||
Logger.Warn("Error in SendMail() - while sending mail [{0} - Subject: {1}]", pSendTo, pSubject)
|
||||
Logger.Error(ex)
|
||||
|
||||
Logger.Debug("Sent [{0}] mails.", pSendTo.Count)
|
||||
Logger.Debug("Successful [{0}]", oSuccessfulSends.Count)
|
||||
Logger.Debug("Failed [{0}]", oFailedSends.Count)
|
||||
Return False
|
||||
End Try
|
||||
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Function SendMailTo(pSendTo As String, pSendFrom As String, pSubject As String, pBody As String, pCreationTime As Date, pAttachments As List(Of String), pTest As Boolean)
|
||||
@@ -65,7 +83,7 @@ Namespace Mail
|
||||
Return False
|
||||
End If
|
||||
|
||||
Logger.Debug("Preparing to send mail to [{0}]", pSendTo)
|
||||
Logger.Debug("Preparing to send mail: {0} ...", pSendTo + "|" + pSubject)
|
||||
|
||||
Dim oMailBuilder As New Limilabs.Mail.MailBuilder()
|
||||
oMailBuilder.From.Add(New Limilabs.Mail.Headers.MailBox(pSendFrom))
|
||||
@@ -78,16 +96,17 @@ Namespace Mail
|
||||
Logger.Debug("Adding [{0}] attachments to mail", pAttachments.Count)
|
||||
oMailBuilder = AddAttachments(oMailBuilder, pAttachments)
|
||||
|
||||
Logger.Debug("Now sending mail..")
|
||||
Logger.Debug("Now sending mail...")
|
||||
Dim oMail = oMailBuilder.Create()
|
||||
oClient.SendMessage(oMail)
|
||||
Logger.Info("Mail to [{0}] has been sent.", pSendTo)
|
||||
Logger.Info("Mail [{0}] has been sent.", pSendTo + "|" + pSubject)
|
||||
|
||||
Return True
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Warn("Error while sending mail to [{0}]", pSendTo)
|
||||
Logger.Warn("Error in SendMailTo() - Mailinfo: {0} - Subject: {1}", pSendTo, pSubject)
|
||||
Logger.Error(ex)
|
||||
MailSession.DisconnectFromServer()
|
||||
|
||||
Return False
|
||||
End Try
|
||||
@@ -95,7 +114,7 @@ Namespace Mail
|
||||
|
||||
Private Function SetBody(pMailBuilder As Limilabs.Mail.MailBuilder, pBody As String, pCreationTime As Date, pTest As Boolean) As Limilabs.Mail.MailBuilder
|
||||
If pCreationTime <> Date.MinValue Then
|
||||
pBody &= $"<p>Creation-time: {pCreationTime}</p>"
|
||||
pBody &= $"<p><i>{pCreationTime}</i></p>"
|
||||
End If
|
||||
|
||||
If pTest Then
|
||||
@@ -116,13 +135,18 @@ Namespace Mail
|
||||
Private Function AddAttachments(pMailBuilder As Limilabs.Mail.MailBuilder, pAttachments As List(Of String)) As Limilabs.Mail.MailBuilder
|
||||
For Each oAttachment In pAttachments
|
||||
Try
|
||||
' Read attachment from disk, add it to Attachments collection
|
||||
If IO.File.Exists(oAttachment) Then
|
||||
Logger.Debug("Adding attachment [{0}] to mail.", oAttachment)
|
||||
pMailBuilder.AddAttachment(oAttachment)
|
||||
If oAttachment <> String.Empty Then
|
||||
' Read attachment from disk, add it to Attachments collection
|
||||
If IO.File.Exists(oAttachment) Then
|
||||
Logger.Debug("Adding attachment [{0}] to mail.", oAttachment)
|
||||
pMailBuilder.AddAttachment(oAttachment)
|
||||
Else
|
||||
Logger.Warn("Attachment [{0}] does not exist. Skipping.", oAttachment)
|
||||
End If
|
||||
Else
|
||||
Logger.Warn("Attachment [{0}] does not exist. Skipping.", oAttachment)
|
||||
Logger.Debug("Attachment is String.Empty")
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Warn("Could not read or add attachment [{0}]!", oAttachment)
|
||||
Logger.Error(ex)
|
||||
@@ -131,6 +155,19 @@ Namespace Mail
|
||||
|
||||
Return pMailBuilder
|
||||
End Function
|
||||
|
||||
Private Function IsValidEmailAddress(pEmailAddress As String) As Boolean
|
||||
Try
|
||||
If pEmailAddress.Contains("@") Then
|
||||
Dim oAddress = New System.Net.Mail.MailAddress(pEmailAddress)
|
||||
Return oAddress.Address = pEmailAddress
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
End Class
|
||||
End Namespace
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ Imports Limilabs.Client
|
||||
Imports Limilabs.Client.IMAP
|
||||
Imports Limilabs.Client.SMTP
|
||||
Imports Microsoft.Identity.Client
|
||||
Imports NLog
|
||||
|
||||
Namespace Mail
|
||||
Public Class MailSession
|
||||
@@ -18,6 +19,7 @@ Namespace Mail
|
||||
Public Const AUTH_SSLTLS = "SSL/TLS"
|
||||
Public Const AUTH_NONE = "NONE"
|
||||
Public Const AUTH_OAUTH2 = "OAUTH2"
|
||||
Public Const SSLProtocol_TLS12 = "TLS12"
|
||||
|
||||
Private Const SMTP_IGNORED_ERRORS As SslPolicyErrors =
|
||||
SslPolicyErrors.RemoteCertificateChainErrors Or ' self-signed
|
||||
@@ -78,12 +80,14 @@ Namespace Mail
|
||||
.AuthType = pAuthType
|
||||
}
|
||||
|
||||
Logger.Debug("Connecting to Server..")
|
||||
Logger.Debug("ConnectToServerWithBasicAuth..")
|
||||
Logger.Debug("Server: [{0}]", oSession.Server)
|
||||
Logger.Debug("Port: [{0}]", oSession.Port)
|
||||
Logger.Debug("User: [{0}]", oSession.User)
|
||||
Logger.Debug("AuthType: [{0}]", oSession.AuthType)
|
||||
|
||||
Logger.Debug($"_Config.TlsVersion.EnableTls1_1 = [{pOptions.EnableTls1_1}]")
|
||||
Logger.Debug($"_Config.TlsVersion.EnableTls1_2 = [{pOptions.EnableTls1_2}]")
|
||||
Logger.Debug($"_Config.TlsVersion.EnableDefault = [{pOptions.EnableDefault}]")
|
||||
_Session = oSession
|
||||
|
||||
Logger.Debug("Initializing Connection with Auth type [{0}].", oSession.AuthType)
|
||||
@@ -128,16 +132,14 @@ Namespace Mail
|
||||
|
||||
' Set TLS Version manually if requested
|
||||
If pOptions.EnableTls1_1 Then
|
||||
Logger.Debug("Enabling TLS Version 1.1")
|
||||
Logger.Debug("Enabling TLS Version 1.1...")
|
||||
Client.SSLConfiguration.EnabledSslProtocols = Client.SSLConfiguration.EnabledSslProtocols Or Security.Authentication.SslProtocols.Tls11
|
||||
End If
|
||||
|
||||
If pOptions.EnableTls1_2 Then
|
||||
Logger.Debug("Enabling TLS Version 1.2")
|
||||
Client.SSLConfiguration.EnabledSslProtocols = Client.SSLConfiguration.EnabledSslProtocols Or Security.Authentication.SslProtocols.Tls12
|
||||
Logger.Debug("Enabling TLS Version 1.2...")
|
||||
Client.SSLConfiguration.EnabledSslProtocols = Security.Authentication.SslProtocols.Tls12
|
||||
End If
|
||||
|
||||
' This is not available in .NET 4.6.2, only in .NET 4.7/4.8
|
||||
'If pOptions.EnableTls1_3 Then
|
||||
' Logger.Debug("Enabling TLS Version 1.3")
|
||||
' oSession.SSLConfiguration.EnabledSslProtocols = oSession.SSLConfiguration.EnabledSslProtocols Or Security.Authentication.SslProtocols.Tls13
|
||||
@@ -150,14 +152,14 @@ Namespace Mail
|
||||
If TypeOf Client Is Imap Then
|
||||
Dim oClient As Imap = Client
|
||||
|
||||
Logger.Debug("Connecting with [ConnectSSL] on [{0}]", pSession.Server)
|
||||
Logger.Debug("Connecting with [OAuth2/ConnectSSL] on [{0}]", pSession.Server)
|
||||
oClient.ConnectSSL(pSession.Server)
|
||||
Else
|
||||
Throw New ApplicationException("Only OAuth2 for IMAP is not yet supported!")
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Warn("Error while connecting with Auth type OAuth2!")
|
||||
Logger.Warn("Unexpected Error in ConnectToServer with Auth type OAuth2!")
|
||||
Logger.Error(ex)
|
||||
|
||||
Session.Error = ex
|
||||
@@ -166,17 +168,20 @@ Namespace Mail
|
||||
|
||||
ElseIf pSession.AuthType = AUTH_SSL Then
|
||||
Try
|
||||
If pSession.Port = 993 Then
|
||||
Logger.Debug("Connecting with [ConnectSSL] on [{0}/{1}]", pSession.Server, pSession.Port)
|
||||
' Port 465 ist der SMTP-SSL-Port, wird bei der WISAG verwendet, aber veraltet
|
||||
' Port 993 ist der IMAP-SSL-Port, zum Abholen der Mails
|
||||
If pSession.Port = 465 Or pSession.Port = 993 Then
|
||||
Logger.Debug("Connecting with [SSL/ConnectSSL] on [{0}/{1}]", pSession.Server, pSession.Port)
|
||||
Client.ConnectSSL(pSession.Server, pSession.Port)
|
||||
Else
|
||||
Logger.Debug("Connecting with [Connect] on [{0}/{1}]", pSession.Server, pSession.Port)
|
||||
Logger.Debug("Connecting with [SSL/Connect] on [{0}/{1}]", pSession.Server, pSession.Port)
|
||||
Client.Connect(pSession.Server, pSession.Port)
|
||||
End If
|
||||
Logger.Info("Connection Successful!")
|
||||
Logger.Debug("Connection (AUTH_SSL) Successful!")
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Warn("Error while connecting with Auth type SSL!")
|
||||
Logger.Warn("Unexpected Error in ConnectToServer with Auth type SSL!")
|
||||
Logger.Warn($"Error-message: {ex.Message}")
|
||||
Logger.Error(ex)
|
||||
|
||||
Session.Error = ex
|
||||
@@ -186,28 +191,30 @@ Namespace Mail
|
||||
ElseIf Session.AuthType = AUTH_SSLTLS Or Session.AuthType = AUTH_STARTTLS Then
|
||||
|
||||
Try
|
||||
Logger.Debug("Client.SSLConfiguration.EnabledSslProtocols is [{0}]", Client.SSLConfiguration.EnabledSslProtocols.ToString)
|
||||
If pSession.Port = 993 Then
|
||||
Logger.Debug("Connecting with [ConnectSSL] on [{0}/{1}]", pSession.Server, pSession.Port)
|
||||
Logger.Debug("Port is 993 - So Client.ConnectSSL will be used!")
|
||||
Logger.Debug("Connecting with [STARTTLS/ConnectSSL] on [{0}/{1}]", pSession.Server, pSession.Port)
|
||||
Client.ConnectSSL(pSession.Server, pSession.Port)
|
||||
Else
|
||||
Logger.Debug("Connecting with [Connect] on [{0}/{1}]", pSession.Server, pSession.Port)
|
||||
Logger.Debug("Connecting with [STARTTLS/Connect] on [{0}/{1}]", pSession.Server, pSession.Port)
|
||||
Client.Connect(pSession.Server, pSession.Port)
|
||||
End If
|
||||
Logger.Info("Connection Successful!")
|
||||
Logger.Debug("Connection (AUTH_SSLTLS or AUTH_STARTTLS) Successful!")
|
||||
|
||||
Dim oSupportsSTARTTLS As Boolean = SupportsSTARTTLS(Client)
|
||||
Logger.Debug("Server supports STARTTLS: [{0}]", oSupportsSTARTTLS)
|
||||
|
||||
If oSupportsSTARTTLS Then
|
||||
DoSTARTTLS(Client)
|
||||
Logger.Info("STARTTLS Successful!")
|
||||
Logger.Debug("STARTTLS Successful!")
|
||||
Else
|
||||
Logger.Debug("Server does not support STARTTLS. Enabling TLS1.2 instead.")
|
||||
Client.SSLConfiguration.EnabledSslProtocols = Security.Authentication.SslProtocols.Tls12
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Warn("Error while connecting with Auth type STARTTLS!")
|
||||
Logger.Warn("Unexpected Error in ConnectToServer with Auth type STARTTLS!")
|
||||
Logger.Error(ex)
|
||||
|
||||
pSession.Error = ex
|
||||
@@ -218,9 +225,9 @@ Namespace Mail
|
||||
Try
|
||||
Logger.Debug("Auth type [{0}]. Using PLAINTEXT connection.", Session.AuthType)
|
||||
Client.Connect(pSession.Server, pSession.Port, useSSL:=False)
|
||||
Logger.Info("Connection Successful!")
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Warn("Error while connecting with Auth type [{0}]!", Session.AuthType)
|
||||
Logger.Warn("Unexpected Error in ConnectToServer with Auth type [{0}]!", Session.AuthType)
|
||||
Logger.Error(ex)
|
||||
|
||||
pSession.Error = ex
|
||||
@@ -243,7 +250,7 @@ Namespace Mail
|
||||
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Logger.Warn("Error while connecting with Auth type [{0}]!", pSession.AuthType)
|
||||
Logger.Warn("Unexpected Error in ConnectToServer with Auth type [{0}]!", pSession.AuthType)
|
||||
Logger.Error(ex)
|
||||
|
||||
pSession.Error = ex
|
||||
|
||||
@@ -44,6 +44,14 @@
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="DigitalData.Modules.Base, Version=1.3.9.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Base\bin\Debug\DigitalData.Modules.Base.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Logging, Version=2.6.5.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Mail">
|
||||
<HintPath>P:\Visual Studio Projekte\Bibliotheken\Limilabs\Mail.dll\Mail.dll</HintPath>
|
||||
<EmbedInteropTypes>False</EmbedInteropTypes>
|
||||
@@ -135,20 +143,13 @@
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Base\Base.vbproj">
|
||||
<Project>{6ea0c51f-c2b1-4462-8198-3de0b32b74f8}</Project>
|
||||
<Name>Base</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Logging\Logging.vbproj">
|
||||
<Project>{903b2d7d-3b80-4be9-8713-7447b704e1b0}</Project>
|
||||
<Name>Logging</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="MailLicense.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>powershell.exe -command "& { &'$(SolutionDir)copy-binary.ps1' '$(TargetPath)' '$(TargetFileName)' '$(ConfigurationName)' '$(ProjectName)' }"</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -8,12 +8,12 @@ Imports System.Runtime.InteropServices
|
||||
|
||||
' Werte der Assemblyattribute überprüfen
|
||||
|
||||
<Assembly: AssemblyTitle("Messaging")>
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("")>
|
||||
<Assembly: AssemblyProduct("Messaging")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2023")>
|
||||
<Assembly: AssemblyTrademark("1.9.2.0")>
|
||||
<Assembly: AssemblyTitle("Modules.Messaging")>
|
||||
<Assembly: AssemblyDescription("Funktionen rund um das Versenden und Empfangen von Emails")>
|
||||
<Assembly: AssemblyCompany("Digital Data GmbH, Heuchelheim")>
|
||||
<Assembly: AssemblyProduct("Modules.Messaging")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2025")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.9.2.0")>
|
||||
<Assembly: AssemblyFileVersion("1.9.2.0")>
|
||||
<Assembly: AssemblyVersion("2.0.0.0")>
|
||||
<Assembly: AssemblyFileVersion("2.0.0.0")>
|
||||
|
||||
10
Modules.sln
10
Modules.sln
@@ -33,7 +33,7 @@ Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ZooFlow", "ZooFlow\ZooFlow.
|
||||
EndProject
|
||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Messaging", "Messaging\Messaging.vbproj", "{AF664D85-0A4B-4BAB-A2F8-83110C06553A}"
|
||||
EndProject
|
||||
Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Database.Test", "Database.Test\Database.Test.vbproj", "{91B4DFC0-543C-43A7-A9E0-6817DCA277EC}"
|
||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Filesystem", "Filesystem\Filesystem.vbproj", "{991D0231-4623-496D-8BD0-9CA906029CBC}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@@ -101,10 +101,10 @@ Global
|
||||
{AF664D85-0A4B-4BAB-A2F8-83110C06553A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AF664D85-0A4B-4BAB-A2F8-83110C06553A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AF664D85-0A4B-4BAB-A2F8-83110C06553A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{91B4DFC0-543C-43A7-A9E0-6817DCA277EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{91B4DFC0-543C-43A7-A9E0-6817DCA277EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{91B4DFC0-543C-43A7-A9E0-6817DCA277EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{91B4DFC0-543C-43A7-A9E0-6817DCA277EC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{991D0231-4623-496D-8BD0-9CA906029CBC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{991D0231-4623-496D-8BD0-9CA906029CBC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{991D0231-4623-496D-8BD0-9CA906029CBC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{991D0231-4623-496D-8BD0-9CA906029CBC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -13,6 +13,11 @@ Namespace Modules
|
||||
Public Const INT_VALUE_DOMAIN = "DOMAIN"
|
||||
Public Const INT_VALUE_DATE = "DATE"
|
||||
|
||||
Public Const INT_VALUE_FILENAME_EXT = "FILENAME_EXT"
|
||||
Public Const INT_VALUE_FILENAME = "FILENAME_ONLY"
|
||||
Public Const INT_VALUE_FILE_DATE = "FILE_DATE"
|
||||
Public Const INT_VALUE_FILEEXT = "FILE_EXT"
|
||||
|
||||
Public Const INT_VALUE_DATE_YYYY = "YYYY"
|
||||
Public Const INT_VALUE_DATE_MM = "MM"
|
||||
Public Const INT_VALUE_DATE_DD = "DD"
|
||||
|
||||
@@ -8,12 +8,12 @@ Imports System.Runtime.InteropServices
|
||||
|
||||
' Werte der Assemblyattribute überprüfen
|
||||
|
||||
<Assembly: AssemblyTitle("Patterns")>
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("")>
|
||||
<Assembly: AssemblyProduct("Patterns")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2022")>
|
||||
<Assembly: AssemblyTrademark("1.3.0.0")>
|
||||
<Assembly: AssemblyTitle("DigitalData.Patterns")>
|
||||
<Assembly: AssemblyDescription("Enthält die Digital Data Struktur von Patterns die zum Ersetzen innerhalb der DD Produkte dienen")>
|
||||
<Assembly: AssemblyCompany("Digital Data GmbH, Heuchelheim")>
|
||||
<Assembly: AssemblyProduct("DigitalData.Patterns")>
|
||||
<Assembly: AssemblyCopyright("")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.3.0.0")>
|
||||
<Assembly: AssemblyFileVersion("1.3.0.0")>
|
||||
<Assembly: AssemblyVersion("1.3.1.0")>
|
||||
<Assembly: AssemblyFileVersion("1.3.1.0")>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
Imports System.Text.RegularExpressions
|
||||
Imports System.IO
|
||||
Imports System.Text.RegularExpressions
|
||||
Imports System.Windows.Forms
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.ZooFlow
|
||||
@@ -36,10 +37,21 @@ Public Class ClassPatterns
|
||||
Public Const INT_VALUE_DOMAIN = "DOMAIN"
|
||||
Public Const INT_VALUE_DATE = "DATE"
|
||||
|
||||
Public Const INT_VALUE_FILENAME_EXT = "FILENAME_EXT"
|
||||
Public Const INT_VALUE_FILENAME = "FILENAME"
|
||||
Public Const INT_VALUE_FILEEXT = "FILE_EXT"
|
||||
Public Const INT_VALUE_FILE_DATE = "FILE_DATE"
|
||||
|
||||
|
||||
Public Const CLIPBOARD_VALUE_DE = "@Zwischenablage"
|
||||
Public Const CLIPBOARD_VALUE_EN = "@Clipboard"
|
||||
|
||||
Public Const PATTERN_WMDOCID = "{@WMDocID}"
|
||||
Public Const PATTERN_IDBOBJID = "{@IDBObjID}"
|
||||
|
||||
|
||||
Public Const MAX_TRY_COUNT = 100
|
||||
Public _handled_File As String = Nothing
|
||||
|
||||
Public ReadOnly Property PatternRegex As Regex
|
||||
Get
|
||||
@@ -51,7 +63,7 @@ Public Class ClassPatterns
|
||||
Private ReadOnly _LogConfig As LogConfig
|
||||
|
||||
Private ReadOnly _Regex As Regex = New Regex("{#(\w+)#([\w\s_-]+)}+")
|
||||
Private ReadOnly _AllPatterns As New List(Of String) From {PATTERN_WMI, PATTERN_CTRL, PATTERN_USER, PATTERN_INT}
|
||||
Private ReadOnly _AllPatterns As New List(Of String) From {PATTERN_WMI, PATTERN_CTRL, PATTERN_USER, PATTERN_INT, PATTERN_WMDOCID, PATTERN_IDBOBJID}
|
||||
Private ReadOnly _ComplexPatterns As New List(Of String) From {PATTERN_WMI, PATTERN_CTRL}
|
||||
Private ReadOnly _SimplePatterns As New List(Of String) From {PATTERN_USER, PATTERN_INT}
|
||||
|
||||
@@ -67,12 +79,13 @@ Public Class ClassPatterns
|
||||
_Logger = pLogConfig.GetLogger
|
||||
End Sub
|
||||
|
||||
Public Function ReplaceAllValues(pInput As String, pUser As State.UserState, pClipboardContents As String) As String
|
||||
Public Function ReplaceAllValues(pInput As String, pUser As State.UserState, pClipboardContents As String, pObjectID As String) As String
|
||||
Try
|
||||
Dim result = pInput
|
||||
|
||||
result = ReplaceClipboardContents(result, pClipboardContents)
|
||||
result = ReplaceInternalValues(result)
|
||||
result = ReplaceObjectIDValues(result, pObjectID)
|
||||
result = ReplaceUserValues(result, pUser)
|
||||
|
||||
Return result
|
||||
@@ -95,6 +108,13 @@ Public Class ClassPatterns
|
||||
|
||||
Return oResult
|
||||
End Function
|
||||
Public Function ReplaceObjectIDValues(pInput As String, pObjectID As String) As String
|
||||
Dim oResult = pInput
|
||||
|
||||
oResult = oResult.Replace(CLIPBOARD_VALUE_DE, pObjectID)
|
||||
|
||||
Return oResult
|
||||
End Function
|
||||
|
||||
Public Function ReplaceInternalValues(pInput As String) As String
|
||||
Try
|
||||
@@ -120,6 +140,45 @@ Public Class ClassPatterns
|
||||
oResult = ReplacePattern(oResult, PATTERN_INT, Now.ToShortDateString)
|
||||
End While
|
||||
|
||||
While ContainsPatternAndValue(oResult, PATTERN_INT, INT_VALUE_FILENAME_EXT)
|
||||
If Not IsNothing(_handled_File) Then
|
||||
If File.Exists(_handled_File) Then
|
||||
Dim oFileName As String = Path.GetFileName(_handled_File)
|
||||
oResult = ReplacePattern(oResult, PATTERN_INT, oFileName)
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
End While
|
||||
|
||||
While ContainsPatternAndValue(oResult, PATTERN_INT, INT_VALUE_FILENAME)
|
||||
If Not IsNothing(_handled_File) Then
|
||||
If File.Exists(_handled_File) Then
|
||||
Dim oFileName As String = Path.GetFileNameWithoutExtension(_handled_File)
|
||||
oResult = ReplacePattern(oResult, PATTERN_INT, oFileName)
|
||||
End If
|
||||
End If
|
||||
End While
|
||||
While ContainsPatternAndValue(oResult, PATTERN_INT, INT_VALUE_FILEEXT)
|
||||
If Not IsNothing(_handled_File) Then
|
||||
If File.Exists(_handled_File) Then
|
||||
Dim oFileExt As String = Path.GetExtension(_handled_File).Substring(1)
|
||||
oResult = ReplacePattern(oResult, PATTERN_INT, oFileExt)
|
||||
End If
|
||||
End If
|
||||
End While
|
||||
While ContainsPatternAndValue(oResult, PATTERN_INT, INT_VALUE_FILE_DATE)
|
||||
If Not IsNothing(_handled_File) Then
|
||||
If File.Exists(_handled_File) Then
|
||||
Dim oCreationDate As DateTime = File.GetCreationTime(_handled_File)
|
||||
Dim oDateOnlyString As String = oCreationDate.ToString("yyyy-MM-dd")
|
||||
oResult = ReplacePattern(oResult, PATTERN_INT, oDateOnlyString)
|
||||
End If
|
||||
End If
|
||||
End While
|
||||
|
||||
|
||||
|
||||
Return oResult
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
|
||||
@@ -53,6 +53,13 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\DDMonorepo\Controls.LookupGrid\bin\Debug\DigitalData.Controls.LookupGrid.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Logging, Version=2.6.5.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\DigitalData.Modules.Logging.2.6.5\lib\net462\DigitalData.Modules.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.ZooFlow, Version=1.3.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\ZooFlow\bin\Debug\DigitalData.Modules.ZooFlow.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Interop.WINDREAMLib">
|
||||
<HintPath>P:\Visual Studio Projekte\Bibliotheken\windream\Interop.WINDREAMLib.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
@@ -141,16 +148,9 @@
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Logging\Logging.vbproj">
|
||||
<Project>{903b2d7d-3b80-4be9-8713-7447b704e1b0}</Project>
|
||||
<Name>Logging</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\ZooFlow\ZooFlow.vbproj">
|
||||
<Project>{81cac44f-3711-4c8f-ae98-e02a7448782a}</Project>
|
||||
<Name>ZooFlow</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>powershell.exe -command "& { &'$(SolutionDir)copy-binary.ps1' '$(TargetPath)' '$(TargetFileName)' '$(ConfigurationName)' '$(ProjectName)' }"</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -1,11 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="FirebirdSql.Data.FirebirdClient" publicKeyToken="3750abcc3150b00c" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-7.5.0.0" newVersion="7.5.0.0"/>
|
||||
<assemblyIdentity name="FirebirdSql.Data.FirebirdClient" publicKeyToken="3750abcc3150b00c" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-7.5.0.0" newVersion="7.5.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/></startup></configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" /></startup></configuration>
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="DigitalData.Modules.Logging" version="2.6.5" targetFramework="net462" />
|
||||
<package id="NLog" version="5.0.5" targetFramework="net461" />
|
||||
<package id="NuGet.CommandLine" version="6.13.2" targetFramework="net462" developmentDependency="true" />
|
||||
</packages>
|
||||
11
README.md
Normal file
11
README.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# Modules
|
||||
|
||||
Diese Projektmappe enthält die Grundfunktionen für alle Produkte in Form von Modulen.
|
||||
|
||||
## Deploy Skript
|
||||
|
||||
Das Skript `copy-binary.ps1` liegt im Hauptverzeichnis und kann über den folgenden Befehl aufgerufen werden. Der Befehl wird pro Projekt in den Projekteinstellungen unter `Kompilieren > Buildereignisse > Postbuildereignis` eingetragen und sorgt dafür, dass die Assembly des Projekts in ein Deploy Verzeichnis kopiert wird.
|
||||
|
||||
```cmd
|
||||
powershell.exe -command "& { &'$(SolutionDir)copy-binary.ps1' '$(TargetPath)' '$(TargetFileName)' '$(ConfigurationName)' }"
|
||||
```
|
||||
@@ -8,12 +8,12 @@ Imports System.Runtime.InteropServices
|
||||
|
||||
' Werte der Assemblyattribute überprüfen
|
||||
|
||||
<Assembly: AssemblyTitle("Windows")>
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("")>
|
||||
<Assembly: AssemblyProduct("Windows")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2022")>
|
||||
<Assembly: AssemblyTrademark("1.5.0.0")>
|
||||
<Assembly: AssemblyTitle("Modules.Windows")>
|
||||
<Assembly: AssemblyDescription("Stellt Funktionen für windows und Hotkeys bereit")>
|
||||
<Assembly: AssemblyCompany("Digital Data GmbH, Heuchelheim")>
|
||||
<Assembly: AssemblyProduct("Modules.Windows")>
|
||||
<Assembly: AssemblyCopyright("")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.5.0.0")>
|
||||
<Assembly: AssemblyFileVersion("1.5.0.0")>
|
||||
<Assembly: AssemblyVersion("1.5.1.0")>
|
||||
<Assembly: AssemblyFileVersion("1.5.1.0")>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user