This commit is contained in:
SchreiberM 2020-03-17 16:27:04 +01:00
parent c20fc2dbf5
commit dff085ced2
3 changed files with 13 additions and 12 deletions

View File

@ -3,6 +3,7 @@ Imports System.Globalization
Imports System.Text.RegularExpressions Imports System.Text.RegularExpressions
Imports DigitalData.Modules.Logging Imports DigitalData.Modules.Logging
Imports GdPicture14 Imports GdPicture14
Imports Independentsoft
Public Class DocumentViewer Public Class DocumentViewer
Private Enum ZoomMode Private Enum ZoomMode
@ -66,7 +67,7 @@ Public Class DocumentViewer
''' Terminate Viewer, freeing up resources and deleting temp files ''' Terminate Viewer, freeing up resources and deleting temp files
''' </summary> ''' </summary>
Public Sub Done() Public Sub Done()
_logger.Warn("Called Done, removing temp files") _logger.Debug("(DocView)Called Done, removing temp files")
DeleteTempFiles() DeleteTempFiles()
'Dispose() 'Dispose()
End Sub End Sub
@ -77,14 +78,14 @@ Public Class DocumentViewer
''' <param name="filepath"></param> ''' <param name="filepath"></param>
Public Sub LoadFile(filepath As String) Public Sub LoadFile(filepath As String)
If _licenseKey = String.Empty Then If _licenseKey = String.Empty Then
_logger.Warn("License key was not provided. File {0} not loaded.", filepath) _logger.Warn("(DocView)License key was not provided. File {0} not loaded.", filepath)
Exit Sub Exit Sub
End If End If
GdViewer.ZoomMode = ViewerZoomMode.ZoomModeWidthViewer GdViewer.ZoomMode = ViewerZoomMode.ZoomModeWidthViewer
GdViewer.DocumentAlignment = ViewerDocumentAlignment.DocumentAlignmentTopCenter GdViewer.DocumentAlignment = ViewerDocumentAlignment.DocumentAlignmentTopCenter
_logger.Info("Loading File {0}", filepath) _logger.Info("(DocView)Loading File {0}", filepath)
DoLoadFile(filepath) DoLoadFile(filepath)
@ -103,9 +104,9 @@ Public Class DocumentViewer
Public Sub DeleteTempFiles() Public Sub DeleteTempFiles()
For Each oFile In _TempFiles For Each oFile In _TempFiles
Try Try
IO.File.Delete(oFile) System.IO.File.Delete(oFile)
Catch ex As Exception Catch ex As Exception
_logger.Warn("Could not delete temp file {0}", oFile) _logger.Warn("(DocView)Could not delete temp file {0}", oFile)
End Try End Try
Next Next
_TempFiles.Clear() _TempFiles.Clear()
@ -113,16 +114,16 @@ Public Class DocumentViewer
Private Sub DoLoadFile(FilePath As String) Private Sub DoLoadFile(FilePath As String)
Try Try
Dim oFileInfo = New IO.FileInfo(FilePath) Dim oFileInfo = New System.IO.FileInfo(FilePath)
Dim oExtension As String = oFileInfo.Extension.ToUpper Dim oExtension As String = oFileInfo.Extension.ToUpper
Select Case oExtension.ToUpper Select Case oExtension.ToUpper
Case ".MSG" Case ".MSG"
Dim oMsg As New Independentsoft.Msg.Message(FilePath) Dim oMsg As New Msg.Message(FilePath)
' TODO: Improve Encoding, maybe convert based on encoding ' TODO: Improve Encoding, maybe convert based on encoding
oMsg.Encoding = System.Text.Encoding.UTF32 oMsg.Encoding = System.Text.Encoding.UTF32
Dim oMime = oMsg.ConvertToMimeMessage() Dim oMime = oMsg.ConvertToMimeMessage()
Dim oTempFileName = IO.Path.GetTempFileName() Dim oTempFileName = System.IO.Path.GetTempFileName()
oMime.Save(oTempFileName, True) oMime.Save(oTempFileName, True)
RichEditControl1.LoadDocument(oTempFileName, DevExpress.XtraRichEdit.DocumentFormat.Mht) RichEditControl1.LoadDocument(oTempFileName, DevExpress.XtraRichEdit.DocumentFormat.Mht)
@ -139,7 +140,7 @@ Public Class DocumentViewer
Case Else Case Else
_docPath = FilePath _docPath = FilePath
_logger.Info("Displaying file {0}", _docPath) _logger.Info("(DocView)Displaying file {0}", _docPath)
GdViewer.DisplayFromFile(_docPath) GdViewer.DisplayFromFile(_docPath)

View File

@ -63,8 +63,8 @@
<Reference Include="GdPicture.NET.14"> <Reference Include="GdPicture.NET.14">
<HintPath>D:\ProgramFiles\GdPicture.NET 14\Redist\GdPicture.NET (.NET Framework 4.5)\GdPicture.NET.14.dll</HintPath> <HintPath>D:\ProgramFiles\GdPicture.NET 14\Redist\GdPicture.NET (.NET Framework 4.5)\GdPicture.NET.14.dll</HintPath>
</Reference> </Reference>
<Reference Include="Independentsoft.Msg.2.0.570.21482"> <Reference Include="Independentsoft.Msg">
<HintPath>P:\Visual Studio Projekte\Bibliotheken\MSG .NET\Bin\Independentsoft.Msg.2.0.570.21482.dll</HintPath> <HintPath>P:\Projekte DIGITAL DATA\DIGITAL DATA - Entwicklung\DLL_Bibliotheken\Independentsoft.Msg.dll</HintPath>
</Reference> </Reference>
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL"> <Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">

View File

@ -32,4 +32,4 @@ Imports System.Runtime.InteropServices
' <Assembly: AssemblyVersion("1.0.*")> ' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.0")> <Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.1")> <Assembly: AssemblyFileVersion("1.0.0.2")>