Compare commits
45 Commits
3e795a1a6d
...
ZugferdSer
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ae12ea21f2 | ||
|
|
124cfde45e | ||
|
|
c23a608b6a | ||
|
|
2fabdb90a5 | ||
|
|
0b36700ba1 | ||
|
|
4f75d7eb96 | ||
|
|
a8a9dd84eb | ||
|
|
40b8783af4 | ||
|
|
acaa2e7ad6 | ||
|
|
5ac28e2032 | ||
|
|
0e592de288 | ||
|
|
9623ce8191 | ||
|
|
a69712d94c | ||
|
|
52149cbeb8 | ||
|
|
c9fdf80936 | ||
|
|
b5feec77f7 | ||
|
|
8d91dcdb43 | ||
|
|
84dab7f5a6 | ||
|
|
3449b16d69 | ||
|
|
7b3dc1bf89 | ||
|
|
3d3a491744 | ||
|
|
322ca23f33 | ||
|
|
6ec458ccdf | ||
|
|
a437359114 | ||
|
|
b6b29e5de8 | ||
|
|
51c1f9f3f7 | ||
|
|
28d2e4241d | ||
|
|
edf7c37cb5 | ||
|
|
c8291116a3 | ||
|
|
7977b926f1 | ||
|
|
a46809ae24 | ||
|
|
33937a41d3 | ||
| a66c2928f2 | |||
| dff085ced2 | |||
|
|
efade78579 | ||
|
|
d7bbd08a36 | ||
|
|
e013fd4a25 | ||
|
|
4c4ea524eb | ||
|
|
3d5bfd5f39 | ||
|
|
540d021e27 | ||
|
|
1c2fb43f6a | ||
|
|
1e02757b22 | ||
|
|
73c5255bd5 | ||
|
|
0c8a4fb8e3 | ||
|
|
204151b78c |
63
Controls.DocumentViewer/DocumentViewer.Designer.vb
generated
63
Controls.DocumentViewer/DocumentViewer.Designer.vb
generated
@@ -53,13 +53,11 @@ Partial Class DocumentViewer
|
||||
Me.btnFlipY = New System.Windows.Forms.ToolStripButton()
|
||||
Me.ToolStripSeparator4 = New System.Windows.Forms.ToolStripSeparator()
|
||||
Me.btnSettings = New System.Windows.Forms.ToolStripButton()
|
||||
Me.statusbar = New System.Windows.Forms.StatusStrip()
|
||||
Me.infoLabel = New System.Windows.Forms.ToolStripStatusLabel()
|
||||
Me.statusLabel = New System.Windows.Forms.ToolStripStatusLabel()
|
||||
Me.OpenFileDialog = New System.Windows.Forms.OpenFileDialog()
|
||||
Me.RichEditControl1 = New DevExpress.XtraRichEdit.RichEditControl()
|
||||
Me.SpreadsheetControl1 = New DevExpress.XtraSpreadsheet.SpreadsheetControl()
|
||||
Me.PrintDocument1 = New System.Drawing.Printing.PrintDocument()
|
||||
Me.mainToolStrip.SuspendLayout()
|
||||
Me.statusbar.SuspendLayout()
|
||||
Me.SuspendLayout()
|
||||
'
|
||||
'GdViewer
|
||||
@@ -125,7 +123,7 @@ Partial Class DocumentViewer
|
||||
Me.GdViewer.ScrollLargeChange = CType(50, Short)
|
||||
Me.GdViewer.ScrollSmallChange = CType(1, Short)
|
||||
Me.GdViewer.SilentMode = True
|
||||
Me.GdViewer.Size = New System.Drawing.Size(1015, 537)
|
||||
Me.GdViewer.Size = New System.Drawing.Size(1015, 559)
|
||||
Me.GdViewer.TabIndex = 0
|
||||
Me.GdViewer.ViewRotation = System.Drawing.RotateFlipType.RotateNoneFlipNone
|
||||
Me.GdViewer.Zoom = 1.0R
|
||||
@@ -195,7 +193,7 @@ Partial Class DocumentViewer
|
||||
'
|
||||
Me.DefaultToolStripMenuItem.CheckOnClick = True
|
||||
Me.DefaultToolStripMenuItem.Name = "DefaultToolStripMenuItem"
|
||||
Me.DefaultToolStripMenuItem.Size = New System.Drawing.Size(180, 22)
|
||||
Me.DefaultToolStripMenuItem.Size = New System.Drawing.Size(151, 22)
|
||||
Me.DefaultToolStripMenuItem.Text = "Default"
|
||||
'
|
||||
'PanToolStripMenuItem
|
||||
@@ -204,28 +202,28 @@ Partial Class DocumentViewer
|
||||
Me.PanToolStripMenuItem.CheckOnClick = True
|
||||
Me.PanToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked
|
||||
Me.PanToolStripMenuItem.Name = "PanToolStripMenuItem"
|
||||
Me.PanToolStripMenuItem.Size = New System.Drawing.Size(180, 22)
|
||||
Me.PanToolStripMenuItem.Size = New System.Drawing.Size(151, 22)
|
||||
Me.PanToolStripMenuItem.Text = "Pan"
|
||||
'
|
||||
'AreaSelectionToolStripMenuItem
|
||||
'
|
||||
Me.AreaSelectionToolStripMenuItem.CheckOnClick = True
|
||||
Me.AreaSelectionToolStripMenuItem.Name = "AreaSelectionToolStripMenuItem"
|
||||
Me.AreaSelectionToolStripMenuItem.Size = New System.Drawing.Size(180, 22)
|
||||
Me.AreaSelectionToolStripMenuItem.Size = New System.Drawing.Size(151, 22)
|
||||
Me.AreaSelectionToolStripMenuItem.Text = "Area selection"
|
||||
'
|
||||
'AreaZoomingToolStripMenuItem
|
||||
'
|
||||
Me.AreaZoomingToolStripMenuItem.CheckOnClick = True
|
||||
Me.AreaZoomingToolStripMenuItem.Name = "AreaZoomingToolStripMenuItem"
|
||||
Me.AreaZoomingToolStripMenuItem.Size = New System.Drawing.Size(180, 22)
|
||||
Me.AreaZoomingToolStripMenuItem.Size = New System.Drawing.Size(151, 22)
|
||||
Me.AreaZoomingToolStripMenuItem.Text = "Area zooming"
|
||||
'
|
||||
'MagnifierToolStripMenuItem
|
||||
'
|
||||
Me.MagnifierToolStripMenuItem.CheckOnClick = True
|
||||
Me.MagnifierToolStripMenuItem.Name = "MagnifierToolStripMenuItem"
|
||||
Me.MagnifierToolStripMenuItem.Size = New System.Drawing.Size(180, 22)
|
||||
Me.MagnifierToolStripMenuItem.Size = New System.Drawing.Size(151, 22)
|
||||
Me.MagnifierToolStripMenuItem.Text = "Magnifier"
|
||||
'
|
||||
'ToolStripSeparator6
|
||||
@@ -382,58 +380,44 @@ Partial Class DocumentViewer
|
||||
Me.btnSettings.Size = New System.Drawing.Size(28, 28)
|
||||
Me.btnSettings.Text = "Viewer settings"
|
||||
'
|
||||
'statusbar
|
||||
'
|
||||
Me.statusbar.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.infoLabel, Me.statusLabel})
|
||||
Me.statusbar.Location = New System.Drawing.Point(0, 568)
|
||||
Me.statusbar.Name = "statusbar"
|
||||
Me.statusbar.Size = New System.Drawing.Size(1015, 22)
|
||||
Me.statusbar.SizingGrip = False
|
||||
Me.statusbar.TabIndex = 7
|
||||
Me.statusbar.Text = "StatusStrip1"
|
||||
'
|
||||
'infoLabel
|
||||
'
|
||||
Me.infoLabel.Name = "infoLabel"
|
||||
Me.infoLabel.Size = New System.Drawing.Size(56, 17)
|
||||
Me.infoLabel.Text = "infoLabel"
|
||||
'
|
||||
'statusLabel
|
||||
'
|
||||
Me.statusLabel.Name = "statusLabel"
|
||||
Me.statusLabel.Size = New System.Drawing.Size(66, 17)
|
||||
Me.statusLabel.Text = "statusLabel"
|
||||
'
|
||||
'OpenFileDialog
|
||||
'
|
||||
Me.OpenFileDialog.FileName = "OpenFileDialog1"
|
||||
'
|
||||
'RichEditControl1
|
||||
'
|
||||
Me.RichEditControl1.Location = New System.Drawing.Point(735, 313)
|
||||
Me.RichEditControl1.Location = New System.Drawing.Point(735, 377)
|
||||
Me.RichEditControl1.Name = "RichEditControl1"
|
||||
Me.RichEditControl1.Options.HorizontalRuler.Visibility = DevExpress.XtraRichEdit.RichEditRulerVisibility.Hidden
|
||||
Me.RichEditControl1.Options.VerticalRuler.Visibility = DevExpress.XtraRichEdit.RichEditRulerVisibility.Hidden
|
||||
Me.RichEditControl1.ReadOnly = True
|
||||
Me.RichEditControl1.Size = New System.Drawing.Size(249, 225)
|
||||
Me.RichEditControl1.Size = New System.Drawing.Size(249, 161)
|
||||
Me.RichEditControl1.TabIndex = 8
|
||||
Me.RichEditControl1.Text = "RichEditControl1"
|
||||
Me.RichEditControl1.Visible = False
|
||||
'
|
||||
'SpreadsheetControl1
|
||||
'
|
||||
Me.SpreadsheetControl1.Location = New System.Drawing.Point(461, 377)
|
||||
Me.SpreadsheetControl1.Name = "SpreadsheetControl1"
|
||||
Me.SpreadsheetControl1.ReadOnly = True
|
||||
Me.SpreadsheetControl1.Size = New System.Drawing.Size(268, 161)
|
||||
Me.SpreadsheetControl1.TabIndex = 9
|
||||
Me.SpreadsheetControl1.Text = "SpreadsheetControl1"
|
||||
Me.SpreadsheetControl1.Visible = False
|
||||
'
|
||||
'DocumentViewer
|
||||
'
|
||||
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
||||
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
|
||||
Me.Controls.Add(Me.SpreadsheetControl1)
|
||||
Me.Controls.Add(Me.RichEditControl1)
|
||||
Me.Controls.Add(Me.GdViewer)
|
||||
Me.Controls.Add(Me.statusbar)
|
||||
Me.Controls.Add(Me.mainToolStrip)
|
||||
Me.Name = "DocumentViewer"
|
||||
Me.Size = New System.Drawing.Size(1015, 590)
|
||||
Me.mainToolStrip.ResumeLayout(False)
|
||||
Me.mainToolStrip.PerformLayout()
|
||||
Me.statusbar.ResumeLayout(False)
|
||||
Me.statusbar.PerformLayout()
|
||||
Me.ResumeLayout(False)
|
||||
Me.PerformLayout()
|
||||
|
||||
@@ -469,9 +453,8 @@ Partial Class DocumentViewer
|
||||
Friend WithEvents btnFlipY As ToolStripButton
|
||||
Friend WithEvents ToolStripSeparator4 As ToolStripSeparator
|
||||
Friend WithEvents btnSettings As ToolStripButton
|
||||
Friend WithEvents statusbar As StatusStrip
|
||||
Friend WithEvents infoLabel As ToolStripStatusLabel
|
||||
Friend WithEvents statusLabel As ToolStripStatusLabel
|
||||
Friend WithEvents OpenFileDialog As OpenFileDialog
|
||||
Friend WithEvents RichEditControl1 As DevExpress.XtraRichEdit.RichEditControl
|
||||
Friend WithEvents SpreadsheetControl1 As DevExpress.XtraSpreadsheet.SpreadsheetControl
|
||||
Friend WithEvents PrintDocument1 As Printing.PrintDocument
|
||||
End Class
|
||||
|
||||
@@ -124,13 +124,13 @@
|
||||
<data name="btnPrint.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAFhSURBVEhLvVVBToRAEESNF/+kv+BIuPEAEgIXM4/wsnLQ
|
||||
kx9gvRkf4oVw4AWb3XAQZ+yanXaHQcLsrlhJZao73V3TuxCCKeR5LokKZ1EUg5OJmGna/CCEuKQByhdH
|
||||
GyRJcr2sgRA3C2/wqDeQUuoB9snkGDjK4K5Yq3NoxhxA7u9RFH3hqej7Xt3mFXElUYzT1nbOjaHBtm31
|
||||
0xXH8WeWZS8w+Hn0/tLAzOy1ARMGXHgq+T9hLr2BHBh0XafEwys1VLp4b3bQds6NodHbNM20QVVVqq5r
|
||||
iVtgVZy2tnNuDI3esizHBktysMGctnNuPKX/ZwMtDKCnbmTn3HhKY6BO2OQiX7hDWeNtxodlTYmRCeiL
|
||||
33qJPXFlfpgxUMR4fvtQTw6RY+C2+EiZVj/YBnM422BuA9SGYXhlWv3gbuC+uRwDp26wMf2zSNN0Ry0X
|
||||
+05P0K3Io9hgkxluifemzUEQfAOjsN87/RDFYwAAAABJRU5ErkJggg==
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAFhSURBVEhLvVWxToRAEEWNjf+kf0FBRccHkBBozH6CjSHa
|
||||
aGVvuNL4IRIKvuFyFwpx13l7O96ySNi7E1/ysm8mM/N27iAEU8jzXBIVzqIoBicTMdO0+UEIcU4DlC8O
|
||||
NkiS5HJZAyGuFt7gUW8gpdQD7JPJMXCQwU2xUqfQjNmD3N+jKPrCU9H3vbrOK+K9RDFOW9s5N4YG27bV
|
||||
T1ccx59Zlr3A4OfR+0sDM7PXBkwYcOGx5P+EufQGcmDQdZ0Sd6/UUOnindle2zk3hkZv0zTTBlVVqbqu
|
||||
JW6BVXHa2s65MTR6y7IcGyzJwQZz2s658ZT+nw20MICeupGdc+MpjYE6YZOLfOEOZY23GR+WFSVGJqAv
|
||||
fusl9sQH88OMgSLG89uHenKIHAO3xUfKtPrBNpjDyQZzG6A2DMML0+oHdwP3zeUYOHaDtemfRZqmW2o5
|
||||
23V6gm5FHsUam8xwQ7w1bQ6C4BuAm93DSGjZ/gAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<data name="btnFitWidth.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
@@ -154,87 +154,87 @@
|
||||
<data name="btnMouseMode.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAHASURBVEhLnZM9LwRRGIU38VVp/AGNSqPQIDMjVH4AnaDS
|
||||
iAhhZ0ShIDQSEZWKkiXB3I34KGhIiCyFWoKSjpAQrnvGu8nEPWtmPcmTm7nvPWd2Z3cypejpyVU4fr7X
|
||||
DVToZdV9Q//qhxcoPZe70lija7OPOc7hvESTaRndr3Oy6gxFv906vbX2IM4jJxV/Yz7VHivpnj/SsxuF
|
||||
aGVz5KSiNN6kclkYPr+9a4CVzSNNXqo4nh8u06AxDptHmrxUcZwJdUGDxjhsDpGXKo4zpp5YEMZhc4i8
|
||||
VHG8PvXJgjAOm0eavFTZtE8fV9KQsXMqr69vn/SL+YGx4pqdg1Jn0zx4WcUCcbOr53S/aLtR6myKNzgo
|
||||
PPzL/MVddBOps2HfAI+if/FE+2vnema9oOc3r6IV19hnj0rqbNI8ojRKnU3jdK6aBcpV6my6hvdqWKBc
|
||||
pc7m52+68sVC6V35kjrOX29yGhPfZCdQhyyYVuSliuP64RALphV5qeK0TezUtgbqkYWTRA55qSqN6+8O
|
||||
sIIkkZOKZFxfLbGSUuK8RNPjBuF408j2GyssijnOSaR8Oqby9U4QLpiyG+NrzBvsYy5HCZnMN/I6uJAB
|
||||
Y+kDAAAAAElFTkSuQmCC
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAHASURBVEhLnZM9LwRRGIU38VVp/AFqjUKDzIxQ+QE0IqHS
|
||||
iAhhZ0ShIDQSEVFTsiSYuxEfBQ0JkaVQS1DSERLCdc94N5m4Z82sJ3lyM/e958zu7E6mFD09uQrHz/e5
|
||||
gQq9rLpv6F/98AKl53JXGmt0bfYxxzmcl2gyLaP7dU5WnaHot1unt9YexHnkpOJvzKfaYyXd80d6dqMQ
|
||||
rWyOnFSUxptULgvD57d3DbCyeaTJSxXH88NlGjTGYfNIk5cqjjOhLmjQGIfNIfJSxXHG1BMLwjhsDpGX
|
||||
Ko7Xqz5ZEMZh80iTlyqb9unjShoydk7l9fXtk34xPzBWXLNzUOpsmgcvq1ggbnb1nO4XbTdKnU3xBgeF
|
||||
h3+Zv7iLbiJ1Nuwb4FH0L55of+1cz6wX9PzmVbTiGvvsUUmdTZpHlEaps2mczlWzQLlKnU3X8F4NC5Sr
|
||||
1Nn8/E1XvlgovStfUsf5601OY+Kb7ATqkAXTirxUcVw/HGLBtCIvVZy2iZ3a1kA9snCSyCEvVaVx/d0B
|
||||
VpAkclKRjOurJVZSSpyXaHrcIBxvGtl+Y4VFMcc5iZRPx1S+3gnCBVN2Y3yNeYN9zOUoIZP5Bl9auHhV
|
||||
DRJiAAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
<data name="btnFirstPage.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGjSURBVEhLxVRLS8NAEF7UnkVRPHr32oNCsgmI4FkkKIp4
|
||||
69lXs1tEgg9Ef4In76LY7BYRPPgHREFR/4Pg8+ozk0502aY1KY1+MGQyj+/bGZIlWWC45Peh21oAMWVi
|
||||
m7oHzxgixOLyU7X+2d1XTCWGvSB6KBdbBhdPEQ+mCKFs7QMMgvBMI2CWjnpNJjaD3hedB0uaEwBiyuTG
|
||||
IBOPaq/qY2m6FZm80gXE1tz+g96nG7Ykm2Bo/ribuv6qwao7Vuvr+djaWCA8MZcrlPn3el1iAQioFglY
|
||||
XCxbi+U7PZ/UQnJAzSlGxTvsuCauvavxOB/pYwQa+Or7b/VI/wcCEMjCkP4fJhjg8i24Uy71eFpD+vj/
|
||||
YISddBpMjhlFcW7x9e/Tq3XRs56P9PECmCKOs9ceXL/jwY92odclFoCAanFXhe2ddti84qRZHbY2nqAG
|
||||
ntcW3PsTxhII/awu6lV97EgpgICJTFdOmm75Su1VfSxNtqJ6yBfOcpYrpgzu3+g8WNLcBDrCj6Eop6kr
|
||||
rqPVYaq1yBd2cjYXM2bx8BZD2QBWV/UI+QIsdSyLN+9oxwAAAABJRU5ErkJggg==
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGgSURBVEhLxVRLS8NAEF7UnkVRPHr32oNCsgmof0CkKIp4
|
||||
69lXs1tEgiCiP8GTd1FsdksRPPgHREFR/4Pg8+oz005w2KY1Ka1+MGQyj+/bGZJlncB4MRhCt70AYi7U
|
||||
LveOXjDEmCP1F7Xhxf03TCWGu6IGuFQ7llTPEQ+mGOPC/wSDIDzTCNjFyqAt1HbY+2ryYElrAkDMhd4a
|
||||
FeqJ9lIfS9OtyJblPiB2lg4fzT7TsCXZBGPLJ/3cCzYtUdsxrW/kY2tzgeqJpd7gIngw6xILQIBaJOBI
|
||||
te6slu7NfFKrkgPqTjGhPmDHdXHjncbjfKSPEWji0/ff6pH+DwQg0AlD+n+YYETq9/BOuTLjaQ3p4/+D
|
||||
SXHaawk9ZRXUhSN/Tk/romcjH+njBTDFcrmD7vD6nQ5/tEuzLrEABKjFXRWuf9bjynIuzeqwtfkEdfD9
|
||||
rvDen7HWQKjWR3upjx0pBRAwke3pWdsrXdNe6mNpshU1QjZ/nnE8NWfJ4NbkwZLWJjBR/RgKep576iZa
|
||||
Habai2x+L+NKtWAXju8w1BnA6moeY9/IuSrpVj3aVAAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<data name="btnPreviousPage.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAHLSURBVEhLY6AZqK9ngrKoC4zTzrDalG0OsS3bdAIqRB1g
|
||||
X7+fw7Z8U4pdxeYbQPwfhKFSlAH7/PUCduWbyy1KNz2zLW/6BzIYRIMwVAl5wKlqszTQxZ02RZveIBtK
|
||||
sQU2FVvV7Mo2T7esWPsFFhS4MFQLMeA/o1XpBhOb8k0rtSo2/0F3KS42VDMeAExq9hVbXGzLN+yxdd/0
|
||||
F9kAiiwIDV3FbFuxKdymdPMpO4/Nf0GayMFQ4xDAtXgnNzD9ptuVbryJzUXIfGRxXGyosQwMFoU7hIAp
|
||||
ohSIn+LTgMzHpQaZDTbctnxjg23BmnfEaEDmE6MebIFdxZY064rN9+0qmsGS1MRgC0DAI3cbu33Fplib
|
||||
sg2X8bkImY9LDTIbajwCAMsTFpvKTQHAjHQEpJBSDDUWO7Ar3eBoXb5xh3z8/N8wFyG7EEbjY0ONwg/s
|
||||
yjcY2pRtXGGbteknsgFUswAGgEWFum355qn6+eu/gwwhBkO1kgZsq7ZLgkpRu4qNb7G5GpkN1UIesKnY
|
||||
ImhbtrESVA/QxAIYABUvoLxkV7LhLshwZAxVQh0ASuK2pZujgbXbWar6AAMAi3ig672sSzcdhIrQCvxn
|
||||
ZGBgYAAAFXGJG9oJLr4AAAAASUVORK5CYII=
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAHKSURBVEhLY6AZqK9ngrKoC4zTzrDalG0OsS3bdAIqRB1g
|
||||
X7+fw7Z8U4pdxeYbQPwfhKFSlAH7/PUCduWbyy1KNz2zLa//BzIYRIMwVAl5wKlqszTQxZ02RZveIBtK
|
||||
sQU2FVvV7Mo2T7esWPsFFhS4MFQLMeA/o1XpBhOb8k0rtSo2/0F3KS42VDMeAExq9hVbXGzLN+yxdd70
|
||||
F9kAiiwIDV3FbFuxKdymdPMpO5fNf0GayMFQ4xDAtXgnNzD9ptuVbryJzUXIfGRxXGyosQwMFoU7hIAp
|
||||
ohSIn+LTgMzHpQaZDTbctnxjg23BmnfEaEDmE6MebIFdxZY064rN9+0qIJLUxGALQMAjdxu7fcWmWJuy
|
||||
DZfxuQiZj0sNMhtqPAIAyxMWm8pNAcCMdASkkFIMNRY7sCvd4GhdvnGHfPz83zAXIbsQRuNjQ43CD+zK
|
||||
NxjalG1cYZu16SeyAVSzAAaARYW6bfnmqfr567+DDCEGQ7WSBmyrtkuCSlG7io1vsbkamQ3VQh6wqdgi
|
||||
aFu2sRJUD9DEAhgAFS+gvGRXsuEuyHBkDFVCHQBK4ralm6OBtdtZqvoAAwCLeKDrvaxLNx2EitAK/Gdk
|
||||
YGBgAABSZ4fXERBsXgAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<data name="btnNextPage.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAHCSURBVEhLYwCD+nomCINGwLZs0wmbss0hxmlnWKFC1AV2
|
||||
FZv/Q/EN2/JNKfb1+zmgUtQBtuVN/0AYZAmItijd9MyufHO5ff56AagSygC6BTC2TdGmN0AfdTpVbZaG
|
||||
KiUPQIMHJ7asWPvFrmzzdJuKrWpQLaQBXD5AZ2tVbP5jU75ppVXpBhMGhv+MUO2EAT5DkdlwMfdNf23L
|
||||
N+yxr9jiQlQSB2kkC3ts/mtTuvmUbcWm8NDQVcxQ4zABuktxsZHF0Pl2pRtvAvNTumvxTm6osQiAVQOp
|
||||
FsDZm54CcalF4Q4hqPHUtgDKLljzzrZ8YwPYApAAdXHzP+uKzfftKrakgS3A6Qo0NrIYOh/GtinbcNm+
|
||||
FZv/Q/EN2/JNKfb1+zmgUtQBtuX1/0AYZAmItijd9MyufHO5ff56AagSygC6BTC2TdGmN0AfdTpVbZaG
|
||||
KiUPQIMHJ7asWPvFrmzzdJuKrWpQLaQBXD5AZ2tVbP5jU75ppVXpBhMGhv+MUO2EAT5DkdlwMedNf23L
|
||||
N+yxr9jiQlQSB2kkC7ts/mtTuvmUbcWm8NDQVcxQ4zABuktxsZHF0Pl2pRtvAvNTumvxTm6osQiAVQOp
|
||||
FsDZm54CcalF4Q4hqPHUtgDKLljzzrZ8YwPYApAAdXH9P+uKzfftKrakgS3A6Qo0NrIYOh/GtinbcNm+
|
||||
YlOsR+42drDhIACSpBiXbT5iU7kpAFiOsUCNRQB8LkJmI4uBsHz8/N/W5Rt32JVucIQahR3ANBBtQdam
|
||||
nzZlG1fYlW8whBqBH4A0EoP189d/ty3fPBVYVKhDtRIH0F2Kyd74FlSq2lZtl4RqIQ1gN3Tzf1C9YFu2
|
||||
sdKmYosgVCl5AGQYCi7ZcBeUhrFme3IA3NXlm8/alm6OxprUKAHWpZsOAl3uRcPWBQmVB0mAgQEAzT+J
|
||||
GzCOALMAAAAASUVORK5CYII=
|
||||
sdKmYosgVCl5AGQYCi7ZcBeUhrFme3IA3NXlm8/alm6OxprUKAHWpZsOAl3uRcPWBQmVB0mAgQEA5X2H
|
||||
142IlcMAAAAASUVORK5CYII=
|
||||
</value>
|
||||
</data>
|
||||
<data name="btnLastPage.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAFxSURBVEhLY4ABp8qN4lAmbYBt2dqPtuWbOmlmkV3F5v8g
|
||||
bF2x6YNtxaYO+6JNIlApooF8/PzfMHNgGCoF9EF50z+QAIiGsj/ZlG9qs6ncJgpVQhCALEA3ByqF1QIw
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAFwSURBVEhLY4ABp8qN4lAmbYBt2dqPtuWbOmlmkV3F5v8g
|
||||
bF2x6YNtxaYO+6JNIlApooF8/PzfMHNgGCoF9EF5/T+QAIiGsj/ZlG9qs6ncJgpVQhCALEA3ByqF1QIw
|
||||
27x803vb8s0txFiE1wKQIF5csOYd2KKKLYJQLRiA1CDCYINo63JgHJVtbLQo3CEE1QoHZAURMhtZzLZ8
|
||||
41vbis21yD6iLIhw4eINr+wqNlWDzKBKEMHE0PngOHLf9BddHGo8FSzAwYYaTwcLQIK0wFDjh4APgGXY
|
||||
Ja2KzX/QxaHGk+uD5n/WpZvOWZdvDnQp381P7Yx2Hli8B4eGrmKGGkGdjAYKCvuKLaH29ftZoFrhgIKM
|
||||
BgyKkk2XgPVEOEN9PRNUCwYgK4hsyjZctinbHIHNxeiApCCyrth4za5sU5Rx2hlWqBKCgIggav5nW7bp
|
||||
qm3p5mjkyCMW4PWBTen66/YVm2KN02YS7WKSAClBQTxgYAAA1qQsi7HTS0QAAAAASUVORK5CYII=
|
||||
41vbis21yD6iLIhw4eINr+wqNlWDzKBKEMHE0PngOHLe9BddHGo8FSzAwYYaTwcLQIK0wFDjh4APgGXY
|
||||
Ja2KzX/QxaHGk+uD+n/WpZvOWZdvDnQp381P7Yx2Hli8B4eGrmKGGkGdjAYKCvuKLaH29ftZoFrhgIKM
|
||||
BgyKkk2XgPVEOEN9PRNUCwYgK4hsyjZctinbHIHNxeiApCCyrth4za5sU5Rx2hlWqBKCgIggAtpatumq
|
||||
benmaOTIIxbg9YFN6frr9hWbYo3TZhLtYpIAKUFBPGBgAAB8byrpVSoE5AAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<data name="btnZoomOut.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAMFSURBVEhLtVXfS5NRGA6KLuqiKCSCqIsi6Da69qL+Bm/S
|
||||
EN3UuWkT50DL7bMEwbAwKbFQK60M6qIfhBJlSRAI5lisCTnd1BElVmpSy9Z3et597/k836aoSQ+8e8+P
|
||||
5zzPec92zjatBKfTeaC4uNhbVFT0FHm0pKRkGu0xxDP0a+12+2Gmrg8FBQVZELiem5ubgKhO4XA4hJo5
|
||||
FhF3YLSPl64OCB+DyAQJrTUKCws/Ix9niZWB0o9iN3Nyh7SY84KmNcQuXmmdamxs/kj9dA5Vi82dYKlM
|
||||
2Gy2XSCOywUUZWVlM68GBj6NjY/rQsHExKQeeh8Wbrf7p8pHTMNkP0taAWIzkWV4vd54OBxOkmA8HrcY
|
||||
yH40GtXb2tr+qOsQ91hyCeXl5VlwT5VNJJfLNRsKhZIktFrEYjFd0zTzuPLz83+XlpYeYWkDmLBziSnS
|
||||
w96+aVqc2i6gtgmyL/OH0YhZAWngmDSWNoCBLkmA+6/57wsW0dUMdHzWnTtvmkDvBUsbwOAbWUFlZc0M
|
||||
Lcyufiyyq58gKKttdczoE7/z1m2zAsQUSxuAY1Aa4DxnaFeZYisbEHoePFINvrG0AUy8lgY1Z87O/0sF
|
||||
HTe7TAPcp0mWNoCJdpqkwPuTnJ2bt5y72ibIvsw6vgSfX0ut53jO0gYwcFJWQITevr51GYRHRkxx0sCR
|
||||
17K0AQzswOQXSaqoqEgGAoE1GSQSCVFfX28aIBZxCodYeglw9ssKKPt8Pj0YDC57uWREIhG9paXF3Dnn
|
||||
bpa0AlVso1+TJFN4PB7R3/+SLpKlgihu79DbYeH3+01xaYAveBAvwW6WtQKTB0Gi11ItWZx2u0XjhSZx
|
||||
9Vq7aLp0WXiqquhCWjhqYKND9HiyrBVkQpXIHam7kyHHluPINnSG6Y+LZa3Iy8vbDlIdCF/TF6si2OUP
|
||||
5FaI3U+f43YAnD0smwm89ztBPAViJzI9JyHkQVTYg7YTwnuJl5OTsxXjd0l0mXiXEtsoYLIZpt2IjONi
|
||||
ysaBd2wLqrvx3wwIbNKxdEQO8ReCLifXLt6zbwAAAABJRU5ErkJggg==
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAMESURBVEhLtVVdS1RRFA2KHuqhKCSCqIci6DV69qF+gy9p
|
||||
iDrqfDiNOA5oOXMtQTAsTEos1Eorg3rog1CiLAkC0TGKSaeZUaaMKLFSk5psuqe15+5zPXdGUZMWbPf5
|
||||
WGetvY/e47ql4HQ695SUlPiKi4sfIkdLS0snMR5DPMK8xmaz7Wfq6lBQUJAFgcu5ubkJiOoUdrtdqJlj
|
||||
HnEDRrv46PKA8CGIvCOhlUZhYeFn5MMssTTQ+kFUMyMrpMOc5zStPn72QstEQ0PTR5qnc6hbFHeEpTJR
|
||||
VFS0DcRxeYCirKxs6ll//6e3kYguFIyNjeuhNyPC4/H8VPmISZjsZkkrQGwisgyfz/chFAolSTAej1sM
|
||||
5Dwajeqtra1/1HOIWyy5ALfbnQX3VNtEcrlc0yROQstFLBbTNU0zrys/P/+3w+E4wNIGsGHjFlOkuz29
|
||||
k3Q4VS6gjglyLnMkGjM7IA1ck8bSBrDQKQlw/zX7fc4iupyBjp+1p06bJtB7wtIGsPhCdlBRUT1FB7Or
|
||||
7ovsqgcIyupYXTPmxO+4dt3sADHB0gbg+Eoa4D6nqKpMsaUNCN137qkG31jaADaeS4PqEydn/6WD9qud
|
||||
pgG+p/csbQAbbbRJgfcnOT0za7l3dUyQc5l1/BL8AS11nuMxSxvAwlHZARF6entXZTAyOmqKkwauvIal
|
||||
DWBhCza/SFJ5eXlycHBwRQaJRELU1dWZBoh53MI+ll4AnAOyA8p+v18PBoOLflwywuGw3tzcbFbOuYsl
|
||||
rUAXm+ivSZIpvF6v6Ot7iisIWzqI4usdCg6LQCBgiksD/IIH8BJsZ1krsLkXJHot1ZbFcY9HNJxpFBcv
|
||||
tYnGc+eFt7KSPkgLRw0UOkSPJ8taQSbUiaxIrU6GXFuMI8fQGaZ/XCxrRV5e3maQakH4mn5YFUGVP5Bb
|
||||
IHY7fY/HL8HZwbKZwHu/FcRjIHYg03MSQh5Ah90YOyG8k3g5OTkbsX6TRBeJ1ymxtQIm62Hahci4Lqas
|
||||
HXjHNqC7K//NgMAm7QtXZBd/AWaMJXnjHFh9AAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
<data name="btnZoomIn.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
@@ -307,25 +307,25 @@
|
||||
<data name="btnSettings.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAALCSURBVEhLpVY9aBRBFD5ECxstFLVSq1Mi5G+z2ATTKDYW
|
||||
gjbqYbpEubvdmdlDLYRDC61EMIKIhQSNEMlm9yLaio1pLEy0sAikERsbFRIhnre+b+7NOe7m4nH54DHv
|
||||
ffPe997M7MHlDAb9mZPsargyCg6MPv5F/GWmuofjzTx1RJg4Kp5G3C/DPlfFCbgeEdZ10mYwUHz2A4Lr
|
||||
2ZCMH3Fa9zjq1fZiWghiHSyHH1u+CCc4bXMwDfrL0z06vvp8J7gmH5VHqq+36sRu4Hhz+yHeo+JVpjTo
|
||||
Td6DNzYk4uO81TkcGY3/nTROBr3ZU+BdUTvS5KNkSNXoqqJkIIiPYS/wPFcIkSilElpvgGsLmnLZboA1
|
||||
L6ZWmn6UuH74ckQ9mRwWU7dG1MPdqJG+P241eKGF2sFRtRP6+Gp2kr79+/CbMb2HiheRc0WV6lLKN7qA
|
||||
QMIxxGGlUukr0+DPgaPcPqaywG8Ap0ADV8y8UqK0opRMpJ5Y1rFi+kKh8Bti8Pk085af+L5/iCWzwI8L
|
||||
DRw/mr8kro0G1MAWpAkbJsZKXMPy0eAzS62PXjWb7w3CPRzmSHDBTGZETIzVat5AXCwWd3FpZ8AVQSBl
|
||||
EyR2h9a1FJ9w2caQ0iuQwF2yBRRZU65Vq9UtnKbhed43k4MTkP+W3kAQP8wpWaCgjWW+e+KKqZyWcUoW
|
||||
2MQ0PJF9ggqntEDTXjQ5Vp42TsmCHvYMFd6mYy7aDegBv3BKCyT0yeRAFFdGNkf11zmlPXDfKLaNRJaC
|
||||
IDhL/mka5EN6n/ZaX2BHoEl+YjIUmylNjDV1Ld+5rDNQQc0Im9WYHRsfTehUN7l8Y5TL5R0otGw1Fbc1
|
||||
arKdZTYGJedRQNf0AHGlUtlHUy5hUvC0LtPeQeyR/475f/5A/BdjY2Pb2NUgEfwAdQMSv8e0BnGH2e0e
|
||||
dPzzEGe7wPQ6yOX+AB71ZRTERZI4AAAAAElFTkSuQmCC
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAALDSURBVEhLpVY9aFNRFA6ig4sOijqpU5QI/XsNLsUsiouD
|
||||
oEP8wW6tkuS9e+8L6lAIOugkghVEHKRohUpe3ktFV3Gxi4OtDg6FLuLiokIr1Jjn+W7Ojdf81JB+cLjn
|
||||
fPec75x77wskYTDilU+yq5GWoX9g/PEv4q8w1T8ct/zUEUHsqGgO8ZAMBtMqisGlRFDTSZvBcO7ZDwh2
|
||||
slEZPeK0/nHUre7FtBDEOlIIPjZ9EUxz2uZgGgwV5lI6vvZ8J7gGHxYypddbdWI/cNz5/RBPqWiNKQ16
|
||||
k/fgjY2K6Dhv9Q5HhpN/J43iEbdyCnxaVI80+DAeVVW6qjAe9qNj2PNdNy2EiJVSMa03wHUFTbliN8Ca
|
||||
FLOrDT+M017wMqOezIyJ2VsZ9XA3aqTnTVoNXmihbnBU9YQ+vqrM0Ld/H34jpvdQ0RJyrqp8TUr5RhcQ
|
||||
SDiCOCyfz39lGvw5cJQ7yFQ78BvAKdAgLcqvlMivKiVjqSeWNayYPpvN/oYYfD7NguXHnucdYsl24MeF
|
||||
Bo4XLlwW18d9amAL0oR1E2Mlrm75aPCZpTpjQFWSA36wh8MECS6ayYyIibFazeuIc7ncLi7tDbgiCLTY
|
||||
NIndoXW9hY+5bGNI6V4kgbtkiyiyplwvlUpbOE3Ddd1vJgcnIP8tvYEgfoxT2oGCLtb23ROXa8lpGqe0
|
||||
A5uYhieyT1DklCZo2ksmx8rTxintoIc9Q4W36ZhLdgN6wC+c0gQJfTI5EMWVkc1T/RSndAfuG8W2kciy
|
||||
7/tnyT9Ng3xo3ae95hfYE2iSn5gMxWZKE2NtuZbvXNYbqKBqhM1qzI6NjyZ0qptcvjEKhcIOFFq21hJ3
|
||||
NWqynWU2BiUnUUDX9ABxsVjcR1MuY1LwtK7Q3kHskf+O+X/+QPwXExMT29jVIBH8AHUDEr/HtAZxh9nt
|
||||
H3T88xBnu8B0ByQSfwCqJWQA7REYAQAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="statusbar.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>128, 20</value>
|
||||
</metadata>
|
||||
<metadata name="OpenFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>233, 25</value>
|
||||
</metadata>
|
||||
<metadata name="PrintDocument1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>368, 25</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -2,7 +2,11 @@
|
||||
Imports System.Globalization
|
||||
Imports System.Text.RegularExpressions
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports Independentsoft.Msg
|
||||
Imports DevExpress.Spreadsheet
|
||||
Imports GdPicture14
|
||||
Imports DevExpress
|
||||
Imports DevExpress.Office.Utils
|
||||
|
||||
Public Class DocumentViewer
|
||||
Private Enum ZoomMode
|
||||
@@ -16,14 +20,14 @@ Public Class DocumentViewer
|
||||
ZoomFitHeight
|
||||
End Enum
|
||||
|
||||
Private _docPath As String
|
||||
Private _currentSearchOccurence As Integer = 0
|
||||
Private _toggleGamma As Boolean = True
|
||||
Private _licenseKey As String = String.Empty
|
||||
Private _licenseManager As New GdPicture14.LicenseManager()
|
||||
Private _logConfig As LogConfig
|
||||
Private _logger As Logger
|
||||
Private _view_only As Boolean = False
|
||||
|
||||
Private _hide_file_info_from_user As Boolean = False
|
||||
|
||||
' List of all created temp files when converting msg files
|
||||
Private _TempFiles As New List(Of String)
|
||||
@@ -66,31 +70,25 @@ Public Class DocumentViewer
|
||||
''' Terminate Viewer, freeing up resources and deleting temp files
|
||||
''' </summary>
|
||||
Public Sub Done()
|
||||
_logger.Warn("Called Done, removing temp files")
|
||||
DeleteTempFiles()
|
||||
'Dispose()
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' Load a file and display it
|
||||
''' </summary>
|
||||
''' <param name="filepath"></param>
|
||||
Public Sub LoadFile(filepath As String)
|
||||
''' <param name="FilePath"></param>
|
||||
Public Sub LoadFile(FilePath As String)
|
||||
If _licenseKey = String.Empty Then
|
||||
_logger.Warn("License key was not provided. File {0} not loaded.", filepath)
|
||||
_logger.Warn("License key was not provided. File {0} not loaded.", FilePath)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
GdViewer.ZoomMode = ViewerZoomMode.ZoomModeWidthViewer
|
||||
GdViewer.DocumentAlignment = ViewerDocumentAlignment.DocumentAlignmentTopCenter
|
||||
|
||||
_logger.Info("Loading File {0}", filepath)
|
||||
_logger.Info("Loading File {0}", FilePath)
|
||||
|
||||
DoLoadFile(filepath)
|
||||
|
||||
If _view_only Then
|
||||
statusLabel.Text = _docPath
|
||||
End If
|
||||
DoLoadFile(FilePath)
|
||||
|
||||
UpdateMainUi()
|
||||
End Sub
|
||||
@@ -116,35 +114,68 @@ Public Class DocumentViewer
|
||||
Dim oFileInfo = New IO.FileInfo(FilePath)
|
||||
Dim oExtension As String = oFileInfo.Extension.ToUpper
|
||||
|
||||
RichEditControl1.Visible = False
|
||||
RichEditControl1.Dock = DockStyle.None
|
||||
|
||||
SpreadsheetControl1.Visible = False
|
||||
SpreadsheetControl1.Dock = DockStyle.None
|
||||
|
||||
mainToolStrip.Visible = False
|
||||
|
||||
Select Case oExtension.ToUpper
|
||||
Case ".MSG"
|
||||
Dim oMsg As New Independentsoft.Msg.Message(FilePath)
|
||||
Dim oMsg As New Message(FilePath)
|
||||
' TODO: Improve Encoding, maybe convert based on encoding
|
||||
oMsg.Encoding = System.Text.Encoding.UTF32
|
||||
Dim oMime = oMsg.ConvertToMimeMessage()
|
||||
Dim oTempFileName = IO.Path.GetTempFileName()
|
||||
oMime.Save(oTempFileName, True)
|
||||
|
||||
RichEditControl1.LoadDocument(oTempFileName, DevExpress.XtraRichEdit.DocumentFormat.Mht)
|
||||
RichEditControl1.LoadDocument(oTempFileName, XtraRichEdit.DocumentFormat.Mht)
|
||||
|
||||
_TempFiles.Add(oTempFileName)
|
||||
|
||||
RichEditControl1.Visible = True
|
||||
RichEditControl1.Dock = DockStyle.Fill
|
||||
Case ".EML"
|
||||
RichEditControl1.LoadDocument(FilePath, DevExpress.XtraRichEdit.DocumentFormat.Mht)
|
||||
|
||||
Case ".EML", ".DOC", ".DOCX", ".ODT", ".RTF", ".TXT"
|
||||
Dim oFormat As XtraRichEdit.DocumentFormat = XtraRichEdit.DocumentFormat.Undefined
|
||||
|
||||
Select Case oExtension.ToUpper
|
||||
Case ".EML" : oFormat = XtraRichEdit.DocumentFormat.Mht
|
||||
Case ".DOC" : oFormat = XtraRichEdit.DocumentFormat.Doc
|
||||
Case ".DOCX" : oFormat = XtraRichEdit.DocumentFormat.OpenXml
|
||||
Case ".ODT" : oFormat = XtraRichEdit.DocumentFormat.OpenDocument
|
||||
Case ".RTF" : oFormat = XtraRichEdit.DocumentFormat.Rtf
|
||||
Case ".TXT" : oFormat = XtraRichEdit.DocumentFormat.PlainText
|
||||
End Select
|
||||
|
||||
RichEditControl1.LoadDocument(FilePath, oFormat)
|
||||
|
||||
RichEditControl1.Visible = True
|
||||
RichEditControl1.Dock = DockStyle.Fill
|
||||
|
||||
Case ".XLSX", ".XLS", "CSV"
|
||||
Dim oFormat As Spreadsheet.DocumentFormat = Spreadsheet.DocumentFormat.Undefined
|
||||
|
||||
Select Case oExtension.ToUpper
|
||||
Case "XLSX" : oFormat = Spreadsheet.DocumentFormat.Xlsx
|
||||
Case "XLS" : oFormat = Spreadsheet.DocumentFormat.Xls
|
||||
Case "CSV" : oFormat = Spreadsheet.DocumentFormat.Csv
|
||||
End Select
|
||||
|
||||
SpreadsheetControl1.LoadDocument(FilePath, oFormat)
|
||||
|
||||
Dim oRange = SpreadsheetControl1.ActiveWorksheet.GetUsedRange()
|
||||
oRange.AutoFitColumns()
|
||||
|
||||
SpreadsheetControl1.Visible = True
|
||||
SpreadsheetControl1.Dock = DockStyle.Fill
|
||||
|
||||
Case Else
|
||||
_docPath = FilePath
|
||||
mainToolStrip.Visible = True
|
||||
|
||||
_logger.Info("Displaying file {0}", _docPath)
|
||||
|
||||
GdViewer.DisplayFromFile(_docPath)
|
||||
|
||||
RichEditControl1.Visible = False
|
||||
RichEditControl1.Dock = DockStyle.None
|
||||
GdViewer.DisplayFromFile(FilePath)
|
||||
End Select
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
@@ -163,33 +194,21 @@ Public Class DocumentViewer
|
||||
UpdateMainUi()
|
||||
End Sub
|
||||
|
||||
Private Function GetDocumentTypeLabel() As String
|
||||
Dim result As String = ""
|
||||
Select Case GdViewer.GetDocumentType()
|
||||
Case DocumentType.DocumentTypeBitmap
|
||||
result = "Imagefile"
|
||||
Case DocumentType.DocumentTypeMetaFile
|
||||
result = "Metafile"
|
||||
Case DocumentType.DocumentTypePDF
|
||||
result = "PDF"
|
||||
Case DocumentType.DocumentTypeSVG
|
||||
result = "SVG"
|
||||
Case DocumentType.DocumentTypeTXT
|
||||
result = "textfile"
|
||||
Case DocumentType.DocumentTypeUnknown
|
||||
result = "Unknown"
|
||||
End Select
|
||||
Return result
|
||||
End Function
|
||||
|
||||
Public Sub RightOnlyView(ValueRight As Boolean)
|
||||
If ValueRight Then
|
||||
''' <summary>
|
||||
''' Configures the viewer to hide the file path to the end-user.
|
||||
''' </summary>
|
||||
''' <param name="ViewOnly">
|
||||
''' True means that all file info should be hidden from the end-user
|
||||
''' False means the end user may see the filepath or other info about the file
|
||||
''' </param>
|
||||
Public Sub RightOnlyView(ViewOnly As Boolean)
|
||||
If ViewOnly Then
|
||||
btnPrint.Visible = False
|
||||
Else
|
||||
btnPrint.Visible = True
|
||||
End If
|
||||
|
||||
_view_only = ValueRight
|
||||
_hide_file_info_from_user = Not ViewOnly
|
||||
End Sub
|
||||
Private Sub UpdateMainUi()
|
||||
Exit Sub
|
||||
@@ -458,24 +477,6 @@ Public Class DocumentViewer
|
||||
btnLastPage.Enabled = True
|
||||
End If
|
||||
cbZoom.Text = String.Format(CultureInfo.InvariantCulture, "{0:#0.##%}", GdViewer.Zoom)
|
||||
|
||||
|
||||
Dim widthInches, heightInches As Double
|
||||
|
||||
If GdViewer.GetDocumentType = DocumentType.DocumentTypePDF Then
|
||||
widthInches = GdViewer.PdfGetPageWidth / 72
|
||||
heightInches = GdViewer.PdfGetPageHeight / 72
|
||||
Else
|
||||
widthInches = GdViewer.PageWidth / GdViewer.HorizontalResolution
|
||||
heightInches = GdViewer.PageHeight / GdViewer.VerticalResolution
|
||||
End If
|
||||
|
||||
Me.infoLabel.Text = "Type: " + GetDocumentTypeLabel() + " - " +
|
||||
"Pagesize (zoll): " + Trim(Str(Math.Round(widthInches, 2))) + " × " + Trim(Str(Math.Round(heightInches, 2))) + " - " +
|
||||
"Pagesize (pixel): " + Trim(Str(GdViewer.PageWidth)) + " × " + Trim(Str(GdViewer.PageHeight)) + " - " +
|
||||
"Horizontal resolution: " + Trim(Str(Math.Round(GdViewer.HorizontalResolution, 2))) + " DPI - " +
|
||||
"Vertical resolution: " + Trim(Str(Math.Round(GdViewer.VerticalResolution, 2))) + " DPI"
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub btnFitWidth_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnFitWidth.Click
|
||||
@@ -536,8 +537,9 @@ Public Class DocumentViewer
|
||||
GdViewer.Focus()
|
||||
End Sub
|
||||
|
||||
'Private Sub DocumentViewer_Disposed(sender As Object, e As EventArgs) Handles Me.Disposed
|
||||
' _logger.Warn("Disposing GDViewer")
|
||||
' GdViewer.Dispose()
|
||||
'End Sub
|
||||
Private Sub RichEditControl1_SizeChanged(sender As Object, e As EventArgs) Handles RichEditControl1.SizeChanged
|
||||
Dim oControlWidth = RichEditControl1.Width - 100
|
||||
Dim oPageWidth = Units.DocumentsToPixelsF(RichEditControl1.Document.Sections(0).Page.Width, RichEditControl1.DpiX)
|
||||
RichEditControl1.Views.PrintLayoutView.ZoomFactor = oControlWidth / oPageWidth
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
@@ -48,27 +48,37 @@
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="DevExpress.Charts.v19.2.Core, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.DataAccess.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.DataAccess.v19.2.UI, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.Images.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.Office.v19.2.Core, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.Pdf.v19.2.Core, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.Printing.v19.2.Core, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.RichEdit.v19.2.Core, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.Spreadsheet.v19.2.Core, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.Utils.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.Utils.v19.2.UI, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.XtraBars.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.XtraCharts.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="DevExpress.XtraLayout.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.XtraNavBar.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.XtraPrinting.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.XtraRichEdit.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
|
||||
<Reference Include="DevExpress.XtraSpreadsheet.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
|
||||
<Reference Include="DevExpress.XtraTreeList.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="GdPicture.NET.14">
|
||||
<HintPath>D:\ProgramFiles\GdPicture.NET 14\Redist\GdPicture.NET (.NET Framework 4.5)\GdPicture.NET.14.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Independentsoft.Msg.2.0.570.21482">
|
||||
<HintPath>P:\Visual Studio Projekte\Bibliotheken\MSG .NET\Bin\Independentsoft.Msg.2.0.570.21482.dll</HintPath>
|
||||
<Reference Include="Independentsoft.Msg, Version=2.0.570.21482, Culture=neutral, PublicKeyToken=76be97fe952f1ec7, processorArchitecture=MSIL">
|
||||
<HintPath>P:\Visual Studio Projekte\Bibliotheken\MSG .NET\Bin\22_11_19\Independentsoft.Msg.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.6.8\lib\net45\NLog.dll</HintPath>
|
||||
<HintPath>..\packages\NLog.4.7.0\lib\net45\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
|
||||
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.0.0.0")>
|
||||
<Assembly: AssemblyFileVersion("1.0.0.1")>
|
||||
<Assembly: AssemblyVersion("1.0.2.0")>
|
||||
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
DevExpress.XtraSpreadsheet.SpreadsheetControl, DevExpress.XtraSpreadsheet.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
DevExpress.XtraRichEdit.RichEditControl, DevExpress.XtraRichEdit.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NLog" version="4.6.8" targetFramework="net461" />
|
||||
<package id="NLog" version="4.7.0" targetFramework="net461" />
|
||||
</packages>
|
||||
@@ -48,34 +48,27 @@
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.Office.v19.2.Core, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.Pdf.v19.2.Core, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.Printing.v19.2.Core, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.RichEdit.v19.2.Core, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.RichEdit.v19.2.Export, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
|
||||
</Reference>
|
||||
<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, processorArchitecture=MSIL" />
|
||||
<Reference Include="DevExpress.XtraLayout.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.XtraPrinting.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
|
||||
@@ -80,6 +80,7 @@ Public Class LookupControl2
|
||||
|
||||
Properties.Buttons.Item(0).Tag = TAG_DROPDOWN
|
||||
Properties.Buttons.AddRange({_LookupFormButton})
|
||||
Properties.NullText = TEXT_NO_RECORDS
|
||||
|
||||
AddHandler ButtonClick, AddressOf HandleButtonClick
|
||||
AddHandler EditValueChanging, AddressOf HandleEditValueChanging
|
||||
|
||||
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("0.0.2.0")>
|
||||
<Assembly: AssemblyVersion("1.0.2.2")>
|
||||
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
DevExpress.XtraEditors.GridLookUpEdit, DevExpress.XtraGrid.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
DevExpress.XtraEditors.Repository.RepositoryItemGridLookUpEdit, DevExpress.XtraGrid.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
|
||||
@@ -157,9 +157,19 @@ Public Class frmLookupGrid
|
||||
End Sub
|
||||
|
||||
Private Sub gridLookup_KeyUp(sender As Object, e As KeyEventArgs) Handles gridLookup.KeyUp
|
||||
HandleCustomKeys(e)
|
||||
End Sub
|
||||
|
||||
Private Sub gridLookup_EditorKeyUp(sender As Object, e As KeyEventArgs) Handles gridLookup.EditorKeyUp
|
||||
HandleCustomKeys(e)
|
||||
End Sub
|
||||
|
||||
Private Sub HandleCustomKeys(e As KeyEventArgs)
|
||||
If e.KeyCode = Keys.Escape Then
|
||||
Close()
|
||||
ElseIf e.KeyCode = Keys.F2 Then
|
||||
' Make sure the currently focused row's state is saved
|
||||
viewLookup.PostEditor()
|
||||
SaveSelectedValues()
|
||||
|
||||
DialogResult = DialogResult.OK
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.6.8\lib\net45\NLog.dll</HintPath>
|
||||
<HintPath>..\packages\NLog.4.7.0\lib\net45\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="FirebirdSql.Data.FirebirdClient" version="6.4.0" targetFramework="net461" />
|
||||
<package id="NLog" version="4.6.8" targetFramework="net461" />
|
||||
<package id="NLog" version="4.7.0" targetFramework="net461" />
|
||||
</packages>
|
||||
@@ -49,7 +49,7 @@
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.6.8\lib\net45\NLog.dll</HintPath>
|
||||
<HintPath>..\packages\NLog.4.7.0\lib\net45\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
@@ -125,9 +125,7 @@
|
||||
<CustomToolNamespace>My</CustomToolNamespace>
|
||||
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
|
||||
</None>
|
||||
<None Include="packages.config">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Modules.Database\Database.vbproj">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NLog" version="4.6.8" targetFramework="net461" />
|
||||
<package id="NLog" version="4.7.0" targetFramework="net461" />
|
||||
</packages>
|
||||
@@ -104,6 +104,10 @@ Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "GUIs.Test.DocumentViewerTes
|
||||
EndProject
|
||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "DDEmailService", "DDEmailService\DDEmailService.vbproj", "{83ED2617-B398-4859-8F59-B38F8807E83E}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WebServices", "WebServices", "{D3BAE68E-406E-493D-A4E5-DB6EDDFFB371}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZUGFeRDRESTService", "WEBSERVICES\ZUGFeRDRESTService\ZUGFeRDRESTService.csproj", "{FD50590A-59C1-4798-AD90-419A588DCE76}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -270,6 +274,10 @@ Global
|
||||
{83ED2617-B398-4859-8F59-B38F8807E83E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{83ED2617-B398-4859-8F59-B38F8807E83E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{83ED2617-B398-4859-8F59-B38F8807E83E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{FD50590A-59C1-4798-AD90-419A588DCE76}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{FD50590A-59C1-4798-AD90-419A588DCE76}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FD50590A-59C1-4798-AD90-419A588DCE76}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FD50590A-59C1-4798-AD90-419A588DCE76}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -315,6 +323,7 @@ Global
|
||||
{609B09B4-AD1E-40F7-8899-A6685924621C} = {CC368D6A-6AC4-4EB9-A092-14700FABEF7A}
|
||||
{F9CCEFCD-21B3-4319-9DB1-A0756DA5BA1C} = {CC368D6A-6AC4-4EB9-A092-14700FABEF7A}
|
||||
{83ED2617-B398-4859-8F59-B38F8807E83E} = {7AF3F9C2-C939-4A08-95C1-0453207E298A}
|
||||
{FD50590A-59C1-4798-AD90-419A588DCE76} = {D3BAE68E-406E-493D-A4E5-DB6EDDFFB371}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {C1BE4090-A0FD-48AF-86CB-39099D14B286}
|
||||
|
||||
@@ -32,11 +32,14 @@
|
||||
<value>10</value>
|
||||
</setting>
|
||||
<setting name="MSSQL_CONNECTIONSTRING" serializeAs="String">
|
||||
<value />
|
||||
<value/>
|
||||
</setting>
|
||||
<setting name="MSSQL_ENABLED" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
<setting name="GDPICTURE_KEY" serializeAs="String">
|
||||
<value>1234567890_EXAMPLE_KEY</value>
|
||||
</setting>
|
||||
</DDZUGFeRDService.My.MySettings>
|
||||
</applicationSettings>
|
||||
<system.data>
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.6.8\lib\net45\NLog.dll</HintPath>
|
||||
<HintPath>..\packages\NLog.4.7.0\lib\net45\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
|
||||
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.0.0.0")>
|
||||
<Assembly: AssemblyVersion("1.1.0.1")>
|
||||
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
||||
|
||||
11
DDZUGFeRDService/My Project/Settings.Designer.vb
generated
11
DDZUGFeRDService/My Project/Settings.Designer.vb
generated
@@ -15,7 +15,7 @@ Option Explicit On
|
||||
Namespace My
|
||||
|
||||
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.7.0.0"), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.4.0.0"), _
|
||||
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Partial Friend NotInheritable Class MySettings
|
||||
Inherits Global.System.Configuration.ApplicationSettingsBase
|
||||
@@ -134,6 +134,15 @@ Namespace My
|
||||
Return CType(Me("MSSQL_ENABLED"),Boolean)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Configuration.DefaultSettingValueAttribute("1234567890_EXAMPLE_KEY")> _
|
||||
Public ReadOnly Property GDPICTURE_KEY() As String
|
||||
Get
|
||||
Return CType(Me("GDPICTURE_KEY"),String)
|
||||
End Get
|
||||
End Property
|
||||
End Class
|
||||
End Namespace
|
||||
|
||||
|
||||
@@ -29,5 +29,8 @@
|
||||
<Setting Name="MSSQL_ENABLED" Type="System.Boolean" Scope="Application">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
<Setting Name="GDPICTURE_KEY" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">1234567890_EXAMPLE_KEY</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
@@ -31,7 +31,6 @@ Public Class ThreadRunner
|
||||
_logConfig = LogConfig
|
||||
_logger = _logConfig.GetLogger()
|
||||
_firebird = Firebird
|
||||
_zugferd = New ZUGFeRDInterface(_logConfig)
|
||||
_mssql = MSSQL
|
||||
|
||||
Dim args As New WorkerArgs()
|
||||
@@ -113,25 +112,6 @@ Public Class ThreadRunner
|
||||
Dim args As WorkerArgs = e.Argument
|
||||
|
||||
_logger.Debug("Background worker running..")
|
||||
' Use MSSQL Server if available
|
||||
If Not IsNothing(_mssql) Then
|
||||
'Checking if documents have bee´n rejected
|
||||
Dim oSQL As String = "Select * from TBEDMI_DOC_REJECTED WHERE MD5_UPDATE = 0"
|
||||
'Dim oDT As DataTable = _mssql.GetDatatable(oSQL)
|
||||
'If Not IsNothing(oDT) Then
|
||||
' For Each oRow As DataRow In oDT.Rows
|
||||
' oSQL = $"UPDATE TBEDM_ZUGFERD_HISTORY_IN SET REJECTED = TRUE WHERE MESSAGE_ID = '{oRow.Item("MESSAGE_ID")}'"
|
||||
' If _firebird.ExecuteNonQuery(oSQL) = True Then
|
||||
' oSQL = $"UPDATE TBEDMI_DOC_REJECTED SET MD5_UPDATE = 1 WHERE GUID = '{oRow.Item("GUID")}'"
|
||||
' If _mssql.ExecuteNonQuery(oSQL) = True Then
|
||||
' _logger.Debug($"Refreshed the Rejected Info for messageid [{oRow.Item("MESSAGE_ID")}]")
|
||||
' End If
|
||||
' End If
|
||||
' Next
|
||||
'Else
|
||||
' _logger.Warn("oDTTBEDMI_DOC_REJECTED is nothing...")
|
||||
'End If
|
||||
End If
|
||||
Dim job As New ImportZUGFeRDFiles(_logConfig, _firebird, _mssql)
|
||||
job.Start(args)
|
||||
Catch ex As Exception
|
||||
|
||||
@@ -24,6 +24,7 @@ Public Class ZUGFeRDService
|
||||
Dim oJobInterval As Integer = My.Settings.JOB_INTERVAL
|
||||
Dim oMSSQLConnectionString As String = My.Settings.MSSQL_CONNECTIONSTRING
|
||||
Dim oMSSQLEnabled As Boolean = My.Settings.MSSQL_ENABLED
|
||||
Dim oGDPictureKey As String = My.Settings.GDPICTURE_KEY
|
||||
|
||||
_firebird = New Firebird(_logConfig, oDataSource, oDatabase, oUser, oPassword)
|
||||
|
||||
@@ -37,7 +38,7 @@ Public Class ZUGFeRDService
|
||||
End If
|
||||
|
||||
Try
|
||||
_threadRunner = New ThreadRunner(_logConfig, _firebird, _mssql)
|
||||
_threadRunner = New ThreadRunner(_logConfig, oGDPictureKey, _firebird, _mssql)
|
||||
_threadRunner.Start(oJobInterval)
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="FirebirdSql.Data.FirebirdClient" version="6.4.0" targetFramework="net461" />
|
||||
<package id="NLog" version="4.6.8" targetFramework="net461" />
|
||||
<package id="NLog" version="4.7.0" targetFramework="net461" />
|
||||
</packages>
|
||||
11
EDMI.File/Archive.vb
Normal file
11
EDMI.File/Archive.vb
Normal file
@@ -0,0 +1,11 @@
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class Archive
|
||||
Private _LogConfig As LogConfig
|
||||
Private _Logger As Logger
|
||||
|
||||
Public Sub New(LogConfig As LogConfig)
|
||||
_LogConfig = LogConfig
|
||||
_Logger = LogConfig.GetLogger()
|
||||
End Sub
|
||||
End Class
|
||||
120
EDMI.File/EDMI.File.vbproj
Normal file
120
EDMI.File/EDMI.File.vbproj
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{1477032D-7A02-4C5F-B026-A7117DA4BC6B}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>DigitalData.Modules.EDMI.File</RootNamespace>
|
||||
<AssemblyName>DigitalData.Modules.EDMI.File</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<MyType>Windows</MyType>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DocumentationFile>DigitalData.Modules.EDMI.File.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DocumentationFile>DigitalData.Modules.EDMI.File.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionExplicit>On</OptionExplicit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionCompare>Binary</OptionCompare>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionStrict>Off</OptionStrict>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.7.0\lib\net45\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.IO.Compression" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.Transactions" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Import Include="Microsoft.VisualBasic" />
|
||||
<Import Include="System" />
|
||||
<Import Include="System.Collections" />
|
||||
<Import Include="System.Collections.Generic" />
|
||||
<Import Include="System.Data" />
|
||||
<Import Include="System.Diagnostics" />
|
||||
<Import Include="System.Linq" />
|
||||
<Import Include="System.Xml.Linq" />
|
||||
<Import Include="System.Threading.Tasks" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Archive.vb" />
|
||||
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||
<Compile Include="My Project\Application.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Application.myapp</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="My Project\Resources.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="My Project\Settings.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="My Project\Resources.resx">
|
||||
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
|
||||
<CustomToolNamespace>My.Resources</CustomToolNamespace>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="My Project\Application.myapp">
|
||||
<Generator>MyApplicationCodeGenerator</Generator>
|
||||
<LastGenOutput>Application.Designer.vb</LastGenOutput>
|
||||
</None>
|
||||
<None Include="My Project\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<CustomToolNamespace>My</CustomToolNamespace>
|
||||
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Modules.Logging\Logging.vbproj">
|
||||
<Project>{903B2D7D-3B80-4BE9-8713-7447B704E1B0}</Project>
|
||||
<Name>Logging</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
</Project>
|
||||
13
EDMI.File/My Project/Application.Designer.vb
generated
Normal file
13
EDMI.File/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
EDMI.File/My Project/Application.myapp
Normal file
10
EDMI.File/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
EDMI.File/My Project/AssemblyInfo.vb
Normal file
35
EDMI.File/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("EDMI.File")>
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("")>
|
||||
<Assembly: AssemblyProduct("EDMI.File")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2020")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
'Die folgende GUID wird für die typelib-ID verwendet, wenn dieses Projekt für COM verfügbar gemacht wird.
|
||||
<Assembly: Guid("2a4f6a80-e6e0-4764-ba6e-91484bda887f")>
|
||||
|
||||
' 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,
|
||||
' indem Sie "*" wie unten gezeigt eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.0.0.0")>
|
||||
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
||||
63
EDMI.File/My Project/Resources.Designer.vb
generated
Normal file
63
EDMI.File/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", "16.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.EDMI.File.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
EDMI.File/My Project/Resources.resx
Normal file
117
EDMI.File/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
EDMI.File/My Project/Settings.Designer.vb
generated
Normal file
73
EDMI.File/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", "16.4.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.EDMI.File.My.MySettings
|
||||
Get
|
||||
Return Global.DigitalData.Modules.EDMI.File.My.MySettings.Default
|
||||
End Get
|
||||
End Property
|
||||
End Module
|
||||
End Namespace
|
||||
7
EDMI.File/My Project/Settings.settings
Normal file
7
EDMI.File/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>
|
||||
4
EDMI.File/packages.config
Normal file
4
EDMI.File/packages.config
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NLog" version="4.7.0" targetFramework="net472" />
|
||||
</packages>
|
||||
@@ -89,7 +89,7 @@
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.6.8\lib\net45\NLog.dll</HintPath>
|
||||
<HintPath>..\packages\NLog.4.7.0\lib\net45\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ScintillaNET, Version=3.6.3.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\jacobslusser.ScintillaNET.3.6.3\lib\net40\ScintillaNET.dll</HintPath>
|
||||
@@ -496,9 +496,9 @@
|
||||
<Project>{44982f9b-6116-44e2-85d0-f39650b1ef99}</Project>
|
||||
<Name>Config</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Modules.EDMIAPI\EDMIAPI.vbproj">
|
||||
<ProjectReference Include="..\Modules.EDMIAPI\EDMI.API.vbproj">
|
||||
<Project>{5b1171dc-fffe-4813-a20d-786aae47b320}</Project>
|
||||
<Name>EDMIAPI</Name>
|
||||
<Name>EDMI.API</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Modules.Language\Language.vbproj">
|
||||
<Project>{d3c8cfed-d6f6-43a8-9bdf-454145d0352f}</Project>
|
||||
@@ -512,9 +512,9 @@
|
||||
<Project>{903b2d7d-3b80-4be9-8713-7447b704e1b0}</Project>
|
||||
<Name>Logging</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\SERVICES\DDEDM_NetworkService\IDBService.vbproj">
|
||||
<ProjectReference Include="..\SERVICES\DDEDM_NetworkService\EDMIService.vbproj">
|
||||
<Project>{A8C3F298-76AB-4359-AB3C-986E313B4336}</Project>
|
||||
<Name>IDBService</Name>
|
||||
<Name>EDMIService</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
<package id="FirebirdSql.Data.FirebirdClient" version="6.4.0" targetFramework="net461" />
|
||||
<package id="FirebirdSql.EntityFrameworkCore.Firebird" version="6.4.0" targetFramework="net461" />
|
||||
<package id="jacobslusser.ScintillaNET" version="3.6.3" targetFramework="net461" />
|
||||
<package id="NLog" version="4.6.8" targetFramework="net461" />
|
||||
<package id="NLog" version="4.7.0" targetFramework="net461" />
|
||||
<package id="System.Runtime.Serialization.Primitives" version="4.3.0" targetFramework="net461" />
|
||||
</packages>
|
||||
@@ -45,20 +45,17 @@
|
||||
<ItemGroup>
|
||||
<Reference Include="DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.Utils.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.XtraBars.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, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.6.8\lib\net45\NLog.dll</HintPath>
|
||||
<HintPath>..\packages\NLog.4.7.0\lib\net45\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NLog" version="4.6.8" targetFramework="net461" />
|
||||
<package id="NLog" version="4.7.0" targetFramework="net461" />
|
||||
</packages>
|
||||
@@ -62,7 +62,7 @@
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.6.8\lib\net45\NLog.dll</HintPath>
|
||||
<HintPath>..\packages\NLog.4.7.0\lib\net45\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NLog" version="4.6.8" targetFramework="net461" />
|
||||
<package id="NLog" version="4.7.0" targetFramework="net461" />
|
||||
</packages>
|
||||
@@ -49,7 +49,7 @@
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.6.8\lib\net45\NLog.dll</HintPath>
|
||||
<HintPath>..\packages\NLog.4.7.0\lib\net45\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NLog" version="4.6.8" targetFramework="net461" />
|
||||
<package id="NLog" version="4.7.0" targetFramework="net461" />
|
||||
</packages>
|
||||
@@ -4,6 +4,18 @@ Imports GdPicture14
|
||||
Public Class Form1
|
||||
Private oSubform As Form3
|
||||
|
||||
Private LogConfig As LogConfig
|
||||
|
||||
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
Dim oLogConfig As New LogConfig(LogConfig.PathType.CustomPath,
|
||||
Application.StartupPath,
|
||||
Nothing,
|
||||
My.Application.Info.CompanyName,
|
||||
My.Application.Info.ProductName)
|
||||
|
||||
LogConfig = oLogConfig
|
||||
End Sub
|
||||
|
||||
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
||||
Dim oResult = OpenFileDialog1.ShowDialog()
|
||||
|
||||
@@ -14,8 +26,7 @@ Public Class Form1
|
||||
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
|
||||
Try
|
||||
Dim oKey = "0467389434974657969312056"
|
||||
Dim oLogConfig As New LogConfig(LogConfig.PathType.CurrentDirectory)
|
||||
Dim oSubform As New Form3(oLogConfig, oKey)
|
||||
Dim oSubform As New Form3(LogConfig, oKey)
|
||||
|
||||
oSubform.FilePath = TextBox1.Text
|
||||
oSubform.Show()
|
||||
@@ -27,8 +38,7 @@ Public Class Form1
|
||||
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
|
||||
Try
|
||||
Dim oKey = "0467389434974657969312056"
|
||||
Dim oLogConfig As New LogConfig(LogConfig.PathType.CurrentDirectory)
|
||||
Dim oSubform As New Form4(oLogConfig, oKey)
|
||||
Dim oSubform As New Form4(LogConfig, oKey)
|
||||
|
||||
oSubform.FilePath = TextBox1.Text
|
||||
oSubform.Show()
|
||||
@@ -76,4 +86,6 @@ Public Class Form1
|
||||
End If
|
||||
End Using
|
||||
End Sub
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
@@ -50,12 +50,9 @@
|
||||
<Reference Include="GdPicture.NET.14">
|
||||
<HintPath>D:\ProgramFiles\GdPicture.NET 14\Redist\GdPicture.NET (.NET Framework 4.5)\GdPicture.NET.14.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Independentsoft.Msg.2.0.570.21482">
|
||||
<HintPath>P:\Visual Studio Projekte\Bibliotheken\MSG .NET\Bin\Independentsoft.Msg.2.0.570.21482.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.6.8\lib\net45\NLog.dll</HintPath>
|
||||
<HintPath>..\packages\NLog.4.7.0\lib\net45\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NLog" version="4.6.8" targetFramework="net461" />
|
||||
<package id="NLog" version="4.7.0" targetFramework="net461" />
|
||||
</packages>
|
||||
@@ -52,7 +52,7 @@
|
||||
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.6.8\lib\net45\NLog.dll</HintPath>
|
||||
<HintPath>..\packages\NLog.4.7.0\lib\net45\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net461" />
|
||||
<package id="NLog" version="4.6.8" targetFramework="net461" />
|
||||
<package id="NLog" version="4.7.0" targetFramework="net461" />
|
||||
</packages>
|
||||
@@ -32,6 +32,9 @@
|
||||
<setting name="MD5Cheksum" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
<setting name="MSSQL_CONNECTIONSTRING" serializeAs="String">
|
||||
<value>Server=SDD-VMP04-SQL17\DD_DEVELOP01;Database=DD_ECM_TEST;User Id=sa;Password=dd</value>
|
||||
</setting>
|
||||
</ZUGFeRDTest.My.MySettings>
|
||||
</userSettings>
|
||||
<runtime>
|
||||
|
||||
@@ -13,6 +13,7 @@ Imports DigitalData.Modules.Logging
|
||||
Public Class Form1
|
||||
Private _logConfig As LogConfig
|
||||
Private _firebird As Firebird
|
||||
Private _mssql As MSSQLServer
|
||||
Private _zugferd As ZUGFeRDInterface
|
||||
|
||||
Private PropertyMap As New Dictionary(Of String, XmlItemProperty)
|
||||
@@ -22,8 +23,9 @@ Public Class Form1
|
||||
_logConfig = New LogConfig(LogConfig.PathType.CurrentDirectory)
|
||||
_logConfig.Debug = True
|
||||
_firebird = New Firebird(_logConfig, My.Settings.FB_DATASOURCE, My.Settings.FB_DATABASE, My.Settings.FB_USER, My.Settings.FB_PASS)
|
||||
_mssql = New MSSQLServer(_logConfig, My.Settings.MSSQL_CONNECTIONSTRING)
|
||||
|
||||
_zugferd = New ZUGFeRDInterface(_logConfig)
|
||||
_zugferd = New ZUGFeRDInterface(_logConfig, "")
|
||||
End Sub
|
||||
|
||||
Private Function LoadFolderConfig(args As WorkerArgs)
|
||||
@@ -85,9 +87,8 @@ Public Class Form1
|
||||
Dim args As New WorkerArgs()
|
||||
args = LoadFolderConfig(args)
|
||||
args = LoadPropertyMapFor(args, "DEFAULT")
|
||||
args.GDPictureKey = "21182889975216572111813147150675976632"
|
||||
|
||||
Dim job As New Jobs.ImportZUGFeRDFiles(_logConfig, _firebird)
|
||||
Dim job As New Jobs.ImportZUGFeRDFiles(_logConfig, _firebird, _mssql)
|
||||
|
||||
job.Start(args)
|
||||
End Sub
|
||||
@@ -163,13 +164,11 @@ Public Class Form1
|
||||
End Sub
|
||||
|
||||
Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
|
||||
Dim oExtractor = New Jobs.PDFAttachments(_logConfig, "21182889975216572111813147150675976632")
|
||||
|
||||
Dim oExtractor = New PDFAttachments(_logConfig)
|
||||
Dim oResult = OpenFileDialog1.ShowDialog()
|
||||
|
||||
If oResult = DialogResult.OK Then
|
||||
oExtractor.Extract(OpenFileDialog1.FileName, AllowedExtensions:=New List(Of String) From {"docx", "doc", "pdf", "xls", "xlsx", "ppt", "pptx", "txt"})
|
||||
End If
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
@@ -15,7 +15,7 @@ Option Explicit On
|
||||
Namespace My
|
||||
|
||||
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.7.0.0"), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.4.0.0"), _
|
||||
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Partial Friend NotInheritable Class MySettings
|
||||
Inherits Global.System.Configuration.ApplicationSettingsBase
|
||||
@@ -107,6 +107,18 @@ Namespace My
|
||||
Me("MD5Cheksum") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
<Global.System.Configuration.UserScopedSettingAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Configuration.DefaultSettingValueAttribute("Server=SDD-VMP04-SQL17\DD_DEVELOP01;Database=DD_ECM_TEST;User Id=sa;Password=dd")> _
|
||||
Public Property MSSQL_CONNECTIONSTRING() As String
|
||||
Get
|
||||
Return CType(Me("MSSQL_CONNECTIONSTRING"),String)
|
||||
End Get
|
||||
Set
|
||||
Me("MSSQL_CONNECTIONSTRING") = value
|
||||
End Set
|
||||
End Property
|
||||
End Class
|
||||
End Namespace
|
||||
|
||||
|
||||
@@ -17,5 +17,8 @@
|
||||
<Setting Name="MD5Cheksum" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
<Setting Name="MSSQL_CONNECTIONSTRING" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">Server=SDD-VMP04-SQL17\DD_DEVELOP01;Database=DD_ECM_TEST;User Id=sa;Password=dd</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
@@ -52,7 +52,7 @@
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.6.8\lib\net45\NLog.dll</HintPath>
|
||||
<HintPath>..\packages\NLog.4.7.0\lib\net45\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="FirebirdSql.Data.FirebirdClient" version="6.4.0" targetFramework="net461" />
|
||||
<package id="NLog" version="4.6.8" targetFramework="net461" />
|
||||
<package id="NLog" version="4.7.0" targetFramework="net461" />
|
||||
</packages>
|
||||
@@ -55,7 +55,7 @@
|
||||
<Reference Include="DevExpress.XtraLayout.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
|
||||
<Reference Include="DevExpress.XtraPrinting.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.6.8\lib\net45\NLog.dll</HintPath>
|
||||
<HintPath>..\packages\NLog.4.7.0\lib\net45\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NLog" version="4.6.8" targetFramework="net461" />
|
||||
<package id="NLog" version="4.7.0" targetFramework="net461" />
|
||||
</packages>
|
||||
@@ -45,7 +45,7 @@
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.6.8\lib\net45\NLog.dll</HintPath>
|
||||
<HintPath>..\packages\NLog.4.7.0\lib\net45\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NLog" version="4.6.8" targetFramework="net461" />
|
||||
<package id="NLog" version="4.7.0" targetFramework="net461" />
|
||||
</packages>
|
||||
@@ -59,7 +59,7 @@
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.6.8\lib\net45\NLog.dll</HintPath>
|
||||
<HintPath>..\packages\NLog.4.7.0\lib\net45\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Oracle.ManagedDataAccess">
|
||||
<HintPath>P:\Visual Studio Projekte\Bibliotheken\Oracle.ManagedDataAccess.dll</HintPath>
|
||||
|
||||
@@ -3,5 +3,5 @@
|
||||
<package id="EntityFramework" version="6.2.0" targetFramework="net461" />
|
||||
<package id="EntityFramework.Firebird" version="6.4.0" targetFramework="net461" />
|
||||
<package id="FirebirdSql.Data.FirebirdClient" version="6.4.0" targetFramework="net461" />
|
||||
<package id="NLog" version="4.6.8" targetFramework="net461" />
|
||||
<package id="NLog" version="4.7.0" targetFramework="net461" />
|
||||
</packages>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
This file is automatically generated by Visual Studio .Net. It is
|
||||
used to store generic object data source configuration information.
|
||||
Renaming the file extension or editing the content of this file may
|
||||
cause the file to be unrecognizable by the program.
|
||||
-->
|
||||
<GenericObjectDataSource DisplayName="DocumentResult" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<TypeInfo>DigitalData.Modules.EDMI.API.IDBServiceReference.DocumentResult</TypeInfo>
|
||||
</GenericObjectDataSource>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
This file is automatically generated by Visual Studio .Net. It is
|
||||
used to store generic object data source configuration information.
|
||||
Renaming the file extension or editing the content of this file may
|
||||
cause the file to be unrecognizable by the program.
|
||||
-->
|
||||
<GenericObjectDataSource DisplayName="DocumentResult2" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<TypeInfo>DigitalData.Modules.EDMI.API.IDBServiceReference.DocumentResult2</TypeInfo>
|
||||
</GenericObjectDataSource>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
This file is automatically generated by Visual Studio .Net. It is
|
||||
used to store generic object data source configuration information.
|
||||
Renaming the file extension or editing the content of this file may
|
||||
cause the file to be unrecognizable by the program.
|
||||
-->
|
||||
<GenericObjectDataSource DisplayName="IndexResult" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<TypeInfo>DigitalData.Modules.EDMI.API.IDBServiceReference.IndexResult</TypeInfo>
|
||||
</GenericObjectDataSource>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
This file is automatically generated by Visual Studio .Net. It is
|
||||
used to store generic object data source configuration information.
|
||||
Renaming the file extension or editing the content of this file may
|
||||
cause the file to be unrecognizable by the program.
|
||||
-->
|
||||
<GenericObjectDataSource DisplayName="NonQueryResult" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<TypeInfo>DigitalData.Modules.EDMI.API.IDBServiceReference.NonQueryResult</TypeInfo>
|
||||
</GenericObjectDataSource>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
This file is automatically generated by Visual Studio .Net. It is
|
||||
used to store generic object data source configuration information.
|
||||
Renaming the file extension or editing the content of this file may
|
||||
cause the file to be unrecognizable by the program.
|
||||
-->
|
||||
<GenericObjectDataSource DisplayName="ScalarResult" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<TypeInfo>DigitalData.Modules.EDMI.API.IDBServiceReference.ScalarResult</TypeInfo>
|
||||
</GenericObjectDataSource>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
This file is automatically generated by Visual Studio .Net. It is
|
||||
used to store generic object data source configuration information.
|
||||
Renaming the file extension or editing the content of this file may
|
||||
cause the file to be unrecognizable by the program.
|
||||
-->
|
||||
<GenericObjectDataSource DisplayName="TableResult" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<TypeInfo>DigitalData.Modules.EDMI.API.IDBServiceReference.TableResult</TypeInfo>
|
||||
</GenericObjectDataSource>
|
||||
186
Modules.EDMIAPI/EDMI.API.vbproj
Normal file
186
Modules.EDMIAPI/EDMI.API.vbproj
Normal file
@@ -0,0 +1,186 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{5B1171DC-FFFE-4813-A20D-786AAE47B320}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>DigitalData.Modules.EDMI.API</RootNamespace>
|
||||
<AssemblyName>DigitalData.Modules.EDMI.API</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<MyType>Windows</MyType>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DocumentationFile>DigitalData.Modules.EDMI.API.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DocumentationFile>DigitalData.Modules.EDMI.API.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionExplicit>On</OptionExplicit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionCompare>Binary</OptionCompare>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionStrict>Off</OptionStrict>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.7.0\lib\net45\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.IO.Compression" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.Transactions" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Import Include="Microsoft.VisualBasic" />
|
||||
<Import Include="System" />
|
||||
<Import Include="System.Collections" />
|
||||
<Import Include="System.Collections.Generic" />
|
||||
<Import Include="System.Data" />
|
||||
<Import Include="System.Diagnostics" />
|
||||
<Import Include="System.Linq" />
|
||||
<Import Include="System.Xml.Linq" />
|
||||
<Import Include="System.Threading.Tasks" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Channel.vb" />
|
||||
<Compile Include="Connected Services\IDBServiceReference\Reference.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Reference.svcmap</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Constants.vb" />
|
||||
<Compile Include="Document.vb" />
|
||||
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||
<Compile Include="My Project\Application.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Application.myapp</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="My Project\Resources.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="My Project\Settings.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="My Project\Resources.resx">
|
||||
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
|
||||
<CustomToolNamespace>My.Resources</CustomToolNamespace>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="Connected Services\IDBServiceReference\DigitalData.Modules.EDMI.API.IDBServiceReference.DocumentResult.datasource">
|
||||
<DependentUpon>Reference.svcmap</DependentUpon>
|
||||
</None>
|
||||
<None Include="Connected Services\IDBServiceReference\DigitalData.Modules.EDMI.API.IDBServiceReference.DocumentResult2.datasource">
|
||||
<DependentUpon>Reference.svcmap</DependentUpon>
|
||||
</None>
|
||||
<None Include="Connected Services\IDBServiceReference\DigitalData.Modules.EDMI.API.IDBServiceReference.IndexResult.datasource">
|
||||
<DependentUpon>Reference.svcmap</DependentUpon>
|
||||
</None>
|
||||
<None Include="Connected Services\IDBServiceReference\DigitalData.Modules.EDMI.API.IDBServiceReference.NonQueryResult.datasource">
|
||||
<DependentUpon>Reference.svcmap</DependentUpon>
|
||||
</None>
|
||||
<None Include="Connected Services\IDBServiceReference\DigitalData.Modules.EDMI.API.IDBServiceReference.ScalarResult.datasource">
|
||||
<DependentUpon>Reference.svcmap</DependentUpon>
|
||||
</None>
|
||||
<None Include="Connected Services\IDBServiceReference\DigitalData.Modules.EDMI.API.IDBServiceReference.TableResult.datasource">
|
||||
<DependentUpon>Reference.svcmap</DependentUpon>
|
||||
</None>
|
||||
<None Include="Connected Services\IDBServiceReference\DigitalData.Modules.Filesystem.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="Connected Services\IDBServiceReference\DigitalData.Services.IDBService.wsdl" />
|
||||
<None Include="Connected Services\IDBServiceReference\DigitalData.Services.IDBService.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="Connected Services\IDBServiceReference\DigitalData.Services.IDBService1.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="Connected Services\IDBServiceReference\service.wsdl" />
|
||||
<None Include="Connected Services\IDBServiceReference\service.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="Connected Services\IDBServiceReference\System.Data.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="Connected Services\IDBServiceReference\System.IO.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="Connected Services\IDBServiceReference\System.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="My Project\Application.myapp">
|
||||
<Generator>MyApplicationCodeGenerator</Generator>
|
||||
<LastGenOutput>Application.Designer.vb</LastGenOutput>
|
||||
</None>
|
||||
<None Include="My Project\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<CustomToolNamespace>My</CustomToolNamespace>
|
||||
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<WCFMetadata Include="Connected Services\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Modules.Logging\Logging.vbproj">
|
||||
<Project>{903b2d7d-3b80-4be9-8713-7447b704e1b0}</Project>
|
||||
<Name>Logging</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<WCFMetadataStorage Include="Connected Services\IDBServiceReference\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Connected Services\IDBServiceReference\configuration91.svcinfo" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Connected Services\IDBServiceReference\configuration.svcinfo" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Connected Services\IDBServiceReference\Reference.svcmap">
|
||||
<Generator>WCF Proxy Generator</Generator>
|
||||
<LastGenOutput>Reference.vb</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
</Project>
|
||||
@@ -161,13 +161,14 @@ Public Class File
|
||||
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)
|
||||
Dim oFileInfo As New FileInfo(FilePath)
|
||||
IO.File.Move(FilePath, Path.Combine(Directory, NewFileName))
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.6.8\lib\net45\NLog.dll</HintPath>
|
||||
<HintPath>..\packages\NLog.4.7.0\lib\net45\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>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NLog" version="4.6.8" targetFramework="net461" />
|
||||
<package id="NLog" version="4.7.0" targetFramework="net461" />
|
||||
<package id="protobuf-net" version="2.4.0" targetFramework="net461" />
|
||||
</packages>
|
||||
@@ -43,12 +43,15 @@
|
||||
<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>
|
||||
<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.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.6.8\lib\net45\NLog.dll</HintPath>
|
||||
<HintPath>..\packages\NLog.4.7.0\lib\net45\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
@@ -108,6 +111,10 @@
|
||||
</Compile>
|
||||
<Compile Include="ZUGFeRDInterface\CrossIndustryDocumentType.vb" />
|
||||
<Compile Include="ZUGFeRDInterface.vb" />
|
||||
<Compile Include="ZUGFeRDInterface\FileGroups.vb" />
|
||||
<Compile Include="ZUGFeRDInterface\PDFAttachments.vb" />
|
||||
<Compile Include="ZUGFeRDInterface\PropertyValues.vb" />
|
||||
<Compile Include="ZUGFeRDInterface\XmlItemProperty.vb" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="My Project\Resources.resx">
|
||||
@@ -128,7 +135,7 @@
|
||||
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
<None Include="ZUGFeRDInterface\pdf_zugferd_lib.lib">
|
||||
<None Include="ZUGFeRDInterface\pdf_zugferd_lib\pdf_zugferd_lib.lib">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
@@ -143,10 +150,10 @@
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="ZUGFeRDInterface\pdf_zugferd_lib.dll">
|
||||
<Content Include="ZUGFeRDInterface\pdf_zugferd_lib\pdf_zugferd_lib.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="ZUGFeRDInterface\pdf_zugferd_test.exe">
|
||||
<Content Include="ZUGFeRDInterface\pdf_zugferd_lib\pdf_zugferd_test.exe">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.0.0.0")>
|
||||
<Assembly: AssemblyVersion("1.0.1.0")>
|
||||
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
||||
|
||||
@@ -1,28 +1,46 @@
|
||||
Imports System.Xml
|
||||
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.Logging
|
||||
Imports GdPicture14
|
||||
|
||||
Public Class ZUGFeRDInterface
|
||||
Private _logConfig As LogConfig
|
||||
Private _logger As Logger
|
||||
|
||||
Private Const ZUGFERD_CONVERTER_EXE = "ZUGFeRDInterface\pdf_zugferd_test.exe"
|
||||
Private Const ZUGFERD_CONVERTER_EXE = "ZUGFeRDInterface\pdf_zugferd_lib\pdf_zugferd_test.exe"
|
||||
Private Const ZUGFERD_CONVERTER_SUCCESS_MESSAGE = "Document contains ZUGFeRD data."
|
||||
|
||||
Public Enum ErrorType
|
||||
NoValidFile
|
||||
NoZugferd
|
||||
NoValidZugferd
|
||||
MissingProperties
|
||||
End Enum
|
||||
|
||||
Public Sub New(LogConfig As LogConfig)
|
||||
Public ReadOnly Property FileGroup As FileGroups
|
||||
Public ReadOnly Property PropertyValues As PropertyValues
|
||||
|
||||
Public Sub New(LogConfig As LogConfig, GDPictureKey As String)
|
||||
_logConfig = LogConfig
|
||||
_logger = _logConfig.GetLogger()
|
||||
|
||||
FileGroup = New FileGroups(_logConfig)
|
||||
PropertyValues = New PropertyValues(_logConfig)
|
||||
|
||||
Try
|
||||
Dim oLicenseManager As New LicenseManager
|
||||
oLicenseManager.RegisterKEY(GDPictureKey)
|
||||
Catch ex As Exception
|
||||
_logger.Warn("GDPicture License could not be registered!")
|
||||
_logger.Error(ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
|
||||
''' <summary>
|
||||
''' Validates a ZUGFeRD File and extracts the XML Document from it
|
||||
''' </summary>
|
||||
@@ -30,7 +48,6 @@ Public Class ZUGFeRDInterface
|
||||
''' <exception cref="ZUGFeRDExecption"></exception>
|
||||
''' <returns></returns>
|
||||
Public Function ExtractZUGFeRDFile(Path As String) As CrossIndustryDocumentType
|
||||
Dim oException As New Exception
|
||||
Dim oXmlDocument = ValidateZUGFeRDFile(Path)
|
||||
|
||||
If IsNothing(oXmlDocument) Then
|
||||
@@ -40,6 +57,25 @@ Public Class ZUGFeRDInterface
|
||||
Return SerializeZUGFeRDDocument(oXmlDocument)
|
||||
End Function
|
||||
|
||||
Public Function ExtractZUGFeRDFileWithGDPicture(Path As String) As CrossIndustryDocumentType
|
||||
Dim oXmlDocument = ValidateZUGFeRDFileWithGDPicture(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(Stream As Stream) As CrossIndustryDocumentType
|
||||
Dim oXmlDocument = ValidateZUGFeRDFileWithGDPicture(Stream)
|
||||
|
||||
If IsNothing(oXmlDocument) Then
|
||||
Throw New ZUGFeRDExecption(ErrorType.NoZugferd, "Datei ist keine ZUGFeRD Datei.")
|
||||
End If
|
||||
|
||||
Return SerializeZUGFeRDDocument(oXmlDocument)
|
||||
End Function
|
||||
|
||||
Public Function ValidateZUGFeRDFile(Path As String) As XPathDocument
|
||||
Dim oProcessOutput, oProcessError As String
|
||||
@@ -85,6 +121,69 @@ Public Class ZUGFeRDInterface
|
||||
Return oXmlDocument
|
||||
End Function
|
||||
|
||||
Public Function ValidateZUGFeRDFileWithGDPicture(Stream As Stream) As XPathDocument
|
||||
Dim oAttachmentExtractor = New PDFAttachments(_logConfig)
|
||||
Dim oAllowedExtensions = New List(Of String) From {"xml"}
|
||||
|
||||
Try
|
||||
Dim oResults = oAttachmentExtractor.Extract(Stream, oAllowedExtensions)
|
||||
Return HandleAttachments(oResults)
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function ValidateZUGFeRDFileWithGDPicture(Path As String) As XPathDocument
|
||||
Dim oAttachmentExtractor = New PDFAttachments(_logConfig)
|
||||
Dim oAllowedExtensions = New List(Of String) From {"xml"}
|
||||
|
||||
Try
|
||||
Dim oResults = oAttachmentExtractor.Extract(Path, oAllowedExtensions)
|
||||
Return HandleAttachments(oResults)
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Function HandleAttachments(Results As List(Of PDFAttachments.AttachmentResult)) As XPathDocument
|
||||
Dim oXmlDocument As XPathDocument
|
||||
|
||||
If Results Is Nothing Then
|
||||
Throw New ZUGFeRDExecption(ErrorType.NoZugferd, "Datei ist keine ZUGFeRD Datei.")
|
||||
End If
|
||||
|
||||
If Results.Count = 0 Then
|
||||
Throw New ZUGFeRDExecption(ErrorType.NoZugferd, "Datei ist keine ZUGFeRD Datei.")
|
||||
End If
|
||||
|
||||
Dim oFound As Boolean = False
|
||||
Dim oFoundResult As PDFAttachments.AttachmentResult = Nothing
|
||||
|
||||
For Each oResult In Results
|
||||
If oResult.FileName.ToUpper() = PDFAttachments.ZUGFERD_XML_FILENAME.ToUpper() Then
|
||||
oFound = True
|
||||
oFoundResult = oResult
|
||||
End If
|
||||
Next
|
||||
|
||||
If Not oFound Then
|
||||
Throw New ZUGFeRDExecption(ErrorType.NoZugferd, "Datei ist keine ZUGFeRD Datei.")
|
||||
End If
|
||||
|
||||
Try
|
||||
Using oStream As New MemoryStream(oFoundResult.FileContents)
|
||||
oXmlDocument = New XPathDocument(oStream)
|
||||
End Using
|
||||
|
||||
Return oXmlDocument
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function SerializeZUGFeRDDocument(Document As XPathDocument) As CrossIndustryDocumentType
|
||||
Try
|
||||
Dim oNavigator As XPathNavigator = Document.CreateNavigator()
|
||||
|
||||
82
Modules.Interfaces/ZUGFeRDInterface/FileGroups.vb
Normal file
82
Modules.Interfaces/ZUGFeRDInterface/FileGroups.vb
Normal file
@@ -0,0 +1,82 @@
|
||||
Imports System.IO
|
||||
Imports System.Text.RegularExpressions
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class FileGroups
|
||||
Private _logger As Logger
|
||||
|
||||
Public Sub New(LogConfig As LogConfig)
|
||||
_logger = LogConfig.GetLogger()
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' Group files by message id. Message id is extracted from filename.
|
||||
''' Filename is expected to be in the form: 1234@subdomain.company.com
|
||||
''' <param name="Files">The list of files to process</param>
|
||||
''' </summary>
|
||||
Public Function GroupFiles(Files As List(Of FileInfo)) As Dictionary(Of String, List(Of FileInfo))
|
||||
Dim oGrouped As New Dictionary(Of String, List(Of FileInfo))
|
||||
|
||||
If Files.Count = 0 Then
|
||||
Return oGrouped
|
||||
End If
|
||||
|
||||
For Each oFile In Files
|
||||
Dim oMessageId = GetMessageIdFromFileName(oFile.Name)
|
||||
|
||||
If oMessageId Is Nothing Then
|
||||
_logger.Warn("File {0} did not have the required filename-format!", oMessageId)
|
||||
Continue For
|
||||
End If
|
||||
|
||||
If oGrouped.ContainsKey(oMessageId) Then
|
||||
oGrouped.Item(oMessageId).Add(oFile)
|
||||
Else
|
||||
oGrouped.Add(oMessageId, New List(Of FileInfo) From {oFile})
|
||||
End If
|
||||
Next
|
||||
|
||||
Return oGrouped
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Group files by message id. Message id is created from `FakeMessageIdDomain` and a random string
|
||||
''' </summary>
|
||||
''' <param name="Files">The list of files to process</param>
|
||||
''' <param name="FakeMessageIdDomain">Arbitrary domain for message id generation. Example: sub.company.com</param>
|
||||
''' <returns></returns>
|
||||
Public Function GroupFiles(Files As List(Of FileInfo), FakeMessageIdDomain As String) As Dictionary(Of String, List(Of FileInfo))
|
||||
Dim oGrouped As New Dictionary(Of String, List(Of FileInfo))
|
||||
|
||||
If Files.Count = 0 Then
|
||||
Return oGrouped
|
||||
End If
|
||||
|
||||
For Each oFile In Files
|
||||
Dim oIdentifier = Guid.NewGuid().ToString()
|
||||
Dim oMessageId = $"{oIdentifier}@{FakeMessageIdDomain}"
|
||||
|
||||
If oGrouped.ContainsKey(oMessageId) Then
|
||||
oGrouped.Item(oMessageId).Add(oFile)
|
||||
Else
|
||||
oGrouped.Add(oMessageId, New List(Of FileInfo) From {oFile})
|
||||
End If
|
||||
Next
|
||||
|
||||
Return oGrouped
|
||||
End Function
|
||||
|
||||
Private Function GetMessageIdFromFileName(Filename As String) As String
|
||||
' Regex to find MessageId
|
||||
' See also: https://stackoverflow.com/questions/3968500/regex-to-validate-a-message-id-as-per-rfc2822
|
||||
Dim oRegex = "(((([a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*)|(""(([\x01-\x08\x0B\x0C\x0E-\x1F\x7F]|[\x21\x23-\x5B\x5D-\x7E])|(\\[\x01-\x09\x0B\x0C\x0E-\x7F]))*""))@(([a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*)|(\[(([\x01-\x08\x0B\x0C\x0E-\x1F\x7F]|[\x21-\x5A\x5E-\x7E])|(\\[\x01-\x09\x0B\x0C\x0E-\x7F]))*\]))))~.+"
|
||||
Dim oMatch = Regex.Match(Filename, oRegex, RegexOptions.IgnoreCase)
|
||||
|
||||
If oMatch.Success Then
|
||||
Dim oMessageId = oMatch.Groups(1).Value
|
||||
Return oMessageId
|
||||
Else
|
||||
Return Nothing
|
||||
End If
|
||||
End Function
|
||||
End Class
|
||||
136
Modules.Interfaces/ZUGFeRDInterface/PDFAttachments.vb
Normal file
136
Modules.Interfaces/ZUGFeRDInterface/PDFAttachments.vb
Normal file
@@ -0,0 +1,136 @@
|
||||
Imports System.Collections.Generic
|
||||
Imports System.IO
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports GdPicture14
|
||||
|
||||
Public Class PDFAttachments
|
||||
Private ReadOnly Logger As Logger
|
||||
|
||||
Public Const ZUGFERD_XML_FILENAME = "ZUGFeRD-invoice.xml"
|
||||
|
||||
Public Class AttachmentResult
|
||||
Public FileName As String
|
||||
Public FileContents As Byte()
|
||||
End Class
|
||||
|
||||
Public Sub New(LogConfig As LogConfig)
|
||||
Logger = LogConfig.GetLogger
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' Extracts all embedded files from a PDF file.
|
||||
''' Note: This does NOT filter out `ZUGFeRD-invoice.xml` anymore to allow for a more generic use.
|
||||
''' </summary>
|
||||
''' <param name="FilePath">Filepath of the pdf</param>
|
||||
''' <param name="AllowedExtensions">List of allowed extensions to be extracted</param>
|
||||
Public Function Extract(FilePath As String, AllowedExtensions As List(Of String)) As List(Of AttachmentResult)
|
||||
Dim oResults As New List(Of AttachmentResult)
|
||||
Dim oExtensions = AllowedExtensions.ConvertAll(New Converter(Of String, String)(Function(ext) ext.ToUpper))
|
||||
|
||||
Logger.Debug("Extracting embedded files from [{0}]", FilePath)
|
||||
|
||||
Try
|
||||
Using oGDPicturePDF As New GdPicturePDF()
|
||||
If oGDPicturePDF.LoadFromFile(FilePath, False) = GdPictureStatus.OK Then
|
||||
oResults = DoExtract(oGDPicturePDF, oExtensions)
|
||||
Else
|
||||
Dim oMessage = String.Format("The file [{0}] can't be loaded. Status: [{1}]", FilePath, oGDPicturePDF.GetStat().ToString())
|
||||
Throw New ApplicationException(oMessage)
|
||||
End If
|
||||
End Using
|
||||
|
||||
Return oResults
|
||||
Catch ex As Exception
|
||||
Logger.Warn("Unexpected Error while Extracting attachments from File [{0}]", FilePath)
|
||||
Logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Extracts all embedded files from a PDF file.
|
||||
''' Note: This does NOT filter out `ZUGFeRD-invoice.xml` anymore to allow for a more generic use.
|
||||
''' </summary>
|
||||
''' <param name="Stream">Filestream of the pdf</param>
|
||||
''' <param name="AllowedExtensions">List of allowed extensions to be extracted</param>
|
||||
Public Function Extract(Stream As Stream, AllowedExtensions As List(Of String)) As List(Of AttachmentResult)
|
||||
Dim oResults As New List(Of AttachmentResult)
|
||||
Dim oExtensions = AllowedExtensions.ConvertAll(New Converter(Of String, String)(Function(ext) ext.ToUpper))
|
||||
|
||||
Logger.Debug("Extracting embedded files from stream")
|
||||
|
||||
Try
|
||||
Using oGDPicturePDF As New GdPicturePDF()
|
||||
If oGDPicturePDF.LoadFromStream(Stream, False) = GdPictureStatus.OK Then
|
||||
oResults = DoExtract(oGDPicturePDF, oExtensions)
|
||||
Else
|
||||
Dim oMessage = String.Format("The filestream can't be loaded. Status: [{0}]", oGDPicturePDF.GetStat().ToString())
|
||||
Throw New ApplicationException(oMessage)
|
||||
End If
|
||||
End Using
|
||||
|
||||
Return oResults
|
||||
Catch ex As Exception
|
||||
Logger.Warn("Unexpected Error while Extracting attachments from Filestream")
|
||||
Logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Function DoExtract(GDPicturePDF As GdPicturePDF, Extensions As List(Of String)) As List(Of AttachmentResult)
|
||||
Dim oResults As New List(Of AttachmentResult)
|
||||
Dim oEmbeddedFileCount As Integer = GDPicturePDF.GetEmbeddedFileCount()
|
||||
|
||||
If GDPicturePDF.GetStat() = GdPictureStatus.OK Then
|
||||
Logger.Debug("Embedded file count is: [{0}]", oEmbeddedFileCount)
|
||||
|
||||
If oEmbeddedFileCount > 0 Then
|
||||
For oIndex = 0 To oEmbeddedFileCount - 1
|
||||
Dim oFileName As String = GDPicturePDF.GetEmbeddedFileName(oIndex)
|
||||
|
||||
If GDPicturePDF.GetStat() = GdPictureStatus.OK Then
|
||||
Logger.Debug("Extracting embedded file [{0}]", oFileName)
|
||||
|
||||
Dim oExtension = New FileInfo(oFileName).Extension.ToUpper.Substring(1)
|
||||
If Extensions.Contains(oExtension) Then
|
||||
Dim oFileSize As Integer = GDPicturePDF.GetEmbeddedFileSize(oIndex)
|
||||
|
||||
If GDPicturePDF.GetStat() = GdPictureStatus.OK Then
|
||||
Logger.Debug("Filesize of embedded file is [{0}]", oFileSize)
|
||||
|
||||
Dim oFileData As Byte() = New Byte(oFileSize) {}
|
||||
Dim oStatus As GdPictureStatus = GDPicturePDF.ExtractEmbeddedFile(oIndex, oFileData)
|
||||
|
||||
If oStatus = GdPictureStatus.OK Then
|
||||
Logger.Debug("Embedded file [{0}] extracted sucessfully!", oFileName)
|
||||
|
||||
oResults.Add(New AttachmentResult() With {
|
||||
.FileContents = oFileData,
|
||||
.FileName = oFileName
|
||||
})
|
||||
Else
|
||||
Logger.Error("The embedded file [{0}] has failed to extract. Status: {1}", oFileName, GDPicturePDF.GetStat().ToString())
|
||||
Continue For
|
||||
End If
|
||||
Else
|
||||
Logger.Error("An error occurred getting the file size for [{0}]. Status: {1}", oFileName, GDPicturePDF.GetStat().ToString())
|
||||
Continue For
|
||||
End If
|
||||
Else
|
||||
Logger.Warn("File [{0}] was skipped because its extension [{1}] is not allowed.", oFileName, oExtension)
|
||||
Continue For
|
||||
End If
|
||||
Else
|
||||
Logger.Error("An error occurred getting the file name for [{0}]. Status: {1}", oFileName, GDPicturePDF.GetStat().ToString())
|
||||
Continue For
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
Return oResults
|
||||
Else
|
||||
Dim oMessage = String.Format("An error occurred getting the number of embedded files. Status: {0}", GDPicturePDF.GetStat().ToString())
|
||||
Throw New ApplicationException(oMessage)
|
||||
End If
|
||||
End Function
|
||||
End Class
|
||||
313
Modules.Interfaces/ZUGFeRDInterface/PropertyValues.vb
Normal file
313
Modules.Interfaces/ZUGFeRDInterface/PropertyValues.vb
Normal file
@@ -0,0 +1,313 @@
|
||||
Imports System.Reflection
|
||||
Imports System.Text.RegularExpressions
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class PropertyValues
|
||||
Private _logger As Logger
|
||||
Private _logConfig As LogConfig
|
||||
|
||||
Private _indexPattern = "\((\d+)\)"
|
||||
Private _indexRegex As New Regex(_indexPattern)
|
||||
|
||||
Public Sub New(LogConfig As LogConfig)
|
||||
_logConfig = LogConfig
|
||||
_logger = LogConfig.GetLogger()
|
||||
End Sub
|
||||
|
||||
Public Class CheckPropertyValuesResult
|
||||
Public MissingProperties As New List(Of String)
|
||||
Public ValidProperties As New List(Of ValidProperty)
|
||||
End Class
|
||||
|
||||
Public Class ValidProperty
|
||||
Public MessageId As String
|
||||
Public TableName As String
|
||||
|
||||
Public GroupCounter As Integer = -1
|
||||
|
||||
Public Description As String
|
||||
Public Value As String
|
||||
End Class
|
||||
|
||||
Public Function CheckPropertyValues(Document As CrossIndustryDocumentType, 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()
|
||||
|
||||
' PropertyMap items with `IsGrouped = False` are handled normally
|
||||
Dim oDefaultProperties As Dictionary(Of String, XmlItemProperty) = PropertyMap.
|
||||
Where(Function(Item) Item.Value.IsGrouped = False).
|
||||
ToDictionary(Function(Item) Item.Key,
|
||||
Function(Item) Item.Value)
|
||||
|
||||
_logger.Debug("Found {0} default properties.", oDefaultProperties.Count)
|
||||
|
||||
' PropertyMap items with `IsGrouped = True` are grouped by group scope
|
||||
Dim oGroupedProperties = PropertyMap.
|
||||
Where(Function(Item) Item.Value.IsGrouped = True).
|
||||
ToLookup(Function(Item) Item.Value.GroupScope, ' Lookup key is group scope
|
||||
Function(Item) Item)
|
||||
|
||||
_logger.Debug("Found {0} properties grouped in {1} group(s)", PropertyMap.Count - oDefaultProperties.Count, oGroupedProperties.Count)
|
||||
' Iterate through groups to get group scope and group items
|
||||
For Each oGroup In oGroupedProperties
|
||||
Dim oGroupScope As String = oGroup.Key
|
||||
Dim oPropertyList As New Dictionary(Of XmlItemProperty, List(Of Object))
|
||||
Dim oRowCount = 0
|
||||
|
||||
_logger.Debug("Fetching Property values for group {0}.", oGroupScope)
|
||||
|
||||
' get properties as a nested object, see `oPropertyList`
|
||||
For Each oProperty As KeyValuePair(Of String, XmlItemProperty) In oGroup
|
||||
Dim oPropertyValues As List(Of Object)
|
||||
|
||||
Try
|
||||
oPropertyValues = GetPropValue(Document, oProperty.Key)
|
||||
Catch ex As Exception
|
||||
_logger.Warn("Unknown error occurred while fetching property [{0}] in group [{1}]:", oProperty.Value.Description, oGroupScope)
|
||||
_logger.Error(ex)
|
||||
oPropertyValues = New List(Of Object)
|
||||
End Try
|
||||
|
||||
' 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
|
||||
' [ # Propertyname # Row 1 # Row 2
|
||||
' PositionsMenge: [BilledQuantity1, BilledQuantity2, ...],
|
||||
' PositionsSteuersatz: [ApplicablePercent1, ApplicablePercent2, ...],
|
||||
' ...
|
||||
' ]
|
||||
For oRowIndex = 0 To oRowCount - 1
|
||||
_logger.Debug("Processing row {0}", oRowIndex)
|
||||
|
||||
For Each oColumn As KeyValuePair(Of XmlItemProperty, List(Of Object)) In oPropertyList
|
||||
Dim oTableName As String = oColumn.Key.TableName
|
||||
Dim oPropertyDescription As String = oColumn.Key.Description
|
||||
Dim oRowCounter = oRowIndex + oGlobalGroupCounter + 1
|
||||
|
||||
' Returns nothing if oColumn.Value contains an empty list
|
||||
Dim oPropertyValue = oColumn.Value.ElementAtOrDefault(oRowIndex)
|
||||
|
||||
_logger.Debug("Processing property {0}.", oPropertyDescription)
|
||||
|
||||
If IsNothing(oPropertyValue) OrElse String.IsNullOrEmpty(oPropertyValue) Then
|
||||
If oColumn.Key.IsRequired Then
|
||||
_logger.Warn("Property [{0}] is empty or not found but is required. Continuing with Empty String.", oPropertyDescription)
|
||||
oResult.MissingProperties.Add(oPropertyDescription)
|
||||
Else
|
||||
_logger.Debug("Property [{0}] is empty or not found. Continuing with Empty String.", oPropertyDescription)
|
||||
End If
|
||||
|
||||
oPropertyValue = String.Empty
|
||||
End If
|
||||
|
||||
_logger.Debug("Property {0} has value '{1}'", oPropertyDescription, oPropertyValue)
|
||||
|
||||
oResult.ValidProperties.Add(New ValidProperty() With {
|
||||
.MessageId = MessageId,
|
||||
.Description = oPropertyDescription,
|
||||
.Value = oPropertyValue,
|
||||
.GroupCounter = oRowCounter,
|
||||
.TableName = oTableName
|
||||
})
|
||||
Next
|
||||
Next
|
||||
|
||||
oGlobalGroupCounter += oRowCount
|
||||
Next
|
||||
|
||||
' Iterate through default properties
|
||||
For Each oItem As KeyValuePair(Of String, XmlItemProperty) In oDefaultProperties
|
||||
Dim oPropertyValueList As List(Of Object)
|
||||
Dim oPropertyDescription As String = oItem.Value.Description
|
||||
Dim oPropertyValue As Object = Nothing
|
||||
Dim oTableName = oItem.Value.TableName
|
||||
|
||||
Try
|
||||
oPropertyValueList = GetPropValue(Document, oItem.Key)
|
||||
Catch ex As Exception
|
||||
_logger.Warn("Unknown error occurred while fetching property {0} in group {1}:", oPropertyDescription, oItem.Value.GroupScope)
|
||||
_logger.Error(ex)
|
||||
oPropertyValueList = New List(Of Object)
|
||||
End Try
|
||||
|
||||
Try
|
||||
If IsNothing(oPropertyValueList) Then
|
||||
oPropertyValue = Nothing
|
||||
ElseIf TypeOf oPropertyValueList Is List(Of Object) Then
|
||||
Select Case oPropertyValueList.Count
|
||||
Case 0
|
||||
oPropertyValue = Nothing
|
||||
Case Else
|
||||
Dim oList As List(Of Object) = DirectCast(oPropertyValueList, List(Of Object))
|
||||
oPropertyValue = oList.Item(0)
|
||||
|
||||
' This should hopefully show config errors
|
||||
If TypeOf oPropertyValue Is List(Of Object) Then
|
||||
_logger.Warn("Property with Description {0} may be configured incorrectly", oPropertyDescription)
|
||||
oPropertyValue = Nothing
|
||||
End If
|
||||
End Select
|
||||
End If
|
||||
Catch ex As Exception
|
||||
_logger.Warn("Unknown error occurred while processing property {0}:", oPropertyDescription)
|
||||
_logger.Error(ex)
|
||||
oPropertyValue = Nothing
|
||||
End Try
|
||||
|
||||
If IsNothing(oPropertyValue) OrElse String.IsNullOrEmpty(oPropertyValue) Then
|
||||
If oItem.Value.IsRequired Then
|
||||
_logger.Warn("Property {0} is empty but marked as required! Skipping.", oPropertyDescription)
|
||||
oResult.MissingProperties.Add(oPropertyDescription)
|
||||
Continue For
|
||||
Else
|
||||
_logger.Debug("Property [{0}] is empty or not found. Skipping.", oPropertyDescription)
|
||||
Continue For
|
||||
End If
|
||||
End If
|
||||
|
||||
oResult.ValidProperties.Add(New ValidProperty() With {
|
||||
.MessageId = MessageId,
|
||||
.Description = oPropertyDescription,
|
||||
.Value = oPropertyValue,
|
||||
.TableName = oTableName
|
||||
})
|
||||
Next
|
||||
|
||||
Return oResult
|
||||
End Function
|
||||
|
||||
Public Function GetPropValue(Obj As Object, PropertyName As String) As List(Of Object)
|
||||
Dim oNameParts As String() = PropertyName.Split("."c)
|
||||
|
||||
If IsNothing(Obj) Then
|
||||
_logger.Debug("`Obj` is Nothing. Exiting.")
|
||||
Return New List(Of Object)
|
||||
End If
|
||||
|
||||
|
||||
If oNameParts.Length = 1 Then
|
||||
Dim oPropInfo As PropertyInfo = Obj.GetType().GetProperty(PropertyName)
|
||||
|
||||
If IsNothing(oPropInfo) Then
|
||||
_logger.Debug("Property {0} does not exist.", PropertyName)
|
||||
Return New List(Of Object)
|
||||
Else
|
||||
Dim oPropValue = oPropInfo.GetValue(Obj, Nothing)
|
||||
Return New List(Of Object) From {oPropValue}
|
||||
End If
|
||||
End If
|
||||
|
||||
For Each oPart As String In oNameParts
|
||||
Dim oType As Type = Obj.GetType()
|
||||
Dim oPartName = oPart
|
||||
Dim oIndex As Integer = Nothing
|
||||
Dim oHasIndex As Boolean = HasIndex(oPartName)
|
||||
|
||||
If oHasIndex Then
|
||||
oPartName = StripIndex(oPart)
|
||||
oIndex = GetIndex(oPart)
|
||||
End If
|
||||
|
||||
Dim oInfo As PropertyInfo = oType.GetProperty(oPartName)
|
||||
|
||||
If IsNothing(oInfo) OrElse IsNothing(oInfo.GetValue(Obj, Nothing)) Then
|
||||
_logger.Debug("Property {0} does not exist.", oPartName)
|
||||
Return New List(Of Object)
|
||||
End If
|
||||
|
||||
Obj = oInfo.GetValue(Obj, Nothing)
|
||||
|
||||
If oHasIndex Then
|
||||
Obj = Obj(0)
|
||||
End If
|
||||
|
||||
If IsArray(Obj) And Not oHasIndex Then
|
||||
Dim oCurrentPart As String = oPart
|
||||
Dim oSplitString As String() = New String() {oCurrentPart & "."}
|
||||
Dim oPathFragments = PropertyName.Split(oSplitString, StringSplitOptions.None)
|
||||
Dim oResults As New List(Of Object)
|
||||
|
||||
' if path has no more subitems, return an empty list
|
||||
If oPathFragments.Length = 1 Then
|
||||
Return oResults
|
||||
End If
|
||||
|
||||
For Each oArrayItem In Obj
|
||||
Dim oResult As List(Of Object) = GetPropValue(oArrayItem, oPathFragments(1))
|
||||
|
||||
If Not IsNothing(oResult) Then
|
||||
oResults.Add(oResult)
|
||||
End If
|
||||
Next
|
||||
|
||||
Return oResults
|
||||
End If
|
||||
Next
|
||||
|
||||
Return New List(Of Object) From {Obj}
|
||||
End Function
|
||||
|
||||
Public Function GetFinalPropValue(List As List(Of Object)) As List(Of Object)
|
||||
Dim oResult As New List(Of Object)
|
||||
|
||||
For Each Item In List
|
||||
Dim oItemValue = DoGetFinalPropValue(Item)
|
||||
|
||||
If Not IsNothing(oItemValue) Then
|
||||
oResult.Add(oItemValue)
|
||||
End If
|
||||
Next
|
||||
|
||||
Return oResult
|
||||
End Function
|
||||
|
||||
Private Function DoGetFinalPropValue(Value As Object) As String
|
||||
If TypeOf Value Is List(Of Object) Then
|
||||
Dim oList = DirectCast(Value, List(Of Object))
|
||||
Dim oCount = oList.Count
|
||||
|
||||
Select Case oCount
|
||||
Case 0
|
||||
Return Nothing
|
||||
Case Else
|
||||
Return DoGetFinalPropValue(oList.First())
|
||||
End Select
|
||||
|
||||
Return DoGetFinalPropValue(Value)
|
||||
Else
|
||||
Return Value.ToString
|
||||
End If
|
||||
End Function
|
||||
|
||||
Private Function GetIndex(Prop As String) As Integer
|
||||
If Regex.IsMatch(Prop, _indexPattern) Then
|
||||
Dim oMatch = _indexRegex.Match(Prop)
|
||||
Dim oGroup = oMatch.Groups.Item(1)
|
||||
Dim oValue = oGroup.Value
|
||||
|
||||
Return Integer.Parse(oValue)
|
||||
End If
|
||||
|
||||
Return Nothing
|
||||
End Function
|
||||
|
||||
Private Function StripIndex(Prop As String) As String
|
||||
Return Regex.Replace(Prop, _indexPattern, "")
|
||||
End Function
|
||||
|
||||
Private Function HasIndex(Prop As String) As Boolean
|
||||
Return Regex.IsMatch(Prop, _indexPattern)
|
||||
End Function
|
||||
|
||||
End Class
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net461" />
|
||||
<package id="NLog" version="4.6.8" targetFramework="net461" />
|
||||
<package id="NLog" version="4.7.0" targetFramework="net461" />
|
||||
</packages>
|
||||
197
Modules.Jobs/EDMI/ZUGFeRD/EmailFunctions.vb
Normal file
197
Modules.Jobs/EDMI/ZUGFeRD/EmailFunctions.vb
Normal file
@@ -0,0 +1,197 @@
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports System.Data
|
||||
Imports System.IO
|
||||
|
||||
Public Class EmailFunctions
|
||||
Private ReadOnly _logConfig As LogConfig
|
||||
Private ReadOnly _logger As Logger
|
||||
Private ReadOnly _mssql As MSSQLServer
|
||||
Private ReadOnly _firebird As Firebird
|
||||
|
||||
Public Sub New(LogConfig As LogConfig, MSSQL As MSSQLServer, Firebird As Firebird)
|
||||
_logConfig = LogConfig
|
||||
_logger = _logConfig.GetLogger()
|
||||
_mssql = MSSQL
|
||||
_firebird = Firebird
|
||||
End Sub
|
||||
|
||||
Public Sub AddToEmailQueueFB(MessageId As String, BodyText As String, EmailData As EmailData)
|
||||
If EmailData Is Nothing Then
|
||||
_logger.Warn("EmailData is empty. Email will not be sent!")
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Try
|
||||
Dim oJobId = RandomValue(1, 10000)
|
||||
Dim oReference = MessageId
|
||||
Dim oEmailTo = ""
|
||||
Dim oSubject = EmailStrings.EMAIL_SUBJECT
|
||||
Dim oAccountId = 1
|
||||
Dim oCreatedWho = "ZUGFeRD Service"
|
||||
Dim oFinalBodyText = String.Format(EmailStrings.EMAIL_WRAPPING_TEXT, BodyText)
|
||||
|
||||
Dim oEmailAddress = EmailData.From
|
||||
Dim oAttachment = EmailData.Attachment
|
||||
|
||||
If IsNothing(oEmailAddress) OrElse String.IsNullOrWhiteSpace(oEmailAddress) Then
|
||||
_logger.Warn("Could not find email-address for MessageId {0}", MessageId)
|
||||
oEmailTo = String.Empty
|
||||
Else
|
||||
oEmailTo = oEmailAddress
|
||||
End If
|
||||
|
||||
_logger.Debug("Generated Email:")
|
||||
_logger.Debug("To: {0}", oEmailTo)
|
||||
_logger.Debug("Subject: {0}", oSubject)
|
||||
_logger.Debug("Body {0}", oFinalBodyText)
|
||||
Dim osql = $"select * from TBEDM_EMAIL_QUEUE where REFERENCE1 = '{oReference} and EMAIL_TO = ''{oEmailTo}' and EMAIL_SUBJ = '{oSubject}'"
|
||||
|
||||
Dim oDTResult As DataTable = _firebird.GetDatatable(osql)
|
||||
|
||||
If oDTResult.Rows.Count = 0 Then
|
||||
Dim oSQLInsert = $"INSERT INTO TBEDM_EMAIL_QUEUE "
|
||||
oSQLInsert &= "(JOB_ID, REFERENCE1, EMAIL_ACCOUNT_ID, EMAIL_TO, EMAIL_SUBJ, EMAIL_BODY, CREATEDWHO, EMAIL_ATTMT1) VALUES "
|
||||
oSQLInsert &= $"({oJobId}, '{oReference}', {oAccountId}, '{oEmailTo}', '{oSubject}', '{oFinalBodyText.Replace("'", "''")}', '{oCreatedWho}', '{oAttachment}')"
|
||||
_firebird.ExecuteNonQuery(oSQLInsert)
|
||||
_logger.Debug("Email Queue updated for MessageId {0}.", MessageId, oEmailTo)
|
||||
Else
|
||||
_logger.Debug("Email has already been sent!!")
|
||||
End If
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
End Try
|
||||
End Sub
|
||||
Public Sub AddToEmailQueueMSSQL(MessageId As String, BodyText As String, pEmailData As EmailData, SourceProcedure As String)
|
||||
If pEmailData Is Nothing Then
|
||||
_logger.Warn("EmailData is empty. Email will not be sent!")
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Try
|
||||
Dim oJobId = RandomValue(1, 10000)
|
||||
Dim oReference = MessageId
|
||||
Dim oEmailTo = ""
|
||||
Dim oSubject = EmailStrings.EMAIL_SUBJECT
|
||||
Dim oAccountId = 1
|
||||
Dim oCreatedWho = "ZUGFeRD Service"
|
||||
Dim oFinalBodyText = String.Format(EmailStrings.EMAIL_WRAPPING_TEXT, BodyText)
|
||||
|
||||
Dim oEmailAddress = pEmailData.From
|
||||
Dim oAttachment = pEmailData.Attachment
|
||||
If oAttachment <> String.Empty Then
|
||||
_logger.Debug($"Attachment_String [{oAttachment}]!")
|
||||
If IO.File.Exists(oAttachment) = False Then
|
||||
_logger.Info($"Attachment.File [{oAttachment}] is not existing!!!")
|
||||
End If
|
||||
End If
|
||||
|
||||
If IsNothing(oEmailAddress) OrElse String.IsNullOrWhiteSpace(oEmailAddress) Then
|
||||
_logger.Warn("Could not find email-address for MessageId {0}", MessageId)
|
||||
oEmailTo = String.Empty
|
||||
Else
|
||||
oEmailTo = oEmailAddress
|
||||
End If
|
||||
|
||||
_logger.Debug("Generated Email:")
|
||||
_logger.Debug("To: {0}", oEmailTo)
|
||||
_logger.Debug("Subject: {0}", oSubject)
|
||||
_logger.Debug("Body {0}", oFinalBodyText)
|
||||
Dim osql = $"Select MAX(GUID) FROM TBEMLP_HISTORY WHERE EMAIL_MSGID = '{MessageId}'"
|
||||
Dim oHistoryID = _mssql.GetScalarValue(osql)
|
||||
|
||||
'osql = $"select * from TBEMLP_EMAIL_OUT where REFERENCE_ID = {oHistoryID} and EMAIL_ADRESS = '{oEmailTo}' and EMAIL_SUBJ = '{oSubject}'"
|
||||
|
||||
'Dim oDTResult As DataTable = _mssql.GetDatatable(osql)
|
||||
|
||||
If IsNumeric(oHistoryID) Then
|
||||
Dim oInsert = $"INSERT INTO [dbo].[TBEMLP_EMAIL_OUT] (
|
||||
[REMINDER_TYPE_ID]
|
||||
,[SENDING_PROFILE]
|
||||
,[REFERENCE_ID]
|
||||
,[REFERENCE_STRING]
|
||||
,[WF_ID]
|
||||
,[EMAIL_ADRESS]
|
||||
,[EMAIL_SUBJ]
|
||||
,[EMAIL_BODY]
|
||||
,[COMMENT]
|
||||
,[ADDED_WHO]
|
||||
,EMAIL_ATTMT1)
|
||||
VALUES
|
||||
(77
|
||||
,{oAccountId}
|
||||
,{oHistoryID}
|
||||
,'{MessageId}'
|
||||
,77
|
||||
,'{oEmailTo}'
|
||||
,'{oSubject}'
|
||||
,'{oFinalBodyText}'
|
||||
,'{SourceProcedure}'
|
||||
,'{oCreatedWho}'
|
||||
,'{oAttachment}')"
|
||||
_mssql.ExecuteNonQuery(oInsert)
|
||||
Else
|
||||
'If oDTResult.Rows.Count = 0 Then
|
||||
' _logger.Debug("Email has already been sent!!")
|
||||
'Else
|
||||
_logger.Warn("Could not get oHistoryID in AddToEmailQueueMSSQL!!")
|
||||
' End If
|
||||
End If
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Public Function GetEmailDataForMessageId(MessageId As String) As EmailData
|
||||
Dim oSQL = $"SELECT EMAIL_FROM, EMAIL_SUBJECT, EMAIL_ATTMT1 FROM TBEDM_EMAIL_PROFILER_HISTORY WHERE EMAIL_MSGID = '{MessageId}'"
|
||||
Try
|
||||
Dim oDatatable = _firebird.GetDatatable(oSQL)
|
||||
Dim oRow As DataRow
|
||||
|
||||
If oDatatable.Rows.Count = 0 Then
|
||||
_logger.Warn("Got no results for MessageId {0}", MessageId)
|
||||
Return Nothing
|
||||
ElseIf oDatatable.Rows.Count > 1 Then
|
||||
_logger.Warn("Got too many results for MessageId {0}. Using last row.", MessageId)
|
||||
End If
|
||||
|
||||
_logger.Debug("Got Email Data for FileId {0}", MessageId)
|
||||
oRow = oDatatable.Rows.Item(oDatatable.Rows.Count - 1)
|
||||
|
||||
Return New EmailData() With {
|
||||
.From = oRow.Item("EMAIL_FROM"),
|
||||
.Attachment = oRow.Item("EMAIL_ATTMT1"),
|
||||
.Subject = oRow.Item("EMAIL_SUBJECT")
|
||||
}
|
||||
Catch ex As Exception
|
||||
_logger.Warn("Could not fetch Email Data for FileId {0}", MessageId)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function GetOriginalEmailPath(OriginalEmailDirectory As String, MessageId As String) As String
|
||||
Dim oAttachmentDirectory = OriginalEmailDirectory
|
||||
Dim oAttachmentFile = MessageId & ".eml"
|
||||
Dim oAttachmentPath = Path.Combine(oAttachmentDirectory, oAttachmentFile)
|
||||
|
||||
If IO.File.Exists(oAttachmentPath) Then
|
||||
Return oAttachmentPath
|
||||
Else
|
||||
Return String.Empty
|
||||
End If
|
||||
End Function
|
||||
|
||||
Public Function GetEmailPathWithSubjectAsName(RejectedEmailDirectory As String, UncleanedSubject As String) As String
|
||||
Dim oCleanSubject = String.Join("", UncleanedSubject.Split(Path.GetInvalidPathChars()))
|
||||
Dim oAttachmentDirectory = RejectedEmailDirectory
|
||||
Dim oAttachmentFile = oCleanSubject & ".eml"
|
||||
Dim oAttachmentPath = Path.Combine(oAttachmentDirectory, oAttachmentFile)
|
||||
|
||||
Return oAttachmentPath
|
||||
End Function
|
||||
|
||||
Private Function RandomValue(lowerBound As Integer, upperBound As Integer) As Integer
|
||||
Dim oRandomValue = CInt(Math.Floor((upperBound - lowerBound + 1) * Rnd())) + lowerBound
|
||||
Return oRandomValue
|
||||
End Function
|
||||
End Class
|
||||
18
Modules.Jobs/EDMI/ZUGFeRD/EmailStrings.vb
Normal file
18
Modules.Jobs/EDMI/ZUGFeRD/EmailStrings.vb
Normal file
@@ -0,0 +1,18 @@
|
||||
Public Class EmailStrings
|
||||
Public Const EMAIL_WRAPPING_TEXT = "<html><body style=''font-family:""Arial"";font-size:10.0pt''>Sehr geehrte Damen und Herren,<br>
|
||||
das WISAG-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>"
|
||||
Public Const EMAIL_SUBJECT = "WISAG ZUGFeRD Portal: Beleg abgelehnt"
|
||||
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_MD5_ERROR = "<p>Die von Ihnen gesendete Rechnung wurde bereits von unserem System verarbeitet.</p>"
|
||||
Public Const EMAIL_TOO_MUCH_FERDS = "<p>Ihre Email enthielt mehr als ein ZUGFeRD-Dokument.</p>"
|
||||
Public Const EMAIL_NO_FERDS = "<p>Ihre Email enthielt keine ZUGFeRD-Dokumente.</p>"
|
||||
Public Const EMAIL_INVALID_DOCUMENT = """
|
||||
<p>Ihre Email 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 (25,01 anstatt 25.01)</li>
|
||||
</ul></p>
|
||||
"""
|
||||
End Class
|
||||
@@ -13,6 +13,7 @@ Imports DigitalData.Modules.Interfaces.Exceptions
|
||||
Imports DigitalData.Modules.Jobs.Exceptions
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports FirebirdSql.Data.FirebirdClient
|
||||
Imports GdPicture14
|
||||
|
||||
Public Class ImportZUGFeRDFiles
|
||||
Implements IJob
|
||||
@@ -25,106 +26,47 @@ Public Class ImportZUGFeRDFiles
|
||||
Public Const ZUGFERD_ATTACHMENTS = "ZUGFeRD Attachments"
|
||||
Public HISTORY_ID As Integer
|
||||
|
||||
Private Const EMAIL_WRAPPING_TEXT = "<html><body style=''font-family:""Arial"";font-size:10.0pt''>Sehr geehrte Damen und Herren,<br>
|
||||
das WISAG-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>"
|
||||
Private Const EMAIL_SUBJECT = "WISAG ZUGFeRD Portal: Beleg abgelehnt"
|
||||
Private Const EMAIL_MISSINGPROPERTIES_1 = "<p>Die angehängte Datei entspricht nicht dem WISAG ZUGFeRD-Format: {0}</p>"
|
||||
Private Const EMAIL_MISSINGPROPERTIES_2 = "<p>Die folgenden Eigenschaften wurden als ERFORDERLICH eingestuft, wurden aber nicht gefunden:<p/>"
|
||||
Private Const EMAIL_MD5_ERROR = "<p>Die von Ihnen gesendete Rechnung wurde bereits von unserem System verarbeitet.</p>"
|
||||
Private Const EMAIL_TOO_MUCH_FERDS = "<p>Ihre Email enthielt mehr als ein ZUGFeRD-Dokument.</p>"
|
||||
Private Const EMAIL_NO_FERDS = "<p>Ihre Email enthielt keine ZUGFeRD-Dokumente.</p>"
|
||||
Private Const EMAIL_INVALID_DOCUMENT = """
|
||||
<p>Ihre Email 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 (25,01 anstatt 25.01)</li>
|
||||
</ul></p>
|
||||
"""
|
||||
|
||||
' List of allowed extensions for PDF/A Attachments
|
||||
Private AllowedExtensions = New List(Of String) From {"docx", "doc", "pdf", "xls", "xlsx", "ppt", "pptx", "txt"}
|
||||
Private ReadOnly AllowedExtensions As List(Of String) = New List(Of String) From {"docx", "doc", "pdf", "xls", "xlsx", "ppt", "pptx", "txt"}
|
||||
|
||||
Private _logger As Logger
|
||||
Private _logConfig As LogConfig
|
||||
Private _zugferd As ZUGFeRDInterface
|
||||
Private _firebird As Firebird
|
||||
Private _filesystem As Filesystem.File
|
||||
Private _mssql As MSSQLServer
|
||||
Private ReadOnly _logger As Logger
|
||||
Private ReadOnly _logConfig As LogConfig
|
||||
Private ReadOnly _zugferd As ZUGFeRDInterface
|
||||
Private ReadOnly _firebird As Firebird
|
||||
Private ReadOnly _filesystem As Filesystem.File
|
||||
Private ReadOnly _mssql As MSSQLServer
|
||||
Private ReadOnly _email As EmailFunctions
|
||||
|
||||
Public Sub New(LogConfig As LogConfig, Firebird As Firebird, Optional MSSQL As MSSQLServer = Nothing)
|
||||
_logConfig = LogConfig
|
||||
_logger = LogConfig.GetLogger()
|
||||
_firebird = Firebird
|
||||
_filesystem = New Filesystem.File(_logConfig)
|
||||
_zugferd = New ZUGFeRDInterface(_logConfig)
|
||||
_mssql = MSSQL
|
||||
_email = New EmailFunctions(LogConfig, _mssql, _firebird)
|
||||
|
||||
_logger.Debug("Registering GDPicture License")
|
||||
If _mssql IsNot Nothing Then
|
||||
Dim oSQL = "SELECT LICENSE FROM TBDD_3RD_PARTY_MODULES WHERE NAME = 'GDPICTURE'"
|
||||
Dim oLicenseKey As String = _mssql.GetScalarValue(oSQL)
|
||||
_zugferd = New ZUGFeRDInterface(_logConfig, oLicenseKey)
|
||||
Else
|
||||
_logger.Warn("GDPicture License could not be registered! MSSQL is not enabled!")
|
||||
Throw New ArgumentNullException("MSSQL")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Function RandomValue(lowerBound As Integer, upperBound As Integer) As Integer
|
||||
Dim oRandomValue = CInt(Math.Floor((upperBound - lowerBound + 1) * Rnd())) + lowerBound
|
||||
Return oRandomValue
|
||||
End Function
|
||||
|
||||
Private Function GetEmailDataForMessageId(MessageId As String) As EmailData
|
||||
Dim oSQL = $"SELECT EMAIL_FROM, EMAIL_SUBJECT, EMAIL_ATTMT1 FROM TBEDM_EMAIL_PROFILER_HISTORY WHERE EMAIL_MSGID = '{MessageId}'"
|
||||
Try
|
||||
Dim oDatatable = _firebird.GetDatatable(oSQL)
|
||||
Dim oRow As DataRow
|
||||
|
||||
If oDatatable.Rows.Count = 0 Then
|
||||
_logger.Warn("Got no results for MessageId {0}", MessageId)
|
||||
Return Nothing
|
||||
ElseIf oDatatable.Rows.Count > 1 Then
|
||||
_logger.Warn("Got too many results for MessageId {0}. Using last row.", MessageId)
|
||||
End If
|
||||
|
||||
_logger.Debug("Got Email Data for FileId {0}", MessageId)
|
||||
oRow = oDatatable.Rows.Item(oDatatable.Rows.Count - 1)
|
||||
|
||||
Return New EmailData() With {
|
||||
.From = oRow.Item("EMAIL_FROM"),
|
||||
.Attachment = oRow.Item("EMAIL_ATTMT1"),
|
||||
.Subject = oRow.Item("EMAIL_SUBJECT")
|
||||
}
|
||||
Catch ex As Exception
|
||||
_logger.Warn("Could not fetch Email Data for FileId {0}", MessageId)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Function GetOriginalEmailPath(OriginalEmailDirectory As String, MessageId As String) As String
|
||||
Dim oAttachmentDirectory = OriginalEmailDirectory
|
||||
Dim oAttachmentFile = MessageId & ".eml"
|
||||
Dim oAttachmentPath = Path.Combine(oAttachmentDirectory, oAttachmentFile)
|
||||
|
||||
If IO.File.Exists(oAttachmentPath) Then
|
||||
Return oAttachmentPath
|
||||
Else
|
||||
Return String.Empty
|
||||
End If
|
||||
End Function
|
||||
|
||||
Private Function GetEmailPathWithSubjectAsName(RejectedEmailDirectory As String, UncleanedSubject As String) As String
|
||||
Dim oCleanSubject = String.Join("", UncleanedSubject.Split(Path.GetInvalidPathChars()))
|
||||
Dim oAttachmentDirectory = RejectedEmailDirectory
|
||||
Dim oAttachmentFile = oCleanSubject & ".eml"
|
||||
Dim oAttachmentPath = Path.Combine(oAttachmentDirectory, oAttachmentFile)
|
||||
|
||||
Return oAttachmentPath
|
||||
End Function
|
||||
|
||||
Private Function MoveAndRenameEmailToRejected(Args As WorkerArgs, MessageId As String) As EmailData
|
||||
Dim oEmailData = GetEmailDataForMessageId(MessageId)
|
||||
Dim oSource = GetOriginalEmailPath(Args.OriginalEmailDirectory, MessageId)
|
||||
Dim oEmailData = _email.GetEmailDataForMessageId(MessageId)
|
||||
Dim oSource = _email.GetOriginalEmailPath(Args.OriginalEmailDirectory, MessageId)
|
||||
Dim oDestination As String
|
||||
|
||||
' 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
|
||||
oDestination = GetEmailPathWithSubjectAsName(Args.RejectedEmailDirectory, MessageId)
|
||||
oDestination = _email.GetEmailPathWithSubjectAsName(Args.RejectedEmailDirectory, MessageId)
|
||||
Else
|
||||
oDestination = GetEmailPathWithSubjectAsName(Args.RejectedEmailDirectory, oEmailData.Subject)
|
||||
oDestination = _email.GetEmailPathWithSubjectAsName(Args.RejectedEmailDirectory, oEmailData.Subject)
|
||||
End If
|
||||
|
||||
_logger.Debug("Destination for eml file is {0}", oDestination)
|
||||
@@ -153,183 +95,18 @@ Public Class ImportZUGFeRDFiles
|
||||
|
||||
Private Sub AddRejectedState(oMessageID As String, oTitle As String, oTitle1 As String, oComment As String)
|
||||
Try
|
||||
'PRCUST_ADD_HISTORY_STATE: @MessageID VARCHAR(250), @TITLE1 VARCHAR(250), @TITLE2 VARCHAR(250)
|
||||
Dim oSQL = $"EXEC PRCUST_ADD_HISTORY_STATE '{oMessageID}','{oTitle}','{oTitle1}','{oComment}'"
|
||||
_mssql.NewExecutenonQuery(oSQL)
|
||||
'@MessageID VARCHAR(250), @TITLE1 VARCHAR(250), @TITLE2 VARCHAR(250)
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub AddToEmailQueueFB(MessageId As String, BodyText As String, EmailData As EmailData)
|
||||
If EmailData Is Nothing Then
|
||||
_logger.Warn("EmailData is empty. Email will not be sent!")
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Try
|
||||
Dim oJobId = RandomValue(1, 10000)
|
||||
Dim oReference = MessageId
|
||||
Dim oEmailTo = ""
|
||||
Dim oSubject = EMAIL_SUBJECT
|
||||
Dim oAccountId = 1
|
||||
Dim oCreatedWho = "ZUGFeRD Service"
|
||||
Dim oFinalBodyText = String.Format(EMAIL_WRAPPING_TEXT, BodyText)
|
||||
|
||||
Dim oEmailAddress = EmailData.From
|
||||
Dim oAttachment = EmailData.Attachment
|
||||
|
||||
If IsNothing(oEmailAddress) OrElse String.IsNullOrWhiteSpace(oEmailAddress) Then
|
||||
_logger.Warn("Could not find email-address for MessageId {0}", MessageId)
|
||||
oEmailTo = String.Empty
|
||||
Else
|
||||
oEmailTo = oEmailAddress
|
||||
End If
|
||||
|
||||
_logger.Debug("Generated Email:")
|
||||
_logger.Debug("To: {0}", oEmailTo)
|
||||
_logger.Debug("Subject: {0}", oSubject)
|
||||
_logger.Debug("Body {0}", oFinalBodyText)
|
||||
Dim osql = $"select * from TBEDM_EMAIL_QUEUE where REFERENCE1 = '{oReference} and EMAIL_TO = ''{oEmailTo}' and EMAIL_SUBJ = '{oSubject}'"
|
||||
|
||||
Dim oDTResult As DataTable = _firebird.GetDatatable(osql)
|
||||
|
||||
If oDTResult.Rows.Count = 0 Then
|
||||
Dim oSQLInsert = $"INSERT INTO TBEDM_EMAIL_QUEUE "
|
||||
oSQLInsert &= "(JOB_ID, REFERENCE1, EMAIL_ACCOUNT_ID, EMAIL_TO, EMAIL_SUBJ, EMAIL_BODY, CREATEDWHO, EMAIL_ATTMT1) VALUES "
|
||||
oSQLInsert &= $"({oJobId}, '{oReference}', {oAccountId}, '{oEmailTo}', '{oSubject}', '{oFinalBodyText.Replace("'", "''")}', '{oCreatedWho}', '{oAttachment}')"
|
||||
_firebird.ExecuteNonQuery(oSQLInsert)
|
||||
_logger.Debug("Email Queue updated for MessageId {0}.", MessageId, oEmailTo)
|
||||
Else
|
||||
_logger.Debug("Email has already been sent!!")
|
||||
End If
|
||||
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)
|
||||
If pEmailData Is Nothing Then
|
||||
_logger.Warn("EmailData is empty. Email will not be sent!")
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Try
|
||||
Dim oJobId = RandomValue(1, 10000)
|
||||
Dim oReference = MessageId
|
||||
Dim oEmailTo = ""
|
||||
Dim oSubject = EMAIL_SUBJECT
|
||||
Dim oAccountId = 1
|
||||
Dim oCreatedWho = "ZUGFeRD Service"
|
||||
Dim oFinalBodyText = String.Format(EMAIL_WRAPPING_TEXT, BodyText)
|
||||
|
||||
Dim oEmailAddress = pEmailData.From
|
||||
Dim oAttachment = pEmailData.Attachment
|
||||
If oAttachment <> String.Empty Then
|
||||
_logger.Debug($"Attachment_String [{oAttachment}]!")
|
||||
If IO.File.Exists(oAttachment) = False Then
|
||||
_logger.Info($"Attachment.File [{oAttachment}] is not existing!!!")
|
||||
End If
|
||||
End If
|
||||
|
||||
If IsNothing(oEmailAddress) OrElse String.IsNullOrWhiteSpace(oEmailAddress) Then
|
||||
_logger.Warn("Could not find email-address for MessageId {0}", MessageId)
|
||||
oEmailTo = String.Empty
|
||||
Else
|
||||
oEmailTo = oEmailAddress
|
||||
End If
|
||||
|
||||
_logger.Debug("Generated Email:")
|
||||
_logger.Debug("To: {0}", oEmailTo)
|
||||
_logger.Debug("Subject: {0}", oSubject)
|
||||
_logger.Debug("Body {0}", oFinalBodyText)
|
||||
Dim osql = $"Select MAX(GUID) FROM TBEMLP_HISTORY WHERE EMAIL_MSGID = '{MessageId}'"
|
||||
Dim oHistoryID = _mssql.GetScalarValue(osql)
|
||||
|
||||
'osql = $"select * from TBEMLP_EMAIL_OUT where REFERENCE_ID = {oHistoryID} and EMAIL_ADRESS = '{oEmailTo}' and EMAIL_SUBJ = '{oSubject}'"
|
||||
|
||||
'Dim oDTResult As DataTable = _mssql.GetDatatable(osql)
|
||||
|
||||
If IsNumeric(oHistoryID) Then
|
||||
Dim oInsert = $"INSERT INTO [dbo].[TBEMLP_EMAIL_OUT] (
|
||||
[REMINDER_TYPE_ID]
|
||||
,[SENDING_PROFILE]
|
||||
,[REFERENCE_ID]
|
||||
,[REFERENCE_STRING]
|
||||
,[WF_ID]
|
||||
,[EMAIL_ADRESS]
|
||||
,[EMAIL_SUBJ]
|
||||
,[EMAIL_BODY]
|
||||
,[COMMENT]
|
||||
,[ADDED_WHO]
|
||||
,EMAIL_ATTMT1)
|
||||
VALUES
|
||||
(77
|
||||
,{oAccountId}
|
||||
,{oHistoryID}
|
||||
,'{MessageId}'
|
||||
,77
|
||||
,'{oEmailTo}'
|
||||
,'{oSubject}'
|
||||
,'{oFinalBodyText}'
|
||||
,'{SourceProcedure}'
|
||||
,'{oCreatedWho}'
|
||||
,'{oAttachment}')"
|
||||
_mssql.ExecuteNonQuery(oInsert)
|
||||
Else
|
||||
'If oDTResult.Rows.Count = 0 Then
|
||||
' _logger.Debug("Email has already been sent!!")
|
||||
'Else
|
||||
_logger.Warn("Could not get oHistoryID in AddToEmailQueueMSSQL!!")
|
||||
' End If
|
||||
End If
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
End Try
|
||||
End Sub
|
||||
Private Function GetMessageIdFromFileName(Filename As String) As String
|
||||
' Regex to find MessageId
|
||||
' See also: https://stackoverflow.com/questions/3968500/regex-to-validate-a-message-id-as-per-rfc2822
|
||||
Dim oRegex = "(((([a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*)|(""(([\x01-\x08\x0B\x0C\x0E-\x1F\x7F]|[\x21\x23-\x5B\x5D-\x7E])|(\\[\x01-\x09\x0B\x0C\x0E-\x7F]))*""))@(([a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*)|(\[(([\x01-\x08\x0B\x0C\x0E-\x1F\x7F]|[\x21-\x5A\x5E-\x7E])|(\\[\x01-\x09\x0B\x0C\x0E-\x7F]))*\]))))~.+"
|
||||
Dim oMatch = Regex.Match(Filename, oRegex, RegexOptions.IgnoreCase)
|
||||
|
||||
If oMatch.Success Then
|
||||
Dim oMessageId = oMatch.Groups(1).Value
|
||||
Return oMessageId
|
||||
Else
|
||||
Return Nothing
|
||||
End If
|
||||
End Function
|
||||
|
||||
Private Function GroupFiles(Files As List(Of FileInfo)) As Dictionary(Of String, List(Of FileInfo))
|
||||
Dim oGrouped As New Dictionary(Of String, List(Of FileInfo))
|
||||
|
||||
If Files.Count = 0 Then
|
||||
Return oGrouped
|
||||
End If
|
||||
|
||||
For Each oFile In Files
|
||||
Dim oMessageId = GetMessageIdFromFileName(oFile.Name)
|
||||
|
||||
If oMessageId Is Nothing Then
|
||||
_logger.Warn("File {0} did not have the required filename-format!", oMessageId)
|
||||
Continue For
|
||||
End If
|
||||
|
||||
If oGrouped.ContainsKey(oMessageId) Then
|
||||
oGrouped.Item(oMessageId).Add(oFile)
|
||||
Else
|
||||
oGrouped.Add(oMessageId, New List(Of FileInfo) From {oFile})
|
||||
End If
|
||||
Next
|
||||
|
||||
Return oGrouped
|
||||
End Function
|
||||
|
||||
|
||||
Public Sub Start(Arguments As Object) Implements IJob.Start
|
||||
Dim oArgs As WorkerArgs = Arguments
|
||||
Dim oPropertyExtractor = New PropertyValues(_logConfig)
|
||||
Dim oAttachmentExtractor = New PDFAttachments(_logConfig, oArgs.GDPictureKey)
|
||||
Dim oAttachmentExtractor = New PDFAttachments(_logConfig)
|
||||
|
||||
_logger.Debug("Starting Job {0}", [GetType].Name)
|
||||
|
||||
@@ -356,7 +133,7 @@ Public Class ImportZUGFeRDFiles
|
||||
End If
|
||||
|
||||
' Group files by messageId
|
||||
Dim oGrouped As Dictionary(Of String, List(Of FileInfo)) = GroupFiles(oFiles)
|
||||
Dim oGrouped As Dictionary(Of String, List(Of FileInfo)) = _zugferd.FileGroup.GroupFiles(oFiles)
|
||||
|
||||
_logger.Info("Found {0} file groups", oGrouped.Count)
|
||||
|
||||
@@ -372,14 +149,15 @@ Public Class ImportZUGFeRDFiles
|
||||
Dim oMoveDirectory As String = oArgs.SuccessDirectory
|
||||
' Create file lists
|
||||
Dim oFileGroupFiles As List(Of FileInfo) = oFileGroup.Value
|
||||
Dim oFileAttachmentFiles As New List(Of FileInfo)
|
||||
Dim oEmailAttachmentFiles As New List(Of FileInfo)
|
||||
Dim oEmbeddedAttachmentFiles As New List(Of PDFAttachments.AttachmentResult)
|
||||
|
||||
Dim oFileGroupId As String = oFileGroup.Key
|
||||
Dim oMessageId As String = oFileGroup.Key
|
||||
Dim oMissingProperties As New List(Of String)
|
||||
Dim oMD5CheckSum As String = String.Empty
|
||||
|
||||
_logger.NewBlock($"Message Id {oFileGroupId}")
|
||||
_logger.Info("Start processing file group {0}", oFileGroupId)
|
||||
_logger.NewBlock($"Message Id {oMessageId}")
|
||||
_logger.Info("Start processing file group {0}", oMessageId)
|
||||
|
||||
Try
|
||||
For Each oFile In oFileGroupFiles
|
||||
@@ -393,7 +171,7 @@ Public Class ImportZUGFeRDFiles
|
||||
' Only pdf files are allowed from here on
|
||||
If Not oFile.Name.EndsWith(".pdf") Then
|
||||
_logger.Debug("Skipping non-pdf file {0}", oFile.Name)
|
||||
oFileAttachmentFiles.Add(oFile)
|
||||
oEmailAttachmentFiles.Add(oFile)
|
||||
Continue For
|
||||
End If
|
||||
|
||||
@@ -405,7 +183,7 @@ Public Class ImportZUGFeRDFiles
|
||||
Select Case ex.ErrorType
|
||||
Case ZUGFeRDInterface.ErrorType.NoZugferd
|
||||
_logger.Warn("File is not a valid ZUGFeRD document! Skipping.")
|
||||
oFileAttachmentFiles.Add(oFile)
|
||||
oEmailAttachmentFiles.Add(oFile)
|
||||
Continue For
|
||||
|
||||
Case ZUGFeRDInterface.ErrorType.NoValidZugferd
|
||||
@@ -418,12 +196,13 @@ Public Class ImportZUGFeRDFiles
|
||||
End Select
|
||||
End Try
|
||||
|
||||
' 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.
|
||||
Dim oAttachments = oAttachmentExtractor.Extract(oFile.FullName, AllowedExtensions)
|
||||
If oAttachments Is Nothing Then
|
||||
_logger.Warn("Attachments for file [{0}] could not be extracted", oFile.FullName)
|
||||
Else
|
||||
oFileAttachmentFiles.AddRange(oFileGroupFiles)
|
||||
oFileAttachmentFiles.AddRange(oAttachments)
|
||||
oEmbeddedAttachmentFiles.AddRange(oAttachments)
|
||||
End If
|
||||
|
||||
oMD5CheckSum = CreateMD5(oFile.FullName)
|
||||
@@ -460,159 +239,192 @@ Public Class ImportZUGFeRDFiles
|
||||
|
||||
' Since extraction went well, increase the amount of ZUGFeRD files
|
||||
oZUGFeRDCount += 1
|
||||
#Region "Check Property Values"
|
||||
' --- BEGIN Check Property Values
|
||||
|
||||
' PropertyMap items with `IsGrouped = False` are handled normally
|
||||
Dim oDefaultProperties As Dictionary(Of String, XmlItemProperty) = oArgs.PropertyMap.
|
||||
Where(Function(Item As KeyValuePair(Of String, XmlItemProperty))
|
||||
Return Item.Value.IsGrouped = False
|
||||
End Function).
|
||||
ToDictionary(Function(Item) Item.Key,
|
||||
Function(Item) Item.Value)
|
||||
'' PropertyMap items with `IsGrouped = False` are handled normally
|
||||
'Dim oDefaultProperties As Dictionary(Of String, XmlItemProperty) = oArgs.PropertyMap.
|
||||
' Where(Function(Item) Item.Value.IsGrouped = True).
|
||||
' ToDictionary(Function(Item) Item.Key,
|
||||
' Function(Item) Item.Value)
|
||||
|
||||
_logger.Debug("Found {0} default properties.", oDefaultProperties.Count)
|
||||
'_logger.Debug("Found {0} default properties.", oDefaultProperties.Count)
|
||||
|
||||
' PropertyMap items with `IsGrouped = True` are grouped by group scope
|
||||
Dim oGroupedProperties = oArgs.PropertyMap.
|
||||
Where(Function(Item) Item.Value.IsGrouped = True).
|
||||
ToLookup(Function(Item) Item.Value.GroupScope, ' Lookup key is group scope
|
||||
Function(Item) Item)
|
||||
'' PropertyMap items with `IsGrouped = True` are grouped by group scope
|
||||
'Dim oGroupedProperties = oArgs.PropertyMap.
|
||||
' Where(Function(Item) Item.Value.IsGrouped = True).
|
||||
' ToLookup(Function(Item) Item.Value.GroupScope, ' Lookup key is group scope
|
||||
' Function(Item) Item)
|
||||
|
||||
_logger.Debug("Found {0} properties grouped in {1} group(s)", oArgs.PropertyMap.Count - oDefaultProperties.Count, oGroupedProperties.Count)
|
||||
' Iterate through groups to get group scope and group items
|
||||
For Each oGroup In oGroupedProperties
|
||||
Dim oGroupScope As String = oGroup.Key
|
||||
Dim oPropertyList As New Dictionary(Of XmlItemProperty, List(Of Object))
|
||||
Dim oRowCount = 0
|
||||
'_logger.Debug("Found {0} properties grouped in {1} group(s)", oArgs.PropertyMap.Count - oDefaultProperties.Count, oGroupedProperties.Count)
|
||||
'' Iterate through groups to get group scope and group items
|
||||
'For Each oGroup In oGroupedProperties
|
||||
' Dim oGroupScope As String = oGroup.Key
|
||||
' Dim oPropertyList As New Dictionary(Of XmlItemProperty, List(Of Object))
|
||||
' Dim oRowCount = 0
|
||||
|
||||
_logger.Debug("Fetching Property values for group {0}.", oGroupScope)
|
||||
' _logger.Debug("Fetching Property values for group {0}.", oGroupScope)
|
||||
|
||||
' get properties as a nested object, see `oPropertyList`
|
||||
For Each oProperty As KeyValuePair(Of String, XmlItemProperty) In oGroup
|
||||
Dim oPropertyValues As List(Of Object)
|
||||
' ' get properties as a nested object, see `oPropertyList`
|
||||
' For Each oProperty As KeyValuePair(Of String, XmlItemProperty) In oGroup
|
||||
' Dim oPropertyValues As List(Of Object)
|
||||
|
||||
Try
|
||||
oPropertyValues = oPropertyExtractor.GetPropValue(oDocument, oProperty.Key)
|
||||
Catch ex As Exception
|
||||
_logger.Warn("Unknown error occurred while fetching property [{0}] in group [{1}]:", oProperty.Value.Description, oGroupScope)
|
||||
_logger.Error(ex)
|
||||
oPropertyValues = New List(Of Object)
|
||||
End Try
|
||||
' Try
|
||||
' oPropertyValues = oPropertyExtractor.GetPropValue(oDocument, oProperty.Key)
|
||||
' Catch ex As Exception
|
||||
' _logger.Warn("Unknown error occurred while fetching property [{0}] in group [{1}]:", oProperty.Value.Description, oGroupScope)
|
||||
' _logger.Error(ex)
|
||||
' oPropertyValues = New List(Of Object)
|
||||
' End Try
|
||||
|
||||
' Flatten result value
|
||||
oPropertyValues = oPropertyExtractor.GetFinalPropValue(oPropertyValues)
|
||||
' ' Flatten result value
|
||||
' oPropertyValues = oPropertyExtractor.GetFinalPropValue(oPropertyValues)
|
||||
|
||||
' Add to list
|
||||
oPropertyList.Add(oProperty.Value, 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
|
||||
' ' check the first batch of values to determine the row count
|
||||
' If oRowCount = 0 Then
|
||||
' oRowCount = oPropertyValues.Count
|
||||
' End If
|
||||
' Next
|
||||
|
||||
' Structure of oPropertyList
|
||||
' [ # Propertyname # Row 1 # Row 2
|
||||
' PositionsMenge: [BilledQuantity1, BilledQuantity2, ...],
|
||||
' PositionsSteuersatz: [ApplicablePercent1, ApplicablePercent2, ...],
|
||||
' ...
|
||||
' ]
|
||||
For oRowIndex = 0 To oRowCount - 1
|
||||
_logger.Debug("Processing row {0}", oRowIndex)
|
||||
' ' Structure of oPropertyList
|
||||
' ' [ # Propertyname # Row 1 # Row 2
|
||||
' ' PositionsMenge: [BilledQuantity1, BilledQuantity2, ...],
|
||||
' ' PositionsSteuersatz: [ApplicablePercent1, ApplicablePercent2, ...],
|
||||
' ' ...
|
||||
' ' ]
|
||||
' For oRowIndex = 0 To oRowCount - 1
|
||||
' _logger.Debug("Processing row {0}", oRowIndex)
|
||||
|
||||
For Each oColumn As KeyValuePair(Of XmlItemProperty, List(Of Object)) In oPropertyList
|
||||
Dim oTableName As String = oColumn.Key.TableName
|
||||
Dim oPropertyDescription As String = oColumn.Key.Description
|
||||
Dim oRowCounter = oRowIndex + oGlobalGroupCounter + 1
|
||||
' For Each oColumn As KeyValuePair(Of XmlItemProperty, List(Of Object)) In oPropertyList
|
||||
' Dim oTableName As String = oColumn.Key.TableName
|
||||
' Dim oPropertyDescription As String = oColumn.Key.Description
|
||||
' Dim oRowCounter = oRowIndex + oGlobalGroupCounter + 1
|
||||
|
||||
' Returns nothing if oColumn.Value contains an empty list
|
||||
Dim oPropertyValue = oColumn.Value.ElementAtOrDefault(oRowIndex)
|
||||
' ' Returns nothing if oColumn.Value contains an empty list
|
||||
' Dim oPropertyValue = oColumn.Value.ElementAtOrDefault(oRowIndex)
|
||||
|
||||
_logger.Debug("Processing property {0}.", oPropertyDescription)
|
||||
' _logger.Debug("Processing property {0}.", oPropertyDescription)
|
||||
|
||||
If IsNothing(oPropertyValue) OrElse String.IsNullOrEmpty(oPropertyValue) Then
|
||||
If oColumn.Key.IsRequired Then
|
||||
_logger.Warn("Property [{0}] is empty or not found but is required. Continuing with Empty String.", oPropertyDescription)
|
||||
oMissingProperties.Add(oPropertyDescription)
|
||||
Else
|
||||
_logger.Debug("Property [{0}] is empty or not found. Continuing with Empty String.", oPropertyDescription)
|
||||
End If
|
||||
' If IsNothing(oPropertyValue) OrElse String.IsNullOrEmpty(oPropertyValue) Then
|
||||
' If oColumn.Key.IsRequired Then
|
||||
' _logger.Warn("Property [{0}] is empty or not found but is required. Continuing with Empty String.", oPropertyDescription)
|
||||
' oMissingProperties.Add(oPropertyDescription)
|
||||
' Else
|
||||
' _logger.Debug("Property [{0}] is empty or not found. Continuing with Empty String.", oPropertyDescription)
|
||||
' End If
|
||||
|
||||
oPropertyValue = String.Empty
|
||||
End If
|
||||
' oPropertyValue = String.Empty
|
||||
' End If
|
||||
|
||||
_logger.Debug("Property {0} has value '{1}'", oPropertyDescription, oPropertyValue)
|
||||
' _logger.Debug("Property {0} has value '{1}'", oPropertyDescription, oPropertyValue)
|
||||
|
||||
Dim oCommand = $"INSERT INTO {oTableName} (REFERENCE_GUID, ITEM_DESCRIPTION, ITEM_VALUE, GROUP_COUNTER) VALUES ('{oFileGroupId}', '{oPropertyDescription}', '{oPropertyValue}', {oRowCounter})"
|
||||
_logger.Debug("Mapping Property {0} to value {1}. Will be inserted into table {2} with RowCounter {3}", oPropertyDescription, oPropertyValue, oTableName, oRowCounter)
|
||||
' Dim oCommand = $"INSERT INTO {oTableName} (REFERENCE_GUID, ITEM_DESCRIPTION, ITEM_VALUE, GROUP_COUNTER) VALUES ('{oMessageId}', '{oPropertyDescription}', '{oPropertyValue}', {oRowCounter})"
|
||||
' _logger.Debug("Mapping Property {0} to value {1}. Will be inserted into table {2} with RowCounter {3}", oPropertyDescription, oPropertyValue, oTableName, oRowCounter)
|
||||
|
||||
' Insert into SQL Server
|
||||
If oArgs.InsertIntoSQLServer = True Then
|
||||
Dim oResult = _mssql.NewExecutenonQuery(oCommand)
|
||||
If oResult = False Then
|
||||
_logger.Warn("SQL Command was not successful. Check the log.")
|
||||
End If
|
||||
End If
|
||||
' ' Insert into SQL Server
|
||||
' If oArgs.InsertIntoSQLServer = True Then
|
||||
' Dim oResult = _mssql.NewExecutenonQuery(oCommand)
|
||||
' If oResult = False Then
|
||||
' _logger.Warn("SQL Command was not successful. Check the log.")
|
||||
' End If
|
||||
' End If
|
||||
|
||||
' Insert into Firebird
|
||||
_firebird.ExecuteNonQueryWithConnection(oCommand, oConnection, Firebird.TransactionMode.ExternalTransaction, oTransaction)
|
||||
Next
|
||||
Next
|
||||
' ' Insert into Firebird
|
||||
' _firebird.ExecuteNonQueryWithConnection(oCommand, oConnection, Firebird.TransactionMode.ExternalTransaction, oTransaction)
|
||||
' Next
|
||||
' Next
|
||||
|
||||
oGlobalGroupCounter += oRowCount
|
||||
Next
|
||||
' oGlobalGroupCounter += oRowCount
|
||||
'Next
|
||||
|
||||
' Iterate through default properties
|
||||
For Each Item As KeyValuePair(Of String, XmlItemProperty) In oDefaultProperties
|
||||
Dim oPropertyValueList As List(Of Object)
|
||||
Dim oPropertyDescription As String = Item.Value.Description
|
||||
Dim oPropertyValue As Object = Nothing
|
||||
'' Iterate through default properties
|
||||
'For Each Item As KeyValuePair(Of String, XmlItemProperty) In oDefaultProperties
|
||||
' Dim oPropertyValueList As List(Of Object)
|
||||
' Dim oPropertyDescription As String = Item.Value.Description
|
||||
' Dim oPropertyValue As Object = Nothing
|
||||
|
||||
Try
|
||||
oPropertyValueList = oPropertyExtractor.GetPropValue(oDocument, Item.Key)
|
||||
Catch ex As Exception
|
||||
_logger.Warn("Unknown error occurred while fetching property {0} in group {1}:", oPropertyDescription, Item.Value.GroupScope)
|
||||
_logger.Error(ex)
|
||||
oPropertyValueList = New List(Of Object)
|
||||
End Try
|
||||
' Try
|
||||
' oPropertyValueList = oPropertyExtractor.GetPropValue(oDocument, Item.Key)
|
||||
' Catch ex As Exception
|
||||
' _logger.Warn("Unknown error occurred while fetching property {0} in group {1}:", oPropertyDescription, Item.Value.GroupScope)
|
||||
' _logger.Error(ex)
|
||||
' oPropertyValueList = New List(Of Object)
|
||||
' End Try
|
||||
|
||||
Try
|
||||
If IsNothing(oPropertyValueList) Then
|
||||
oPropertyValue = Nothing
|
||||
ElseIf TypeOf oPropertyValueList Is List(Of Object) Then
|
||||
Select Case oPropertyValueList.Count
|
||||
Case 0
|
||||
oPropertyValue = Nothing
|
||||
Case Else
|
||||
Dim oList As List(Of Object) = DirectCast(oPropertyValueList, List(Of Object))
|
||||
oPropertyValue = oList.Item(0)
|
||||
' Try
|
||||
' If IsNothing(oPropertyValueList) Then
|
||||
' oPropertyValue = Nothing
|
||||
' ElseIf TypeOf oPropertyValueList Is List(Of Object) Then
|
||||
' Select Case oPropertyValueList.Count
|
||||
' Case 0
|
||||
' oPropertyValue = Nothing
|
||||
' Case Else
|
||||
' Dim oList As List(Of Object) = DirectCast(oPropertyValueList, List(Of Object))
|
||||
' oPropertyValue = oList.Item(0)
|
||||
|
||||
' This should hopefully show config errors
|
||||
If TypeOf oPropertyValue Is List(Of Object) Then
|
||||
_logger.Warn("Property with Description {0} may be configured incorrectly", oPropertyDescription)
|
||||
oPropertyValue = Nothing
|
||||
End If
|
||||
End Select
|
||||
End If
|
||||
Catch ex As Exception
|
||||
_logger.Warn("Unknown error occurred while processing property {0}:", oPropertyDescription)
|
||||
_logger.Error(ex)
|
||||
oPropertyValue = Nothing
|
||||
End Try
|
||||
' ' This should hopefully show config errors
|
||||
' If TypeOf oPropertyValue Is List(Of Object) Then
|
||||
' _logger.Warn("Property with Description {0} may be configured incorrectly", oPropertyDescription)
|
||||
' oPropertyValue = Nothing
|
||||
' End If
|
||||
' End Select
|
||||
' End If
|
||||
' Catch ex As Exception
|
||||
' _logger.Warn("Unknown error occurred while processing property {0}:", oPropertyDescription)
|
||||
' _logger.Error(ex)
|
||||
' oPropertyValue = Nothing
|
||||
' End Try
|
||||
|
||||
If IsNothing(oPropertyValue) OrElse String.IsNullOrEmpty(oPropertyValue) Then
|
||||
If Item.Value.IsRequired Then
|
||||
_logger.Warn("Property {0} is empty but marked as required! Skipping.", oPropertyDescription)
|
||||
oMissingProperties.Add(oPropertyDescription)
|
||||
Continue For
|
||||
Else
|
||||
_logger.Debug("Property [{0}] is empty or not found. Skipping.", oPropertyDescription)
|
||||
Continue For
|
||||
End If
|
||||
' If IsNothing(oPropertyValue) OrElse String.IsNullOrEmpty(oPropertyValue) Then
|
||||
' If Item.Value.IsRequired Then
|
||||
' _logger.Warn("Property {0} is empty but marked as required! Skipping.", oPropertyDescription)
|
||||
' oMissingProperties.Add(oPropertyDescription)
|
||||
' Continue For
|
||||
' Else
|
||||
' _logger.Debug("Property [{0}] is empty or not found. Skipping.", oPropertyDescription)
|
||||
' Continue For
|
||||
' End If
|
||||
' End If
|
||||
|
||||
' Dim oTableName = Item.Value.TableName
|
||||
' Dim oCommand = $"INSERT INTO {oTableName} (REFERENCE_GUID, ITEM_DESCRIPTION, ITEM_VALUE) VALUES ('{oMessageId}', '{oPropertyDescription}', '{oPropertyValue}')"
|
||||
' _logger.Debug("Mapping Property [{0}] to value [{1}] . Will be inserted into table {2}", oPropertyDescription, oPropertyValue, oTableName)
|
||||
|
||||
' ' Insert into SQL Server
|
||||
' If oArgs.InsertIntoSQLServer = True Then
|
||||
' Dim oResult = _mssql.NewExecutenonQuery(oCommand)
|
||||
' If oResult = False Then
|
||||
' _logger.Warn("SQL Command was not successful. Check the log.")
|
||||
' End If
|
||||
' End If
|
||||
|
||||
' ' Insert into Firebird
|
||||
' _firebird.ExecuteNonQueryWithConnection(oCommand, oConnection, Firebird.TransactionMode.ExternalTransaction, oTransaction)
|
||||
'Next
|
||||
|
||||
'--- END Check Property Values
|
||||
#End Region
|
||||
' Check the document against the configured property map and return:
|
||||
' - a List of valid properties
|
||||
' - a List of missing properties
|
||||
Dim oCheckResult = _zugferd.PropertyValues.CheckPropertyValues(oDocument, oArgs.PropertyMap, oMessageId)
|
||||
|
||||
If oCheckResult.MissingProperties.Count > 0 Then
|
||||
Throw New MissingValueException(oFile)
|
||||
End If
|
||||
|
||||
For Each oProperty In oCheckResult.ValidProperties
|
||||
Dim oGroupCounterValue = Nothing
|
||||
|
||||
If oProperty.GroupCounter > -1 Then
|
||||
oGroupCounterValue = oProperty.GroupCounter
|
||||
End If
|
||||
|
||||
Dim oTableName = Item.Value.TableName
|
||||
Dim oCommand = $"INSERT INTO {oTableName} (REFERENCE_GUID, ITEM_DESCRIPTION, ITEM_VALUE) VALUES ('{oFileGroupId}', '{oPropertyDescription}', '{oPropertyValue}')"
|
||||
_logger.Debug("Mapping Property [{0}] to value [{1}] . Will be inserted into table {2}", oPropertyDescription, oPropertyValue, oTableName)
|
||||
Dim oCommand = $"INSERT INTO {oProperty.TableName} (REFERENCE_GUID, ITEM_DESCRIPTION, ITEM_VALUE, GROUP_COUNTER) VALUES ('{oMessageId}', '{oProperty.Description}', '{oProperty.Value}', {oGroupCounterValue})"
|
||||
_logger.Debug("Mapping Property [{0}] to value [{1}] . Will be inserted into table {2}", oProperty.Description, oProperty.Value, oProperty.TableName)
|
||||
|
||||
' Insert into SQL Server
|
||||
If oArgs.InsertIntoSQLServer = True Then
|
||||
@@ -625,10 +437,6 @@ Public Class ImportZUGFeRDFiles
|
||||
' Insert into Firebird
|
||||
_firebird.ExecuteNonQueryWithConnection(oCommand, oConnection, Firebird.TransactionMode.ExternalTransaction, oTransaction)
|
||||
Next
|
||||
|
||||
If oMissingProperties.Count > 0 Then
|
||||
Throw New MissingValueException(oFile)
|
||||
End If
|
||||
Next
|
||||
|
||||
'Check if there are no ZUGFeRD files
|
||||
@@ -639,12 +447,12 @@ Public Class ImportZUGFeRDFiles
|
||||
'If no errors occurred...
|
||||
'Log the History
|
||||
If oMD5CheckSum <> String.Empty Then
|
||||
Dim oInsertCommand = $"INSERT INTO TBEDM_ZUGFERD_HISTORY_IN (MESSAGE_ID, MD5HASH) VALUES ('{oFileGroupId}', '{oMD5CheckSum}')"
|
||||
Dim oInsertCommand = $"INSERT INTO TBEDM_ZUGFERD_HISTORY_IN (MESSAGE_ID, MD5HASH) VALUES ('{oMessageId}', '{oMD5CheckSum}')"
|
||||
_firebird.ExecuteNonQueryWithConnection(oInsertCommand, oConnection, Firebird.TransactionMode.ExternalTransaction, oTransaction)
|
||||
'commit the transaction
|
||||
oTransaction.Commit()
|
||||
Try
|
||||
Dim oSQL = $"SELECT MAX(GUID) FROM TBEDM_ZUGFERD_HISTORY_IN WHERE MESSAGE_ID = '{oFileGroupId}'"
|
||||
Dim oSQL = $"SELECT MAX(GUID) FROM TBEDM_ZUGFERD_HISTORY_IN WHERE MESSAGE_ID = '{oMessageId}'"
|
||||
HISTORY_ID = _firebird.GetScalarValue(oSQL)
|
||||
Catch ex As Exception
|
||||
HISTORY_ID = 0
|
||||
@@ -657,40 +465,40 @@ Public Class ImportZUGFeRDFiles
|
||||
Dim oSQL = $"UPDATE TBEDM_ZUGFERD_HISTORY_IN SET COMMENT = 'REJECTED - Already processed (MD5Hash)' WHERE GUID = '{HISTORY_ID}'"
|
||||
_firebird.ExecuteNonQuery(oSQL)
|
||||
|
||||
Dim oBody = EMAIL_MD5_ERROR
|
||||
Dim oEmailData = MoveAndRenameEmailToRejected(oArgs, oFileGroupId)
|
||||
AddToEmailQueueMSSQL(oFileGroupId, oBody, oEmailData, "MD5HashException")
|
||||
AddRejectedState(oFileGroupId, "MD5HashException", "Die gesendete Rechnung wurde bereits verarbeitet!", "")
|
||||
Dim oBody = EmailStrings.EMAIL_MD5_ERROR
|
||||
Dim oEmailData = MoveAndRenameEmailToRejected(oArgs, oMessageId)
|
||||
_email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "MD5HashException")
|
||||
AddRejectedState(oMessageId, "MD5HashException", "Die gesendete Rechnung wurde bereits verarbeitet!", "")
|
||||
Catch ex As InvalidFerdException
|
||||
_logger.Error(ex)
|
||||
|
||||
oMoveDirectory = oArgs.ErrorDirectory
|
||||
Dim oSQL = $"UPDATE TBEDM_ZUGFERD_HISTORY_IN SET COMMENT = 'REJECTED - ZUGFeRD yes but incorrect format' WHERE GUID = '{HISTORY_ID}'"
|
||||
_firebird.ExecuteNonQuery(oSQL)
|
||||
Dim oBody = EMAIL_INVALID_DOCUMENT
|
||||
Dim oEmailData = MoveAndRenameEmailToRejected(oArgs, oFileGroupId)
|
||||
AddToEmailQueueMSSQL(oFileGroupId, oBody, oEmailData, "InvalidFerdException")
|
||||
AddRejectedState(oFileGroupId, "InvalidFerdException", "Inkorrekte Formate", "")
|
||||
Dim oBody = EmailStrings.EMAIL_INVALID_DOCUMENT
|
||||
Dim oEmailData = MoveAndRenameEmailToRejected(oArgs, oMessageId)
|
||||
_email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "InvalidFerdException")
|
||||
AddRejectedState(oMessageId, "InvalidFerdException", "Inkorrekte Formate", "")
|
||||
Catch ex As TooMuchFerdsException
|
||||
_logger.Error(ex)
|
||||
|
||||
oMoveDirectory = oArgs.ErrorDirectory
|
||||
Dim oSQL = $"UPDATE TBEDM_ZUGFERD_HISTORY_IN SET COMMENT = 'REJECTED - More than one ZUGFeRD-document in email' WHERE GUID = '{HISTORY_ID}'"
|
||||
_firebird.ExecuteNonQuery(oSQL)
|
||||
Dim oBody = EMAIL_TOO_MUCH_FERDS
|
||||
Dim oEmailData = MoveAndRenameEmailToRejected(oArgs, oFileGroupId)
|
||||
AddToEmailQueueMSSQL(oFileGroupId, oBody, oEmailData, "TooMuchFerdsException")
|
||||
AddRejectedState(oFileGroupId, "TooMuchFerdsException", "Email enthielt mehr als ein ZUGFeRD-Dokument", "")
|
||||
Dim oBody = EmailStrings.EMAIL_TOO_MUCH_FERDS
|
||||
Dim oEmailData = MoveAndRenameEmailToRejected(oArgs, oMessageId)
|
||||
_email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "TooMuchFerdsException")
|
||||
AddRejectedState(oMessageId, "TooMuchFerdsException", "Email enthielt mehr als ein ZUGFeRD-Dokument", "")
|
||||
Catch ex As NoFerdsException
|
||||
_logger.Error(ex)
|
||||
|
||||
oMoveDirectory = oArgs.ErrorDirectory
|
||||
Dim oSQL = $"UPDATE TBEDM_ZUGFERD_HISTORY_IN SET COMMENT = 'REJECTED - no ZUGFeRD-Document in email' WHERE GUID = '{HISTORY_ID}'"
|
||||
_firebird.ExecuteNonQuery(oSQL)
|
||||
Dim oBody = EMAIL_NO_FERDS
|
||||
Dim oEmailData = MoveAndRenameEmailToRejected(oArgs, oFileGroupId)
|
||||
AddToEmailQueueMSSQL(oFileGroupId, oBody, oEmailData, "NoFerdsException")
|
||||
AddRejectedState(oFileGroupId, "NoFerdsException", " Email enthielt keine ZUGFeRD-Dokumente", "")
|
||||
Dim oBody = EmailStrings.EMAIL_NO_FERDS
|
||||
Dim oEmailData = MoveAndRenameEmailToRejected(oArgs, oMessageId)
|
||||
_email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "NoFerdsException")
|
||||
AddRejectedState(oMessageId, "NoFerdsException", " Email enthielt keine ZUGFeRD-Dokumente", "")
|
||||
Catch ex As MissingValueException
|
||||
_logger.Error(ex)
|
||||
|
||||
@@ -703,9 +511,9 @@ Public Class ImportZUGFeRDFiles
|
||||
_firebird.ExecuteNonQuery(oSQL)
|
||||
|
||||
Dim oBody = CreateBodyForMissingProperties(ex.File.Name, oMissingProperties)
|
||||
Dim oEmailData = MoveAndRenameEmailToRejected(oArgs, oFileGroupId)
|
||||
AddToEmailQueueMSSQL(oFileGroupId, oBody, oEmailData, "MissingValueException")
|
||||
AddRejectedState(oFileGroupId, "MissingValueException", "Es fehlten ZugferdSpezifikationen", oMessage)
|
||||
Dim oEmailData = MoveAndRenameEmailToRejected(oArgs, oMessageId)
|
||||
_email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "MissingValueException")
|
||||
AddRejectedState(oMessageId, "MissingValueException", "Es fehlten ZugferdSpezifikationen", oMessage)
|
||||
|
||||
Catch ex As Exception
|
||||
_logger.Warn("Unknown Error occurred: {0}", ex.Message)
|
||||
@@ -713,14 +521,14 @@ Public Class ImportZUGFeRDFiles
|
||||
Dim oSQL = $"UPDATE TBEDM_ZUGFERD_HISTORY_IN SET COMMENT = 'REJECTED - Unknown error occured' WHERE GUID = '{HISTORY_ID}'"
|
||||
_firebird.ExecuteNonQuery(oSQL)
|
||||
oMoveDirectory = oArgs.ErrorDirectory
|
||||
AddRejectedState(oFileGroupId, "UnexpectedException", "", ex.Message)
|
||||
AddRejectedState(oMessageId, "UnexpectedException", "", ex.Message)
|
||||
Finally
|
||||
oConnection.Close()
|
||||
|
||||
' Move all files of the current group
|
||||
Try
|
||||
MoveFiles(oArgs, oFileGroupFiles, oFileAttachmentFiles, oMoveDirectory)
|
||||
_logger.Info("Finished processing file group {0}", oFileGroupId)
|
||||
MoveFiles(oArgs, oMessageId, oFileGroupFiles, oEmailAttachmentFiles, oEmbeddedAttachmentFiles, oMoveDirectory)
|
||||
_logger.Info("Finished processing file group {0}", oMessageId)
|
||||
Catch ex As Exception
|
||||
_logger.Warn("Could not move files!")
|
||||
_logger.Error(ex)
|
||||
@@ -740,19 +548,33 @@ Public Class ImportZUGFeRDFiles
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub MoveFiles(Args As WorkerArgs, Files As List(Of FileInfo), AttachmentFiles As List(Of FileInfo), MoveDirectory As String)
|
||||
For Each oFile In Files
|
||||
Private Sub MoveFiles(Args As WorkerArgs, MessageId As String, Files As List(Of FileInfo), AttachmentFiles As List(Of FileInfo), EmbeddedAttachments As List(Of PDFAttachments.AttachmentResult), MoveDirectory As String)
|
||||
Dim oFinalMoveDirectory As String = MoveDirectory
|
||||
Dim oAttachmentDirectory As String = Path.Combine(MoveDirectory, Args.AttachmentsSubDirectory)
|
||||
|
||||
' Create directories if they don't exist
|
||||
If Not Directory.Exists(oFinalMoveDirectory) Then
|
||||
Try
|
||||
Dim oFinalMoveDirectory As String = MoveDirectory
|
||||
Directory.CreateDirectory(oFinalMoveDirectory)
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
End Try
|
||||
End If
|
||||
|
||||
If AttachmentFiles.Contains(oFile) Then
|
||||
oFinalMoveDirectory = Path.Combine(MoveDirectory, Args.AttachmentsSubDirectory)
|
||||
If Not Directory.Exists(oAttachmentDirectory) And AttachmentFiles.Count > 0 Then
|
||||
Try
|
||||
Directory.CreateDirectory(oAttachmentDirectory)
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
End Try
|
||||
End If
|
||||
|
||||
If Not Directory.Exists(oFinalMoveDirectory) Then
|
||||
Directory.CreateDirectory(oFinalMoveDirectory)
|
||||
End If
|
||||
End If
|
||||
' Filter out Attachments from `Files`
|
||||
Dim oInvoiceFiles As List(Of FileInfo) = Files.Except(AttachmentFiles).ToList()
|
||||
|
||||
' Move PDF/A Files
|
||||
For Each oFile In oInvoiceFiles
|
||||
Try
|
||||
Dim oFileName = _filesystem.GetVersionedFilename(Path.Combine(oFinalMoveDirectory, oFile.Name))
|
||||
|
||||
_filesystem.MoveTo(oFile.FullName, oFileName, oFinalMoveDirectory)
|
||||
@@ -764,15 +586,45 @@ Public Class ImportZUGFeRDFiles
|
||||
_logger.Error(ex)
|
||||
End Try
|
||||
Next
|
||||
|
||||
' Move non-PDF/A Email Attachments/Files
|
||||
For Each oFile In AttachmentFiles
|
||||
Try
|
||||
Dim oFileName = _filesystem.GetVersionedFilename(Path.Combine(oAttachmentDirectory, oFile.Name))
|
||||
|
||||
_filesystem.MoveTo(oFile.FullName, oFileName, oAttachmentDirectory)
|
||||
|
||||
_logger.Info("Finished processing file {0}", oFile.Name)
|
||||
_logger.Info("Attachment moved to {0}", oFileName)
|
||||
Catch ex As Exception
|
||||
_logger.Warn("Could not move attachment {0}", oFile.FullName)
|
||||
_logger.Error(ex)
|
||||
End Try
|
||||
Next
|
||||
|
||||
' Write Embedded Files to disk
|
||||
For Each oResult In EmbeddedAttachments
|
||||
Try
|
||||
Dim oFileName As String = $"{MessageId}~{oResult.FileName}"
|
||||
Dim oFilePath As String = Path.Combine(oAttachmentDirectory, oFileName)
|
||||
|
||||
Using oWriter As New FileStream(oFilePath, FileMode.Create)
|
||||
oWriter.Write(oResult.FileContents, 0, oResult.FileContents.Length)
|
||||
End Using
|
||||
Catch ex As Exception
|
||||
_logger.Warn("Could not save embedded attachment {0}", oResult.FileName)
|
||||
_logger.Error(ex)
|
||||
End Try
|
||||
Next
|
||||
End Sub
|
||||
|
||||
|
||||
Private Function CreateBodyForMissingProperties(OriginalFilename As String, MissingProperties As List(Of String))
|
||||
Dim oBody = String.Format(EMAIL_MISSINGPROPERTIES_1, OriginalFilename)
|
||||
Dim oBody = String.Format(EmailStrings.EMAIL_MISSINGPROPERTIES_1, OriginalFilename)
|
||||
|
||||
If MissingProperties.Count > 0 Then
|
||||
oBody &= $"{vbNewLine}{vbNewLine}"
|
||||
oBody &= EMAIL_MISSINGPROPERTIES_2
|
||||
oBody &= EmailStrings.EMAIL_MISSINGPROPERTIES_2
|
||||
oBody &= $"{vbNewLine}{vbNewLine}"
|
||||
|
||||
For Each prop In MissingProperties
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
Imports System.Collections.Generic
|
||||
Imports System.IO
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports GdPicture14
|
||||
|
||||
Public Class PDFAttachments
|
||||
Private Logger As Logger
|
||||
|
||||
Private Const ZUGFERD_XML_FILENAME = "ZUGFeRD-invoice.xml"
|
||||
|
||||
Public Sub New(LogConfig As LogConfig, GdPictureKey As String)
|
||||
Logger = LogConfig.GetLogger
|
||||
End Sub
|
||||
|
||||
Public Function Extract(FileName As String, AllowedExtensions As List(Of String)) As List(Of FileInfo)
|
||||
Dim oResults As New List(Of FileInfo)
|
||||
Dim oExtensions = AllowedExtensions.ConvertAll(Of String)(New Converter(Of String, String)(Function(ext) ext.ToUpper))
|
||||
|
||||
Try
|
||||
Using oGDPicturePDF As New GdPicturePDF()
|
||||
If oGDPicturePDF.LoadFromFile(FileName, False) = GdPictureStatus.OK Then
|
||||
Dim oEmbeddedFileCount As Integer = oGDPicturePDF.GetEmbeddedFileCount()
|
||||
If oGDPicturePDF.GetStat() = GdPictureStatus.OK Then
|
||||
If oEmbeddedFileCount > 1 Then
|
||||
For index = 0 To oEmbeddedFileCount - 1
|
||||
Dim oFileName As String = oGDPicturePDF.GetEmbeddedFileName(index)
|
||||
|
||||
If oGDPicturePDF.GetStat() = GdPictureStatus.OK Then
|
||||
Dim oExtension = New FileInfo(oFileName).Extension.ToUpper.Substring(1)
|
||||
If oFileName.ToUpper <> ZUGFERD_XML_FILENAME.ToUpper Then
|
||||
If oExtensions.Contains(oExtension) Then
|
||||
Dim FileSize As Integer = oGDPicturePDF.GetEmbeddedFileSize(index)
|
||||
|
||||
If oGDPicturePDF.GetStat() = GdPictureStatus.OK Then
|
||||
Dim FileData As Byte() = New Byte(FileSize) {}
|
||||
Dim status As GdPictureStatus = oGDPicturePDF.ExtractEmbeddedFile(index, FileData)
|
||||
|
||||
If status = GdPictureStatus.OK Then
|
||||
Dim oTempName As String = Path.Combine(Path.GetTempPath(), oFileName)
|
||||
Using oFileStream As New FileStream(oTempName, FileMode.OpenOrCreate)
|
||||
oFileStream.Write(FileData, 0, FileData.Length)
|
||||
End Using
|
||||
|
||||
oResults.Add(New FileInfo(oTempName))
|
||||
Else
|
||||
Logger.Error("The embedded file [{0}] has failed to extract. Status: {1}", oFileName, oGDPicturePDF.GetStat().ToString())
|
||||
Continue For
|
||||
End If
|
||||
Else
|
||||
Logger.Error("An error occurred getting the file size for [{0}]. Status: {1}", oFileName, oGDPicturePDF.GetStat().ToString())
|
||||
Continue For
|
||||
End If
|
||||
Else
|
||||
Logger.Warn("File [{0}] was skipped because its extension [{1}] is not allowed.", oFileName, oExtension)
|
||||
Continue For
|
||||
End If
|
||||
Else
|
||||
Logger.Debug("File [{0}] was skipped because its name indicates the invoice data file.", oFileName)
|
||||
Continue For
|
||||
End If
|
||||
Else
|
||||
Logger.Error("An error occurred getting the file name for [{0}]. Status: {1}", oFileName, oGDPicturePDF.GetStat().ToString())
|
||||
Continue For
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
Else
|
||||
Logger.Error("An error occurred getting the number of embedded files. Status: {0}", oGDPicturePDF.GetStat().ToString())
|
||||
Return Nothing
|
||||
End If
|
||||
Else
|
||||
Logger.Error("The file [{0}] can't be loaded.", FileName)
|
||||
Return Nothing
|
||||
End If
|
||||
End Using
|
||||
|
||||
Return oResults
|
||||
Catch ex As Exception
|
||||
Logger.Warn("Unexpected Error while Extracting attachments from File [{0}]", FileName)
|
||||
Logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
End Class
|
||||
@@ -1,138 +0,0 @@
|
||||
Imports System.Collections.Generic
|
||||
Imports System.Linq
|
||||
Imports System.Reflection
|
||||
Imports System.Text.RegularExpressions
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class PropertyValues
|
||||
Private _indexPattern = "\((\d+)\)"
|
||||
Private _indexRegex As New Regex(_indexPattern)
|
||||
Private _Logger As Logger
|
||||
|
||||
Public Sub New(LogConfig As LogConfig)
|
||||
_Logger = LogConfig.GetLogger()
|
||||
End Sub
|
||||
|
||||
Public Function GetPropValue(Obj As Object, PropertyName As String) As List(Of Object)
|
||||
Dim oNameParts As String() = PropertyName.Split("."c)
|
||||
|
||||
If IsNothing(Obj) Then
|
||||
_Logger.Debug("`Obj` is Nothing. Exiting.")
|
||||
Return New List(Of Object)
|
||||
End If
|
||||
|
||||
|
||||
If oNameParts.Length = 1 Then
|
||||
Dim oPropInfo As PropertyInfo = Obj.GetType().GetProperty(PropertyName)
|
||||
|
||||
If IsNothing(oPropInfo) Then
|
||||
_Logger.Debug("Property {0} does not exist.", PropertyName)
|
||||
Return New List(Of Object)
|
||||
Else
|
||||
Dim oPropValue = oPropInfo.GetValue(Obj, Nothing)
|
||||
Return New List(Of Object) From {oPropValue}
|
||||
End If
|
||||
End If
|
||||
|
||||
For Each oPart As String In oNameParts
|
||||
Dim oType As Type = Obj.GetType()
|
||||
Dim oPartName = oPart
|
||||
Dim oIndex As Integer = Nothing
|
||||
Dim oHasIndex As Boolean = HasIndex(oPartName)
|
||||
|
||||
If oHasIndex Then
|
||||
oPartName = StripIndex(oPart)
|
||||
oIndex = GetIndex(oPart)
|
||||
End If
|
||||
|
||||
Dim oInfo As PropertyInfo = oType.GetProperty(oPartName)
|
||||
|
||||
If IsNothing(oInfo) OrElse IsNothing(oInfo.GetValue(Obj, Nothing)) Then
|
||||
_Logger.Debug("Property {0} does not exist.", oPartName)
|
||||
Return New List(Of Object)
|
||||
End If
|
||||
|
||||
Obj = oInfo.GetValue(Obj, Nothing)
|
||||
|
||||
If oHasIndex Then
|
||||
Obj = Obj(0)
|
||||
End If
|
||||
|
||||
If IsArray(Obj) And Not oHasIndex Then
|
||||
Dim oCurrentPart As String = oPart
|
||||
Dim oSplitString As String() = New String() {oCurrentPart & "."}
|
||||
Dim oPathFragments = PropertyName.Split(oSplitString, StringSplitOptions.None)
|
||||
Dim oResults As New List(Of Object)
|
||||
|
||||
' if path has no more subitems, return an empty list
|
||||
If oPathFragments.Length = 1 Then
|
||||
Return oResults
|
||||
End If
|
||||
|
||||
For Each oArrayItem In Obj
|
||||
Dim oResult As List(Of Object) = GetPropValue(oArrayItem, oPathFragments(1))
|
||||
|
||||
If Not IsNothing(oResult) Then
|
||||
oResults.Add(oResult)
|
||||
End If
|
||||
Next
|
||||
|
||||
Return oResults
|
||||
End If
|
||||
Next
|
||||
|
||||
Return New List(Of Object) From {Obj}
|
||||
End Function
|
||||
|
||||
Public Function GetFinalPropValue(List As List(Of Object)) As List(Of Object)
|
||||
Dim oResult As New List(Of Object)
|
||||
|
||||
For Each Item In List
|
||||
Dim oItemValue = DoGetFinalPropValue(Item)
|
||||
|
||||
If Not IsNothing(oItemValue) Then
|
||||
oResult.Add(oItemValue)
|
||||
End If
|
||||
Next
|
||||
|
||||
Return oResult
|
||||
End Function
|
||||
|
||||
Private Function DoGetFinalPropValue(Value As Object) As String
|
||||
If TypeOf Value Is List(Of Object) Then
|
||||
Dim oList = DirectCast(Value, List(Of Object))
|
||||
Dim oCount = oList.Count
|
||||
|
||||
Select Case oCount
|
||||
Case 0
|
||||
Return Nothing
|
||||
Case Else
|
||||
Return DoGetFinalPropValue(oList.First())
|
||||
End Select
|
||||
|
||||
Return DoGetFinalPropValue(Value)
|
||||
Else
|
||||
Return Value.ToString
|
||||
End If
|
||||
End Function
|
||||
|
||||
Private Function GetIndex(Prop As String) As Integer
|
||||
If Regex.IsMatch(Prop, _indexPattern) Then
|
||||
Dim oMatch = _indexRegex.Match(Prop)
|
||||
Dim oGroup = oMatch.Groups.Item(1)
|
||||
Dim oValue = oGroup.Value
|
||||
|
||||
Return Integer.Parse(oValue)
|
||||
End If
|
||||
|
||||
Return Nothing
|
||||
End Function
|
||||
|
||||
Private Function StripIndex(Prop As String) As String
|
||||
Return Regex.Replace(Prop, _indexPattern, "")
|
||||
End Function
|
||||
|
||||
Private Function HasIndex(Prop As String) As Boolean
|
||||
Return Regex.IsMatch(Prop, _indexPattern)
|
||||
End Function
|
||||
End Class
|
||||
@@ -1,4 +1,5 @@
|
||||
Imports System.Collections.Generic
|
||||
Imports DigitalData.Modules.Interfaces
|
||||
|
||||
Public Class WorkerArgs
|
||||
Public WatchDirectories As List(Of String)
|
||||
@@ -9,7 +10,6 @@ Public Class WorkerArgs
|
||||
Public AttachmentsSubDirectory As String
|
||||
Public PropertyMap As Dictionary(Of String, XmlItemProperty)
|
||||
Public InsertIntoSQLServer As Boolean
|
||||
Public GDPictureKey As String
|
||||
|
||||
Public Sub New()
|
||||
WatchDirectories = New List(Of String)
|
||||
@@ -20,6 +20,5 @@ Public Class WorkerArgs
|
||||
AttachmentsSubDirectory = Nothing
|
||||
PropertyMap = New Dictionary(Of String, XmlItemProperty)
|
||||
InsertIntoSQLServer = False
|
||||
GDPictureKey = String.Empty
|
||||
End Sub
|
||||
End Class
|
||||
@@ -87,11 +87,10 @@
|
||||
<Compile Include="EDMI\GraphQL\GraphQLArgs.vb" />
|
||||
<Compile Include="EDMI\GraphQL\GraphQLJob.vb" />
|
||||
<Compile Include="EDMI\ZUGFeRD\EmailData.vb" />
|
||||
<Compile Include="EDMI\ZUGFeRD\EmailFunctions.vb" />
|
||||
<Compile Include="EDMI\ZUGFeRD\EmailStrings.vb" />
|
||||
<Compile Include="EDMI\ZUGFeRD\ImportZUGFeRDFiles.vb" />
|
||||
<Compile Include="EDMI\ZUGFeRD\PDFAttachments.vb" />
|
||||
<Compile Include="EDMI\ZUGFeRD\PropertyValues.vb" />
|
||||
<Compile Include="EDMI\ZUGFeRD\WorkerArgs.vb" />
|
||||
<Compile Include="EDMI\ZUGFeRD\XmlItemProperty.vb" />
|
||||
<Compile Include="Exceptions.vb" />
|
||||
<Compile Include="JobInterface.vb" />
|
||||
<Compile Include="JobBase.vb" />
|
||||
@@ -109,12 +108,9 @@
|
||||
<Reference Include="FirebirdSql.Data.FirebirdClient, Version=6.4.0.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\FirebirdSql.Data.FirebirdClient.6.4.0\lib\net452\FirebirdSql.Data.FirebirdClient.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GdPicture.NET.14">
|
||||
<HintPath>D:\ProgramFiles\GdPicture.NET 14\Redist\GdPicture.NET (.NET Framework 4.5)\GdPicture.NET.14.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.6.8\lib\net45\NLog.dll</HintPath>
|
||||
<HintPath>..\packages\NLog.4.7.0\lib\net45\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
|
||||
@@ -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("1.0.0.0")>
|
||||
<Assembly: AssemblyVersion("1.1.0.2")>
|
||||
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="FirebirdSql.Data.FirebirdClient" version="6.4.0" targetFramework="net461" />
|
||||
<package id="NLog" version="4.6.8" targetFramework="net461" />
|
||||
<package id="NLog" version="4.7.0" targetFramework="net461" />
|
||||
</packages>
|
||||
@@ -45,7 +45,7 @@
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.6.8\lib\net45\NLog.dll</HintPath>
|
||||
<HintPath>..\packages\NLog.4.7.0\lib\net45\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NLog" version="4.6.8" targetFramework="net461" />
|
||||
<package id="NLog" version="4.7.0" targetFramework="net461" />
|
||||
</packages>
|
||||
@@ -45,7 +45,7 @@
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.6.8\lib\net45\NLog.dll</HintPath>
|
||||
<HintPath>..\packages\NLog.4.7.0\lib\net45\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NLog" version="4.6.8" targetFramework="net461" />
|
||||
<package id="NLog" version="4.7.0" targetFramework="net461" />
|
||||
</packages>
|
||||
@@ -1,4 +1,5 @@
|
||||
Imports System.IO
|
||||
Imports System.Reflection
|
||||
Imports NLog
|
||||
Imports NLog.Config
|
||||
Imports NLog.Targets
|
||||
@@ -14,33 +15,6 @@ Imports NLog.Targets
|
||||
''' <dependencies>
|
||||
''' NLog, >= 4.5.8
|
||||
''' </dependencies>
|
||||
''' <params>
|
||||
''' logPath, PathType
|
||||
''' The basepath to write logs to. Can be AppData, CurrentDirectory or CustomPath.
|
||||
'''
|
||||
''' - AppData: writes to local application data directory
|
||||
''' - CurrentDirectory: writes to `Log` directory relative to the current directory
|
||||
''' - CustomPath: writes to custom path specified in `customLogPath`
|
||||
'''
|
||||
''' customLogPath, String (optional)
|
||||
''' If `logPath` is set to custom, this defines the custom logPath.
|
||||
'''
|
||||
''' suffix, String (optional)
|
||||
''' If set to anything other than Nothing, extends the logfile name with this suffix.
|
||||
''' </params>
|
||||
''' <props>
|
||||
''' LogFile, String (readonly)
|
||||
''' Returns the full path of the default log file.
|
||||
'''
|
||||
''' LogPath, String (readonly)
|
||||
''' Returns the path to the log directory.
|
||||
'''
|
||||
''' LogFactory, NLog.LogFactory (readonly)
|
||||
''' Returns the LogFactory that is used to create the Logger object
|
||||
'''
|
||||
''' Debug, Boolean
|
||||
''' Determines if the debug log should be written.
|
||||
''' </props>
|
||||
''' <example>
|
||||
''' Imports DigitalData.Modules.Logging
|
||||
'''
|
||||
@@ -81,6 +55,7 @@ Imports NLog.Targets
|
||||
''' - NLOG_INTERNAL_LOG_FILE: ex. C:\Temp\Nlog_Internal.log
|
||||
''' </remarks>
|
||||
Public Class LogConfig
|
||||
#Region "Private Properties"
|
||||
Private Const KEEP_FILES_OPEN As Boolean = False
|
||||
' MAX_ARCHIVES_FILES works like this (in version 4.5.8):
|
||||
' 0 = keep ALL archives files
|
||||
@@ -113,15 +88,16 @@ Public Class LogConfig
|
||||
Private Const LOG_FORMAT_DEBUG As String = LOG_FORMAT_BASE_LONG_DATE & " >> ${message}"
|
||||
Private Const LOG_FORMAT_MEMORY As String = LOG_FORMAT_BASE_LONG_DATE & " >> ${message}${newline}${exception:format=Message}${newline}${exception:format=StackTrace}"
|
||||
|
||||
Private Const FOLDER_NAME_LOG = "Log"
|
||||
Private Const FILE_NAME_ACCESS_TEST = "accessTest.txt"
|
||||
Private Const FOLDER_NAME_LOG = "Log"
|
||||
|
||||
Private ReadOnly failSafePath As String = Path.GetTempPath()
|
||||
Private ReadOnly basePath As String = failSafePath
|
||||
|
||||
Private config As LoggingConfiguration
|
||||
Private isDebug As Boolean = False
|
||||
|
||||
#End Region
|
||||
#Region "Public Properties"
|
||||
Public Enum PathType As Integer
|
||||
AppData = 0
|
||||
CurrentDirectory = 1
|
||||
@@ -173,24 +149,41 @@ Public Class LogConfig
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property NLogConfig As LoggingConfiguration
|
||||
Get
|
||||
Return config
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#End Region
|
||||
|
||||
''' <summary>
|
||||
''' Initializes a new LogConfig object with a logpath and optinally a filename-suffix.
|
||||
''' </summary>
|
||||
''' <param name="logPath">The basepath to write logs to. Can be AppData, CurrentDirectory or CustomPath.</param>
|
||||
''' <param name="customLogPath">If `logPath` is set to custom, this defines the custom logPath.</param>
|
||||
''' <param name="suffix">If set to anything other than Nothing, extends the logfile name with this suffix.</param>
|
||||
Public Sub New(logPath As PathType, Optional customLogPath As String = Nothing, Optional suffix As String = Nothing)
|
||||
Dim productName As String = My.Application.Info.ProductName
|
||||
Dim companyName As String = My.Application.Info.CompanyName
|
||||
''' <param name="LogPath">The basepath to write logs to. Can be AppData, CurrentDirectory or CustomPath.</param>
|
||||
''' <param name="CustomLogPath">If `logPath` is set to custom, this defines the custom logPath.</param>
|
||||
''' <param name="Suffix">If set to anything other than Nothing, extends the logfile name with this suffix.</param>
|
||||
''' <param name="CompanyName">CompanyName is used to construct log-path in when LogPath is set to PathType:AppData</param>
|
||||
''' <param name="ProductName">ProductName is used to construct log-path in when LogPath is set to PathType:AppData</param>
|
||||
Public Sub New(LogPath As PathType,
|
||||
Optional CustomLogPath As String = Nothing,
|
||||
Optional Suffix As String = Nothing,
|
||||
Optional CompanyName As String = Nothing,
|
||||
Optional ProductName As String = Nothing)
|
||||
|
||||
If logPath = PathType.AppData Then
|
||||
If LogPath = PathType.AppData And (ProductName Is Nothing Or CompanyName Is Nothing) Then
|
||||
Throw New ArgumentException("Modules.Logging: PathType is AppData and either CompanyName or ProductName was not supplied!")
|
||||
End If
|
||||
|
||||
If LogPath = PathType.CurrentDirectory Then
|
||||
Throw New ArgumentException("Modules.Logging: LogPath.CurrentDirectory is deprecated. Please use LogPath.CustomPath!")
|
||||
End If
|
||||
|
||||
If LogPath = PathType.AppData Then
|
||||
Dim appDataDir = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
|
||||
basePath = Path.Combine(appDataDir, companyName, productName, FOLDER_NAME_LOG)
|
||||
ElseIf logPath = PathType.CurrentDirectory Then
|
||||
Dim currentDirectory As String = My.Application.Info.DirectoryPath
|
||||
basePath = Path.Combine(currentDirectory, FOLDER_NAME_LOG)
|
||||
basePath = Path.Combine(appDataDir, CompanyName, ProductName, FOLDER_NAME_LOG)
|
||||
Else 'Custom Path
|
||||
basePath = customLogPath
|
||||
basePath = CustomLogPath
|
||||
End If
|
||||
|
||||
' If directory does not exist, try to create it!
|
||||
@@ -219,12 +212,12 @@ Public Class LogConfig
|
||||
' Set the suffix to the given string if it exists
|
||||
Dim logFileSuffix As String = String.Empty
|
||||
|
||||
If suffix IsNot Nothing AndAlso suffix.Count > 0 Then
|
||||
logFileSuffix = $"-{suffix}"
|
||||
If Suffix IsNot Nothing AndAlso Suffix.Count > 0 Then
|
||||
logFileSuffix = $"-{Suffix}"
|
||||
End If
|
||||
|
||||
' Create config object and initalize it
|
||||
config = GetConfig(productName, logFileSuffix)
|
||||
config = GetConfig(ProductName, logFileSuffix)
|
||||
|
||||
' Save config
|
||||
LogFactory = New LogFactory With {
|
||||
@@ -236,10 +229,24 @@ Public Class LogConfig
|
||||
LogFile = GetCurrentLogFilePath()
|
||||
End Sub
|
||||
|
||||
Private Sub CheckMyApplication()
|
||||
Dim oAssembly = Assembly.GetEntryAssembly()
|
||||
Dim oMyApp = Nothing
|
||||
For Each oType As Type In oAssembly.DefinedTypes
|
||||
If oType.Name = "MyApplication" Then
|
||||
oMyApp = oType
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
|
||||
oMyApp.GetType().GetProperty("")
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' Returns the Logger for the calling class
|
||||
''' </summary>
|
||||
''' <returns>An object of Logging.Logger</returns>
|
||||
<DebuggerStepThrough()>
|
||||
Public Function GetLogger() As Logger
|
||||
Dim oClassName As String = GetClassFullName()
|
||||
Return LogFactory.GetLogger(Of Logger)(oClassName)
|
||||
@@ -250,6 +257,7 @@ Public Class LogConfig
|
||||
''' </summary>
|
||||
''' <param name="ClassName">The name of the class the logger belongs to</param>
|
||||
''' <returns>An object of Logging.Logger</returns>
|
||||
<DebuggerStepThrough()>
|
||||
Public Function GetLogger(ClassName As String) As Logger
|
||||
Return LogFactory.GetLogger(Of Logger)(ClassName)
|
||||
End Function
|
||||
@@ -268,6 +276,7 @@ Public Class LogConfig
|
||||
''' </summary>
|
||||
''' <returns>The fully qualified class name</returns>
|
||||
''' <remarks>This method is very resource-intensive!</remarks>
|
||||
<DebuggerStepThrough()>
|
||||
Public Shared Function GetClassFullName() As String
|
||||
Dim oFramesToSkip As Integer = 2
|
||||
Dim oClassName As String = String.Empty
|
||||
@@ -437,7 +446,5 @@ Public Class LogConfig
|
||||
|
||||
Return memoryLog
|
||||
End Function
|
||||
|
||||
|
||||
#End Region
|
||||
End Class
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
|
||||
Public Class Logger
|
||||
Inherits NLog.Logger
|
||||
Implements ILogger
|
||||
|
||||
''' <summary>
|
||||
''' Prints a preformatted Block including a block identifier
|
||||
''' </summary>
|
||||
''' <param name="blockId">A unique Identifier for this block, eg. DocId, FullPath, ..</param>
|
||||
<DebuggerStepThrough()>
|
||||
Public Sub NewBlock(blockId As String)
|
||||
Dim message As String = $"-----> Start of Block {blockId}"
|
||||
Dim logEventInfo As New LogEventInfo(LogLevel.Info, Name, message)
|
||||
@@ -15,6 +17,7 @@ Public Class Logger
|
||||
Log(WrapperType, logEventInfo)
|
||||
End Sub
|
||||
|
||||
<DebuggerStepThrough()>
|
||||
Public Sub EndBlock()
|
||||
Dim message As String = $"<----- End of Block"
|
||||
Dim logEventInfo As New LogEventInfo(LogLevel.Info, Name, message)
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.6.8\lib\net45\NLog.dll</HintPath>
|
||||
<HintPath>..\packages\NLog.4.7.0\lib\net45\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
|
||||
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("0.0.1.1")>
|
||||
<Assembly: AssemblyVersion("2.0.0.0")>
|
||||
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NLog" version="4.6.8" targetFramework="net461" />
|
||||
<package id="NLog" version="4.7.0" targetFramework="net461" />
|
||||
</packages>
|
||||
@@ -48,7 +48,7 @@
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.6.8\lib\net45\NLog.dll</HintPath>
|
||||
<HintPath>..\packages\NLog.4.7.0\lib\net45\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="S22.Imap, Version=3.6.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\S22.Imap.3.6.0.0\lib\net40\S22.Imap.dll</HintPath>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user