MS New Version
This commit is contained in:
@@ -1,5 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
</configSections>
|
||||
<connectionStrings>
|
||||
<add name="WIDigConsoleApp.My.MySettings.MyECM_ConnectionString"
|
||||
connectionString="Data Source=SDD-VMP04-SQL17\DD_DEVELOP01;Initial Catalog=DD_ECM_TEST;User ID=sa;Password=dd"
|
||||
providerName="System.Data.SqlClient" />
|
||||
</connectionStrings>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
|
||||
</startup>
|
||||
|
||||
@@ -3,15 +3,18 @@ Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Windream
|
||||
Imports DigitalData.Modules.Config
|
||||
Imports System.IO
|
||||
Imports System.Text.RegularExpressions
|
||||
Imports DigitalData.Modules.Database
|
||||
|
||||
Module Module1
|
||||
Private _ArgumentLength As Integer
|
||||
Public _database As MSSQLServer
|
||||
Public oRegExArg As String
|
||||
Public Function Main(args As String()) As Integer
|
||||
Try
|
||||
' Console.WriteLine("Starting up WIDig...")
|
||||
Dim opath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
|
||||
Dim oLogConfig As New LogConfig(LogConfig.PathType.CustomPath,
|
||||
opath & "\Digital Data\WIDigDat\Log",
|
||||
Nothing,
|
||||
Dim oLogConfig As New LogConfig(LogConfig.PathType.AppData, Nothing, Nothing,
|
||||
"Digital Data",
|
||||
"WIDigCons")
|
||||
|
||||
@@ -26,27 +29,36 @@ Module Module1
|
||||
System.Console.WriteLine($"Starting up WIDig...")
|
||||
If Connect2Windream(oUserPW) = True Then
|
||||
System.Console.WriteLine($"Windream initialized!")
|
||||
Dim oArguments As String() = Environment.GetCommandLineArgs()
|
||||
If ParseArgs(args) = True Then
|
||||
System.Console.WriteLine($"Parsed all arguments!")
|
||||
If StreamIndexFile() = True Then
|
||||
oErrorImport = False
|
||||
If InitDatabase() = True Then
|
||||
Load_DB_DAta()
|
||||
'Dim oArguments As String() = Environment.GetCommandLineArgs()
|
||||
If ParseArgs(args) = True Then
|
||||
System.Console.WriteLine($"Parsed all arguments!")
|
||||
If StreamIndexFile() = True Then
|
||||
oErrorImport = False
|
||||
Else
|
||||
System.Console.WriteLine($"###Error in StreamIndexFile!####")
|
||||
oErrorImport = True
|
||||
End If
|
||||
Else
|
||||
System.Console.WriteLine($"###Error in StreamIndexFile!####")
|
||||
oErrorImport = True
|
||||
System.Console.WriteLine($"###Error in ParseArgs!####")
|
||||
System.Console.WriteLine($"### Error in ParseArgs ####")
|
||||
System.Console.WriteLine(oErrorMessage)
|
||||
System.Console.WriteLine("### For more information check the log! Press any key to exit! ####")
|
||||
System.Console.WriteLine($"####################")
|
||||
Console.ReadKey()
|
||||
End If
|
||||
|
||||
|
||||
Else
|
||||
System.Console.WriteLine($"###Error in ParseArgs!####")
|
||||
System.Console.WriteLine($"### Error in ParseArgs ####")
|
||||
System.Console.WriteLine(oErrorMessage)
|
||||
System.Console.WriteLine("### For more information check the log! Press any key to exit! ####")
|
||||
System.Console.WriteLine($"####################")
|
||||
Console.ReadKey()
|
||||
oErrorMessage = "Could not initialize DB"
|
||||
End If
|
||||
|
||||
Else
|
||||
oErrorMessage = "Could not initialize windream"
|
||||
End If
|
||||
|
||||
|
||||
If oErrorParse = True Or oErrorImport = True Then
|
||||
System.Console.WriteLine(oErrorMessage)
|
||||
System.Console.WriteLine("### For more information check the log! Press any key to exit! ####")
|
||||
@@ -69,10 +81,39 @@ Module Module1
|
||||
CONFIG = New ConfigManager(Of ClassConfig)(LOGCONFIG, oUserAppDataPath, System.AppDomain.CurrentDomain.BaseDirectory, oCommonAppDataPath)
|
||||
System.Console.WriteLine($"Config loaded!")
|
||||
LOGGER.Info("Config loaded")
|
||||
|
||||
|
||||
'Settings_Load()
|
||||
End Sub
|
||||
Public Function InitDatabase() As Boolean
|
||||
If My.Settings.MyECM_ConnectionString = String.Empty Then
|
||||
Return False
|
||||
End If
|
||||
|
||||
Try
|
||||
_database = New MSSQLServer(LOGCONFIG, My.Settings.MyECM_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 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
|
||||
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)
|
||||
@@ -104,6 +145,8 @@ Module Module1
|
||||
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
|
||||
@@ -166,16 +209,22 @@ Module Module1
|
||||
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
|
||||
oINDEXInfotemp = oArg
|
||||
oINDEXInfoStarted = True
|
||||
oINDEXInfotemp = oINDEXInfotemp.Replace("-index@", "")
|
||||
|
||||
Else
|
||||
If oINDEXInfoStarted Then
|
||||
oINDEXInfotemp &= " " & oArg
|
||||
End If
|
||||
End If
|
||||
ocount += 1
|
||||
Next
|
||||
|
||||
Dim oIndexparts As String() = oINDEXInfotemp.Split(New String() {"#~#"}, StringSplitOptions.RemoveEmptyEntries)
|
||||
|
||||
LOGGER.Info($" [{oIndexparts.Length}] Indices transmitted...")
|
||||
oIndexArr = oIndexparts
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
LOGGER.Warn("Error in ParseArgs:" & vbNewLine & ex.Message)
|
||||
@@ -205,28 +254,45 @@ Module Module1
|
||||
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 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
|
||||
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 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
|
||||
End If
|
||||
m = m.NextMatch()
|
||||
Loop
|
||||
Next
|
||||
If oResult = True Then
|
||||
LOGGER.Info("Import finished!")
|
||||
|
||||
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.0.0.0")>
|
||||
<Assembly: AssemblyVersion("1.2.0.0")>
|
||||
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
||||
|
||||
83
WIDigConsoleApp/My Project/Settings.Designer.vb
generated
83
WIDigConsoleApp/My Project/Settings.Designer.vb
generated
@@ -1,10 +1,10 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' This code was generated by a tool.
|
||||
' Runtime Version:4.0.30319.42000
|
||||
' Dieser Code wurde von einem Tool generiert.
|
||||
' Laufzeitversion:4.0.30319.42000
|
||||
'
|
||||
' Changes to this file may cause incorrect behavior and will be lost if
|
||||
' the code is regenerated.
|
||||
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
' der Code erneut generiert wird.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
@@ -13,57 +13,68 @@ Option Explicit On
|
||||
|
||||
|
||||
Namespace My
|
||||
|
||||
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0"), _
|
||||
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
|
||||
<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 "My.Settings Auto-Save Functionality"
|
||||
|
||||
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 addedHandler As Boolean
|
||||
|
||||
Private Shared addedHandlerLockObject As New Object
|
||||
Private Shared addedHandlerLockObject As New Object
|
||||
|
||||
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
|
||||
If My.Application.SaveMySettingsOnExit Then
|
||||
My.Settings.Save()
|
||||
End If
|
||||
End Sub
|
||||
<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
|
||||
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
|
||||
|
||||
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Configuration.SpecialSettingAttribute(Global.System.Configuration.SpecialSetting.ConnectionString), _
|
||||
Global.System.Configuration.DefaultSettingValueAttribute("Data Source=SDD-VMP04-SQL17\DD_DEVELOP01;Initial Catalog=DD_ECM_TEST;User ID=sa;P"& _
|
||||
"assword=dd")> _
|
||||
Public ReadOnly Property MyECM_ConnectionString() As String
|
||||
Get
|
||||
Return CType(Me("MyECM_ConnectionString"),String)
|
||||
End Get
|
||||
End Property
|
||||
End Class
|
||||
End Namespace
|
||||
|
||||
Namespace My
|
||||
|
||||
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
|
||||
|
||||
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
|
||||
Friend Module MySettingsProperty
|
||||
|
||||
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
|
||||
|
||||
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
|
||||
Friend ReadOnly Property Settings() As Global.WIDigConsoleApp.My.MySettings
|
||||
Get
|
||||
Return Global.WIDigConsoleApp.My.MySettings.Default
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
<?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>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="My" GeneratedClassName="MySettings" UseMySettingsClassName="true">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="MyECM_ConnectionString" Type="(Connection string)" Scope="Application">
|
||||
<DesignTimeValue Profile="(Default)"><?xml version="1.0" encoding="utf-16"?>
|
||||
<SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<ConnectionString>Data Source=SDD-VMP04-SQL17\DD_DEVELOP01;Initial Catalog=DD_ECM_TEST;User ID=sa;Password=dd</ConnectionString>
|
||||
<ProviderName>System.Data.SqlClient</ProviderName>
|
||||
</SerializableConnectionString></DesignTimeValue>
|
||||
<Value Profile="(Default)">Data Source=SDD-VMP04-SQL17\DD_DEVELOP01;Initial Catalog=DD_ECM_TEST;User ID=sa;Password=dd</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
@@ -50,10 +50,15 @@
|
||||
<Reference Include="DigitalData.Modules.Config">
|
||||
<HintPath>..\..\DDMonorepo\Modules.Config\bin\Debug\DigitalData.Modules.Config.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Logging">
|
||||
<HintPath>..\..\DDMonorepo\Modules.Windream\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
|
||||
<Reference Include="DigitalData.Modules.Database">
|
||||
<HintPath>..\..\DDMonorepo\Modules.Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Windream">
|
||||
<Reference Include="DigitalData.Modules.Logging, Version=2.1.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\DDMonorepo\Modules.Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Windream, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\DDMonorepo\Modules.Windream\bin\Debug\DigitalData.Modules.Windream.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NLog">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
|
||||
<StartArguments>-Mode%40IMPV -Source%40E:\TEMP\TEST.pdf -Target%40"W:\ImportWIDIG\Testfile.pdf" -WMOT%40"DIGITAL DATA - Entwicklung" -index%40{"Integer 23"=4711%3b"String 38"=WeDigNoWIDig%3b"Boolean 04"=false}</StartArguments>
|
||||
<StartArguments>-Mode%40IMPV -Source%40E:\TEMP\TEST.pdf -Target%40"W:\ImportWIDIG\Testfile.pdf" -WMOT%40"DIGITAL DATA - Entwicklung" -index%40Integer 24={0815}#~#Vektor_Text1={ValueX~#~ValueY}</StartArguments>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user