Verbesserung der Fehlerbehandlung und Protokollierung
Neue Konstanten und Wiederholungslogik in `ActiveDirectoryInterface.vb` hinzugefügt, um vorübergehende AD-Fehler zu handhaben. Funktion `IsTransientAdException` implementiert. Verbesserte Benutzer-Synchronisierungslogik in `SyncUsers.MSSQL.vb`, um unnötige Löschvorgänge zu vermeiden. Versionsnummern in `AssemblyInfo.vb` aktualisiert. Warnmeldungen und Index-Typ-Überprüfung in `Windream.vb` verbessert. NLog-Verwaltung in `Windream.vbproj` auf NuGet umgestellt und entsprechende Referenz aus `packages.config` entfernt.
This commit is contained in:
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.9.8.0")>
|
||||
<Assembly: AssemblyFileVersion("1.9.8.0")>
|
||||
<Assembly: AssemblyVersion("2.0.0.0")>
|
||||
<Assembly: AssemblyFileVersion("2.0.0.0")>
|
||||
|
||||
@@ -1244,7 +1244,7 @@ Public Class Windream
|
||||
Dim oWMObject As IWMObject6 = GetFileByPath(Path)
|
||||
|
||||
If LockObject(oWMObject, WMObjectEditModeIndexEdit) = False Then
|
||||
_logger.Warn("File {0} could not be locked")
|
||||
_logger.Warn("File {0} could not be locked", Path)
|
||||
Return False
|
||||
End If
|
||||
|
||||
@@ -1254,22 +1254,26 @@ Public Class Windream
|
||||
|
||||
Try
|
||||
Dim oType As Integer = GetIndexType(pIndexName)
|
||||
If Not IsNothing(oType) Then
|
||||
Dim oConvertedValue As Object = Helpers.ConvertIndexValue(oType, pStringValue)
|
||||
|
||||
oWMObject.SetVariableValue(pIndexName, oConvertedValue)
|
||||
oWMObject.Save()
|
||||
|
||||
If UnlockObject(oWMObject) = False Then
|
||||
_logger.Warn("File {0} could not be unlocked", Path)
|
||||
End If
|
||||
|
||||
Return True
|
||||
Else
|
||||
' IsNothing() schlägt bei Integer (Werttyp) nie an – stattdessen auf Undefined (0) prüfen
|
||||
If oType = WMObjectVariableValueTypeUndefined Then
|
||||
_logger.Warn("Index '{0}' not found or has undefined type – SetFileIndex aborted for file '{1}'", pIndexName, Path)
|
||||
UnlockObject(oWMObject)
|
||||
Return False
|
||||
End If
|
||||
|
||||
Dim oConvertedValue As Object = Helpers.ConvertIndexValue(oType, pStringValue)
|
||||
|
||||
oWMObject.SetVariableValue(pIndexName, oConvertedValue)
|
||||
oWMObject.Save()
|
||||
|
||||
If UnlockObject(oWMObject) = False Then
|
||||
_logger.Warn("File {0} could not be unlocked", Path)
|
||||
End If
|
||||
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
_logger.Warn("Could not set value '{0}' for index '{1}' on file '{2}'", pStringValue, pIndexName, Path)
|
||||
_logger.Error(ex)
|
||||
UnlockObject(oWMObject)
|
||||
Return False
|
||||
@@ -1285,6 +1289,7 @@ Public Class Windream
|
||||
_logger.Warn("File '{0}' does not exist", pPath)
|
||||
Return False
|
||||
End If
|
||||
|
||||
Dim oWMObject As IWMObject6
|
||||
|
||||
Try
|
||||
@@ -1295,9 +1300,10 @@ Public Class Windream
|
||||
_logger.Warn(ex.Message)
|
||||
Return False
|
||||
End Try
|
||||
|
||||
'Lock WMObject for changes
|
||||
If LockObject(oWMObject, WMObjectEditModeIndexEdit) = False Then
|
||||
_logger.Warn("File {0} could not be locked")
|
||||
_logger.Warn("File '{0}' could not be locked", pPath)
|
||||
Return False
|
||||
End If
|
||||
|
||||
@@ -1307,9 +1313,18 @@ Public Class Windream
|
||||
|
||||
Try
|
||||
Dim oType As Integer = GetIndexType(pIndexName)
|
||||
Dim oConvertedValues As New List(Of String)
|
||||
Dim oArray As Object
|
||||
|
||||
' Gleicher Bug wie in SetFileIndex: Integer-Werttyp – IsNothing() greift nie
|
||||
' Stattdessen auf Undefined (0) prüfen
|
||||
If oType = WMObjectVariableValueTypeUndefined Then
|
||||
_logger.Warn("Index '{0}' not found or has undefined type – SetFileIndexLoS aborted for file '{1}'", pIndexName, pPath)
|
||||
UnlockObject(oWMObject)
|
||||
Return False
|
||||
End If
|
||||
|
||||
_logger.Debug("SetFileIndexLoS '{0}' - Indextype: {1} - Values.Count: {2} ... ", pIndexName, oType, pAttributeValues.Count)
|
||||
|
||||
Dim oArray As Object
|
||||
ReDim oArray(pAttributeValues.Count - 1)
|
||||
|
||||
For oIndex = 0 To pAttributeValues.Count - 1
|
||||
@@ -1322,13 +1337,14 @@ Public Class Windream
|
||||
oWMObject.Save()
|
||||
|
||||
If UnlockObject(oWMObject) = False Then
|
||||
_logger.Warn("File {0} could not be unlocked", pPath)
|
||||
_logger.Warn("File '{0}' could not be unlocked", pPath)
|
||||
End If
|
||||
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
_logger.Warn("Could not set value for index '{0}' on file '{1}'", pIndexName, pPath)
|
||||
_logger.Error(ex)
|
||||
|
||||
UnlockObject(oWMObject)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
@@ -65,9 +65,6 @@
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.5.0.5\lib\net46\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Data" />
|
||||
@@ -81,6 +78,11 @@
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NLog">
|
||||
<Version>5.0.5</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Import Include="Microsoft.VisualBasic" />
|
||||
<Import Include="System" />
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="DigitalData.Modules.Logging" version="2.6.5" targetFramework="net462" />
|
||||
<package id="NLog" version="5.0.5" targetFramework="net461" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user