DocumentViewer: Replace IndependentSoft with Limilabs.Mail
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
Imports System.ComponentModel
|
||||
Imports System.IO
|
||||
Imports System.ComponentModel
|
||||
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
|
||||
Imports System.IO
|
||||
Imports DevExpress.Spreadsheet
|
||||
Imports DevExpress.XtraRichEdit.Commands
|
||||
Imports DevExpress.XtraRichEdit
|
||||
Imports DevExpress.Office.Utils
|
||||
Imports GdPicture14
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Messaging
|
||||
|
||||
Public Class DocumentViewer
|
||||
Private Enum ZoomMode
|
||||
@@ -35,6 +36,7 @@ Public Class DocumentViewer
|
||||
Private _licenseManager As New GdPicture14.LicenseManager()
|
||||
Private _logConfig As LogConfig
|
||||
Private _logger As Logger
|
||||
Private _email As Email2
|
||||
|
||||
Private _hide_file_info_from_user As Boolean = False
|
||||
Private _FilePath As String
|
||||
@@ -55,13 +57,13 @@ Public Class DocumentViewer
|
||||
''' <summary>
|
||||
''' Initialize the Viewer
|
||||
''' </summary>
|
||||
''' <param name="LogConfig">A LogConfig object</param>
|
||||
''' <param name="LicenseKey">The GDPicture.NET License Key</param>
|
||||
Public Sub Init(LogConfig As LogConfig, LicenseKey As String)
|
||||
_logConfig = LogConfig
|
||||
_logger = LogConfig.GetLogger()
|
||||
|
||||
_licenseKey = LicenseKey
|
||||
''' <param name="pLogConfig">A LogConfig object</param>
|
||||
''' <param name="pLicenseKey">The GDPicture.NET License Key</param>
|
||||
Public Sub Init(pLogConfig As LogConfig, pLicenseKey As String)
|
||||
_logConfig = pLogConfig
|
||||
_logger = pLogConfig.GetLogger()
|
||||
_email = New Email2(pLogConfig)
|
||||
_licenseKey = pLicenseKey
|
||||
_licenseManager.RegisterKEY(_licenseKey)
|
||||
End Sub
|
||||
|
||||
@@ -186,23 +188,10 @@ Public Class DocumentViewer
|
||||
SpreadsheetControl1.Visible = False
|
||||
SpreadsheetControl1.Dock = DockStyle.None
|
||||
|
||||
'ToolbarDocumentViewer.Visible = False
|
||||
|
||||
Select Case oExtension.ToUpper
|
||||
Case ".MSG"
|
||||
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, XtraRichEdit.DocumentFormat.Mht)
|
||||
|
||||
_TempFiles.Add(oTempFileName)
|
||||
|
||||
RichEditControl1.Visible = True
|
||||
RichEditControl1.Dock = DockStyle.Fill
|
||||
Dim oEmlPath As String = _email.Convert_ToEml(FilePath)
|
||||
DoLoadFile(oEmlPath)
|
||||
|
||||
Case ".EML", ".DOC", ".DOCX", ".ODT", ".RTF", ".TXT"
|
||||
RichEditControl1.LoadDocument(FilePath, GetDocumentFormat(oExtension))
|
||||
@@ -245,24 +234,18 @@ Public Class DocumentViewer
|
||||
SpreadsheetControl1.Visible = False
|
||||
SpreadsheetControl1.Dock = DockStyle.None
|
||||
|
||||
' ToolbarDocumentViewer.Visible = False
|
||||
|
||||
Select Case Extension.ToUpper
|
||||
Case ".MSG"
|
||||
Dim oMsg As New Message(Stream)
|
||||
|
||||
' 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)
|
||||
Dim oTempFileName = Path.Combine(IO.Path.GetTempPath(), Guid.NewGuid.ToString & ".msg")
|
||||
Using oFileStream As New FileStream(oTempFileName, FileMode.Create)
|
||||
Stream.Seek(0, SeekOrigin.Begin)
|
||||
Stream.CopyTo(oFileStream)
|
||||
Stream.Flush()
|
||||
End Using
|
||||
|
||||
RichEditControl1.LoadDocument(oTempFileName, XtraRichEdit.DocumentFormat.Mht)
|
||||
|
||||
_TempFiles.Add(oTempFileName)
|
||||
|
||||
RichEditControl1.Visible = True
|
||||
RichEditControl1.Dock = DockStyle.Fill
|
||||
Dim oEmlPath As String = _email.Convert_ToEml(oTempFileName)
|
||||
DoLoadFile(oEmlPath)
|
||||
|
||||
Case ".EML", ".DOC", ".DOCX", ".ODT", ".RTF", ".TXT"
|
||||
RichEditControl1.LoadDocument(Stream, GetDocumentFormat(Extension))
|
||||
|
||||
Reference in New Issue
Block a user