Add WidigShared Project, seperate all logig into this shared project
This commit is contained in:
parent
3d55af8502
commit
b8250583e1
@ -7,10 +7,10 @@ Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "WIDigConsoleApp", "WIDigCon
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "WIDigForm", "WIDigForm\WIDigForm.vbproj", "{75B536FE-5D8D-42A9-8519-0041FABC994B}"
|
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "WIDigForm", "WIDigForm\WIDigForm.vbproj", "{75B536FE-5D8D-42A9-8519-0041FABC994B}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "SetupWIX", "SetupWIX\SetupWIX.wixproj", "{3943E21A-DD2B-4C74-B06F-9A39CAA70E11}"
|
|
||||||
EndProject
|
|
||||||
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "SetupWIXVS19", "SetupWIXVS19\SetupWIXVS19.wixproj", "{3C1B87F6-CDE9-49AF-81BB-F697D8BC7D0E}"
|
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "SetupWIXVS19", "SetupWIXVS19\SetupWIXVS19.wixproj", "{3C1B87F6-CDE9-49AF-81BB-F697D8BC7D0E}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "WiDigShared", "WiDigShared\WiDigShared.vbproj", "{A5D032D4-ABDC-44BF-8666-5FBE42AF0AB7}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@ -35,18 +35,20 @@ Global
|
|||||||
{75B536FE-5D8D-42A9-8519-0041FABC994B}.Release|Any CPU.Build.0 = Release|Any CPU
|
{75B536FE-5D8D-42A9-8519-0041FABC994B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{75B536FE-5D8D-42A9-8519-0041FABC994B}.Release|x86.ActiveCfg = Release|Any CPU
|
{75B536FE-5D8D-42A9-8519-0041FABC994B}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
{75B536FE-5D8D-42A9-8519-0041FABC994B}.Release|x86.Build.0 = Release|Any CPU
|
{75B536FE-5D8D-42A9-8519-0041FABC994B}.Release|x86.Build.0 = Release|Any CPU
|
||||||
{3943E21A-DD2B-4C74-B06F-9A39CAA70E11}.Debug|Any CPU.ActiveCfg = Debug|x86
|
|
||||||
{3943E21A-DD2B-4C74-B06F-9A39CAA70E11}.Debug|x86.ActiveCfg = Debug|x86
|
|
||||||
{3943E21A-DD2B-4C74-B06F-9A39CAA70E11}.Debug|x86.Build.0 = Debug|x86
|
|
||||||
{3943E21A-DD2B-4C74-B06F-9A39CAA70E11}.Release|Any CPU.ActiveCfg = Release|x86
|
|
||||||
{3943E21A-DD2B-4C74-B06F-9A39CAA70E11}.Release|x86.ActiveCfg = Release|x86
|
|
||||||
{3943E21A-DD2B-4C74-B06F-9A39CAA70E11}.Release|x86.Build.0 = Release|x86
|
|
||||||
{3C1B87F6-CDE9-49AF-81BB-F697D8BC7D0E}.Debug|Any CPU.ActiveCfg = Debug|x86
|
{3C1B87F6-CDE9-49AF-81BB-F697D8BC7D0E}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||||
{3C1B87F6-CDE9-49AF-81BB-F697D8BC7D0E}.Debug|x86.ActiveCfg = Debug|x86
|
{3C1B87F6-CDE9-49AF-81BB-F697D8BC7D0E}.Debug|x86.ActiveCfg = Debug|x86
|
||||||
{3C1B87F6-CDE9-49AF-81BB-F697D8BC7D0E}.Debug|x86.Build.0 = Debug|x86
|
{3C1B87F6-CDE9-49AF-81BB-F697D8BC7D0E}.Debug|x86.Build.0 = Debug|x86
|
||||||
{3C1B87F6-CDE9-49AF-81BB-F697D8BC7D0E}.Release|Any CPU.ActiveCfg = Release|x86
|
{3C1B87F6-CDE9-49AF-81BB-F697D8BC7D0E}.Release|Any CPU.ActiveCfg = Release|x86
|
||||||
{3C1B87F6-CDE9-49AF-81BB-F697D8BC7D0E}.Release|x86.ActiveCfg = Release|x86
|
{3C1B87F6-CDE9-49AF-81BB-F697D8BC7D0E}.Release|x86.ActiveCfg = Release|x86
|
||||||
{3C1B87F6-CDE9-49AF-81BB-F697D8BC7D0E}.Release|x86.Build.0 = Release|x86
|
{3C1B87F6-CDE9-49AF-81BB-F697D8BC7D0E}.Release|x86.Build.0 = Release|x86
|
||||||
|
{A5D032D4-ABDC-44BF-8666-5FBE42AF0AB7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{A5D032D4-ABDC-44BF-8666-5FBE42AF0AB7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{A5D032D4-ABDC-44BF-8666-5FBE42AF0AB7}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{A5D032D4-ABDC-44BF-8666-5FBE42AF0AB7}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{A5D032D4-ABDC-44BF-8666-5FBE42AF0AB7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{A5D032D4-ABDC-44BF-8666-5FBE42AF0AB7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{A5D032D4-ABDC-44BF-8666-5FBE42AF0AB7}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{A5D032D4-ABDC-44BF-8666-5FBE42AF0AB7}.Release|x86.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@ -1,68 +0,0 @@
|
|||||||
Imports System.Security.Cryptography
|
|
||||||
Public Class ClassEncryption
|
|
||||||
Private TripleDes As New TripleDESCryptoServiceProvider
|
|
||||||
Sub New(ByVal key As String)
|
|
||||||
' Initialize the crypto provider.
|
|
||||||
TripleDes.Key = TruncateHash(key, TripleDes.KeySize \ 8)
|
|
||||||
TripleDes.IV = TruncateHash("", TripleDes.BlockSize \ 8)
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Private Function TruncateHash(
|
|
||||||
ByVal key As String,
|
|
||||||
ByVal length As Integer) As Byte()
|
|
||||||
|
|
||||||
Dim sha1 As New SHA1CryptoServiceProvider
|
|
||||||
|
|
||||||
' Hash the key.
|
|
||||||
Dim keyBytes() As Byte =
|
|
||||||
System.Text.Encoding.Unicode.GetBytes(key)
|
|
||||||
Dim hash() As Byte = sha1.ComputeHash(keyBytes)
|
|
||||||
|
|
||||||
' Truncate or pad the hash.
|
|
||||||
ReDim Preserve hash(length - 1)
|
|
||||||
Return hash
|
|
||||||
End Function
|
|
||||||
Public Function EncryptData(
|
|
||||||
ByVal plaintext As String) As String
|
|
||||||
|
|
||||||
' Convert the plaintext string to a byte array.
|
|
||||||
Dim plaintextBytes() As Byte =
|
|
||||||
System.Text.Encoding.Unicode.GetBytes("!Didalog35452Heuchelheim=" & plaintext)
|
|
||||||
|
|
||||||
' Create the stream.
|
|
||||||
Dim ms As New System.IO.MemoryStream
|
|
||||||
' Create the encoder to write to the stream.
|
|
||||||
Dim encStream As New CryptoStream(ms,
|
|
||||||
TripleDes.CreateEncryptor(),
|
|
||||||
System.Security.Cryptography.CryptoStreamMode.Write)
|
|
||||||
|
|
||||||
' Use the crypto stream to write the byte array to the stream.
|
|
||||||
encStream.Write(plaintextBytes, 0, plaintextBytes.Length)
|
|
||||||
encStream.FlushFinalBlock()
|
|
||||||
|
|
||||||
' Convert the encrypted stream to a printable string.
|
|
||||||
Return Convert.ToBase64String(ms.ToArray)
|
|
||||||
End Function
|
|
||||||
'Entschlüsselt die Zeichenfolge
|
|
||||||
Public Function DecryptData(
|
|
||||||
ByVal encryptedtext As String) As String
|
|
||||||
|
|
||||||
' Convert the encrypted text string to a byte array.
|
|
||||||
Dim encryptedBytes() As Byte = Convert.FromBase64String(encryptedtext)
|
|
||||||
|
|
||||||
' Create the stream.
|
|
||||||
Dim ms As New System.IO.MemoryStream
|
|
||||||
' Create the decoder to write to the stream.
|
|
||||||
Dim decStream As New CryptoStream(ms,
|
|
||||||
TripleDes.CreateDecryptor(),
|
|
||||||
System.Security.Cryptography.CryptoStreamMode.Write)
|
|
||||||
|
|
||||||
' Use the crypto stream to write the byte array to the stream.
|
|
||||||
decStream.Write(encryptedBytes, 0, encryptedBytes.Length)
|
|
||||||
decStream.FlushFinalBlock()
|
|
||||||
Dim result = System.Text.Encoding.Unicode.GetString(ms.ToArray)
|
|
||||||
result = result.Replace("!Didalog35452Heuchelheim=", "")
|
|
||||||
' Convert the plaintext stream to a string.
|
|
||||||
Return result
|
|
||||||
End Function
|
|
||||||
End Class
|
|
||||||
@ -5,391 +5,88 @@ Imports DigitalData.Modules.Config
|
|||||||
Imports System.IO
|
Imports System.IO
|
||||||
Imports System.Text.RegularExpressions
|
Imports System.Text.RegularExpressions
|
||||||
Imports DigitalData.Modules.Database
|
Imports DigitalData.Modules.Database
|
||||||
|
Imports DigitalData.GUIs.WiDigShared
|
||||||
|
|
||||||
Module ModuleMain
|
Module ModuleMain
|
||||||
Private _ArgumentLength As Integer
|
Private _ArgumentLength As Integer
|
||||||
Public _database As MSSQLServer
|
Public _database As MSSQLServer
|
||||||
Public oRegExArg As String
|
Public oRegExArg As String
|
||||||
|
Public LogConfig As LogConfig
|
||||||
Public oRegex As New Regex("([\s\S]+)\={([\s\S]+)}")
|
Public Logger As Logger
|
||||||
|
Public Config As ConfigManager(Of ClassConfig)
|
||||||
Public Const CODE_SUCCESS = 0
|
|
||||||
Public Const CODE_ERROR = 1
|
|
||||||
|
|
||||||
Public Const MODE_OVERWRITE = "IMPO"
|
|
||||||
Public Const MODE_VERSION = "IMPV"
|
|
||||||
Public Const MODE_NACHINDEXIERUNG = "NI"
|
|
||||||
|
|
||||||
Public Const PARAM_SOURCE = "-Source@"
|
|
||||||
Public Const PARAM_MODE = "-Mode@"
|
|
||||||
Public Const PARAM_TARGET = "-Target@"
|
|
||||||
Public Const PARAM_WMTO = "-WMOT@"
|
|
||||||
Public Const PARAM_INDEX = "-index@"
|
|
||||||
|
|
||||||
Public Function Main(CommandLineArguments As String()) As Integer
|
Public Function Main(CommandLineArguments As String()) As Integer
|
||||||
Dim oReturnResult As Integer
|
Dim oWiDig As ClassWIDig
|
||||||
|
|
||||||
Try
|
Try
|
||||||
oReturnResult = CODE_SUCCESS
|
System.Console.WriteLine($"Initializing WIDig...")
|
||||||
' Console.WriteLine("Starting up WIDig...")
|
System.Console.WriteLine($"Logging...")
|
||||||
Dim opath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
|
LogConfig = New LogConfig(LogConfig.PathType.AppData, Nothing, "Console", "Digital Data", "WIDig")
|
||||||
Dim oLogConfig As New LogConfig(LogConfig.PathType.AppData, Nothing, "Console", "Digital Data", "WIDig")
|
Logger = LogConfig.GetLogger
|
||||||
|
|
||||||
LOGCONFIG = oLogConfig
|
System.Console.WriteLine($"Config...")
|
||||||
LOGGER = LOGCONFIG.GetLogger
|
Config = New ConfigManager(Of ClassConfig)(LogConfig, ClassWIDig.GetAppDataPath, ClassWIDig.GetProgramDataPath)
|
||||||
InitUserConfig()
|
LogConfig.Debug = Config.Config.LOG_DEBUG
|
||||||
LOGCONFIG.Debug = CONFIG.Config.LOG_DEBUG
|
|
||||||
LOGGER = LOGCONFIG.GetLogger
|
|
||||||
Dim oUserPW = GetUserPWPlain()
|
|
||||||
|
|
||||||
|
System.Console.WriteLine($"Main Class...")
|
||||||
|
oWiDig = New ClassWIDig(LogConfig, Config.Config)
|
||||||
|
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
Logger.Warn("Could not initialize WiDig because of an error: [{0}]", ex.Message)
|
||||||
|
Logger.Error(ex)
|
||||||
|
|
||||||
|
Return ClassWIDig.CODE_ERROR
|
||||||
|
End Try
|
||||||
|
|
||||||
|
Try
|
||||||
System.Console.WriteLine($"Starting up WIDig...")
|
System.Console.WriteLine($"Starting up WIDig...")
|
||||||
|
|
||||||
If Connect2Windream(oUserPW) = False Then
|
Dim oUserPW = oWiDig.GetUserPWPlain()
|
||||||
|
If oWiDig.Connect2Windream(oUserPW) = False Then
|
||||||
Throw New ApplicationException("Could not initialize windream")
|
Throw New ApplicationException("Could not initialize windream")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
System.Console.WriteLine($"Windream initialized!")
|
System.Console.WriteLine($"Windream initialized!")
|
||||||
|
|
||||||
If InitDatabase() = False Then
|
If oWiDig.InitDatabase() = False Then
|
||||||
Throw New ApplicationException("Could not initialize DB")
|
Throw New ApplicationException("Could not initialize DB")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
System.Console.WriteLine($"Database initialized!")
|
System.Console.WriteLine($"Database initialized!")
|
||||||
|
|
||||||
If Load_DB_DAta() = False Then
|
If oWiDig.ParseArgs(CommandLineArguments) = False Then
|
||||||
Throw New ApplicationException("Could not load Regex from Database")
|
|
||||||
End If
|
|
||||||
|
|
||||||
System.Console.WriteLine($"Regex loaded from Database!")
|
|
||||||
|
|
||||||
If ParseArgs(CommandLineArguments) = False Then
|
|
||||||
Throw New ApplicationException("Could not parse command line arguments")
|
Throw New ApplicationException("Could not parse command line arguments")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
System.Console.WriteLine($"Command line arguments parsed!")
|
System.Console.WriteLine($"Command line arguments parsed!")
|
||||||
|
|
||||||
If StreamORIndexFile() = False Then
|
If oWiDig.StreamORIndexFile() = False Then
|
||||||
Throw New ApplicationException("Could not stream or index file")
|
Throw New ApplicationException("Could not stream or index file")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
System.Console.WriteLine($"File indexed or streamed!")
|
System.Console.WriteLine($"File indexed or streamed!")
|
||||||
|
|
||||||
' Brauchen Sie das überhaupt?
|
' Brauchen Sie das überhaupt?
|
||||||
If oErrorParse = True Or oErrorImport = True Then
|
If oWiDig.ErrorWhileParsing = True Or oWiDig.ErrorWhileImporting Then
|
||||||
Throw New ApplicationException(oErrorMessage)
|
Throw New ApplicationException(oWiDig.ErrorMessage)
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Return CODE_SUCCESS
|
Return ClassWIDig.CODE_SUCCESS
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
LOGGER.Warn("Could not process file because of an error: {0}", oErrorMessage)
|
Logger.Warn("Could not process file because of an error: [{0}]", oWiDig.ErrorMessage)
|
||||||
LOGGER.Warn("Error at Parse Stage: [{0}]", oErrorParse)
|
Logger.Warn("Error at Parse Stage: [{0}]", oWiDig.ErrorWhileParsing)
|
||||||
LOGGER.Warn("Error at Import Stage: [{0}]", oErrorImport)
|
Logger.Warn("Error at Import Stage: [{0}]", oWiDig.ErrorWhileimporting)
|
||||||
LOGGER.Error(ex)
|
Logger.Error(ex)
|
||||||
|
|
||||||
Return CODE_ERROR
|
Return ClassWIDig.CODE_ERROR
|
||||||
End Try
|
|
||||||
|
|
||||||
End Function
|
|
||||||
Public Sub InitUserConfig()
|
|
||||||
Dim oProgramDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Digital Data", "WIDig")
|
|
||||||
Dim oUserAppDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Digital Data", "WIDig")
|
|
||||||
CONFIG = New ConfigManager(Of ClassConfig)(LOGCONFIG, oUserAppDataPath, oProgramDataPath)
|
|
||||||
End Sub
|
|
||||||
Public Function InitDatabase() As Boolean
|
|
||||||
If CONFIG.Config.ConnectionString.Length = 0 Then
|
|
||||||
Return False
|
|
||||||
End If
|
|
||||||
|
|
||||||
Try
|
|
||||||
_database = New MSSQLServer(LOGCONFIG, CONFIG.Config.ConnectionString)
|
|
||||||
If _database.DBInitialized = True Then
|
|
||||||
Return True
|
|
||||||
Else
|
|
||||||
Return False
|
|
||||||
End If
|
|
||||||
|
|
||||||
Catch ex As Exception
|
|
||||||
LOGGER.Error(ex)
|
|
||||||
Return False
|
|
||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
Public Function Load_DB_DAta()
|
|
||||||
Try
|
|
||||||
Dim oSql = "SELECT [REGEX] FROM [TBDD_FUNCTION_REGEX] WHERE FUNCTION_NAME = 'WM-INDEXER-INDEX_GROUP'"
|
|
||||||
oRegExArg = _database.GetScalarValue(oSql, 120)
|
|
||||||
If oRegExArg.Length = 0 Then
|
|
||||||
oRegExArg = 0
|
|
||||||
End If
|
|
||||||
Return True
|
|
||||||
Catch ex As Exception
|
|
||||||
LOGGER.Error(ex)
|
|
||||||
Return False
|
|
||||||
End Try
|
|
||||||
End Function
|
|
||||||
Private Function Connect2Windream(oPW As String)
|
|
||||||
Try
|
|
||||||
WINDREAM = New Windream(LOGCONFIG, False, CONFIG.Config.WMDrive, CONFIG.Config.WMRelPath, True, CONFIG.Config.WMServer, CONFIG.Config.WMUsername, oPW, CONFIG.Config.Domain)
|
|
||||||
If Not IsNothing(WINDREAM) Then
|
|
||||||
If WINDREAM.SessionLoggedin = True Then
|
|
||||||
LOGGER.Debug("windream initialisiert")
|
|
||||||
Return True
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
Return False
|
|
||||||
Catch ex As Exception
|
|
||||||
LOGGER.Warn("CHECKING WMConnectivity: " & ex.Message)
|
|
||||||
Return False
|
|
||||||
End Try
|
|
||||||
End Function
|
|
||||||
Private Function GetUserPWPlain()
|
|
||||||
Try
|
|
||||||
Dim oPassword As String
|
|
||||||
Dim oEncryption As New ClassEncryption("!35452didalog=")
|
|
||||||
If CONFIG.Config.WMUserPW = String.Empty Then
|
|
||||||
oPassword = ""
|
|
||||||
Else
|
|
||||||
oPassword = oEncryption.DecryptData(CONFIG.Config.WMUserPW)
|
|
||||||
End If
|
|
||||||
|
|
||||||
Return oPassword
|
|
||||||
Catch ex As Exception
|
|
||||||
LOGGER.Warn("Error in GetUserPWPlain - the password [" & CONFIG.Config.WMUserPW & "] could not be decrypted", False)
|
|
||||||
Return String.Empty
|
|
||||||
End Try
|
|
||||||
End Function
|
|
||||||
Public Function ParseArgs(pArguments As String(), Optional pTest As Boolean = False)
|
|
||||||
Dim oINDEXInfoStarted As Boolean = False
|
|
||||||
Dim oINDEXInfotemp As String = ""
|
|
||||||
Try
|
|
||||||
If pArguments.Length <= 3 Then
|
|
||||||
_ArgumentLength = pArguments.Length
|
|
||||||
LOGGER.Warn($"Insufficient number of arguments [{pArguments.Length}]!")
|
|
||||||
System.Console.WriteLine($"Insufficient number of arguments - {Now.ToString}")
|
|
||||||
oErrorParse = True
|
|
||||||
Return False
|
|
||||||
End If
|
|
||||||
|
|
||||||
Dim oCount As Integer = 0
|
|
||||||
For Each oArg As String In pArguments
|
|
||||||
LOGGER.Debug($"[{oCount}] {oArg}")
|
|
||||||
oArg = oArg.Replace("""", "")
|
|
||||||
If oArg.StartsWith(PARAM_SOURCE) Then
|
|
||||||
oSourceFile = oArg.Replace(PARAM_SOURCE, "")
|
|
||||||
If IsNumeric(oSourceFile) Then
|
|
||||||
LOGGER.Info($"SourceFile seems to be a DocID [{oSourceFile}]")
|
|
||||||
Dim oSQL = $"SELECT [dbo].[FNDD_GET_WINDREAM_FILE_PATH] ({oSourceFile})"
|
|
||||||
oSourceFile = _database.GetScalarValue(oSQL)
|
|
||||||
End If
|
|
||||||
If System.IO.File.Exists(oSourceFile) = False Then
|
|
||||||
LOGGER.Warn($"Parser@Sourcefile - File [{oSourceFile}] is not existing!")
|
|
||||||
oErrorMessage &= vbNewLine & $"Parser@Sourcefile - File [{oSourceFile}] is not existing!"
|
|
||||||
oErrorParse = True
|
|
||||||
Return False
|
|
||||||
End If
|
|
||||||
|
|
||||||
ElseIf oArg.StartsWith(PARAM_MODE) Then
|
|
||||||
oMode = oArg.Replace(PARAM_MODE, "").ToUpper
|
|
||||||
|
|
||||||
ElseIf oArg.StartsWith(PARAM_TARGET) Then
|
|
||||||
oTargetPath = oArg.Replace(PARAM_TARGET, "")
|
|
||||||
If IsNumeric(oTargetPath) Then
|
|
||||||
LOGGER.Info($"Target seems to be a DocID [{oTargetPath}]")
|
|
||||||
Dim oSQL = $"SELECT [dbo].[FNDD_GET_WINDREAM_FILE_PATH] ({oTargetPath})"
|
|
||||||
oSourceFile = _database.GetScalarValue(oSQL)
|
|
||||||
End If
|
|
||||||
Dim oWMFolder = System.IO.Path.GetDirectoryName(oTargetPath)
|
|
||||||
Dim oWindowsPath = oTargetPath
|
|
||||||
oExtension = Path.GetExtension(oWindowsPath)
|
|
||||||
Dim oNormalizePath = WINDREAM.GetNormalizedPath(oTargetPath)
|
|
||||||
If WINDREAM.TestFileExists(oTargetPath) = False Then
|
|
||||||
LOGGER.Info($"WMFile [{oTargetPath}] not existing!")
|
|
||||||
End If
|
|
||||||
If oMode = MODE_VERSION Then
|
|
||||||
Dim oWMCheckPath = WINDREAM.VersionWMFilename(oTargetPath, System.IO.Path.GetExtension(oTargetPath))
|
|
||||||
If oNormalizePath.ToUpper <> oWMCheckPath.ToString.ToUpper Then
|
|
||||||
LOGGER.Info($"Target [{oNormalizePath}] already existed!! - NewWMFilename [{oWMCheckPath}]")
|
|
||||||
oTargetPath = oWMCheckPath
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
'Checks and creates the path if necessary
|
|
||||||
WINDREAM.NewFolder(oTargetPath, oExtension)
|
|
||||||
|
|
||||||
ElseIf oArg.StartsWith(PARAM_WMTO) Then
|
|
||||||
oWMObjecttype = oArg.Replace(PARAM_WMTO, "")
|
|
||||||
Dim oexists As Boolean = False
|
|
||||||
Dim myWMOTypes = WINDREAM.ObjectTypes
|
|
||||||
For Each otype As String In myWMOTypes
|
|
||||||
If oWMObjecttype = otype Then
|
|
||||||
oexists = True
|
|
||||||
Exit For
|
|
||||||
End If
|
|
||||||
Next
|
|
||||||
If oexists = False Then
|
|
||||||
LOGGER.Info($"WMObjekttype [{oWMObjecttype}] not existing!!")
|
|
||||||
oErrorMessage &= vbNewLine & $"WMObjekttype [{oWMObjecttype}] not existing!!"
|
|
||||||
Return False
|
|
||||||
oErrorParse = True
|
|
||||||
Else
|
|
||||||
WMIndices = WINDREAM.GetIndiciesByObjecttype(oWMObjecttype)
|
|
||||||
End If
|
|
||||||
ElseIf oArg.StartsWith(PARAM_INDEX) Then
|
|
||||||
oINDEXInfotemp = oArg
|
|
||||||
oINDEXInfoStarted = True
|
|
||||||
oINDEXInfotemp = oINDEXInfotemp.Replace(PARAM_INDEX, "")
|
|
||||||
|
|
||||||
Else
|
|
||||||
If oINDEXInfoStarted Then
|
|
||||||
oINDEXInfotemp &= " " & oArg
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
oCount += 1
|
|
||||||
Next
|
|
||||||
|
|
||||||
LOGGER.Debug("INDEXInfoTemp: [{0}]", oINDEXInfotemp)
|
|
||||||
|
|
||||||
Dim oIndexparts As List(Of String) = oINDEXInfotemp.
|
|
||||||
Split(New String() {"#~#"}, StringSplitOptions.RemoveEmptyEntries).
|
|
||||||
ToList()
|
|
||||||
|
|
||||||
For Each oIndexPart As String In oIndexparts
|
|
||||||
LOGGER.Debug(oIndexPart)
|
|
||||||
Next
|
|
||||||
|
|
||||||
LOGGER.Info($" [{oIndexparts.Count}] Indices parsed")
|
|
||||||
oIndexArr = oIndexparts
|
|
||||||
Return True
|
|
||||||
Catch ex As Exception
|
|
||||||
LOGGER.Error(ex)
|
|
||||||
LOGGER.Warn("Error in ParseArgs:" & vbNewLine & ex.Message)
|
|
||||||
oErrorMessage &= vbNewLine & "Error in ParseArgs:" & vbNewLine & ex.Message
|
|
||||||
oErrorParse = True
|
|
||||||
System.Console.WriteLine($"Error in ParseArgs - {Now.ToString}")
|
|
||||||
|
|
||||||
Return False
|
|
||||||
End Try
|
|
||||||
End Function
|
|
||||||
Public Function StreamORIndexFile()
|
|
||||||
Try
|
|
||||||
Dim oResult As Boolean = False
|
|
||||||
If oMode = MODE_VERSION Then
|
|
||||||
oResult = WINDREAM.NewFileStream(oSourceFile, oTargetPath)
|
|
||||||
ElseIf oMode = MODE_OVERWRITE Then
|
|
||||||
Dim oDeleted = WINDREAM.RemoveFile(oTargetPath)
|
|
||||||
If oDeleted = True Then
|
|
||||||
oResult = WINDREAM.NewFileStream(oSourceFile, oTargetPath)
|
|
||||||
Else
|
|
||||||
LOGGER.Warn($"Mode ImportOverwrite is active - but WMFile could not be deleted!!")
|
|
||||||
End If
|
|
||||||
ElseIf oMode = MODE_NACHINDEXIERUNG Then
|
|
||||||
oResult = True
|
|
||||||
End If
|
|
||||||
|
|
||||||
If oResult = True Then
|
|
||||||
If oMode <> MODE_NACHINDEXIERUNG Then
|
|
||||||
LOGGER.Info($"File successfully streamed to windream [{oTargetPath}]! Now indexing...")
|
|
||||||
End If
|
|
||||||
|
|
||||||
For Each oIndex As String In oIndexArr
|
|
||||||
Dim oMatch As Match = oRegex.Match(oIndex)
|
|
||||||
|
|
||||||
If oMatch.Success Then
|
|
||||||
|
|
||||||
Dim oIndexName = oMatch.Groups(1)?.Value
|
|
||||||
Dim oIndexValues = oMatch.Groups.Item(2)?.Value
|
|
||||||
Dim oSplitValue = New String() {"~#~"}
|
|
||||||
|
|
||||||
Dim oIndexValueArray = oIndexValues.Split(oSplitValue, StringSplitOptions.RemoveEmptyEntries)
|
|
||||||
Dim oIndexResult = False
|
|
||||||
|
|
||||||
LOGGER.Info("Setting Index [{0}] to [{1}].", oIndexName, oIndexValues)
|
|
||||||
|
|
||||||
If WINDREAM.TestIndexNameIsVectorIndex(oIndexName) Then
|
|
||||||
Dim oCombinedIndexValues = WINDREAM.GetVectorData(oTargetPath, oIndexName, oIndexValueArray, False)
|
|
||||||
oIndexResult = WINDREAM.SetFileIndex(oTargetPath, oIndexName, oCombinedIndexValues.ToList, oWMObjecttype)
|
|
||||||
Else
|
|
||||||
oIndexResult = WINDREAM.SetFileIndex(oTargetPath, oIndexName, oIndexValueArray(0), oWMObjecttype)
|
|
||||||
End If
|
|
||||||
|
|
||||||
oResult = oIndexResult
|
|
||||||
Else
|
|
||||||
oResult = False
|
|
||||||
End If
|
|
||||||
|
|
||||||
If oResult = False Then
|
|
||||||
LOGGER.Warn("Indexing failed. Exiting.")
|
|
||||||
Exit For
|
|
||||||
End If
|
|
||||||
Next
|
|
||||||
End If
|
|
||||||
|
|
||||||
If oResult = True Then
|
|
||||||
LOGGER.Info("## All Tasks finished ##")
|
|
||||||
oErrorImport = False
|
|
||||||
End If
|
|
||||||
|
|
||||||
'If oResult = True Then
|
|
||||||
' If oMode <> MODE_NACHINDEXIERUNG Then
|
|
||||||
' LOGGER.Info($"File successfully streamed to windream [{oTargetPath}]! Now indexing...")
|
|
||||||
' End If
|
|
||||||
|
|
||||||
' For Each oIndex2 As String In oIndexArr
|
|
||||||
' Dim oIndexInfo() = oIndex2.Split("={")
|
|
||||||
' Dim oIndexName = oIndexInfo(0)
|
|
||||||
' Dim oIndexvalue
|
|
||||||
' Dim r As Regex = New Regex(oRegExArg, RegexOptions.IgnoreCase)
|
|
||||||
' ' ' Match the regular expression pattern against a text string.
|
|
||||||
' Dim m As Match = r.Match(oIndex2)
|
|
||||||
' Do While m.Success
|
|
||||||
|
|
||||||
' ' oClearedBodyText = oClearedBodyText.Replace(m.Value, "")
|
|
||||||
' 'Dim g As Group = m.Groups(1)
|
|
||||||
' Dim g1 As Group = m.Groups(2)
|
|
||||||
' Dim g2 As Group = m.Groups(3)
|
|
||||||
|
|
||||||
' If Not IsNothing(g2.Value) Then
|
|
||||||
' oIndexvalue = g2.Value
|
|
||||||
' Console.WriteLine($"Indexvalue: {oIndexvalue}")
|
|
||||||
' End If
|
|
||||||
|
|
||||||
' If Len(oIndexvalue) > 0 Then
|
|
||||||
' If WMIndices.Contains(oIndexName) Then
|
|
||||||
' LOGGER.Info($"Setting Index: oIndexName [{oIndexName}] - oIndexvalue [{oIndexvalue}]")
|
|
||||||
|
|
||||||
' 'DEBUG
|
|
||||||
' oIndexvalue = New List(Of String) From {"Wert 1", "Wert 2", "wert 3"}
|
|
||||||
' 'DEBUG
|
|
||||||
|
|
||||||
' If WINDREAM.SetFileIndex(oTargetPath, oIndexName, oIndexvalue, oWMObjecttype) = False Then
|
|
||||||
' LOGGER.Info($"Index could not be set...")
|
|
||||||
' If WINDREAM.RemoveFile(oTargetPath) = True Then
|
|
||||||
' LOGGER.Info($"File deleted after error!")
|
|
||||||
' End If
|
|
||||||
' oResult = False
|
|
||||||
' Exit For
|
|
||||||
' End If
|
|
||||||
' Else
|
|
||||||
' LOGGER.Warn($"Transmitted index with name [{oIndexName}] is not existing in WM Objecttype!")
|
|
||||||
' If WINDREAM.RemoveFile(oTargetPath) = True Then
|
|
||||||
' LOGGER.Info($"File deleted after error!")
|
|
||||||
' End If
|
|
||||||
' oResult = False
|
|
||||||
' Exit For
|
|
||||||
' End If
|
|
||||||
' End If
|
|
||||||
' m = m.NextMatch()
|
|
||||||
' Loop
|
|
||||||
' Next
|
|
||||||
' If oResult = True Then
|
|
||||||
' LOGGER.Info("## All Tasks finished ##")
|
|
||||||
' oErrorImport = False
|
|
||||||
' End If
|
|
||||||
'End If
|
|
||||||
|
|
||||||
Return oResult
|
|
||||||
Catch ex As Exception
|
|
||||||
LOGGER.Warn($"Unexpected Error in StreamORIndexFile: {ex.Message}")
|
|
||||||
LOGGER.Error(ex)
|
|
||||||
Return False
|
|
||||||
End Try
|
|
||||||
End Function
|
|
||||||
End Module
|
End Module
|
||||||
|
|||||||
@ -1,19 +0,0 @@
|
|||||||
Imports DigitalData.Modules.Logging
|
|
||||||
Imports DigitalData.Modules.Windream
|
|
||||||
Imports DigitalData.Modules.Config
|
|
||||||
Module ModuleRuntime
|
|
||||||
Public LOGCONFIG As LogConfig
|
|
||||||
Public LOGGER As Logger
|
|
||||||
Public WINDREAM As Windream
|
|
||||||
Public CONFIG As ConfigManager(Of ClassConfig)
|
|
||||||
Public oMode As String = "IMPV"
|
|
||||||
Public oErrorParse As Boolean = False
|
|
||||||
Public oErrorMessage As String
|
|
||||||
Public oErrorImport As Boolean = True
|
|
||||||
Public oSourceFile As String
|
|
||||||
Public oTargetPath As String
|
|
||||||
Public oWMObjecttype As String
|
|
||||||
Public oIndexArr As List(Of String)
|
|
||||||
Public WMIndices As List(Of String)
|
|
||||||
Public oExtension As String
|
|
||||||
End Module
|
|
||||||
@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
|||||||
' übernehmen, indem Sie "*" eingeben:
|
' übernehmen, indem Sie "*" eingeben:
|
||||||
' <Assembly: AssemblyVersion("1.0.*")>
|
' <Assembly: AssemblyVersion("1.0.*")>
|
||||||
|
|
||||||
<Assembly: AssemblyVersion("1.3.6.0")>
|
<Assembly: AssemblyVersion("1.3.8.0")>
|
||||||
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
||||||
|
|||||||
@ -53,6 +53,10 @@
|
|||||||
<Reference Include="DigitalData.Modules.Database">
|
<Reference Include="DigitalData.Modules.Database">
|
||||||
<HintPath>..\..\DDMonorepo\Modules.Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath>
|
<HintPath>..\..\DDMonorepo\Modules.Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="DigitalData.Modules.Encryption, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\..\DDMonorepo\Encryption\bin\Debug\DigitalData.Modules.Encryption.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="DigitalData.Modules.Logging, Version=2.1.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="DigitalData.Modules.Logging, Version=2.1.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\..\DDMonorepo\Modules.Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
|
<HintPath>..\..\DDMonorepo\Modules.Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
|
||||||
@ -61,12 +65,18 @@
|
|||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\..\DDMonorepo\Modules.Windream\bin\Debug\DigitalData.Modules.Windream.dll</HintPath>
|
<HintPath>..\..\DDMonorepo\Modules.Windream\bin\Debug\DigitalData.Modules.Windream.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="NLog">
|
<Reference Include="Microsoft.CSharp" />
|
||||||
<HintPath>..\..\DDMonorepo\Modules.Windream\bin\Debug\NLog.dll</HintPath>
|
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\NLog.4.7.0\lib\net45\NLog.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Configuration" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Deployment" />
|
<Reference Include="System.Deployment" />
|
||||||
|
<Reference Include="System.IO.Compression" />
|
||||||
|
<Reference Include="System.Runtime.Serialization" />
|
||||||
|
<Reference Include="System.ServiceModel" />
|
||||||
|
<Reference Include="System.Transactions" />
|
||||||
<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" />
|
||||||
@ -85,8 +95,6 @@
|
|||||||
<Import Include="System.Threading.Tasks" />
|
<Import Include="System.Threading.Tasks" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="ClassConfig.vb" />
|
|
||||||
<Compile Include="ClassEncryption.vb" />
|
|
||||||
<Compile Include="ModuleMain.vb" />
|
<Compile Include="ModuleMain.vb" />
|
||||||
<Compile Include="My Project\AssemblyInfo.vb" />
|
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||||
<Compile Include="My Project\Application.Designer.vb">
|
<Compile Include="My Project\Application.Designer.vb">
|
||||||
@ -103,7 +111,6 @@
|
|||||||
<DependentUpon>Settings.settings</DependentUpon>
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="ModuleRuntime.vb" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="My Project\Resources.resx">
|
<EmbeddedResource Include="My Project\Resources.resx">
|
||||||
@ -124,6 +131,13 @@
|
|||||||
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
|
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
|
||||||
</None>
|
</None>
|
||||||
<None Include="App.config" />
|
<None Include="App.config" />
|
||||||
|
<None Include="packages.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\WiDigShared\WiDigShared.vbproj">
|
||||||
|
<Project>{a5d032d4-abdc-44bf-8666-5fbe42af0ab7}</Project>
|
||||||
|
<Name>WiDigShared</Name>
|
||||||
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||||
</Project>
|
</Project>
|
||||||
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
|
||||||
<StartArguments>-Mode%40NI -Source%40"\\Windream\Objects\ImportWIDIG\Testfile2.pdf" -Target%40"W:\ImportWIDIG\Testfile2.pdf" -WMOT%40"DIGITAL DATA - Entwicklung" -index%40Integer 24={0815}#~#Vektor_Text1={"Wert 1"~#~"Wert 2"}</StartArguments>
|
<StartArguments>-Mode%40NI -Source%40"\\Windream\Objects\ImportWIDIG\Testfile2.pdf" -Target%40"W:\ImportWIDIG\Testfile2.pdf" -WMOT%40"DIGITAL DATA - Entwicklung" -index%40Boolean 04={1}</StartArguments>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
4
WIDigConsoleApp/packages.config
Normal file
4
WIDigConsoleApp/packages.config
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="NLog" version="4.7.0" targetFramework="net461" />
|
||||||
|
</packages>
|
||||||
@ -1,16 +0,0 @@
|
|||||||
Imports DigitalData.Modules.Config.ConfigAttributes
|
|
||||||
|
|
||||||
Public Class ClassConfig
|
|
||||||
' Global Settings (from computerconfig, overridable by userconfig)
|
|
||||||
<ConnectionString>
|
|
||||||
Public Property ConnectionString As String = ""
|
|
||||||
Public Property WMUsername As String = ""
|
|
||||||
Public Property WMUserPW As String = ""
|
|
||||||
Public Property WMDrive As String = ""
|
|
||||||
Public Property WMRelPath As String = ""
|
|
||||||
Public Property WMServer As String = ""
|
|
||||||
Public Property Domain As String = ""
|
|
||||||
Public Property LOG_DEBUG As Boolean = False
|
|
||||||
|
|
||||||
|
|
||||||
End Class
|
|
||||||
@ -1,68 +0,0 @@
|
|||||||
Imports System.Security.Cryptography
|
|
||||||
Public Class ClassEncryption
|
|
||||||
Private TripleDes As New TripleDESCryptoServiceProvider
|
|
||||||
Sub New(ByVal key As String)
|
|
||||||
' Initialize the crypto provider.
|
|
||||||
TripleDes.Key = TruncateHash(key, TripleDes.KeySize \ 8)
|
|
||||||
TripleDes.IV = TruncateHash("", TripleDes.BlockSize \ 8)
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Private Function TruncateHash(
|
|
||||||
ByVal key As String,
|
|
||||||
ByVal length As Integer) As Byte()
|
|
||||||
|
|
||||||
Dim sha1 As New SHA1CryptoServiceProvider
|
|
||||||
|
|
||||||
' Hash the key.
|
|
||||||
Dim keyBytes() As Byte =
|
|
||||||
System.Text.Encoding.Unicode.GetBytes(key)
|
|
||||||
Dim hash() As Byte = sha1.ComputeHash(keyBytes)
|
|
||||||
|
|
||||||
' Truncate or pad the hash.
|
|
||||||
ReDim Preserve hash(length - 1)
|
|
||||||
Return hash
|
|
||||||
End Function
|
|
||||||
Public Function EncryptData(
|
|
||||||
ByVal plaintext As String) As String
|
|
||||||
|
|
||||||
' Convert the plaintext string to a byte array.
|
|
||||||
Dim plaintextBytes() As Byte =
|
|
||||||
System.Text.Encoding.Unicode.GetBytes("!Didalog35452Heuchelheim=" & plaintext)
|
|
||||||
|
|
||||||
' Create the stream.
|
|
||||||
Dim ms As New System.IO.MemoryStream
|
|
||||||
' Create the encoder to write to the stream.
|
|
||||||
Dim encStream As New CryptoStream(ms,
|
|
||||||
TripleDes.CreateEncryptor(),
|
|
||||||
System.Security.Cryptography.CryptoStreamMode.Write)
|
|
||||||
|
|
||||||
' Use the crypto stream to write the byte array to the stream.
|
|
||||||
encStream.Write(plaintextBytes, 0, plaintextBytes.Length)
|
|
||||||
encStream.FlushFinalBlock()
|
|
||||||
|
|
||||||
' Convert the encrypted stream to a printable string.
|
|
||||||
Return Convert.ToBase64String(ms.ToArray)
|
|
||||||
End Function
|
|
||||||
'Entschlüsselt die Zeichenfolge
|
|
||||||
Public Function DecryptData(
|
|
||||||
ByVal encryptedtext As String) As String
|
|
||||||
|
|
||||||
' Convert the encrypted text string to a byte array.
|
|
||||||
Dim encryptedBytes() As Byte = Convert.FromBase64String(encryptedtext)
|
|
||||||
|
|
||||||
' Create the stream.
|
|
||||||
Dim ms As New System.IO.MemoryStream
|
|
||||||
' Create the decoder to write to the stream.
|
|
||||||
Dim decStream As New CryptoStream(ms,
|
|
||||||
TripleDes.CreateDecryptor(),
|
|
||||||
System.Security.Cryptography.CryptoStreamMode.Write)
|
|
||||||
|
|
||||||
' Use the crypto stream to write the byte array to the stream.
|
|
||||||
decStream.Write(encryptedBytes, 0, encryptedBytes.Length)
|
|
||||||
decStream.FlushFinalBlock()
|
|
||||||
Dim result = System.Text.Encoding.Unicode.GetString(ms.ToArray)
|
|
||||||
result = result.Replace("!Didalog35452Heuchelheim=", "")
|
|
||||||
' Convert the plaintext stream to a string.
|
|
||||||
Return result
|
|
||||||
End Function
|
|
||||||
End Class
|
|
||||||
@ -12,7 +12,7 @@ Imports System.Runtime.InteropServices
|
|||||||
<Assembly: AssemblyDescription("")>
|
<Assembly: AssemblyDescription("")>
|
||||||
<Assembly: AssemblyCompany("")>
|
<Assembly: AssemblyCompany("")>
|
||||||
<Assembly: AssemblyProduct("WIDIG")>
|
<Assembly: AssemblyProduct("WIDIG")>
|
||||||
<Assembly: AssemblyCopyright("Copyright © 2020")>
|
<Assembly: AssemblyCopyright("Copyright © 2021")>
|
||||||
<Assembly: AssemblyTrademark("")>
|
<Assembly: AssemblyTrademark("")>
|
||||||
|
|
||||||
<Assembly: ComVisible(False)>
|
<Assembly: ComVisible(False)>
|
||||||
@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
|||||||
' indem Sie "*" wie unten gezeigt eingeben:
|
' indem Sie "*" wie unten gezeigt eingeben:
|
||||||
' <Assembly: AssemblyVersion("1.0.*")>
|
' <Assembly: AssemblyVersion("1.0.*")>
|
||||||
|
|
||||||
<Assembly: AssemblyVersion("1.2.0.0")>
|
<Assembly: AssemblyVersion("1.3.8.0")>
|
||||||
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
||||||
|
|||||||
@ -1,19 +0,0 @@
|
|||||||
Imports DigitalData.Modules.Logging
|
|
||||||
Imports DigitalData.Modules.Windream
|
|
||||||
Imports DigitalData.Modules.Config
|
|
||||||
Module Runtime
|
|
||||||
Public LOGCONFIG As LogConfig
|
|
||||||
Public LOGGER As Logger
|
|
||||||
Public WINDREAM As Windream
|
|
||||||
Public CONFIG As ConfigManager(Of ClassConfig)
|
|
||||||
Public oMode As String = "IMPV"
|
|
||||||
Public oErrorParse As Boolean = False
|
|
||||||
Public oErrorMessage As String
|
|
||||||
Public oErrorImport As Boolean = True
|
|
||||||
Public oSourceFile As String
|
|
||||||
Public oTargetPath As String
|
|
||||||
Public oWMObjecttype As String
|
|
||||||
Public oIndexArr As String()
|
|
||||||
Public WMIndices As List(Of String)
|
|
||||||
Public OExtension As String
|
|
||||||
End Module
|
|
||||||
@ -58,6 +58,10 @@
|
|||||||
<Reference Include="DigitalData.Modules.Config">
|
<Reference Include="DigitalData.Modules.Config">
|
||||||
<HintPath>..\..\DDMonorepo\Modules.Config\bin\Debug\DigitalData.Modules.Config.dll</HintPath>
|
<HintPath>..\..\DDMonorepo\Modules.Config\bin\Debug\DigitalData.Modules.Config.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="DigitalData.Modules.Encryption, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\..\DDMonorepo\Encryption\bin\Debug\DigitalData.Modules.Encryption.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="DigitalData.Modules.Logging">
|
<Reference Include="DigitalData.Modules.Logging">
|
||||||
<HintPath>..\..\DDMonorepo\Modules.Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
|
<HintPath>..\..\DDMonorepo\Modules.Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
@ -68,10 +72,6 @@
|
|||||||
<HintPath>..\..\DDMonorepo\Modules.Windream\bin\Debug\Interop.WINDREAMLib.dll</HintPath>
|
<HintPath>..\..\DDMonorepo\Modules.Windream\bin\Debug\Interop.WINDREAMLib.dll</HintPath>
|
||||||
<EmbedInteropTypes>False</EmbedInteropTypes>
|
<EmbedInteropTypes>False</EmbedInteropTypes>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Interop.WMOBRWSLib">
|
|
||||||
<HintPath>..\..\..\Interop.WMOBRWSLib.dll</HintPath>
|
|
||||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\NLog.4.7.0\lib\net45\NLog.dll</HintPath>
|
<HintPath>..\packages\NLog.4.7.0\lib\net45\NLog.dll</HintPath>
|
||||||
@ -106,8 +106,6 @@
|
|||||||
<Import Include="System.Threading.Tasks" />
|
<Import Include="System.Threading.Tasks" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="ClassConfig.vb" />
|
|
||||||
<Compile Include="ClassEncryption.vb" />
|
|
||||||
<Compile Include="frmMain.vb">
|
<Compile Include="frmMain.vb">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@ -130,7 +128,6 @@
|
|||||||
<DependentUpon>Settings.settings</DependentUpon>
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Runtime.vb" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="frmMain.resx">
|
<EmbeddedResource Include="frmMain.resx">
|
||||||
@ -160,5 +157,11 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="filedownload.ico" />
|
<Content Include="filedownload.ico" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\WiDigShared\WiDigShared.vbproj">
|
||||||
|
<Project>{a5d032d4-abdc-44bf-8666-5fbe42af0ab7}</Project>
|
||||||
|
<Name>WiDigShared</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||||
</Project>
|
</Project>
|
||||||
@ -1,221 +1,111 @@
|
|||||||
Imports DigitalData.Modules.Logging
|
Imports DigitalData.Modules.Logging
|
||||||
Imports DigitalData.Modules.Windream
|
Imports DigitalData.Modules.Windream
|
||||||
Imports DigitalData.Modules.Config
|
Imports DigitalData.Modules.Config
|
||||||
|
Imports DigitalData.GUIs.WiDigShared
|
||||||
|
Imports DigitalData.Modules.Encryption
|
||||||
|
|
||||||
Public Class frmMain
|
Public Class frmMain
|
||||||
Private _ArgumentLength As Integer
|
Private _ArgumentLength As Integer
|
||||||
|
|
||||||
|
Private LogConfig As LogConfig
|
||||||
|
Private Logger As Logger
|
||||||
|
Private Config As ConfigManager(Of ClassConfig)
|
||||||
|
Private WiDig As ClassWIDig
|
||||||
|
Private Windream As Windream
|
||||||
|
|
||||||
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
|
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||||
Try
|
Try
|
||||||
Me.Hide()
|
Me.Hide()
|
||||||
Me.Visible = False
|
Me.Visible = False
|
||||||
Dim oLogConfig As New LogConfig(LogConfig.PathType.AppData, Nothing, "Form", "Digital Data", "WIDig")
|
Dim oLogConfig As New LogConfig(LogConfig.PathType.AppData, Nothing, "Form", "Digital Data", "WIDig")
|
||||||
|
|
||||||
LOGCONFIG = oLogConfig
|
LogConfig = oLogConfig
|
||||||
LOGGER = LOGCONFIG.GetLogger
|
Logger = LogConfig.GetLogger
|
||||||
InitUserConfig()
|
|
||||||
LOGCONFIG.Debug = CONFIG.Config.LOG_DEBUG
|
|
||||||
LOGGER = LOGCONFIG.GetLogger
|
|
||||||
Dim oUserPW = GetUserPWPlain()
|
|
||||||
LOGGER.Debug("Initializing MainForm....")
|
|
||||||
Me.txtPW.Text = oUserPW
|
|
||||||
|
|
||||||
If Connect2Windream(oUserPW) = True Then
|
Config = New ConfigManager(Of ClassConfig)(LogConfig, ClassWIDig.GetAppDataPath, ClassWIDig.GetAppDataPath)
|
||||||
|
|
||||||
|
LogConfig.Debug = Config.Config.LOG_DEBUG
|
||||||
|
Logger = LogConfig.GetLogger
|
||||||
|
|
||||||
|
Logger.Debug("Initializing MainForm....")
|
||||||
|
WiDig = New ClassWIDig(LogConfig, Config.Config)
|
||||||
|
|
||||||
|
Dim oUserPW = WiDig.GetUserPWPlain()
|
||||||
|
Me.txtPW.Text = oUserPW
|
||||||
|
If WiDig.Connect2Windream(oUserPW) = True Then
|
||||||
Dim oArguments As String() = Environment.GetCommandLineArgs()
|
Dim oArguments As String() = Environment.GetCommandLineArgs()
|
||||||
If ParseArgs(oArguments) = True Then
|
If WiDig.ParseArgs(oArguments) = True Then
|
||||||
If StreamIndexFile() = True Then
|
If WiDig.StreamORIndexFile() = True Then
|
||||||
oErrorImport = False
|
WiDig.ErrorWhileImporting = False
|
||||||
Else
|
Else
|
||||||
oErrorImport = True
|
WiDig.ErrorWhileImporting = True
|
||||||
End If
|
End If
|
||||||
|
Else
|
||||||
|
BarStaticinfo.Caption = $"Error in ParseArgs - {Now.ToString}"
|
||||||
|
BarStaticinfo.ItemAppearance.Normal.BackColor = Color.Red
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
oErrorMessage = "Could not initialize windream"
|
WiDig.ErrorMessage = "Could not initialize windream"
|
||||||
End If
|
End If
|
||||||
|
|
||||||
txtUser.Text = CONFIG.Config.WMUsername
|
txtUser.Text = Config.Config.WMUsername
|
||||||
Me.txtPW.Text = oUserPW
|
Me.txtPW.Text = oUserPW
|
||||||
txtWMDrive.Text = CONFIG.Config.WMDrive
|
txtWMDrive.Text = Config.Config.WMDrive
|
||||||
txtWMRelpath.Text = CONFIG.Config.WMRelPath
|
txtWMRelpath.Text = Config.Config.WMRelPath
|
||||||
txtWMServer.Text = CONFIG.Config.WMUserPW
|
txtWMServer.Text = Config.Config.WMUserPW
|
||||||
txtDomain.Text = CONFIG.Config.Domain
|
txtDomain.Text = Config.Config.Domain
|
||||||
'txtCommands.Text = CONFIG.Config.Arguments
|
'txtCommands.Text = CONFIG.Config.Arguments
|
||||||
txtCommands.Text = My.Settings.TestParams
|
txtCommands.Text = My.Settings.TestParams
|
||||||
If oErrorParse = True Then
|
If WiDig.ErrorWhileParsing = True Then
|
||||||
MsgBox("Error in Parsing or Indexing!", MsgBoxStyle.Critical)
|
MsgBox("Error in Parsing or Indexing!", MsgBoxStyle.Critical, Text)
|
||||||
Me.Visible = True
|
Me.Visible = True
|
||||||
End If
|
End If
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
LOGGER.Error(ex)
|
MsgBox("Error while initializing: " & vbNewLine & vbNewLine & ex.Message, MsgBoxStyle.Critical, Text)
|
||||||
|
Logger.Error(ex)
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Sub InitUserConfig()
|
Public Sub InitUserConfig()
|
||||||
Dim oProgramDataPath = IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Digital Data", "WIDig")
|
Dim oProgramDataPath = IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Digital Data", "WIDig")
|
||||||
Dim oUserAppDataPath = IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Digital Data", "WIDig")
|
Dim oUserAppDataPath = IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Digital Data", "WIDig")
|
||||||
CONFIG = New ConfigManager(Of ClassConfig)(LOGCONFIG, oUserAppDataPath, oProgramDataPath)
|
|
||||||
End Sub
|
End Sub
|
||||||
Private Function Connect2Windream(oPW As String)
|
|
||||||
Try
|
|
||||||
WINDREAM = New Windream(LOGCONFIG, False, CONFIG.Config.WMDrive, CONFIG.Config.WMRelPath, True, CONFIG.Config.WMServer, CONFIG.Config.WMUsername, oPW, CONFIG.Config.Domain)
|
|
||||||
If Not IsNothing(WINDREAM) Then
|
|
||||||
If WINDREAM.SessionLoggedin = True Then
|
|
||||||
LOGGER.Debug("windream initialisiert")
|
|
||||||
bsiWMConnect.Visibility = DevExpress.XtraBars.BarItemVisibility.Always
|
|
||||||
Return True
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
Catch ex As Exception
|
|
||||||
LOGGER.Warn("CHECKING WMConnectivity: " & ex.Message)
|
|
||||||
Return False
|
|
||||||
End Try
|
|
||||||
End Function
|
|
||||||
Private Function GetUserPWPlain()
|
|
||||||
Try
|
|
||||||
Dim PWplainText As String
|
|
||||||
Dim wrapper As New ClassEncryption("!35452didalog=")
|
|
||||||
If CONFIG.Config.WMUserPW = String.Empty Then
|
|
||||||
PWplainText = ""
|
|
||||||
Else
|
|
||||||
PWplainText = wrapper.DecryptData(CONFIG.Config.WMUserPW)
|
|
||||||
End If
|
|
||||||
|
|
||||||
Return PWplainText
|
|
||||||
Catch ex As Exception
|
|
||||||
LOGGER.Warn("Error in GetUserPWPlain - the password [" & CONFIG.Config.WMUserPW & "] could not be decrypted", False)
|
|
||||||
Return String.Empty
|
|
||||||
End Try
|
|
||||||
End Function
|
|
||||||
Public Function ParseArgs(pArguments As String(), Optional pTest As Boolean = False)
|
|
||||||
Try
|
|
||||||
If pArguments.Length <= 3 Then
|
|
||||||
_ArgumentLength = pArguments.Length
|
|
||||||
LOGGER.Warn($"Insufficient number of arguments [{pArguments.Length}]!")
|
|
||||||
BarStaticinfo.Caption = $"Insufficient number of arguments - {Now.ToString}"
|
|
||||||
oErrorMessage = BarStaticinfo.Caption
|
|
||||||
BarStaticinfo.ItemAppearance.Normal.BackColor = Color.Red
|
|
||||||
oErrorParse = True
|
|
||||||
Return False
|
|
||||||
End If
|
|
||||||
|
|
||||||
Dim ocount As Integer = 0
|
|
||||||
For Each oArg As String In pArguments
|
|
||||||
LOGGER.Debug($"[{ocount}] {oArg}")
|
|
||||||
oArg = oArg.Replace("""", "")
|
|
||||||
If oArg.StartsWith("-Source@") Then
|
|
||||||
oSourceFile = oArg.Replace("-Source@", "")
|
|
||||||
If System.IO.File.Exists(oSourceFile) = False Then
|
|
||||||
LOGGER.Warn($"Parser@Sourcefile - File [{oSourceFile}] is not existing!")
|
|
||||||
oErrorMessage &= vbNewLine & $"Parser@Sourcefile - File [{oSourceFile}] is not existing!"
|
|
||||||
oErrorParse = True
|
|
||||||
Return False
|
|
||||||
End If
|
|
||||||
ElseIf oArg.StartsWith("-Mode@") Then
|
|
||||||
oMode = oArg.Replace("-Mode@", "").ToUpper
|
|
||||||
|
|
||||||
ElseIf oArg.StartsWith("-Target@") Then
|
|
||||||
oTargetPath = oArg.Replace("-Target@", "")
|
|
||||||
Dim oWMFolder = System.IO.Path.GetDirectoryName(oTargetPath)
|
|
||||||
Dim oWindowsPath = oTargetPath
|
|
||||||
OExtension = IO.Path.GetExtension(oWindowsPath)
|
|
||||||
Dim oNormalizePath = WINDREAM.GetNormalizedPath(oTargetPath)
|
|
||||||
If WINDREAM.TestFileExists(oTargetPath) = False Then
|
|
||||||
LOGGER.Info($"WMFile [{oTargetPath}] not existing!")
|
|
||||||
End If
|
|
||||||
If oMode = "IMPV" Then
|
|
||||||
Dim oWMCheckPath = WINDREAM.VersionWMFilename(oTargetPath, System.IO.Path.GetExtension(oTargetPath))
|
|
||||||
If oNormalizePath.ToUpper <> oWMCheckPath.ToString.ToUpper Then
|
|
||||||
LOGGER.Info($"Target [{oNormalizePath}] already existed!! - NewWMFilename [{oWMCheckPath}]")
|
|
||||||
oTargetPath = oWMCheckPath
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
|
|
||||||
ElseIf oArg.StartsWith("-WMOT@") Then
|
|
||||||
oWMObjecttype = oArg.Replace("-WMOT@", "")
|
|
||||||
Dim oexists As Boolean = False
|
|
||||||
Dim myWMOTypes = WINDREAM.ObjectTypes
|
|
||||||
For Each otype As String In myWMOTypes
|
|
||||||
If oWMObjecttype = otype Then
|
|
||||||
oexists = True
|
|
||||||
Exit For
|
|
||||||
End If
|
|
||||||
Next
|
|
||||||
If oexists = False Then
|
|
||||||
LOGGER.Info($"WMObjekttype [{oWMObjecttype}] not existing!!")
|
|
||||||
oErrorMessage &= vbNewLine & $"WMObjekttype [{oWMObjecttype}] not existing!!"
|
|
||||||
Return False
|
|
||||||
oErrorParse = True
|
|
||||||
Else
|
|
||||||
WMIndices = WINDREAM.GetIndiciesByObjecttype(oWMObjecttype)
|
|
||||||
End If
|
|
||||||
ElseIf oArg.StartsWith("-index@") Then
|
|
||||||
Dim oINDEXInfotemp = oArg
|
|
||||||
oINDEXInfotemp = oINDEXInfotemp.Replace("-index@{", "")
|
|
||||||
oINDEXInfotemp = oINDEXInfotemp.Replace("}", "")
|
|
||||||
Dim oSplit() = oINDEXInfotemp.ToString.Split(";")
|
|
||||||
LOGGER.Debug($" [{oSplit.Length}] Indices transmitted...")
|
|
||||||
oIndexArr = oSplit
|
|
||||||
|
|
||||||
End If
|
|
||||||
ocount += 1
|
|
||||||
Next
|
|
||||||
Return True
|
|
||||||
Catch ex As Exception
|
|
||||||
LOGGER.Warn("Error in ParseArgs:" & vbNewLine & ex.Message)
|
|
||||||
oErrorMessage &= vbNewLine & "Error in ParseArgs:" & vbNewLine & ex.Message
|
|
||||||
oErrorParse = True
|
|
||||||
BarStaticinfo.Caption = $"Error in ParseArgs - {Now.ToString}"
|
|
||||||
BarStaticinfo.ItemAppearance.Normal.BackColor = Color.Red
|
|
||||||
Return False
|
|
||||||
End Try
|
|
||||||
End Function
|
|
||||||
Private Function WMIndex_exists(pIndex As String)
|
|
||||||
Dim oexist As Boolean = False
|
|
||||||
For Each oWMIndex As String In WMIndices
|
|
||||||
If oWMIndex = pIndex Then
|
|
||||||
Return True
|
|
||||||
End If
|
|
||||||
Next
|
|
||||||
Return oexist
|
|
||||||
End Function
|
|
||||||
Private Sub Form1_Shown(sender As Object, e As EventArgs) Handles Me.Shown
|
Private Sub Form1_Shown(sender As Object, e As EventArgs) Handles Me.Shown
|
||||||
If oErrorImport = False Then
|
If WiDig?.ErrorWhileImporting = False Then
|
||||||
Me.Close()
|
Me.Close()
|
||||||
End If
|
End If
|
||||||
If oErrorParse = True And _ArgumentLength <> 1 Then
|
If WiDig?.ErrorWhileParsing = True And Environment.GetCommandLineArgs().Length <> 1 Then
|
||||||
MsgBox("A unexpected error occured while Parsing arguments!" & vbNewLine & oErrorMessage, MsgBoxStyle.Critical)
|
MsgBox("A unexpected error occured while Parsing arguments!" & vbNewLine & WiDig?.ErrorMessage, MsgBoxStyle.Critical)
|
||||||
Process.Start(LOGCONFIG.LogDirectory)
|
Process.Start(LogConfig.LogDirectory)
|
||||||
|
|
||||||
End If
|
End If
|
||||||
If oErrorImport = True Then
|
If WiDig?.ErrorWhileImporting = True Then
|
||||||
MsgBox("A unexpected error occured while initializing!" & vbNewLine & oErrorMessage, MsgBoxStyle.Critical)
|
MsgBox("A unexpected error occured while initializing!" & vbNewLine & WiDig?.ErrorMessage, MsgBoxStyle.Critical)
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem1.ItemClick
|
Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem1.ItemClick
|
||||||
Dim wrapper As New ClassEncryption("!35452didalog=")
|
Dim wrapper As New EncryptionLegacy("!35452didalog=")
|
||||||
Dim cipherText As String = wrapper.EncryptData(Me.txtPW.Text)
|
Dim cipherText As String = wrapper.EncryptData(Me.txtPW.Text)
|
||||||
Dim pw As String = cipherText
|
Dim pw As String = cipherText
|
||||||
CONFIG.Config.WMUserPW = pw
|
Config.Config.WMUserPW = pw
|
||||||
|
|
||||||
CONFIG.Config.WMUsername = txtUser.Text
|
Config.Config.WMUsername = txtUser.Text
|
||||||
CONFIG.Config.WMDrive = txtWMDrive.Text
|
Config.Config.WMDrive = txtWMDrive.Text
|
||||||
CONFIG.Config.WMRelPath = txtWMRelpath.Text
|
Config.Config.WMRelPath = txtWMRelpath.Text
|
||||||
CONFIG.Config.WMServer = txtWMServer.Text
|
Config.Config.WMServer = txtWMServer.Text
|
||||||
CONFIG.Config.Domain = txtDomain.Text
|
Config.Config.Domain = txtDomain.Text
|
||||||
CONFIG.Save()
|
Config.Save()
|
||||||
BarStaticinfo.Caption = $"WM-Settings saved - {Now.ToString}"
|
BarStaticinfo.Caption = $"WM-Settings saved - {Now.ToString}"
|
||||||
BarStaticinfo.ItemAppearance.Normal.BackColor = Color.Lime
|
BarStaticinfo.ItemAppearance.Normal.BackColor = Color.Lime
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub BarButtonItem2_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem2.ItemClick
|
Private Sub BarButtonItem2_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem2.ItemClick
|
||||||
|
|
||||||
WINDREAM = New Windream(LOGCONFIG, False, txtWMDrive.Text, txtWMRelpath.Text, True, txtWMServer.Text, txtUser.Text, txtPW.Text, txtDomain.Text)
|
Windream = New Windream(LogConfig, False, txtWMDrive.Text, txtWMRelpath.Text, True, txtWMServer.Text, txtUser.Text, txtPW.Text, txtDomain.Text)
|
||||||
If Not IsNothing(WINDREAM) Then
|
If Not IsNothing(Windream) Then
|
||||||
MsgBox("Windream-Connext successfull!", MsgBoxStyle.Information)
|
MsgBox("Windream-Connext successfull!", MsgBoxStyle.Information)
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
@ -228,7 +118,7 @@ Public Class frmMain
|
|||||||
RibbonPageGroup1.Enabled = False
|
RibbonPageGroup1.Enabled = False
|
||||||
End Sub
|
End Sub
|
||||||
Private Sub BarButtonItem4_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem4.ItemClick
|
Private Sub BarButtonItem4_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem4.ItemClick
|
||||||
Process.Start(LOGCONFIG.LogDirectory)
|
Process.Start(LogConfig.LogDirectory)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub BarButtonItem5_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem5.ItemClick
|
Private Sub BarButtonItem5_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem5.ItemClick
|
||||||
@ -237,85 +127,30 @@ Public Class frmMain
|
|||||||
'CONFIG.Config.Arguments = txtCommands.Text
|
'CONFIG.Config.Arguments = txtCommands.Text
|
||||||
'CONFIG.Save()
|
'CONFIG.Save()
|
||||||
Dim oArgs() As String = txtCommands.Text.Split("|")
|
Dim oArgs() As String = txtCommands.Text.Split("|")
|
||||||
LOGGER.Debug($"[{oArgs.Length}] Arguments will be checked...")
|
Logger.Debug($"[{oArgs.Length}] Arguments will be checked...")
|
||||||
If IsNothing(WINDREAM) Then
|
If IsNothing(Windream) Then
|
||||||
Dim oUserPW = GetUserPWPlain()
|
Dim oUserPW = WiDig.GetUserPWPlain()
|
||||||
|
|
||||||
If Connect2Windream(oUserPW) = False Then
|
If WiDig.Connect2Windream(oUserPW) = False Then
|
||||||
MsgBox("Windream could not be initialized!! Check Your log!", MsgBoxStyle.Critical)
|
MsgBox("Windream could not be initialized!! Check Your log!", MsgBoxStyle.Critical)
|
||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
If ParseArgs(oArgs) = False Then
|
If WiDig.ParseArgs(oArgs) = False Then
|
||||||
MsgBox("An unexpected error occured while parsing arguments. Check the log!", MsgBoxStyle.Critical)
|
MsgBox("An unexpected error occured while parsing arguments. Check the log!", MsgBoxStyle.Critical)
|
||||||
Process.Start(LOGCONFIG.LogDirectory)
|
Process.Start(LogConfig.LogDirectory)
|
||||||
Else
|
Else
|
||||||
If StreamIndexFile() = True Then
|
If WiDig.StreamORIndexFile() = True Then
|
||||||
MsgBox("Import succeeded!", MsgBoxStyle.Information)
|
MsgBox("Import succeeded!", MsgBoxStyle.Information)
|
||||||
Else
|
Else
|
||||||
MsgBox("Unexpected Error while streaming or indexing WMFile! Check the logfile!", MsgBoxStyle.Critical)
|
MsgBox("Unexpected Error while streaming or indexing WMFile! Check the logfile!", MsgBoxStyle.Critical)
|
||||||
Process.Start(LOGCONFIG.LogDirectory)
|
Process.Start(LogConfig.LogDirectory)
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
Public Function StreamIndexFile()
|
|
||||||
Try
|
|
||||||
'Checks and creates the path if necessary
|
|
||||||
WINDREAM.NewFolder(oTargetPath, oExtension)
|
|
||||||
Dim oResult As Boolean = False
|
|
||||||
If oMode = "IMPV" Then
|
|
||||||
oResult = WINDREAM.NewFileStream(oSourceFile, oTargetPath)
|
|
||||||
ElseIf oMode = "IMPO" Then
|
|
||||||
Dim oDeleted = WINDREAM.RemoveFile(oTargetPath)
|
|
||||||
If oDeleted = True Then
|
|
||||||
oResult = WINDREAM.NewFileStream(oSourceFile, oTargetPath)
|
|
||||||
Else
|
|
||||||
LOGGER.Warn($"Mode ImportOverwrite is active - but WMFile could not be deleted!!")
|
|
||||||
End If
|
|
||||||
ElseIf oMode = "NI" Then
|
|
||||||
oResult = True
|
|
||||||
End If
|
|
||||||
|
|
||||||
|
|
||||||
If oResult = True Then
|
|
||||||
LOGGER.Info($"File successfully streamed to windream [{oTargetPath}]! Now indexing...")
|
|
||||||
For Each oIndex2 As String In oIndexArr
|
|
||||||
Dim oIndexInfo() = oIndex2.Split("=")
|
|
||||||
Dim oIndexName = oIndexInfo(0)
|
|
||||||
Dim oIndexvalue = oIndexInfo(1)
|
|
||||||
If WMIndex_exists(oIndexName) = True Then
|
|
||||||
LOGGER.Info($"Setting Index: oIndexName [{oIndexName}] - oIndexvalue [{oIndexvalue}]")
|
|
||||||
If WINDREAM.SetFileIndex(oTargetPath, oIndexName, oIndexvalue, oWMObjecttype) = False Then
|
|
||||||
LOGGER.Info($"Index could not be set...")
|
|
||||||
If WINDREAM.RemoveFile(oTargetPath) = True Then
|
|
||||||
LOGGER.Info($"File deleted after error!")
|
|
||||||
End If
|
|
||||||
oResult = False
|
|
||||||
Exit For
|
|
||||||
End If
|
|
||||||
Else
|
|
||||||
LOGGER.Warn($"Transmitted index with name [{oIndexName}] is not existing in WM Objecttype!")
|
|
||||||
If WINDREAM.RemoveFile(oTargetPath) = True Then
|
|
||||||
LOGGER.Info($"File deleted after error!")
|
|
||||||
End If
|
|
||||||
oResult = False
|
|
||||||
Exit For
|
|
||||||
End If
|
|
||||||
|
|
||||||
Next
|
|
||||||
If oResult = True Then
|
|
||||||
LOGGER.Info("Import finished!")
|
|
||||||
oErrorImport = False
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
Return oResult
|
|
||||||
Catch ex As Exception
|
|
||||||
LOGGER.Warn($"Error while indexing: {ex.Message}")
|
|
||||||
End Try
|
|
||||||
|
|
||||||
End Function
|
|
||||||
|
|
||||||
Private Sub txtCommands_GotFocus(sender As Object, e As EventArgs) Handles txtCommands.GotFocus
|
Private Sub txtCommands_GotFocus(sender As Object, e As EventArgs) Handles txtCommands.GotFocus
|
||||||
RibbonPageGroup3.Enabled = True
|
RibbonPageGroup3.Enabled = True
|
||||||
End Sub
|
End Sub
|
||||||
@ -324,10 +159,6 @@ Public Class frmMain
|
|||||||
RibbonPageGroup3.Enabled = False
|
RibbonPageGroup3.Enabled = False
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub RichTextBox1_TextChanged(sender As Object, e As EventArgs)
|
|
||||||
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Private Sub GroupBox2_Enter(sender As Object, e As EventArgs) Handles GroupBox2.Enter
|
Private Sub GroupBox2_Enter(sender As Object, e As EventArgs) Handles GroupBox2.Enter
|
||||||
RibbonPageGroup3.Enabled = False
|
RibbonPageGroup3.Enabled = False
|
||||||
End Sub
|
End Sub
|
||||||
|
|||||||
@ -7,7 +7,7 @@ Public Class ClassConfig
|
|||||||
Public Property WMUsername As String = ""
|
Public Property WMUsername As String = ""
|
||||||
Public Property WMUserPW As String = ""
|
Public Property WMUserPW As String = ""
|
||||||
Public Property WMDrive As String = "W"
|
Public Property WMDrive As String = "W"
|
||||||
Public Property WMRelPath As String = ""
|
Public Property WMRelPath As String = "\\windream\objects"
|
||||||
Public Property WMServer As String = ""
|
Public Property WMServer As String = ""
|
||||||
Public Property Domain As String = ""
|
Public Property Domain As String = ""
|
||||||
Public Property LOG_DEBUG As Boolean = False
|
Public Property LOG_DEBUG As Boolean = False
|
||||||
351
WiDigShared/ClassWIDig.vb
Normal file
351
WiDigShared/ClassWIDig.vb
Normal file
@ -0,0 +1,351 @@
|
|||||||
|
Imports DigitalData.Modules.Logging
|
||||||
|
Imports DigitalData.Modules.Encryption
|
||||||
|
Imports DigitalData.Modules.Windream
|
||||||
|
Imports DigitalData.Modules.Database
|
||||||
|
Imports System.Text.RegularExpressions
|
||||||
|
|
||||||
|
Public Class ClassWIDig
|
||||||
|
Private LogConfig As LogConfig
|
||||||
|
Private Config As ClassConfig
|
||||||
|
Private Windream As Windream
|
||||||
|
Private Logger As Logger
|
||||||
|
Private Database As MSSQLServer
|
||||||
|
|
||||||
|
Public oRegex As New Regex("([\s\S]+)\={([\s\S]+)}")
|
||||||
|
Public Const CODE_SUCCESS = 0
|
||||||
|
Public Const CODE_ERROR = 1
|
||||||
|
|
||||||
|
Public Const MODE_OVERWRITE = "IMPO"
|
||||||
|
Public Const MODE_VERSION = "IMPV"
|
||||||
|
Public Const MODE_NACHINDEXIERUNG = "NI"
|
||||||
|
|
||||||
|
Public Const PARAM_SOURCE = "-Source@"
|
||||||
|
Public Const PARAM_MODE = "-Mode@"
|
||||||
|
Public Const PARAM_TARGET = "-Target@"
|
||||||
|
Public Const PARAM_WMTO = "-WMOT@"
|
||||||
|
Public Const PARAM_INDEX = "-index@"
|
||||||
|
|
||||||
|
Public Property ErrorMessage As String
|
||||||
|
Public Property ErrorWhileParsing As Boolean
|
||||||
|
Public Property ErrorWhileImporting As Boolean
|
||||||
|
Public Property RunMode As String
|
||||||
|
Public Property SourceFile As Object
|
||||||
|
Public Property TargetPath As Object
|
||||||
|
Public Property WindreamObjectType As String
|
||||||
|
Public Property WindreamIndicies As List(Of String)
|
||||||
|
Public Property IndexArray As List(Of String)
|
||||||
|
|
||||||
|
Public Sub New(pLogConfig As LogConfig, pConfig As ClassConfig)
|
||||||
|
LogConfig = pLogConfig
|
||||||
|
Logger = pLogConfig.GetLogger
|
||||||
|
Config = pConfig
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Shared Function GetProgramDataPath()
|
||||||
|
Return IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Digital Data", "WIDig")
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Shared Function GetAppDataPath()
|
||||||
|
Return IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Digital Data", "WIDig")
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Function GetUserPWPlain()
|
||||||
|
Try
|
||||||
|
Dim oPassword As String
|
||||||
|
Dim oEncryption As New EncryptionLegacy("!35452didalog=")
|
||||||
|
If Config.WMUserPW = String.Empty Then
|
||||||
|
oPassword = ""
|
||||||
|
Else
|
||||||
|
oPassword = oEncryption.DecryptData(Config.WMUserPW)
|
||||||
|
End If
|
||||||
|
|
||||||
|
Return oPassword
|
||||||
|
Catch ex As Exception
|
||||||
|
Logger.Warn("Error in GetUserPWPlain - the password [" & Config.WMUserPW & "] could not be decrypted", False)
|
||||||
|
Return String.Empty
|
||||||
|
End Try
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Function Connect2Windream(oPW As String)
|
||||||
|
Try
|
||||||
|
Windream = New Windream(LogConfig, False, Config.WMDrive, Config.WMRelPath, True, Config.WMServer, Config.WMUsername, oPW, Config.Domain)
|
||||||
|
If Not IsNothing(Windream) Then
|
||||||
|
If Windream.SessionLoggedin = True Then
|
||||||
|
Logger.Debug("windream initialisiert")
|
||||||
|
Return True
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
Return False
|
||||||
|
Catch ex As Exception
|
||||||
|
Logger.Warn("CHECKING WMConnectivity: " & ex.Message)
|
||||||
|
Return False
|
||||||
|
End Try
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Function InitDatabase() As Boolean
|
||||||
|
If Config.ConnectionString.Length = 0 Then
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
|
||||||
|
Try
|
||||||
|
Database = New MSSQLServer(LogConfig, Config.ConnectionString)
|
||||||
|
If Database.DBInitialized = True Then
|
||||||
|
Return True
|
||||||
|
Else
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
Logger.Error(ex)
|
||||||
|
Return False
|
||||||
|
End Try
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Function ParseArgs(pArguments As String(), Optional pTest As Boolean = False)
|
||||||
|
Dim oINDEXInfoStarted As Boolean = False
|
||||||
|
Dim oINDEXInfotemp As String = ""
|
||||||
|
Try
|
||||||
|
If pArguments.Length <= 3 Then
|
||||||
|
Logger.Warn($"Insufficient number of arguments [{pArguments.Length}]!")
|
||||||
|
System.Console.WriteLine($"Insufficient number of arguments - {Now.ToString}")
|
||||||
|
ErrorWhileParsing = True
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim oCount As Integer = 0
|
||||||
|
For Each oArg As String In pArguments
|
||||||
|
Logger.Debug($"[{oCount}] {oArg}")
|
||||||
|
oArg = oArg.Replace("""", "")
|
||||||
|
If oArg.StartsWith(PARAM_SOURCE) Then
|
||||||
|
SourceFile = oArg.Replace(PARAM_SOURCE, "")
|
||||||
|
If IsNumeric(SourceFile) Then
|
||||||
|
Logger.Info($"SourceFile seems to be a DocID [{SourceFile}]")
|
||||||
|
Dim oSQL = $"SELECT [dbo].[FNDD_GET_WINDREAM_FILE_PATH] ({SourceFile})"
|
||||||
|
SourceFile = Database.GetScalarValue(oSQL)
|
||||||
|
End If
|
||||||
|
If System.IO.File.Exists(SourceFile) = False Then
|
||||||
|
Logger.Warn($"Parser@Sourcefile - File [{SourceFile}] is not existing!")
|
||||||
|
ErrorMessage &= vbNewLine & $"Parser@Sourcefile - File [{SourceFile}] is not existing!"
|
||||||
|
ErrorWhileParsing = True
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
|
||||||
|
ElseIf oArg.StartsWith(PARAM_MODE) Then
|
||||||
|
RunMode = oArg.Replace(PARAM_MODE, "").ToUpper
|
||||||
|
|
||||||
|
ElseIf oArg.StartsWith(PARAM_TARGET) Then
|
||||||
|
TargetPath = oArg.Replace(PARAM_TARGET, "")
|
||||||
|
|
||||||
|
Dim oWMFolder = System.IO.Path.GetDirectoryName(TargetPath)
|
||||||
|
Dim oWindowsPath = TargetPath
|
||||||
|
Dim oExtension = IO.Path.GetExtension(oWindowsPath)
|
||||||
|
Dim oNormalizePath = Windream.GetNormalizedPath(TargetPath)
|
||||||
|
|
||||||
|
If Windream.TestFileExists(TargetPath) = False Then
|
||||||
|
Logger.Info($"WMFile [{TargetPath}] not existing!")
|
||||||
|
End If
|
||||||
|
|
||||||
|
If RunMode = MODE_VERSION Then
|
||||||
|
Dim oWMCheckPath = Windream.VersionWMFilename(TargetPath, System.IO.Path.GetExtension(TargetPath))
|
||||||
|
If oNormalizePath.ToUpper <> oWMCheckPath.ToString.ToUpper Then
|
||||||
|
Logger.Info($"Target [{oNormalizePath}] already existed!! - NewWMFilename [{oWMCheckPath}]")
|
||||||
|
TargetPath = oWMCheckPath
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
'Checks and creates the path if necessary
|
||||||
|
Windream.NewFolder(TargetPath, oExtension)
|
||||||
|
|
||||||
|
ElseIf oArg.StartsWith(PARAM_WMTO) Then
|
||||||
|
WindreamObjectType = oArg.Replace(PARAM_WMTO, "")
|
||||||
|
Dim oObjectTypExists As Boolean = False
|
||||||
|
Dim myWMOTypes = Windream.ObjectTypes
|
||||||
|
For Each otype As String In myWMOTypes
|
||||||
|
If WindreamObjectType = otype Then
|
||||||
|
oObjectTypExists = True
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
If oObjectTypExists = False Then
|
||||||
|
Logger.Info($"WindreamObjectType [{WindreamObjectType}] not existing!!")
|
||||||
|
ErrorMessage &= vbNewLine & $"WindreamObjectType [{WindreamObjectType}] not existing!!"
|
||||||
|
Return False
|
||||||
|
ErrorWhileParsing = True
|
||||||
|
Else
|
||||||
|
WindreamIndicies = Windream.GetIndiciesByObjecttype(WindreamObjectType)
|
||||||
|
End If
|
||||||
|
|
||||||
|
ElseIf oArg.StartsWith(PARAM_INDEX) Then
|
||||||
|
oINDEXInfotemp = oArg
|
||||||
|
oINDEXInfoStarted = True
|
||||||
|
oINDEXInfotemp = oINDEXInfotemp.Replace(PARAM_INDEX, "")
|
||||||
|
|
||||||
|
Else
|
||||||
|
' All args that do not start with an argument identifier (-EXAMPLE@) are just parts of other arguments
|
||||||
|
' and are put back together just like they used to be before.
|
||||||
|
If oINDEXInfoStarted Then
|
||||||
|
oINDEXInfotemp &= " " & oArg
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
oCount += 1
|
||||||
|
Next
|
||||||
|
|
||||||
|
Logger.Debug("INDEXInfoTemp: [{0}]", oINDEXInfotemp)
|
||||||
|
|
||||||
|
Dim oIndexparts As List(Of String) = oINDEXInfotemp.
|
||||||
|
Split(New String() {"#~#"}, StringSplitOptions.RemoveEmptyEntries).
|
||||||
|
ToList()
|
||||||
|
|
||||||
|
For Each oIndexPart As String In oIndexparts
|
||||||
|
Logger.Debug(oIndexPart)
|
||||||
|
Next
|
||||||
|
|
||||||
|
Logger.Info($" [{oIndexparts.Count}] Indices parsed")
|
||||||
|
IndexArray = oIndexparts
|
||||||
|
Return True
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
Logger.Error(ex)
|
||||||
|
Logger.Warn("Error in ParseArgs:" & vbNewLine & ex.Message)
|
||||||
|
ErrorMessage &= vbNewLine & "Error in ParseArgs:" & vbNewLine & ex.Message
|
||||||
|
ErrorWhileParsing = True
|
||||||
|
System.Console.WriteLine($"Error in ParseArgs - {Now.ToString}")
|
||||||
|
|
||||||
|
Return False
|
||||||
|
End Try
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Function StreamORIndexFile()
|
||||||
|
Try
|
||||||
|
Dim oResult As Boolean = False
|
||||||
|
If RunMode = MODE_VERSION Then
|
||||||
|
oResult = Windream.NewFileStream(SourceFile, TargetPath)
|
||||||
|
ElseIf RunMode = MODE_OVERWRITE Then
|
||||||
|
Dim oDeleted = Windream.RemoveFile(TargetPath)
|
||||||
|
If oDeleted = True Then
|
||||||
|
oResult = Windream.NewFileStream(SourceFile, TargetPath)
|
||||||
|
Else
|
||||||
|
Logger.Warn($"Mode ImportOverwrite is active - but WMFile could not be deleted!!")
|
||||||
|
End If
|
||||||
|
ElseIf RunMode = MODE_NACHINDEXIERUNG Then
|
||||||
|
oResult = True
|
||||||
|
End If
|
||||||
|
|
||||||
|
If oResult = True Then
|
||||||
|
Dim oFilePathToIndex As String = TargetPath
|
||||||
|
|
||||||
|
If RunMode = MODE_NACHINDEXIERUNG Then
|
||||||
|
oFilePathToIndex = SourceFile
|
||||||
|
Logger.Info($"Using Sourcefile as FileName: [{SourceFile}]")
|
||||||
|
Else
|
||||||
|
Logger.Info($"File successfully streamed to windream [{TargetPath}]!")
|
||||||
|
End If
|
||||||
|
|
||||||
|
Logger.Info("Indexing file [{0}]", oFilePathToIndex)
|
||||||
|
|
||||||
|
For Each oIndex As String In IndexArray
|
||||||
|
Dim oMatch As Match = oRegex.Match(oIndex)
|
||||||
|
|
||||||
|
If oMatch.Success Then
|
||||||
|
|
||||||
|
Dim oIndexName = oMatch.Groups(1)?.Value
|
||||||
|
Dim oIndexValues = oMatch.Groups.Item(2)?.Value
|
||||||
|
Dim oSplitValue = New String() {"~#~"}
|
||||||
|
|
||||||
|
Dim oIndexValueArray = oIndexValues.Split(oSplitValue, StringSplitOptions.RemoveEmptyEntries)
|
||||||
|
Dim oIndexResult = False
|
||||||
|
|
||||||
|
Logger.Info("Setting Index [{0}] to [{1}].", oIndexName, oIndexValues)
|
||||||
|
|
||||||
|
If Windream.TestIndexNameIsVectorIndex(oIndexName) Then
|
||||||
|
Dim oCombinedIndexValues = Windream.GetVectorData(oFilePathToIndex, oIndexName, oIndexValueArray, False)
|
||||||
|
oIndexResult = Windream.SetFileIndex(oFilePathToIndex, oIndexName, oCombinedIndexValues.ToList, WindreamObjectType)
|
||||||
|
Else
|
||||||
|
oIndexResult = Windream.SetFileIndex(oFilePathToIndex, oIndexName, oIndexValueArray(0), WindreamObjectType)
|
||||||
|
End If
|
||||||
|
|
||||||
|
oResult = oIndexResult
|
||||||
|
Else
|
||||||
|
oResult = False
|
||||||
|
End If
|
||||||
|
|
||||||
|
If oResult = False Then
|
||||||
|
Logger.Warn("Indexing failed. Exiting.")
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
End If
|
||||||
|
|
||||||
|
If oResult = True Then
|
||||||
|
Logger.Info("## All Tasks finished ##")
|
||||||
|
ErrorWhileImporting = False
|
||||||
|
End If
|
||||||
|
|
||||||
|
#Region "Old Logic"
|
||||||
|
'If oResult = True Then
|
||||||
|
' If oMode <> MODE_NACHINDEXIERUNG Then
|
||||||
|
' LOGGER.Info($"File successfully streamed to windream [{oTargetPath}]! Now indexing...")
|
||||||
|
' End If
|
||||||
|
|
||||||
|
' For Each oIndex2 As String In oIndexArr
|
||||||
|
' Dim oIndexInfo() = oIndex2.Split("={")
|
||||||
|
' Dim oIndexName = oIndexInfo(0)
|
||||||
|
' Dim oIndexvalue
|
||||||
|
' Dim r As Regex = New Regex(oRegExArg, RegexOptions.IgnoreCase)
|
||||||
|
' ' ' Match the regular expression pattern against a text string.
|
||||||
|
' Dim m As Match = r.Match(oIndex2)
|
||||||
|
' Do While m.Success
|
||||||
|
|
||||||
|
' ' oClearedBodyText = oClearedBodyText.Replace(m.Value, "")
|
||||||
|
' 'Dim g As Group = m.Groups(1)
|
||||||
|
' Dim g1 As Group = m.Groups(2)
|
||||||
|
' Dim g2 As Group = m.Groups(3)
|
||||||
|
|
||||||
|
' If Not IsNothing(g2.Value) Then
|
||||||
|
' oIndexvalue = g2.Value
|
||||||
|
' Console.WriteLine($"Indexvalue: {oIndexvalue}")
|
||||||
|
' End If
|
||||||
|
|
||||||
|
' If Len(oIndexvalue) > 0 Then
|
||||||
|
' If WMIndices.Contains(oIndexName) Then
|
||||||
|
' LOGGER.Info($"Setting Index: oIndexName [{oIndexName}] - oIndexvalue [{oIndexvalue}]")
|
||||||
|
|
||||||
|
' 'DEBUG
|
||||||
|
' oIndexvalue = New List(Of String) From {"Wert 1", "Wert 2", "wert 3"}
|
||||||
|
' 'DEBUG
|
||||||
|
|
||||||
|
' If WINDREAM.SetFileIndex(oTargetPath, oIndexName, oIndexvalue, oWMObjecttype) = False Then
|
||||||
|
' LOGGER.Info($"Index could not be set...")
|
||||||
|
' If WINDREAM.RemoveFile(oTargetPath) = True Then
|
||||||
|
' LOGGER.Info($"File deleted after error!")
|
||||||
|
' End If
|
||||||
|
' oResult = False
|
||||||
|
' Exit For
|
||||||
|
' End If
|
||||||
|
' Else
|
||||||
|
' LOGGER.Warn($"Transmitted index with name [{oIndexName}] is not existing in WM Objecttype!")
|
||||||
|
' If WINDREAM.RemoveFile(oTargetPath) = True Then
|
||||||
|
' LOGGER.Info($"File deleted after error!")
|
||||||
|
' End If
|
||||||
|
' oResult = False
|
||||||
|
' Exit For
|
||||||
|
' End If
|
||||||
|
' End If
|
||||||
|
' m = m.NextMatch()
|
||||||
|
' Loop
|
||||||
|
' Next
|
||||||
|
' If oResult = True Then
|
||||||
|
' LOGGER.Info("## All Tasks finished ##")
|
||||||
|
' oErrorImport = False
|
||||||
|
' End If
|
||||||
|
'End If
|
||||||
|
#End Region
|
||||||
|
|
||||||
|
Return oResult
|
||||||
|
Catch ex As Exception
|
||||||
|
Logger.Warn($"Unexpected Error in StreamORIndexFile: {ex.Message}")
|
||||||
|
Logger.Error(ex)
|
||||||
|
Return False
|
||||||
|
End Try
|
||||||
|
End Function
|
||||||
|
End Class
|
||||||
13
WiDigShared/My Project/Application.Designer.vb
generated
Normal file
13
WiDigShared/My Project/Application.Designer.vb
generated
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
'------------------------------------------------------------------------------
|
||||||
|
' <auto-generated>
|
||||||
|
' Dieser Code wurde von einem Tool generiert.
|
||||||
|
' Laufzeitversion:4.0.30319.42000
|
||||||
|
'
|
||||||
|
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||||
|
' der Code erneut generiert wird.
|
||||||
|
' </auto-generated>
|
||||||
|
'------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Option Strict On
|
||||||
|
Option Explicit On
|
||||||
|
|
||||||
10
WiDigShared/My Project/Application.myapp
Normal file
10
WiDigShared/My Project/Application.myapp
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||||
|
<MySubMain>false</MySubMain>
|
||||||
|
<SingleInstance>false</SingleInstance>
|
||||||
|
<ShutdownMode>0</ShutdownMode>
|
||||||
|
<EnableVisualStyles>true</EnableVisualStyles>
|
||||||
|
<AuthenticationMode>0</AuthenticationMode>
|
||||||
|
<ApplicationType>1</ApplicationType>
|
||||||
|
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
|
||||||
|
</MyApplicationData>
|
||||||
35
WiDigShared/My Project/AssemblyInfo.vb
Normal file
35
WiDigShared/My Project/AssemblyInfo.vb
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
Imports System
|
||||||
|
Imports System.Reflection
|
||||||
|
Imports System.Runtime.InteropServices
|
||||||
|
|
||||||
|
' Allgemeine Informationen über eine Assembly werden über die folgenden
|
||||||
|
' Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
|
||||||
|
' die einer Assembly zugeordnet sind.
|
||||||
|
|
||||||
|
' Werte der Assemblyattribute überprüfen
|
||||||
|
|
||||||
|
<Assembly: AssemblyTitle("WiDigShared")>
|
||||||
|
<Assembly: AssemblyDescription("")>
|
||||||
|
<Assembly: AssemblyCompany("")>
|
||||||
|
<Assembly: AssemblyProduct("WiDigShared")>
|
||||||
|
<Assembly: AssemblyCopyright("Copyright © 2021")>
|
||||||
|
<Assembly: AssemblyTrademark("")>
|
||||||
|
|
||||||
|
<Assembly: ComVisible(False)>
|
||||||
|
|
||||||
|
'Die folgende GUID wird für die typelib-ID verwendet, wenn dieses Projekt für COM verfügbar gemacht wird.
|
||||||
|
<Assembly: Guid("0ebd0a01-c0bd-4db0-9174-976458068937")>
|
||||||
|
|
||||||
|
' Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
|
||||||
|
'
|
||||||
|
' Hauptversion
|
||||||
|
' Nebenversion
|
||||||
|
' Buildnummer
|
||||||
|
' Revision
|
||||||
|
'
|
||||||
|
' Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
|
||||||
|
' indem Sie "*" wie unten gezeigt eingeben:
|
||||||
|
' <Assembly: AssemblyVersion("1.0.*")>
|
||||||
|
|
||||||
|
<Assembly: AssemblyVersion("1.0.0.0")>
|
||||||
|
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
||||||
63
WiDigShared/My Project/Resources.Designer.vb
generated
Normal file
63
WiDigShared/My Project/Resources.Designer.vb
generated
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
'------------------------------------------------------------------------------
|
||||||
|
' <auto-generated>
|
||||||
|
' Dieser Code wurde von einem Tool generiert.
|
||||||
|
' Laufzeitversion:4.0.30319.42000
|
||||||
|
'
|
||||||
|
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||||
|
' der Code erneut generiert wird.
|
||||||
|
' </auto-generated>
|
||||||
|
'------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Option Strict On
|
||||||
|
Option Explicit On
|
||||||
|
|
||||||
|
Imports System
|
||||||
|
|
||||||
|
Namespace My.Resources
|
||||||
|
|
||||||
|
'Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
|
||||||
|
'-Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
|
||||||
|
'Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
|
||||||
|
'mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
|
||||||
|
'''<summary>
|
||||||
|
''' Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
|
||||||
|
'''</summary>
|
||||||
|
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0"), _
|
||||||
|
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||||
|
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||||
|
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
|
||||||
|
Friend Module Resources
|
||||||
|
|
||||||
|
Private resourceMan As Global.System.Resources.ResourceManager
|
||||||
|
|
||||||
|
Private resourceCulture As Global.System.Globalization.CultureInfo
|
||||||
|
|
||||||
|
'''<summary>
|
||||||
|
''' Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
|
||||||
|
'''</summary>
|
||||||
|
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||||
|
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
|
||||||
|
Get
|
||||||
|
If Object.ReferenceEquals(resourceMan, Nothing) Then
|
||||||
|
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("DigitalData.GUIs.WiDigShared.Resources", GetType(Resources).Assembly)
|
||||||
|
resourceMan = temp
|
||||||
|
End If
|
||||||
|
Return resourceMan
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
'''<summary>
|
||||||
|
''' Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
|
||||||
|
''' Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
|
||||||
|
'''</summary>
|
||||||
|
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||||
|
Friend Property Culture() As Global.System.Globalization.CultureInfo
|
||||||
|
Get
|
||||||
|
Return resourceCulture
|
||||||
|
End Get
|
||||||
|
Set
|
||||||
|
resourceCulture = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
End Module
|
||||||
|
End Namespace
|
||||||
117
WiDigShared/My Project/Resources.resx
Normal file
117
WiDigShared/My Project/Resources.resx
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
||||||
73
WiDigShared/My Project/Settings.Designer.vb
generated
Normal file
73
WiDigShared/My Project/Settings.Designer.vb
generated
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
'------------------------------------------------------------------------------
|
||||||
|
' <auto-generated>
|
||||||
|
' Dieser Code wurde von einem Tool generiert.
|
||||||
|
' Laufzeitversion:4.0.30319.42000
|
||||||
|
'
|
||||||
|
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||||
|
' der Code erneut generiert wird.
|
||||||
|
' </auto-generated>
|
||||||
|
'------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Option Strict On
|
||||||
|
Option Explicit On
|
||||||
|
|
||||||
|
|
||||||
|
Namespace My
|
||||||
|
|
||||||
|
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||||
|
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.8.1.0"), _
|
||||||
|
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||||
|
Partial Friend NotInheritable Class MySettings
|
||||||
|
Inherits Global.System.Configuration.ApplicationSettingsBase
|
||||||
|
|
||||||
|
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
|
||||||
|
|
||||||
|
#Region "Automatische My.Settings-Speicherfunktion"
|
||||||
|
#If _MyType = "WindowsForms" Then
|
||||||
|
Private Shared addedHandler As Boolean
|
||||||
|
|
||||||
|
Private Shared addedHandlerLockObject As New Object
|
||||||
|
|
||||||
|
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||||
|
Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs)
|
||||||
|
If My.Application.SaveMySettingsOnExit Then
|
||||||
|
My.Settings.Save()
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
#End If
|
||||||
|
#End Region
|
||||||
|
|
||||||
|
Public Shared ReadOnly Property [Default]() As MySettings
|
||||||
|
Get
|
||||||
|
|
||||||
|
#If _MyType = "WindowsForms" Then
|
||||||
|
If Not addedHandler Then
|
||||||
|
SyncLock addedHandlerLockObject
|
||||||
|
If Not addedHandler Then
|
||||||
|
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
|
||||||
|
addedHandler = True
|
||||||
|
End If
|
||||||
|
End SyncLock
|
||||||
|
End If
|
||||||
|
#End If
|
||||||
|
Return defaultInstance
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
End Class
|
||||||
|
End Namespace
|
||||||
|
|
||||||
|
Namespace My
|
||||||
|
|
||||||
|
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
|
||||||
|
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||||
|
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
|
||||||
|
Friend Module MySettingsProperty
|
||||||
|
|
||||||
|
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
|
||||||
|
Friend ReadOnly Property Settings() As Global.DigitalData.GUIs.WiDigShared.My.MySettings
|
||||||
|
Get
|
||||||
|
Return Global.DigitalData.GUIs.WiDigShared.My.MySettings.Default
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
End Module
|
||||||
|
End Namespace
|
||||||
7
WiDigShared/My Project/Settings.settings
Normal file
7
WiDigShared/My Project/Settings.settings
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
|
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
|
||||||
|
<Profiles>
|
||||||
|
<Profile Name="(Default)" />
|
||||||
|
</Profiles>
|
||||||
|
<Settings />
|
||||||
|
</SettingsFile>
|
||||||
131
WiDigShared/WiDigShared.vbproj
Normal file
131
WiDigShared/WiDigShared.vbproj
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{A5D032D4-ABDC-44BF-8666-5FBE42AF0AB7}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<RootNamespace>DigitalData.GUIs.WiDigShared</RootNamespace>
|
||||||
|
<AssemblyName>DigitalData.GUIs.WiDigShared</AssemblyName>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<MyType>Windows</MyType>
|
||||||
|
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||||
|
<Deterministic>true</Deterministic>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<DefineDebug>true</DefineDebug>
|
||||||
|
<DefineTrace>true</DefineTrace>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DocumentationFile>DigitalData.GUIs.WiDigShared.xml</DocumentationFile>
|
||||||
|
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<DefineDebug>false</DefineDebug>
|
||||||
|
<DefineTrace>true</DefineTrace>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DocumentationFile>DigitalData.GUIs.WiDigShared.xml</DocumentationFile>
|
||||||
|
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<OptionExplicit>On</OptionExplicit>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<OptionCompare>Binary</OptionCompare>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<OptionStrict>Off</OptionStrict>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<OptionInfer>On</OptionInfer>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="DigitalData.Modules.Config">
|
||||||
|
<HintPath>..\..\DDMonorepo\Modules.Config\bin\Debug\DigitalData.Modules.Config.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="DigitalData.Modules.Database">
|
||||||
|
<HintPath>..\..\DDMonorepo\Modules.Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="DigitalData.Modules.Encryption">
|
||||||
|
<HintPath>..\..\DDMonorepo\Encryption\bin\Debug\DigitalData.Modules.Encryption.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="DigitalData.Modules.Logging">
|
||||||
|
<HintPath>..\..\DDMonorepo\Modules.Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="DigitalData.Modules.Windream">
|
||||||
|
<HintPath>..\..\DDMonorepo\Modules.Windream\bin\Debug\DigitalData.Modules.Windream.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\NLog.4.7.0\lib\net45\NLog.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Configuration" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.IO.Compression" />
|
||||||
|
<Reference Include="System.Runtime.Serialization" />
|
||||||
|
<Reference Include="System.ServiceModel" />
|
||||||
|
<Reference Include="System.Transactions" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Import Include="Microsoft.VisualBasic" />
|
||||||
|
<Import Include="System" />
|
||||||
|
<Import Include="System.Collections" />
|
||||||
|
<Import Include="System.Collections.Generic" />
|
||||||
|
<Import Include="System.Data" />
|
||||||
|
<Import Include="System.Diagnostics" />
|
||||||
|
<Import Include="System.Linq" />
|
||||||
|
<Import Include="System.Xml.Linq" />
|
||||||
|
<Import Include="System.Threading.Tasks" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="ClassConfig.vb" />
|
||||||
|
<Compile Include="ClassWIDig.vb" />
|
||||||
|
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||||
|
<Compile Include="My Project\Application.Designer.vb">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Application.myapp</DependentUpon>
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="My Project\Resources.Designer.vb">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="My Project\Settings.Designer.vb">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="My Project\Resources.resx">
|
||||||
|
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
|
||||||
|
<CustomToolNamespace>My.Resources</CustomToolNamespace>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</EmbeddedResource>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="My Project\Application.myapp">
|
||||||
|
<Generator>MyApplicationCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>Application.Designer.vb</LastGenOutput>
|
||||||
|
</None>
|
||||||
|
<None Include="My Project\Settings.settings">
|
||||||
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
|
<CustomToolNamespace>My</CustomToolNamespace>
|
||||||
|
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
|
||||||
|
</None>
|
||||||
|
<None Include="packages.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||||
|
</Project>
|
||||||
4
WiDigShared/packages.config
Normal file
4
WiDigShared/packages.config
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="NLog" version="4.7.0" targetFramework="net461" />
|
||||||
|
</packages>
|
||||||
Loading…
x
Reference in New Issue
Block a user