Fix filesystem refs
This commit is contained in:
parent
af90bb9efe
commit
6f33261101
@ -83,9 +83,6 @@
|
|||||||
<Compile Include="Encryption\Encryption.vb" />
|
<Compile Include="Encryption\Encryption.vb" />
|
||||||
<Compile Include="Encryption\EncryptionLegacy.vb" />
|
<Compile Include="Encryption\EncryptionLegacy.vb" />
|
||||||
<Compile Include="DatabaseEx.vb" />
|
<Compile Include="DatabaseEx.vb" />
|
||||||
<Compile Include="FileContainer\DocumentObject.vb" />
|
|
||||||
<Compile Include="FileContainer\FileContainer.vb" />
|
|
||||||
<Compile Include="FileContainer\FileContainerInner.vb" />
|
|
||||||
<Compile Include="FilesystemEx.vb" />
|
<Compile Include="FilesystemEx.vb" />
|
||||||
<Compile Include="FileWatcher\FileWatcher.vb" />
|
<Compile Include="FileWatcher\FileWatcher.vb" />
|
||||||
<Compile Include="FileWatcher\FileWatcherFilters.vb" />
|
<Compile Include="FileWatcher\FileWatcherFilters.vb" />
|
||||||
|
|||||||
@ -1,18 +0,0 @@
|
|||||||
Imports System.Runtime.Serialization
|
|
||||||
|
|
||||||
<Serializable>
|
|
||||||
Public Class DocumentObject
|
|
||||||
|
|
||||||
<DataMember(Name:="FileName")>
|
|
||||||
Public ReadOnly FileName As String
|
|
||||||
<DataMember(Name:="ContainerId")>
|
|
||||||
Public ReadOnly ContainerId As String
|
|
||||||
<DataMember(Name:="DocumentId")>
|
|
||||||
Public ReadOnly DocumentId As Int64
|
|
||||||
|
|
||||||
Public Sub New(ContainerId As String, DocumentId As Int64, FileName As String)
|
|
||||||
Me.ContainerId = ContainerId
|
|
||||||
Me.DocumentId = DocumentId
|
|
||||||
Me.FileName = FileName
|
|
||||||
End Sub
|
|
||||||
End Class
|
|
||||||
@ -1,193 +0,0 @@
|
|||||||
Imports System.IO
|
|
||||||
Imports DigitalData.Modules.Logging
|
|
||||||
Imports DigitalData.Modules.Encryption
|
|
||||||
Imports ProtoBuf
|
|
||||||
|
|
||||||
''' <module>FileContainer</module>
|
|
||||||
''' <version>0.0.0.2</version>
|
|
||||||
''' <date>21.11.2018</date>
|
|
||||||
''' <summary>
|
|
||||||
''' File Container for securely saving files
|
|
||||||
''' </summary>
|
|
||||||
''' <dependencies>
|
|
||||||
''' NLog, >= 4.5.8
|
|
||||||
''' </dependencies>
|
|
||||||
''' <params>
|
|
||||||
''' LogConfig, DigitalData.Module.Logging.LogConfig
|
|
||||||
''' A LogConfig object
|
|
||||||
''' Password, String
|
|
||||||
''' The Password to Encrypt
|
|
||||||
''' Path, String
|
|
||||||
''' The Path to save/load the container
|
|
||||||
''' </params>
|
|
||||||
''' <example>
|
|
||||||
''' dim oContainer = Container.Create(logConfig, "pass", "E:\some.container")
|
|
||||||
''' dim oContainer = Container.Load(logConfig, "pass", "E:\some.container")
|
|
||||||
'''
|
|
||||||
''' dim oContainer = new Container(logConfig, "pass", "E:\some.container")
|
|
||||||
''' oContainer.Save()
|
|
||||||
'''
|
|
||||||
''' dim oContainer = new Container(logConfig, "pass", "E:\some.container")
|
|
||||||
''' oContainer.Contents = oSomeData
|
|
||||||
''' oContainer.Save()
|
|
||||||
'''
|
|
||||||
''' dim oContainer = new Container(logConfig, "pass", "E:\some.container")
|
|
||||||
''' oContainer.Load()
|
|
||||||
''' dim oContents = oContainer.Contents
|
|
||||||
'''
|
|
||||||
''' dim oContainer = new Container(logConfig, "pass", "E:\some.container")
|
|
||||||
''' oContainer.Load()
|
|
||||||
''' oContainer.Contents = oSomeOtherData
|
|
||||||
''' oContainer.Save()
|
|
||||||
''' oContainer.SaveAs("E:\some2.container")
|
|
||||||
''' </example>
|
|
||||||
Public Class FileContainer
|
|
||||||
Private _crypto As Encryption.Encryption
|
|
||||||
Private _compression As Compression
|
|
||||||
Private _inner As FileContainerInner
|
|
||||||
Private _logger As Logger
|
|
||||||
Private _logConfig As LogConfig
|
|
||||||
Private _path As String
|
|
||||||
|
|
||||||
Public Property Contents As Byte()
|
|
||||||
Get
|
|
||||||
Return _inner.Contents
|
|
||||||
End Get
|
|
||||||
Set(value As Byte())
|
|
||||||
_inner.Contents = value
|
|
||||||
End Set
|
|
||||||
End Property
|
|
||||||
Public ReadOnly Property ContainerId As String
|
|
||||||
Get
|
|
||||||
Return _inner.FileId
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
Public ReadOnly Property CreatedAt As String
|
|
||||||
Get
|
|
||||||
Return _inner.CreatedAt
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
Public ReadOnly Property UpdatedAt As String
|
|
||||||
Get
|
|
||||||
Return _inner.UpdatedAt
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
Public Shared Function Create(LogConfig As LogConfig, Password As String) As FileContainer
|
|
||||||
Dim oContainer = New FileContainer(LogConfig, Password)
|
|
||||||
Return oContainer
|
|
||||||
End Function
|
|
||||||
|
|
||||||
Public Shared Function Load(LogConfig As LogConfig, Password As String, Path As String) As FileContainer
|
|
||||||
Dim oContainer = New FileContainer(LogConfig, Password, Path)
|
|
||||||
oContainer.Load()
|
|
||||||
Return oContainer
|
|
||||||
End Function
|
|
||||||
|
|
||||||
Public Sub New(LogConfig As LogConfig, Password As String)
|
|
||||||
_logger = LogConfig.GetLogger()
|
|
||||||
_crypto = New Encryption.Encryption(LogConfig, Password)
|
|
||||||
_compression = New Compression(LogConfig)
|
|
||||||
_inner = New FileContainerInner()
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Public Sub New(LogConfig As LogConfig, Password As String, Path As String)
|
|
||||||
MyClass.New(LogConfig, Password)
|
|
||||||
_path = Path
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Public Sub SetFile(Contents As Byte(), FileName As String)
|
|
||||||
_inner.Contents = Contents
|
|
||||||
_inner.UpdatedAt = Date.Now
|
|
||||||
_inner.FileName = FileName
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Public Function GetFile() As FileContainerInner
|
|
||||||
Return _inner
|
|
||||||
End Function
|
|
||||||
|
|
||||||
Public Sub Save()
|
|
||||||
If IsNothing(_path) Then
|
|
||||||
Throw New ArgumentException("Path not set")
|
|
||||||
End If
|
|
||||||
|
|
||||||
SaveAs(_path)
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Public Sub SaveAs(Path As String)
|
|
||||||
Try
|
|
||||||
WriteBytesToFile(TransformToBytes(_inner), Path)
|
|
||||||
Catch ex As Exception
|
|
||||||
_logger.Error(ex)
|
|
||||||
Throw ex
|
|
||||||
End Try
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Public Sub Load()
|
|
||||||
If IsNothing(_path) Then
|
|
||||||
Throw New ArgumentException("Path not set")
|
|
||||||
End If
|
|
||||||
|
|
||||||
LoadFrom(_path)
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Public Sub LoadFrom(Path As String)
|
|
||||||
Try
|
|
||||||
_inner = TransformToObject(ReadBytesFromFile(_path))
|
|
||||||
Catch ex As Exception
|
|
||||||
_logger.Error(ex)
|
|
||||||
Throw ex
|
|
||||||
End Try
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Private Function TransformToBytes([Object] As FileContainerInner) As Byte()
|
|
||||||
Dim oBytes = Serialize([Object])
|
|
||||||
Dim oCompressed = _compression.Compress(oBytes)
|
|
||||||
Dim oEncrypted = _crypto.Encrypt(oCompressed)
|
|
||||||
Return oEncrypted
|
|
||||||
End Function
|
|
||||||
|
|
||||||
Private Function TransformToObject(Bytes As Byte()) As FileContainerInner
|
|
||||||
Dim oDecrypted = _crypto.Decrypt(Bytes)
|
|
||||||
Dim oDecompressed = _compression.Decompress(oDecrypted)
|
|
||||||
Dim oObject = Deserialize(oDecompressed)
|
|
||||||
Return oObject
|
|
||||||
End Function
|
|
||||||
|
|
||||||
Private Function Serialize(InnerData As FileContainerInner) As Byte()
|
|
||||||
Dim oBinaryData As Byte()
|
|
||||||
|
|
||||||
Using oStream As New MemoryStream
|
|
||||||
Serializer.Serialize(oStream, InnerData)
|
|
||||||
oBinaryData = oStream.ToArray()
|
|
||||||
End Using
|
|
||||||
|
|
||||||
Return oBinaryData
|
|
||||||
End Function
|
|
||||||
|
|
||||||
Private Function Deserialize(InnerData As Byte()) As FileContainerInner
|
|
||||||
Dim oObject As FileContainerInner
|
|
||||||
|
|
||||||
Using oStream As New MemoryStream(InnerData)
|
|
||||||
oObject = Serializer.Deserialize(Of FileContainerInner)(oStream)
|
|
||||||
End Using
|
|
||||||
|
|
||||||
Return oObject
|
|
||||||
End Function
|
|
||||||
|
|
||||||
Private Sub WriteBytesToFile(Data As Byte(), FilePath As String)
|
|
||||||
Using oSourceStream As New FileStream(FilePath, FileMode.OpenOrCreate, FileAccess.Write, FileShare.None)
|
|
||||||
oSourceStream.Write(Data, 0, Data.Length)
|
|
||||||
oSourceStream.Flush()
|
|
||||||
End Using
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Private Function ReadBytesFromFile(FilePath As String) As Byte()
|
|
||||||
Using oFileStream = New FileStream(FilePath, FileMode.Open, FileAccess.Read, FileShare.Read, 4096)
|
|
||||||
Dim oBuffer As Byte() = New Byte(oFileStream.Length - 1) {}
|
|
||||||
oFileStream.Read(oBuffer, 0, oFileStream.Length)
|
|
||||||
oFileStream.Close()
|
|
||||||
Return oBuffer
|
|
||||||
End Using
|
|
||||||
End Function
|
|
||||||
End Class
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
Imports ProtoBuf
|
|
||||||
|
|
||||||
<Serializable>
|
|
||||||
<ProtoContract>
|
|
||||||
Public Class FileContainerInner
|
|
||||||
<ProtoMember(1)>
|
|
||||||
Public FileId As String
|
|
||||||
<ProtoMember(2)>
|
|
||||||
Public Contents As Byte()
|
|
||||||
<ProtoMember(3)>
|
|
||||||
Public CreatedAt As DateTime
|
|
||||||
<ProtoMember(4)>
|
|
||||||
Public UpdatedAt As DateTime
|
|
||||||
<ProtoMember(5)>
|
|
||||||
Public FileName As String
|
|
||||||
|
|
||||||
Public Sub New()
|
|
||||||
FileId = Guid.NewGuid().ToString
|
|
||||||
CreatedAt = Date.Now
|
|
||||||
UpdatedAt = Date.Now
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
End Class
|
|
||||||
@ -1,6 +1,5 @@
|
|||||||
Imports System.IO
|
Imports System.IO
|
||||||
Imports DigitalData.Modules.Filesystem
|
Imports DigitalData.Modules.Base.FileWatcherFilters
|
||||||
Imports DigitalData.Modules.Filesystem.FileWatcherFilters
|
|
||||||
Imports DigitalData.Modules.Logging
|
Imports DigitalData.Modules.Logging
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -44,6 +44,9 @@
|
|||||||
<OptionInfer>On</OptionInfer>
|
<OptionInfer>On</OptionInfer>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Reference Include="DigitalData.Modules.Base">
|
||||||
|
<HintPath>..\Base\bin\Debug\DigitalData.Modules.Base.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\NLog.5.0.5\lib\net46\NLog.dll</HintPath>
|
<HintPath>..\packages\NLog.5.0.5\lib\net46\NLog.dll</HintPath>
|
||||||
@ -120,10 +123,6 @@
|
|||||||
<Project>{8a8f20fc-c46e-41ac-bee7-218366cfff99}</Project>
|
<Project>{8a8f20fc-c46e-41ac-bee7-218366cfff99}</Project>
|
||||||
<Name>Encryption</Name>
|
<Name>Encryption</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\Filesystem\Filesystem.vbproj">
|
|
||||||
<Project>{991d0231-4623-496d-8bd0-9ca906029cbc}</Project>
|
|
||||||
<Name>Filesystem</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
<ProjectReference Include="..\Logging\Logging.vbproj">
|
<ProjectReference Include="..\Logging\Logging.vbproj">
|
||||||
<Project>{903b2d7d-3b80-4be9-8713-7447b704e1b0}</Project>
|
<Project>{903b2d7d-3b80-4be9-8713-7447b704e1b0}</Project>
|
||||||
<Name>Logging</Name>
|
<Name>Logging</Name>
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
Imports System.Reflection
|
Imports System.Reflection
|
||||||
Imports System.Xml.Serialization
|
Imports System.Xml.Serialization
|
||||||
Imports DigitalData.Modules.Logging
|
Imports DigitalData.Modules.Logging
|
||||||
Imports DigitalData.Modules.Encryption
|
|
||||||
Imports DigitalData.Modules.Config.ConfigAttributes
|
Imports DigitalData.Modules.Config.ConfigAttributes
|
||||||
|
Imports DigitalData.Modules.Base
|
||||||
|
|
||||||
Public Class ConfigManager(Of T)
|
Public Class ConfigManager(Of T)
|
||||||
Private Const USER_CONFIG_NAME As String = "UserConfig.xml"
|
Private Const USER_CONFIG_NAME As String = "UserConfig.xml"
|
||||||
@ -12,7 +12,7 @@ Public Class ConfigManager(Of T)
|
|||||||
|
|
||||||
Private ReadOnly _LogConfig As LogConfig
|
Private ReadOnly _LogConfig As LogConfig
|
||||||
Private ReadOnly _Logger As Logger
|
Private ReadOnly _Logger As Logger
|
||||||
Private ReadOnly _File As Filesystem.File
|
Private ReadOnly _File As FilesystemEx
|
||||||
|
|
||||||
Private ReadOnly _UserDirectory As String
|
Private ReadOnly _UserDirectory As String
|
||||||
Private ReadOnly _UserConfigPath As String
|
Private ReadOnly _UserConfigPath As String
|
||||||
@ -104,7 +104,7 @@ Public Class ConfigManager(Of T)
|
|||||||
Public Sub New(LogConfig As LogConfig, UserConfigPath As String, ComputerConfigPath As String, Optional ApplicationStartupPath As String = "", Optional ForceUserConfig As Boolean = False)
|
Public Sub New(LogConfig As LogConfig, UserConfigPath As String, ComputerConfigPath As String, Optional ApplicationStartupPath As String = "", Optional ForceUserConfig As Boolean = False)
|
||||||
_LogConfig = LogConfig
|
_LogConfig = LogConfig
|
||||||
_Logger = LogConfig.GetLogger()
|
_Logger = LogConfig.GetLogger()
|
||||||
_File = New Filesystem.File(_LogConfig)
|
_File = New FilesystemEx(_LogConfig)
|
||||||
|
|
||||||
_Blueprint = Activator.CreateInstance(Of T)
|
_Blueprint = Activator.CreateInstance(Of T)
|
||||||
_BlueprintType = _Blueprint.GetType
|
_BlueprintType = _Blueprint.GetType
|
||||||
|
|||||||
@ -1,15 +1,16 @@
|
|||||||
Imports DigitalData.Modules.Logging
|
Imports DigitalData.Modules.Base
|
||||||
|
Imports DigitalData.Modules.Logging
|
||||||
|
|
||||||
Public Class ConfigUtils
|
Public Class ConfigUtils
|
||||||
Private _Logger As Logger
|
Private _Logger As Logger
|
||||||
Private _File As Filesystem.File
|
Private _File As FilesystemEx
|
||||||
|
|
||||||
Private Const MIGRATE_DIRECTORY As String = "Migrate"
|
Private Const MIGRATE_DIRECTORY As String = "Migrate"
|
||||||
|
|
||||||
|
|
||||||
Public Sub New(LogConfig As LogConfig)
|
Public Sub New(LogConfig As LogConfig)
|
||||||
_Logger = LogConfig.GetLogger()
|
_Logger = LogConfig.GetLogger()
|
||||||
_File = New Filesystem.File(LogConfig)
|
_File = New FilesystemEx(LogConfig)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Function TestMigrationNeeded(TargetDirectory As String) As Boolean
|
Public Function TestMigrationNeeded(TargetDirectory As String) As Boolean
|
||||||
|
|||||||
@ -308,10 +308,6 @@
|
|||||||
<Project>{eaf0ea75-5fa7-485d-89c7-b2d843b03a96}</Project>
|
<Project>{eaf0ea75-5fa7-485d-89c7-b2d843b03a96}</Project>
|
||||||
<Name>Database</Name>
|
<Name>Database</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\Filesystem\Filesystem.vbproj">
|
|
||||||
<Project>{991d0231-4623-496d-8bd0-9ca906029cbc}</Project>
|
|
||||||
<Name>Filesystem</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
<ProjectReference Include="..\Language\Language.vbproj">
|
<ProjectReference Include="..\Language\Language.vbproj">
|
||||||
<Project>{d3c8cfed-d6f6-43a8-9bdf-454145d0352f}</Project>
|
<Project>{d3c8cfed-d6f6-43a8-9bdf-454145d0352f}</Project>
|
||||||
<Name>Language</Name>
|
<Name>Language</Name>
|
||||||
|
|||||||
@ -1,16 +1,17 @@
|
|||||||
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
|
Imports DigitalData.Modules.Base
|
||||||
|
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
|
||||||
Imports DigitalData.Modules.Logging
|
Imports DigitalData.Modules.Logging
|
||||||
|
|
||||||
|
|
||||||
Public Class Helpers
|
Public Class Helpers
|
||||||
Private ReadOnly LogConfig As LogConfig
|
Private ReadOnly LogConfig As LogConfig
|
||||||
Private ReadOnly Logger As Logger
|
Private ReadOnly Logger As Logger
|
||||||
Private ReadOnly FileEx As Filesystem.File
|
Private ReadOnly FileEx As FilesystemEx
|
||||||
|
|
||||||
Public Sub New(pLogConfig As LogConfig)
|
Public Sub New(pLogConfig As LogConfig)
|
||||||
LogConfig = pLogConfig
|
LogConfig = pLogConfig
|
||||||
Logger = pLogConfig.GetLogger()
|
Logger = pLogConfig.GetLogger()
|
||||||
FileEx = New Filesystem.File(pLogConfig)
|
FileEx = New FilesystemEx(pLogConfig)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Function GetFileProperties(pFilePath As String, pDateImportedAt As Date) As FileProperties
|
Public Function GetFileProperties(pFilePath As String, pDateImportedAt As Date) As FileProperties
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
|
Imports DigitalData.Modules.Base
|
||||||
|
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
|
||||||
Imports DigitalData.Modules.Logging
|
Imports DigitalData.Modules.Logging
|
||||||
|
|
||||||
Namespace Modules
|
Namespace Modules
|
||||||
@ -6,14 +7,14 @@ Namespace Modules
|
|||||||
Friend ReadOnly LogConfig As LogConfig
|
Friend ReadOnly LogConfig As LogConfig
|
||||||
Friend ReadOnly Logger As Logger
|
Friend ReadOnly Logger As Logger
|
||||||
Friend ReadOnly Channel As IEDMIServiceChannel
|
Friend ReadOnly Channel As IEDMIServiceChannel
|
||||||
Friend ReadOnly FileEx As Filesystem.File
|
Friend ReadOnly FileEx As FilesystemEx
|
||||||
Friend ReadOnly Helpers As Helpers
|
Friend ReadOnly Helpers As Helpers
|
||||||
|
|
||||||
Public Sub New(pLogConfig As LogConfig, pChannel As IEDMIServiceChannel)
|
Public Sub New(pLogConfig As LogConfig, pChannel As IEDMIServiceChannel)
|
||||||
LogConfig = pLogConfig
|
LogConfig = pLogConfig
|
||||||
Logger = pLogConfig.GetLogger()
|
Logger = pLogConfig.GetLogger()
|
||||||
Channel = pChannel
|
Channel = pChannel
|
||||||
FileEx = New Filesystem.File(pLogConfig)
|
FileEx = New FilesystemEx(pLogConfig)
|
||||||
Helpers = New Helpers(pLogConfig)
|
Helpers = New Helpers(pLogConfig)
|
||||||
End Sub
|
End Sub
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
|
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
|
||||||
Imports DigitalData.Modules.Logging
|
Imports DigitalData.Modules.Logging
|
||||||
Imports DigitalData.Modules.Filesystem
|
|
||||||
|
|
||||||
Namespace Modules.IDB
|
Namespace Modules.IDB
|
||||||
Public Class NewFile
|
Public Class NewFile
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
Imports System.Collections.Generic
|
Imports System.Collections.Generic
|
||||||
Imports System.IO
|
Imports System.IO
|
||||||
|
Imports System.Reflection
|
||||||
|
Imports System.Runtime.Remoting.Messaging
|
||||||
Imports DigitalData.Modules.Logging
|
Imports DigitalData.Modules.Logging
|
||||||
Imports GdPicture14
|
Imports GdPicture14
|
||||||
|
|
||||||
@ -91,6 +93,64 @@ Public Class PDFEmbeds
|
|||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Public Function RemoveEmbeddedFiles(pFilePath As String) As Boolean
|
||||||
|
Dim oFile As New List(Of EmbeddedFile)
|
||||||
|
Dim oFileInfo As FileInfo
|
||||||
|
|
||||||
|
Logger.Debug("Removing embedded files from [{0}]", pFilePath)
|
||||||
|
|
||||||
|
Try
|
||||||
|
oFileInfo = New FileInfo(pFilePath)
|
||||||
|
|
||||||
|
Logger.Debug("Filename: {0}", oFileInfo.Name)
|
||||||
|
Logger.Debug("Filesize: {0} bytes", oFileInfo.Length)
|
||||||
|
Logger.Debug("Exists: {0}", oFileInfo.Exists)
|
||||||
|
Catch ex As Exception
|
||||||
|
Logger.Warn("File information for [{0}] could not be read!", pFilePath)
|
||||||
|
Logger.Error(ex)
|
||||||
|
End Try
|
||||||
|
|
||||||
|
Try
|
||||||
|
Using oGDPicturePDF As New GdPicturePDF()
|
||||||
|
If oGDPicturePDF.LoadFromFile(pFilePath, False) <> GdPictureStatus.OK Then
|
||||||
|
Dim oMessage = String.Format("The file [{0}] can't be loaded. Status: [{1}]", pFilePath, oGDPicturePDF.GetStat().ToString())
|
||||||
|
Throw New ApplicationException(oMessage)
|
||||||
|
End If
|
||||||
|
|
||||||
|
If DoRemove(oGDPicturePDF) = False Then
|
||||||
|
Dim oMessage = String.Format("Attachments for file [{0}] can't be removed. Status: [{1}]", pFilePath, oGDPicturePDF.GetStat().ToString())
|
||||||
|
Throw New ApplicationException(oMessage)
|
||||||
|
End If
|
||||||
|
End Using
|
||||||
|
|
||||||
|
Return True
|
||||||
|
Catch ex As Exception
|
||||||
|
Logger.Warn("Unexpected Error while Extracting attachments from File [{0}]", pFilePath)
|
||||||
|
Logger.Error(ex)
|
||||||
|
Return False
|
||||||
|
End Try
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Private Function DoRemove(GDPicturePDF As GdPicturePDF) As Boolean
|
||||||
|
Dim oStatus As GdPictureStatus
|
||||||
|
|
||||||
|
Dim oEmbeddedFileCount As Integer = GDPicturePDF.GetEmbeddedFileCount()
|
||||||
|
|
||||||
|
If oStatus <> GdPictureStatus.OK Then
|
||||||
|
Logger.Warn("Embedded files could not be removed. Status: [{0}]", oStatus.ToString)
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
|
||||||
|
If oEmbeddedFileCount = 0 Then
|
||||||
|
Return True
|
||||||
|
End If
|
||||||
|
|
||||||
|
While GDPicturePDF.GetEmbeddedFileCount() > 0
|
||||||
|
GDPicturePDF.DeleteEmbeddedFile(0)
|
||||||
|
End While
|
||||||
|
|
||||||
|
End Function
|
||||||
|
|
||||||
Private Function DoExtract(GDPicturePDF As GdPicturePDF, pExtensions As List(Of String)) As List(Of EmbeddedFile)
|
Private Function DoExtract(GDPicturePDF As GdPicturePDF, pExtensions As List(Of String)) As List(Of EmbeddedFile)
|
||||||
Dim oResults As New List(Of EmbeddedFile)
|
Dim oResults As New List(Of EmbeddedFile)
|
||||||
Dim oEmbeddedFileCount As Integer = GDPicturePDF.GetEmbeddedFileCount()
|
Dim oEmbeddedFileCount As Integer = GDPicturePDF.GetEmbeddedFileCount()
|
||||||
|
|||||||
@ -77,10 +77,6 @@
|
|||||||
<Project>{eaf0ea75-5fa7-485d-89c7-b2d843b03a96}</Project>
|
<Project>{eaf0ea75-5fa7-485d-89c7-b2d843b03a96}</Project>
|
||||||
<Name>Database</Name>
|
<Name>Database</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\Filesystem\Filesystem.vbproj">
|
|
||||||
<Project>{991d0231-4623-496d-8bd0-9ca906029cbc}</Project>
|
|
||||||
<Name>Filesystem</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
<ProjectReference Include="..\Interfaces\Interfaces.vbproj">
|
<ProjectReference Include="..\Interfaces\Interfaces.vbproj">
|
||||||
<Project>{ab6f09bf-e794-4f6a-94bb-c97c0ba84d64}</Project>
|
<Project>{ab6f09bf-e794-4f6a-94bb-c97c0ba84d64}</Project>
|
||||||
<Name>Interfaces</Name>
|
<Name>Interfaces</Name>
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
Imports System.Collections.Generic
|
Imports System.Collections.Generic
|
||||||
Imports System.IO
|
Imports System.IO
|
||||||
Imports System.Linq
|
Imports System.Linq
|
||||||
|
Imports DigitalData.Modules.Base
|
||||||
Imports DigitalData.Modules.Database
|
Imports DigitalData.Modules.Database
|
||||||
Imports DigitalData.Modules.Interfaces
|
Imports DigitalData.Modules.Interfaces
|
||||||
Imports DigitalData.Modules.Logging
|
Imports DigitalData.Modules.Logging
|
||||||
@ -11,13 +12,13 @@ Namespace ZUGFeRD
|
|||||||
Private ReadOnly _logConfig As LogConfig
|
Private ReadOnly _logConfig As LogConfig
|
||||||
Private ReadOnly _logger As Logger
|
Private ReadOnly _logger As Logger
|
||||||
Private ReadOnly _mssql As MSSQLServer
|
Private ReadOnly _mssql As MSSQLServer
|
||||||
Private ReadOnly _filesystem As Filesystem.File
|
Private ReadOnly _filesystem As FilesystemEx
|
||||||
|
|
||||||
Public Sub New(LogConfig As LogConfig, MSSQL As MSSQLServer)
|
Public Sub New(LogConfig As LogConfig, MSSQL As MSSQLServer)
|
||||||
_logConfig = LogConfig
|
_logConfig = LogConfig
|
||||||
_logger = _logConfig.GetLogger()
|
_logger = _logConfig.GetLogger()
|
||||||
_mssql = MSSQL
|
_mssql = MSSQL
|
||||||
_filesystem = New Filesystem.File(LogConfig)
|
_filesystem = New FilesystemEx(LogConfig)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Sub MoveFiles(
|
Public Sub MoveFiles(
|
||||||
|
|||||||
@ -32,7 +32,7 @@ Public Class ImportZUGFeRDFiles
|
|||||||
|
|
||||||
Private ReadOnly _logger As Logger
|
Private ReadOnly _logger As Logger
|
||||||
Private ReadOnly _logConfig As LogConfig
|
Private ReadOnly _logConfig As LogConfig
|
||||||
Private ReadOnly _filesystem As Filesystem.File
|
Private ReadOnly _filesystem As FilesystemEx
|
||||||
Private ReadOnly _mssql As MSSQLServer
|
Private ReadOnly _mssql As MSSQLServer
|
||||||
Private ReadOnly _email As ZUGFeRD.EmailFunctions
|
Private ReadOnly _email As ZUGFeRD.EmailFunctions
|
||||||
Private ReadOnly _file As ZUGFeRD.FileFunctions
|
Private ReadOnly _file As ZUGFeRD.FileFunctions
|
||||||
@ -58,7 +58,7 @@ Public Class ImportZUGFeRDFiles
|
|||||||
Public Sub New(LogConfig As LogConfig, Optional MSSQL As MSSQLServer = Nothing)
|
Public Sub New(LogConfig As LogConfig, Optional MSSQL As MSSQLServer = Nothing)
|
||||||
_logConfig = LogConfig
|
_logConfig = LogConfig
|
||||||
_logger = LogConfig.GetLogger()
|
_logger = LogConfig.GetLogger()
|
||||||
_filesystem = New Filesystem.File(_logConfig)
|
_filesystem = New FilesystemEx(_logConfig)
|
||||||
_mssql = MSSQL
|
_mssql = MSSQL
|
||||||
_email = New ZUGFeRD.EmailFunctions(LogConfig, _mssql)
|
_email = New ZUGFeRD.EmailFunctions(LogConfig, _mssql)
|
||||||
_file = New ZUGFeRD.FileFunctions(LogConfig, _mssql)
|
_file = New ZUGFeRD.FileFunctions(LogConfig, _mssql)
|
||||||
@ -82,11 +82,10 @@ Public Class ImportZUGFeRDFiles
|
|||||||
|
|
||||||
_EmailOutAccountId = oArgs.EmailOutProfileId
|
_EmailOutAccountId = oArgs.EmailOutProfileId
|
||||||
|
|
||||||
Dim oOptions As New ZUGFeRDInterface.ZugferdOptions() With {
|
_zugferd = New ZUGFeRDInterface(_logConfig, _gdpictureLicenseKey, New ZUGFeRDInterface.ZugferdOptions() With {
|
||||||
.AllowFacturX_Filename = oArgs.AllowFacturX,
|
.AllowFacturX_Filename = oArgs.AllowFacturX,
|
||||||
.AllowXRechnung_Filename = oArgs.AllowXRechnung
|
.AllowXRechnung_Filename = oArgs.AllowXRechnung
|
||||||
}
|
})
|
||||||
_zugferd = New ZUGFeRDInterface(_logConfig, _gdpictureLicenseKey, oOptions)
|
|
||||||
|
|
||||||
_logger.Debug("Starting Job {0}", [GetType].Name)
|
_logger.Debug("Starting Job {0}", [GetType].Name)
|
||||||
|
|
||||||
@ -523,8 +522,6 @@ Public Class ImportZUGFeRDFiles
|
|||||||
End Try
|
End Try
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#Region "=== REFACTOR"
|
#Region "=== REFACTOR"
|
||||||
Private Function ProcessFileGroup(oMessageId As String, pFiles As List(Of FileInfo), oConnections As DatabaseConnections, pArgs As WorkerArgs)
|
Private Function ProcessFileGroup(oMessageId As String, pFiles As List(Of FileInfo), oConnections As DatabaseConnections, pArgs As WorkerArgs)
|
||||||
Dim oMissingProperties = New List(Of String)
|
Dim oMissingProperties = New List(Of String)
|
||||||
@ -1069,14 +1066,14 @@ Public Class ImportZUGFeRDFiles
|
|||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Function CreateMD5(ByVal Filename As String) As String
|
Private Function CreateMD5(pFilename As String) As String
|
||||||
Try
|
Try
|
||||||
Dim oMD5 As New MD5CryptoServiceProvider
|
Dim oMD5 As New MD5CryptoServiceProvider
|
||||||
Dim oHash As Byte()
|
Dim oHash As Byte()
|
||||||
Dim oHashString As String
|
Dim oHashString As String
|
||||||
Dim oResult As String = ""
|
Dim oResult As String = ""
|
||||||
|
|
||||||
Using oFileStream As New FileStream(Filename, FileMode.Open, FileAccess.Read, FileShare.Read, 8192)
|
Using oFileStream As New FileStream(pFilename, FileMode.Open, FileAccess.Read, FileShare.Read, 8192)
|
||||||
oHash = oMD5.ComputeHash(oFileStream)
|
oHash = oMD5.ComputeHash(oFileStream)
|
||||||
oHashString = BitConverter.ToString(oHash)
|
oHashString = BitConverter.ToString(oHash)
|
||||||
End Using
|
End Using
|
||||||
@ -1236,11 +1233,11 @@ Public Class ImportZUGFeRDFiles
|
|||||||
Return oEmailData
|
Return oEmailData
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Sub AddRejectedState(oMessageID As String, oTitle As String, oTitle1 As String, oComment As String, Transaction As SqlTransaction)
|
Private Sub AddRejectedState(pMessageID As String, pTitle As String, pTitle1 As String, pComment As String, pTransaction As SqlTransaction)
|
||||||
Try
|
Try
|
||||||
'PRCUST_ADD_HISTORY_STATE: @MessageID VARCHAR(250), @TITLE1 VARCHAR(250), @TITLE2 VARCHAR(250)
|
'PRCUST_ADD_HISTORY_STATE: @MessageID VARCHAR(250), @TITLE1 VARCHAR(250), @TITLE2 VARCHAR(250)
|
||||||
Dim oSQL = $"EXEC PRCUST_ADD_HISTORY_STATE '{oMessageID}','{oTitle}','{oTitle1}','{oComment.Replace("'", "''")}'"
|
Dim oSQL = $"EXEC PRCUST_ADD_HISTORY_STATE '{pMessageID}','{pTitle}','{pTitle1}','{pComment.Replace("'", "''")}'"
|
||||||
_mssql.ExecuteNonQuery(oSQL, Transaction)
|
_mssql.ExecuteNonQuery(oSQL, pTransaction)
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_logger.Error(ex)
|
_logger.Error(ex)
|
||||||
End Try
|
End Try
|
||||||
|
|||||||
@ -1,46 +1,46 @@
|
|||||||
Imports System.Text
|
Imports System.IO
|
||||||
Imports System.IO
|
Imports FluentAssertions
|
||||||
Imports Microsoft.VisualStudio.TestTools.UnitTesting
|
|
||||||
Imports DigitalData.Modules.Logging
|
|
||||||
|
|
||||||
''' <summary>
|
''' <summary>
|
||||||
''' Test creating the log path in various configurations
|
''' Test creating the log path in various configurations
|
||||||
''' </summary>
|
''' </summary>
|
||||||
<TestClass()> Public Class ConstructorUnitTest
|
<TestClass()> Public Class ConstructorUnitTest
|
||||||
Private Shared _currentDirectoryLogPath = Path.Combine(Directory.GetCurrentDirectory(), "Log")
|
Private Shared ReadOnly _currentDirectoryLogPath = Path.Combine(Directory.GetCurrentDirectory(), "Log")
|
||||||
Private Shared _appdataDirectoryLogPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Digital Data", "Modules.Logging", "Log")
|
Private Shared ReadOnly _appdataDirectoryLogPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Digital Data", "Modules.Logging.Test", "Log")
|
||||||
Private Shared _customDirectoryLogPath = Path.Combine(Directory.GetCurrentDirectory(), "CustomLogFolder")
|
Private Shared ReadOnly _customDirectoryLogPath = Path.Combine(Directory.GetCurrentDirectory(), "CustomLogFolder")
|
||||||
Private Shared _restrictedDirectoryLogPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "ShouldNotBeCreated")
|
Private Shared ReadOnly _restrictedDirectoryLogPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "ShouldNotBeCreated")
|
||||||
Private Shared _nonsenseDirectoryLogPath = "X:\FOO\BAR\BAZ\QUUX"
|
Private Shared ReadOnly _nonsenseDirectoryLogPath = "X:\DOES\NOT\EVER\EXIST"
|
||||||
|
|
||||||
<TestMethod()> Public Sub TestConstructorCurrentDirectory()
|
<TestMethod()> Public Sub TestConstructorCurrentDirectory()
|
||||||
Assert.ThrowsException(Of ArgumentException)(Sub()
|
|
||||||
Dim oLogConfig As New LogConfig(LogConfig.PathType.Temp)
|
Dim oLogConfig As New LogConfig(LogConfig.PathType.Temp)
|
||||||
End Sub)
|
Dim oTempPath = Path.GetTempPath
|
||||||
|
oLogConfig.LogDirectory.Should.Be(oTempPath)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
<TestMethod()> Public Sub TestConstructorApplicationDirectory()
|
<TestMethod()> Public Sub TestConstructorApplicationDirectory()
|
||||||
Dim oLogConfig As New LogConfig(LogConfig.PathType.AppData, Nothing, Nothing, "Digital Data", "Modules.Logging")
|
Dim oLogConfig As New LogConfig(LogConfig.PathType.AppData, Nothing, Nothing, "Digital Data", "Modules.Logging")
|
||||||
|
|
||||||
Assert.AreEqual(_appdataDirectoryLogPath, oLogConfig.LogDirectory)
|
oLogConfig.LogDirectory.Should.Be(_appdataDirectoryLogPath)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
<TestMethod()> Public Sub TestConstructorCustomDirectory()
|
<TestMethod()> Public Sub TestConstructorCustomDirectory()
|
||||||
Dim oLogConfig As New LogConfig(LogConfig.PathType.CustomPath, _customDirectoryLogPath)
|
Dim oLogConfig As New LogConfig(LogConfig.PathType.CustomPath, _customDirectoryLogPath)
|
||||||
|
|
||||||
Assert.AreEqual(_customDirectoryLogPath, oLogConfig.LogDirectory)
|
oLogConfig.LogDirectory.Should.Be(_customDirectoryLogPath)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
<TestMethod()> Public Sub TestConstructorRestrictedDirectory()
|
<TestMethod()> Public Sub TestConstructorRestrictedDirectory()
|
||||||
Dim oLogConfig As New LogConfig(LogConfig.PathType.CustomPath, _restrictedDirectoryLogPath)
|
Dim oLogConfig As New LogConfig(LogConfig.PathType.CustomPath, _restrictedDirectoryLogPath)
|
||||||
|
Dim oTempPath = Path.GetTempPath
|
||||||
|
|
||||||
Assert.AreEqual(Path.GetTempPath, oLogConfig.LogDirectory)
|
oLogConfig.LogDirectory.Should.Be(oTempPath)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
<TestMethod()> Public Sub TestConstructorNonsenseDirectory()
|
<TestMethod()> Public Sub TestConstructorNonsenseDirectory()
|
||||||
Dim oLogConfig As New LogConfig(LogConfig.PathType.CustomPath, _nonsenseDirectoryLogPath)
|
Dim oLogConfig As New LogConfig(LogConfig.PathType.CustomPath, _nonsenseDirectoryLogPath)
|
||||||
|
Dim oTempPath = Path.GetTempPath
|
||||||
|
|
||||||
Assert.AreEqual(Path.GetTempPath, oLogConfig.LogDirectory)
|
oLogConfig.LogDirectory.Should.Be(oTempPath)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
<ClassCleanup()> Public Shared Sub Cleanup()
|
<ClassCleanup()> Public Shared Sub Cleanup()
|
||||||
|
|||||||
@ -52,6 +52,9 @@
|
|||||||
<OptionInfer>On</OptionInfer>
|
<OptionInfer>On</OptionInfer>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Reference Include="FluentAssertions, Version=6.12.0.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\FluentAssertions.6.12.0\lib\netstandard2.0\FluentAssertions.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\MSTest.TestFramework.2.1.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
|
<HintPath>..\packages\MSTest.TestFramework.2.1.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
@ -60,6 +63,12 @@
|
|||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.0\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
|||||||
@ -1,5 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
|
<package id="FluentAssertions" version="6.12.0" targetFramework="net462" />
|
||||||
<package id="MSTest.TestAdapter" version="2.1.2" targetFramework="net461" />
|
<package id="MSTest.TestAdapter" version="2.1.2" targetFramework="net461" />
|
||||||
<package id="MSTest.TestFramework" version="2.1.2" targetFramework="net461" />
|
<package id="MSTest.TestFramework" version="2.1.2" targetFramework="net461" />
|
||||||
|
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.0" targetFramework="net462" />
|
||||||
|
<package id="System.Threading.Tasks.Extensions" version="4.5.0" targetFramework="net462" />
|
||||||
</packages>
|
</packages>
|
||||||
@ -1,6 +1,6 @@
|
|||||||
Imports System.IO
|
Imports System.IO
|
||||||
Imports DigitalData.Modules.Logging
|
Imports DigitalData.Modules.Logging
|
||||||
Imports DigitalData.Modules.Filesystem
|
Imports DigitalData.Modules.Base
|
||||||
Imports Limilabs.Mail
|
Imports Limilabs.Mail
|
||||||
Imports Limilabs.Mail.MIME
|
Imports Limilabs.Mail.MIME
|
||||||
Imports Limilabs.Mail.MSG
|
Imports Limilabs.Mail.MSG
|
||||||
@ -11,7 +11,7 @@ Public Class Email2
|
|||||||
Private ReadOnly Logger As Logger
|
Private ReadOnly Logger As Logger
|
||||||
Private ReadOnly LoggerMail As Logger
|
Private ReadOnly LoggerMail As Logger
|
||||||
Private ReadOnly LogConfig As LogConfig
|
Private ReadOnly LogConfig As LogConfig
|
||||||
Private ReadOnly FileEx As Filesystem.File
|
Private ReadOnly FileEx As FilesystemEx
|
||||||
Private ReadOnly MailBuilder As New MailBuilder()
|
Private ReadOnly MailBuilder As New MailBuilder()
|
||||||
Private ReadOnly TempFiles As New List(Of String)
|
Private ReadOnly TempFiles As New List(Of String)
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ Public Class Email2
|
|||||||
LogConfig = pLogConfig
|
LogConfig = pLogConfig
|
||||||
Logger = pLogConfig.GetLogger()
|
Logger = pLogConfig.GetLogger()
|
||||||
LoggerMail = pLogConfig.GetLogger("Limilabs.Mail")
|
LoggerMail = pLogConfig.GetLogger("Limilabs.Mail")
|
||||||
FileEx = New Filesystem.File(pLogConfig)
|
FileEx = New FilesystemEx(pLogConfig)
|
||||||
|
|
||||||
' Turn on internal Mail.dll logging
|
' Turn on internal Mail.dll logging
|
||||||
Limilabs.Mail.Log.Enabled = True
|
Limilabs.Mail.Log.Enabled = True
|
||||||
|
|||||||
@ -244,8 +244,8 @@ Namespace Mail
|
|||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Async Function TestLogin(pServer As String, pPort As Integer, pUser As String, pPassword As String, pAuthType As String, pOptions As MailSessionOptions) As Task(Of Boolean)
|
Public Function TestLogin(pServer As String, pPort As Integer, pUser As String, pPassword As String, pAuthType As String, pOptions As MailSessionOptions) As Boolean
|
||||||
Dim oInfo = Await ConnectToServer(pServer, pPort, pUser, pPassword, pAuthType, pOptions)
|
Dim oInfo = ConnectToServer(pServer, pPort, pUser, pPassword, pAuthType, pOptions)
|
||||||
If oInfo.Connected Then
|
If oInfo.Connected Then
|
||||||
If DisconnectFromServer() Then
|
If DisconnectFromServer() Then
|
||||||
Return True
|
Return True
|
||||||
|
|||||||
@ -140,10 +140,6 @@
|
|||||||
<Project>{6ea0c51f-c2b1-4462-8198-3de0b32b74f8}</Project>
|
<Project>{6ea0c51f-c2b1-4462-8198-3de0b32b74f8}</Project>
|
||||||
<Name>Base</Name>
|
<Name>Base</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\Filesystem\Filesystem.vbproj">
|
|
||||||
<Project>{991d0231-4623-496d-8bd0-9ca906029cbc}</Project>
|
|
||||||
<Name>Filesystem</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
<ProjectReference Include="..\Language\Language.vbproj">
|
<ProjectReference Include="..\Language\Language.vbproj">
|
||||||
<Project>{d3c8cfed-d6f6-43a8-9bdf-454145d0352f}</Project>
|
<Project>{d3c8cfed-d6f6-43a8-9bdf-454145d0352f}</Project>
|
||||||
<Name>Language</Name>
|
<Name>Language</Name>
|
||||||
|
|||||||
@ -13,6 +13,7 @@ Imports WMOTOOLLib
|
|||||||
|
|
||||||
Imports DigitalData.Modules.Logging
|
Imports DigitalData.Modules.Logging
|
||||||
Imports DigitalData.Modules.Language
|
Imports DigitalData.Modules.Language
|
||||||
|
Imports DigitalData.Modules.Base
|
||||||
|
|
||||||
''' <module>Windream</module>
|
''' <module>Windream</module>
|
||||||
''' <version>0.0.0.2</version>
|
''' <version>0.0.0.2</version>
|
||||||
@ -97,7 +98,7 @@ Public Class Windream
|
|||||||
#Region "Private Properties"
|
#Region "Private Properties"
|
||||||
Private ReadOnly _logger As Logger
|
Private ReadOnly _logger As Logger
|
||||||
Private ReadOnly _logConfig As LogConfig
|
Private ReadOnly _logConfig As LogConfig
|
||||||
Private ReadOnly _fileSystem As Filesystem.File
|
Private ReadOnly _fileSystem As FilesystemEx
|
||||||
Private ReadOnly _sessionDomain As String
|
Private ReadOnly _sessionDomain As String
|
||||||
Private ReadOnly _sessionPassword As String
|
Private ReadOnly _sessionPassword As String
|
||||||
Private ReadOnly _sessionUsername As String
|
Private ReadOnly _sessionUsername As String
|
||||||
@ -149,7 +150,7 @@ Public Class Windream
|
|||||||
' Create logger and save LogFactory for dependent classes
|
' Create logger and save LogFactory for dependent classes
|
||||||
_logger = LogConfig.GetLogger()
|
_logger = LogConfig.GetLogger()
|
||||||
_logConfig = LogConfig
|
_logConfig = LogConfig
|
||||||
_fileSystem = New Filesystem.File(LogConfig)
|
_fileSystem = New FilesystemEx(LogConfig)
|
||||||
|
|
||||||
' Create a session
|
' Create a session
|
||||||
Dim oSession As IWMSession2 = NewSession(SessionServerName, SessionUserName, SessionPassword, SessionDomain)
|
Dim oSession As IWMSession2 = NewSession(SessionServerName, SessionUserName, SessionPassword, SessionDomain)
|
||||||
@ -584,9 +585,7 @@ Public Class Windream
|
|||||||
''' changes the archive end date
|
''' changes the archive end date
|
||||||
''' </summary>
|
''' </summary>
|
||||||
''' <param name="wmfilepath">WM Filepath</param>
|
''' <param name="wmfilepath">WM Filepath</param>
|
||||||
''' <param name="date_period">number/count of period (if </param>
|
''' <param name="oArchUntil">number/count of period (if </param>
|
||||||
''' <param name="date_unit">date_unity (d,m,y or day(s),month(s),years(s)</param>
|
|
||||||
''' <param name="dateFrom_value">dateFrom_value</param>
|
|
||||||
''' <returns>Returns true when date was set, false if not</returns>
|
''' <returns>Returns true when date was set, false if not</returns>
|
||||||
''' <remarks></remarks>
|
''' <remarks></remarks>
|
||||||
Public Function NewLifecycle_PeriodTEST(ByVal wmfilepath As String, ByVal oArchUntil As String)
|
Public Function NewLifecycle_PeriodTEST(ByVal wmfilepath As String, ByVal oArchUntil As String)
|
||||||
|
|||||||
@ -110,7 +110,6 @@
|
|||||||
<DependentUpon>Settings.settings</DependentUpon>
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Windream_alt.vb" />
|
|
||||||
<Compile Include="Windream.vb" />
|
<Compile Include="Windream.vb" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@ -134,9 +133,9 @@
|
|||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Filesystem\Filesystem.vbproj">
|
<ProjectReference Include="..\Base\Base.vbproj">
|
||||||
<Project>{991d0231-4623-496d-8bd0-9ca906029cbc}</Project>
|
<Project>{6EA0C51F-C2B1-4462-8198-3DE0B32B74F8}</Project>
|
||||||
<Name>Filesystem</Name>
|
<Name>Base</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\Language\Language.vbproj">
|
<ProjectReference Include="..\Language\Language.vbproj">
|
||||||
<Project>{d3c8cfed-d6f6-43a8-9bdf-454145d0352f}</Project>
|
<Project>{d3c8cfed-d6f6-43a8-9bdf-454145d0352f}</Project>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user