jj: zugferd
This commit is contained in:
@@ -88,6 +88,7 @@
|
|||||||
<DependentUpon>Settings.settings</DependentUpon>
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="ZUGFeRD1p0.vb" />
|
||||||
<Compile Include="ZUGFeRDInterface.vb" />
|
<Compile Include="ZUGFeRDInterface.vb" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
3176
Modules.Interfaces/ZUGFeRD1p0.vb
Normal file
3176
Modules.Interfaces/ZUGFeRD1p0.vb
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,7 @@
|
|||||||
Imports System.Xml
|
Imports System.Xml
|
||||||
|
Imports System.Xml.Serialization
|
||||||
|
Imports System.Xml.XPath
|
||||||
|
Imports System.Xml.Xsl
|
||||||
Imports DigitalData.Modules.Interfaces.Exceptions
|
Imports DigitalData.Modules.Interfaces.Exceptions
|
||||||
Imports DigitalData.Modules.Logging
|
Imports DigitalData.Modules.Logging
|
||||||
|
|
||||||
@@ -25,7 +28,7 @@ Public Class ZUGFeRDInterface
|
|||||||
''' <param name="Path"></param>
|
''' <param name="Path"></param>
|
||||||
''' <exception cref="ZUGFeRDExecption"></exception>
|
''' <exception cref="ZUGFeRDExecption"></exception>
|
||||||
''' <returns></returns>
|
''' <returns></returns>
|
||||||
Public Function ExtractXMLFile(Path As String) As XmlDocument
|
Public Function ExtractXMLFile(Path As String) As XPathDocument
|
||||||
Dim oException As New Exception
|
Dim oException As New Exception
|
||||||
Dim oXmlDocument = ExtractZugferd(Path)
|
Dim oXmlDocument = ExtractZugferd(Path)
|
||||||
|
|
||||||
@@ -36,10 +39,10 @@ Public Class ZUGFeRDInterface
|
|||||||
Return oXmlDocument
|
Return oXmlDocument
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function ExtractZugferd(Path As String) As XmlDocument
|
Public Function ExtractZugferd(Path As String) As XPathDocument
|
||||||
Dim oProcessOutput, oProcessError, oFileContent As String
|
Dim oProcessOutput, oProcessError, oFileContent As String
|
||||||
Dim oXmlDocument As New XmlDocument()
|
Dim oXmlDocument As XPathDocument
|
||||||
Dim oTempFile = IO.Path.GetTempFileName()
|
Dim oTempFile = System.IO.Path.GetTempFileName()
|
||||||
|
|
||||||
Dim oProcessStartInfo As New ProcessStartInfo() With {
|
Dim oProcessStartInfo As New ProcessStartInfo() With {
|
||||||
.FileName = ZUGFERD_CONVERTER_EXE,
|
.FileName = ZUGFERD_CONVERTER_EXE,
|
||||||
@@ -68,14 +71,8 @@ Public Class ZUGFeRDInterface
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
Try
|
Try
|
||||||
oFileContent = IO.File.ReadAllText(oTempFile)
|
oXmlDocument = New XPath.XPathDocument(oTempFile)
|
||||||
Catch ex As Exception
|
|
||||||
_logger.Error(ex)
|
|
||||||
Return Nothing
|
|
||||||
End Try
|
|
||||||
|
|
||||||
Try
|
|
||||||
oXmlDocument.LoadXml(oFileContent)
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_logger.Error(ex)
|
_logger.Error(ex)
|
||||||
Return Nothing
|
Return Nothing
|
||||||
@@ -84,31 +81,11 @@ Public Class ZUGFeRDInterface
|
|||||||
Return oXmlDocument
|
Return oXmlDocument
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Function CheckZugferd(Path As String) As Boolean
|
Public Function ParseXMLDocument(doc As XPathDocument)
|
||||||
Dim oProcessOutput, oProcessError As String
|
Dim nav As XPathNavigator = doc.CreateNavigator()
|
||||||
Dim oProcessStartInfo As New ProcessStartInfo() With {
|
Dim reader = nav.ReadSubtree()
|
||||||
.FileName = ZUGFERD_CONVERTER_EXE,
|
|
||||||
.RedirectStandardError = True,
|
|
||||||
.RedirectStandardOutput = True,
|
|
||||||
.UseShellExecute = False,
|
|
||||||
.Arguments = $"-i {Path}"
|
|
||||||
}
|
|
||||||
Dim oProcess As New Process() With {
|
|
||||||
.StartInfo = oProcessStartInfo
|
|
||||||
}
|
|
||||||
|
|
||||||
Try
|
Dim serializer As New XmlSerializer(GetType(CrossIndustryDocumentType))
|
||||||
oProcess.Start()
|
Dim cross As CrossIndustryDocumentType = serializer.Deserialize(reader)
|
||||||
oProcessOutput = oProcess.StandardOutput.ReadToEnd()
|
|
||||||
oProcessError = oProcess.StandardError.ReadToEnd()
|
|
||||||
oProcess.WaitForExit()
|
|
||||||
Catch ex As Exception
|
|
||||||
_logger.Error(ex)
|
|
||||||
Return False
|
|
||||||
End Try
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Return True
|
|
||||||
End Function
|
End Function
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
|
<package id="IKVM" version="8.0.5449.1" targetFramework="net461" />
|
||||||
<package id="NLog" version="4.5.11" targetFramework="net461" />
|
<package id="NLog" version="4.5.11" targetFramework="net461" />
|
||||||
</packages>
|
</packages>
|
||||||
@@ -14,7 +14,9 @@ Public Class Form1
|
|||||||
Dim zugferd As ZUGFeRDInterface = New ZUGFeRDInterface(logConfig)
|
Dim zugferd As ZUGFeRDInterface = New ZUGFeRDInterface(logConfig)
|
||||||
|
|
||||||
If oFDialogResult = DialogResult.OK Then
|
If oFDialogResult = DialogResult.OK Then
|
||||||
Dim xml As XmlDocument = zugferd.ExtractXMLFile(OpenFileDialog1.FileName)
|
Dim xml As XPath.XPathDocument = zugferd.ExtractXMLFile(OpenFileDialog1.FileName)
|
||||||
|
|
||||||
|
zugferd.ParseXMLDocument(xml)
|
||||||
|
|
||||||
MsgBox("YAY!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
|
MsgBox("YAY!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
|
||||||
End If
|
End If
|
||||||
|
|||||||
Reference in New Issue
Block a user