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 DigitalData.Modules.Logging
Imports GdPicture14
Imports Independentsoft
Public Class DocumentViewer
Private Enum ZoomMode
@ -66,7 +67,7 @@ Public Class DocumentViewer
''' Terminate Viewer, freeing up resources and deleting temp files
''' </summary>
Public Sub Done()
_logger.Warn("Called Done, removing temp files")
_logger.Debug("(DocView)Called Done, removing temp files")
DeleteTempFiles()
'Dispose()
End Sub
@ -77,14 +78,14 @@ Public Class DocumentViewer
''' <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("(DocView)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("(DocView)Loading File {0}", filepath)
DoLoadFile(filepath)
@ -103,9 +104,9 @@ Public Class DocumentViewer
Public Sub DeleteTempFiles()
For Each oFile In _TempFiles
Try
IO.File.Delete(oFile)
System.IO.File.Delete(oFile)
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
Next
_TempFiles.Clear()
@ -113,16 +114,16 @@ Public Class DocumentViewer
Private Sub DoLoadFile(FilePath As String)
Try
Dim oFileInfo = New IO.FileInfo(FilePath)
Dim oFileInfo = New System.IO.FileInfo(FilePath)
Dim oExtension As String = oFileInfo.Extension.ToUpper
Select Case oExtension.ToUpper
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
oMsg.Encoding = System.Text.Encoding.UTF32
Dim oMime = oMsg.ConvertToMimeMessage()
Dim oTempFileName = IO.Path.GetTempFileName()
Dim oTempFileName = System.IO.Path.GetTempFileName()
oMime.Save(oTempFileName, True)
RichEditControl1.LoadDocument(oTempFileName, DevExpress.XtraRichEdit.DocumentFormat.Mht)
@ -139,7 +140,7 @@ Public Class DocumentViewer
Case Else
_docPath = FilePath
_logger.Info("Displaying file {0}", _docPath)
_logger.Info("(DocView)Displaying file {0}", _docPath)
GdViewer.DisplayFromFile(_docPath)

View File

@ -63,8 +63,8 @@
<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">
<HintPath>P:\Projekte DIGITAL DATA\DIGITAL DATA - Entwicklung\DLL_Bibliotheken\Independentsoft.Msg.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<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.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.1")>
<Assembly: AssemblyFileVersion("1.0.0.2")>