Interfaces: Remove obsolete pdf_zugferd_test.exe

This commit is contained in:
Jonathan Jenne 2021-07-13 13:52:45 +02:00
parent 757a8616dc
commit aa873d501c
5 changed files with 12 additions and 66 deletions

View File

@ -136,9 +136,6 @@
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
</None>
<None Include="packages.config" />
<None Include="ZUGFeRDInterface\pdf_zugferd_lib\pdf_zugferd_lib.lib">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Modules.Database\Database.vbproj">
@ -150,14 +147,6 @@
<Name>Logging</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="ZUGFeRDInterface\pdf_zugferd_lib\pdf_zugferd_lib.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="ZUGFeRDInterface\pdf_zugferd_lib\pdf_zugferd_test.exe">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
</Project>

View File

@ -40,23 +40,12 @@ Public Class ZUGFeRDInterface
End Try
End Sub
''' <summary>
''' Validates a ZUGFeRD File and extracts the XML Document from it
''' </summary>
''' <param name="Path"></param>
''' <exception cref="ZUGFeRDExecption"></exception>
''' <returns></returns>
Public Function ExtractZUGFeRDFile(Path As String) As CrossIndustryDocumentType
Dim oXmlDocument = ValidateZUGFeRDFile(Path)
If IsNothing(oXmlDocument) Then
Throw New ZUGFeRDExecption(ErrorType.NoZugferd, "Datei ist keine ZUGFeRD Datei.")
End If
Return SerializeZUGFeRDDocument(oXmlDocument)
End Function
Public Function ExtractZUGFeRDFileWithGDPicture(Path As String) As CrossIndustryDocumentType
Dim oXmlDocument = ValidateZUGFeRDFileWithGDPicture(Path)
@ -67,6 +56,12 @@ Public Class ZUGFeRDInterface
Return SerializeZUGFeRDDocument(oXmlDocument)
End Function
''' <summary>
''' Validates a ZUGFeRD File and extracts the XML Document from it
''' </summary>
''' <param name="Stream"></param>
''' <exception cref="ZUGFeRDExecption"></exception>
''' <returns></returns>
Public Function ExtractZUGFeRDFileWithGDPicture(Stream As Stream) As CrossIndustryDocumentType
Dim oXmlDocument = ValidateZUGFeRDFileWithGDPicture(Stream)
@ -77,50 +72,12 @@ Public Class ZUGFeRDInterface
Return SerializeZUGFeRDDocument(oXmlDocument)
End Function
Public Function ValidateZUGFeRDFile(Path As String) As XPathDocument
Dim oProcessOutput, oProcessError As String
Dim oXmlDocument As XPathDocument
Dim oTempFile = IO.Path.GetTempFileName()
Dim oProcess As New Process() With {
.StartInfo = New ProcessStartInfo() With {
.FileName = ZUGFERD_CONVERTER_EXE,
.RedirectStandardError = True,
.RedirectStandardOutput = True,
.UseShellExecute = False,
.Arguments = $"-i ""{Path}"" -o ""{oTempFile}"""
}
}
Try
oProcess.Start()
oProcessOutput = oProcess.StandardOutput.ReadToEnd()
oProcessError = oProcess.StandardError.ReadToEnd()
oProcess.WaitForExit()
_logger.Debug("Process Output:")
_logger.Debug(oProcessOutput)
Catch ex As Exception
_logger.Error(ex)
Throw ex
End Try
If Not oProcessOutput.ToLower.Contains(ZUGFERD_CONVERTER_SUCCESS_MESSAGE.ToLower) Then
_logger.Warn("File {0} is not a valid ZUGFeRD File!", Path)
Throw New ZUGFeRDExecption(ErrorType.NoZugferd, "Datei ist keine ZUGFeRD Datei.")
End If
Try
oXmlDocument = New XPathDocument(oTempFile)
Catch ex As Exception
_logger.Error(ex)
Throw ex
End Try
Return oXmlDocument
End Function
''' <summary>
''' Validates a ZUGFeRD File and extracts the XML Document from it
''' </summary>
''' <param name="Stream"></param>
''' <exception cref="ZUGFeRDExecption"></exception>
''' <returns></returns>
Public Function ValidateZUGFeRDFileWithGDPicture(Stream As Stream) As XPathDocument
Dim oEmbedExtractor = New PDFEmbeds(_logConfig)
Dim oAllowedExtensions = New List(Of String) From {"xml"}