File Container, Prepare Import for Marvman

This commit is contained in:
Jonathan Jenne
2019-03-01 15:52:00 +01:00
parent cfbcd8a8f2
commit 6f0164d010
24 changed files with 496 additions and 306 deletions

View File

@@ -0,0 +1,12 @@
<Serializable>
Public Class DocumentObject
Public ReadOnly Property FileName As String
Public ReadOnly Property ContainerId As String
Public ReadOnly Property DocumentId As Int64
Public Sub New(ContainerId As String, DocumentId As Int64, FileName As String)
_ContainerId = ContainerId
_DocumentId = DocumentId
_FileName = FileName
End Sub
End Class

View File

@@ -43,7 +43,6 @@ Imports ProtoBuf
Public Class FileContainer
Private _crypto As Encryption
Private _compression As Compression
Private _containerId As Guid
Private _inner As FileContainerInner
Private _logger As Logger
Private _logConfig As LogConfig
@@ -57,15 +56,7 @@ Public Class FileContainer
_inner.Contents = value
End Set
End Property
Public Property Extension As String
Get
Return _inner.Extension
End Get
Set(value As String)
_inner.Extension = value
End Set
End Property
Public ReadOnly Property FileId As String
Public ReadOnly Property ContainerId As String
Get
Return _inner.FileId
End Get
@@ -92,14 +83,6 @@ Public Class FileContainer
Return oContainer
End Function
Public Sub New(LogConfig As LogConfig, Password As String, Path As String)
_logger = LogConfig.GetLogger()
_crypto = New Encryption(LogConfig, Password)
_compression = New Compression(LogConfig)
_inner = New FileContainerInner()
_path = Path
End Sub
Public Sub New(LogConfig As LogConfig, Password As String)
_logger = LogConfig.GetLogger()
_crypto = New Encryption(LogConfig, Password)
@@ -107,9 +90,15 @@ Public Class FileContainer
_inner = New FileContainerInner()
End Sub
Public Sub SetFile(Contents As Byte(), Extension As String)
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.Extension = Extension
_inner.UpdatedAt = Date.Now
_inner.FileName = FileName
End Sub
Public Function GetFile() As FileContainerInner

View File

@@ -12,11 +12,12 @@ Public Class FileContainerInner
<ProtoMember(4)>
Public UpdatedAt As DateTime
<ProtoMember(5)>
Public Extension As String
Public FileName As String
Public Sub New()
FileId = Guid.NewGuid.ToString
FileId = Guid.NewGuid().ToString
CreatedAt = Date.Now
UpdatedAt = Date.Now
End Sub
End Class

View File

@@ -76,6 +76,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Compression.vb" />
<Compile Include="DocumentObject.vb" />
<Compile Include="FileContainer.vb" />
<Compile Include="Encryption.vb" />
<Compile Include="File.vb" />