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