Vor Update .net8
This commit is contained in:
@@ -10,9 +10,9 @@ Imports System.Runtime.InteropServices
|
||||
|
||||
<Assembly: AssemblyTitle("TestGUI")>
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("DD JJMS")>
|
||||
<Assembly: AssemblyCompany("")>
|
||||
<Assembly: AssemblyProduct("TestGUI")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2018")>
|
||||
<Assembly: AssemblyCopyright("")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
DevExpress.XtraEditors.TextEdit, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
DevExpress.XtraSpreadsheet.SpreadsheetControl, DevExpress.XtraSpreadsheet.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
|
||||
@@ -6,11 +6,12 @@ Imports DigitalData.GUIs.Common
|
||||
Imports DigitalData.Modules.Base.IDB.Constants
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.EDMI.API
|
||||
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.ZooFlow.State
|
||||
Imports DigitalData.Services.EDMIService
|
||||
Imports DigitalData.Services.EDMIService.GlobalState
|
||||
Imports DigitalData.Services.EDMIService.Methods.GlobalIndexer.ImportFile
|
||||
Imports DigitalData.Services.EDMIService.Methods.IDB
|
||||
|
||||
Public Class frmFilesystem
|
||||
Private EDMIClient As Client
|
||||
@@ -26,35 +27,18 @@ Public Class frmFilesystem
|
||||
Public Property ServiceOnline As Boolean = False
|
||||
Private LogConfig As LogConfig
|
||||
Private MYDD_Filesystem As DigitalData.Modules.Filesystem.File
|
||||
Private _globalState As GlobalState
|
||||
|
||||
Private ShortName As String = "E:\some_test_file.txt"
|
||||
Private LongName As String = "E:\some_test_file_with_some_more_data_and_with_some_more_data_and_with_some_more_data_and_with_some_more_data_and_with_some_more_data_and_with_some_more_data_and_with_some_more_data_and_with_some_more_data_and_with_some_more_data_and_with_some_more.txt"
|
||||
Private LongName As String = "E:\some_test_file_with_some_more_data_and_with_some_more_data_and_with_some_more_data_and_with_some_more_data_and_with_some_more_data_and_with_some_more_data_and_with_some_more_data_and_with_some_more_data_and_with_some_more_data_and_with_some_more_data_and_with_some_more_data_and_with_some_more.txt"
|
||||
|
||||
Private Sub frmFilesystem_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||
Try
|
||||
LogConfig = New LogConfig(LogConfig.PathType.Temp)
|
||||
Logger = LogConfig.GetLogger()
|
||||
MYDD_Filesystem = New DigitalData.Modules.Filesystem.File(LogConfig)
|
||||
|
||||
|
||||
'Using oWriter = IO.File.CreateText("E:\some_test_file.txt")
|
||||
' oWriter.WriteLine("bla bla bla")
|
||||
'End Using
|
||||
|
||||
'IO.File.Copy(ShortName, LongName)
|
||||
|
||||
'Dim oVersion1 = Filesystem.GetVersionedFilename(LongName)
|
||||
'IO.File.Copy(ShortName, oVersion1)
|
||||
|
||||
'Dim oVersion2 = Filesystem.GetVersionedFilename(LongName)
|
||||
'IO.File.Copy(ShortName, oVersion2)
|
||||
Catch ex As Exception
|
||||
|
||||
Finally
|
||||
'IO.File.Delete(ShortName)
|
||||
'IO.File.Delete(LongName)
|
||||
Catch
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
||||
@@ -63,15 +47,11 @@ Public Class frmFilesystem
|
||||
|
||||
Private Sub Button3_Click(sender As Object, e As EventArgs)
|
||||
If SaveFileDialog1.ShowDialog = DialogResult.OK Then
|
||||
' Fallback: einfache Textdatei schreiben
|
||||
System.IO.File.WriteAllText(SaveFileDialog1.FileName, "Some text data")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Class SecureStorageHandler
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
|
||||
@@ -84,7 +64,7 @@ Public Class frmFilesystem
|
||||
txtStatus.Text = STATUS_CONNECTING
|
||||
Dim oResult = EDMIClient.Connect()
|
||||
|
||||
If oResult = True Then
|
||||
If oResult Then
|
||||
ServiceAddress = $"{oIPAddress}:{oPort}"
|
||||
ServiceOnline = True
|
||||
txtStatus.Text = STATUS_CONNECTED
|
||||
@@ -101,37 +81,39 @@ Public Class frmFilesystem
|
||||
|
||||
Logger.Debug("Establishing Database connection with fallback..")
|
||||
My.Database = New DatabaseWithFallback(LogConfig, My.Application.Service.Client, My.DatabaseECM, My.DatabaseIDB)
|
||||
|
||||
InitializeGlobalState()
|
||||
Else
|
||||
ServiceAddress = ""
|
||||
ServiceOnline = True
|
||||
txtStatus.Text = STATUS_FAILED
|
||||
txtStatus.BackColor = Color.LightCoral
|
||||
' TODO: Make a connection test that is as elaborate as this one :D
|
||||
'Select Case oResult
|
||||
' Case ClassService.ConnectionTestResult.NotFound
|
||||
' lblStatus.Text = "Dienst konnte nicht gefunden werden. Bitte überprüfen sie Addresse und Port."
|
||||
' Case ClassService.ConnectionTestResult.EmptyURI
|
||||
' lblStatus.Text = "Bitte tragen Sie eine gültige Dienst Adresse ein."
|
||||
' Case ClassService.ConnectionTestResult.Authentication
|
||||
' lblStatus.Text = "Authentifizierungsfehler. Prüfen Sie, ob sich Ihr Gerät in der korrekten Domäne befindet."
|
||||
' Case Else
|
||||
' lblStatus.Text = "Unbekannter Fehler."
|
||||
'End Select
|
||||
_globalState = Nothing
|
||||
End If
|
||||
Catch ex As Exception
|
||||
_globalState = Nothing
|
||||
If Logger IsNot Nothing Then Logger.Error(ex)
|
||||
MsgBox("Fehler beim Verbindungsaufbau", MsgBoxStyle.Critical, Text)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub Button2_ClickAsync(sender As Object, e As EventArgs) Handles btnStreamSimpleFile.Click
|
||||
' Import a file via EDMI Globix ImportFile API to test Service.EDMIService ImportFileMethod
|
||||
Private Sub btnStreamSimpleFile_ClickAsync(sender As Object, e As EventArgs) Handles btnStreamSimpleFile.Click
|
||||
Try
|
||||
If EDMIClient Is Nothing OrElse ServiceOnline = False Then
|
||||
MsgBox("Bitte zuerst Verbindung zum EDMI Service herstellen.", MsgBoxStyle.Exclamation, Text)
|
||||
Return
|
||||
End If
|
||||
|
||||
If My.DatabaseIDB Is Nothing OrElse My.DatabaseECM Is Nothing Then
|
||||
MsgBox("Bitte zuerst die Datenbankverbindungen herstellen.", MsgBoxStyle.Exclamation, Text)
|
||||
Return
|
||||
End If
|
||||
|
||||
If _globalState Is Nothing Then
|
||||
MsgBox("GlobalState konnte nicht initialisiert werden.", MsgBoxStyle.Exclamation, Text)
|
||||
Return
|
||||
End If
|
||||
|
||||
Using ofd As New OpenFileDialog()
|
||||
ofd.Title = "Datei für Import wählen"
|
||||
ofd.Filter = "Alle Dateien (*.*)|*.*"
|
||||
@@ -143,8 +125,7 @@ Public Class frmFilesystem
|
||||
Dim fi As New FileInfo(oFilePath)
|
||||
Dim fileBytes As Byte() = IO.File.ReadAllBytes(oFilePath)
|
||||
|
||||
' Basic user context for testing
|
||||
Dim user As New DigitalData.Modules.ZooFlow.State.UserState() With {
|
||||
Dim oUser As New UserState With {
|
||||
.UserName = Environment.UserName,
|
||||
.Language = "de-DE",
|
||||
.LanguageId = 1031
|
||||
@@ -154,8 +135,7 @@ Public Class frmFilesystem
|
||||
Dim oIDBDoctypeId As Long = 1
|
||||
Dim oObjectKind As String = "DOC"
|
||||
Dim oProfileId As Integer = 1
|
||||
Dim oAttributes As List(Of UserAttributeValue) = Nothing
|
||||
Dim oOptions As New Options.ImportFileOptions
|
||||
Dim oAttributes As New List(Of UserAttributeValue)
|
||||
|
||||
Logger.Debug("FilePath: [{0}]", oFilePath)
|
||||
Logger.Debug("ObjectStore: [{0}]", oObjectStore)
|
||||
@@ -163,11 +143,71 @@ Public Class frmFilesystem
|
||||
Logger.Debug("ProfileId: [{0}]", oProfileId)
|
||||
Logger.Debug("IDB DoctypeId: [{0}]", oIDBDoctypeId)
|
||||
|
||||
Dim oChecksum As String
|
||||
Using oSha256 As SHA256 = SHA256.Create()
|
||||
oChecksum = BitConverter.ToString(oSha256.ComputeHash(fileBytes)).Replace("-", String.Empty)
|
||||
End Using
|
||||
|
||||
Dim oFileProperties As New FileProperties With {
|
||||
.FileName = fi.FullName,
|
||||
.FileCreatedAt = fi.CreationTimeUtc.ToString("O"),
|
||||
.FileChangedAt = fi.LastWriteTimeUtc.ToString("O"),
|
||||
.FileImportedAt = DateTime.UtcNow,
|
||||
.FileContents = fileBytes,
|
||||
.FileChecksum = oChecksum,
|
||||
.FileInfoRaw = fi
|
||||
}
|
||||
|
||||
Dim oRequest As New Globix_ImportFileRequest With {
|
||||
.File = oFileProperties,
|
||||
.ProfileId = oProfileId,
|
||||
.IDBDoctypeId = oIDBDoctypeId,
|
||||
.KindType = oObjectKind,
|
||||
.StoreName = oObjectStore,
|
||||
.AttributeValues = oAttributes,
|
||||
.User = oUser
|
||||
}
|
||||
|
||||
Dim oImportMethod = New ImportFileMethod(LogConfig, My.DatabaseIDB, My.DatabaseECM, _globalState)
|
||||
Dim oResponse = oImportMethod.Run(oRequest)
|
||||
|
||||
If oResponse IsNot Nothing AndAlso oResponse.ObjectId > 0 Then
|
||||
Logger.Info("Import erfolgreich abgeschlossen. ObjectId [{0}]", oResponse.ObjectId)
|
||||
MsgBox($"Import erfolgreich. ObjectId: {oResponse.ObjectId}", MsgBoxStyle.Information, Text)
|
||||
Else
|
||||
Logger.Warn("ImportFile lieferte kein erfolgreiches Ergebnis.")
|
||||
MsgBox("Import konnte nicht durchgeführt werden.", MsgBoxStyle.Exclamation, Text)
|
||||
End If
|
||||
End Using
|
||||
Catch ex As Exception
|
||||
If Logger IsNot Nothing Then Logger.Error(ex)
|
||||
MsgBox("Fehler beim Datei-Import.", MsgBoxStyle.Critical, Text)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub InitializeGlobalState()
|
||||
Try
|
||||
_globalState = New GlobalState(LogConfig, My.DatabaseIDB, My.DatabaseECM)
|
||||
_globalState.LoadObjectStores()
|
||||
_globalState.LoadConnections()
|
||||
_globalState.LoadDoctypes()
|
||||
|
||||
Dim oConfig As New Config With {
|
||||
.ClientConfig = New Config.ClientConfiguration With {
|
||||
.ForceDirectDatabaseAccess = True
|
||||
}
|
||||
}
|
||||
|
||||
_globalState.LoadClientConfig(oConfig)
|
||||
|
||||
Logger.Info("GlobalState init: ObjectStores [{0}], Connections [{1}], Doctypes [{2}]",
|
||||
_globalState.ObjectStores.Count,
|
||||
_globalState.Connections.Count,
|
||||
_globalState.Doctypes.Count)
|
||||
Catch ex As Exception
|
||||
_globalState = Nothing
|
||||
Logger.Error(ex)
|
||||
MsgBox("GlobalState konnte nicht initialisiert werden.", MsgBoxStyle.Exclamation, Text)
|
||||
End Try
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user