Add correct duplicate handling for indexed files
This commit is contained in:
parent
6f273fbea8
commit
a8e6d2acd9
@ -38,12 +38,12 @@ Public Class ClassWindream
|
||||
|
||||
#Region "+++++ Variablen +++++"
|
||||
Public Shared oConnect ' der Typ darf nicht festgelegt werden (warum auch immer... geht sonst nicht)
|
||||
Public Shared oSession 'As WINDREAMLib.WMSession ' der Typ darf nicht festgelegt werden (warum auch immer... geht sonst nicht)
|
||||
Public Shared _session 'As WINDREAMLib.WMSession ' der Typ darf nicht festgelegt werden (warum auch immer... geht sonst nicht)
|
||||
Public Shared oBrowser As New WMOBRWSLib.ServerBrowser
|
||||
Public Shared oDokumentTypen As WINDREAMLib.WMObjects
|
||||
Private oController As New WMOSearchController
|
||||
Public Shared _DocumentTypes As WINDREAMLib.WMObjects
|
||||
Private _SearchController As New WMOSearchController
|
||||
Public Shared _WDObjekttyp As String
|
||||
Private Shared aktWMObject As WINDREAMLib.WMObject
|
||||
Private Shared _currentWMObject As WINDREAMLib.WMObject
|
||||
#End Region
|
||||
|
||||
|
||||
@ -71,13 +71,13 @@ Public Class ClassWindream
|
||||
Dim ProfileName = wdfLocation.Substring(wdfLocation.LastIndexOf("\") + 1)
|
||||
Dim ProfilePath = wdfLocation.Substring(0, wdfLocation.Length - ProfileName.Length)
|
||||
|
||||
oController = New WMOSearchController
|
||||
_SearchController = New WMOSearchController
|
||||
|
||||
Me.oController.CheckSearchProfile(wdfLocation.ToLower)
|
||||
Dim suchTyp = Me.oController.SearchProfileTargetProgID
|
||||
Me._SearchController.CheckSearchProfile(wdfLocation.ToLower)
|
||||
Dim suchTyp = Me._SearchController.SearchProfileTargetProgID
|
||||
Dim ExSettings As Object
|
||||
Dim oSearch As Object
|
||||
ExSettings = Me.oController.SearchProfileExSettings
|
||||
ExSettings = Me._SearchController.SearchProfileExSettings
|
||||
If ExSettings = 0 Then ExSettings = 7
|
||||
|
||||
Dim srchQuick As WMOSRCHLib.WMQuickSearch = CreateObject("WMOSrch.WMQuickSearch")
|
||||
@ -195,7 +195,7 @@ Public Class ClassWindream
|
||||
Try
|
||||
Try
|
||||
' Session-Objekt instanziieren und mit dem im Client ausgewählten Server belegen
|
||||
oSession = CreateObject("Windream.WMSession", GetCurrentServer)
|
||||
_session = CreateObject("Windream.WMSession", GetCurrentServer)
|
||||
LOGGER.Info(" ...windream-Server: '" & GetCurrentServer() & "'")
|
||||
' Connection-Objekt instanziieren
|
||||
oConnect = CreateObject("Windream.WMConnect")
|
||||
@ -224,8 +224,8 @@ Public Class ClassWindream
|
||||
' oConnect.Password "windream"
|
||||
|
||||
' Verbindung mit Session-Objekt (und dem ausgewählten Server) aufbauen
|
||||
oConnect.LoginSession(oSession)
|
||||
If oSession.aLoggedin = False Then
|
||||
oConnect.LoginSession(_session)
|
||||
If _session.aLoggedin = False Then
|
||||
MsgBox("Es konnte keine Verbindung mit dem windream-Server hergestellt werden", MsgBoxStyle.Exclamation, "Verbindung konnte nicht hergestellt werden")
|
||||
Return False
|
||||
End If
|
||||
@ -251,10 +251,10 @@ Public Class ClassWindream
|
||||
'MsgBox(WMCtrl.WMServerName)
|
||||
|
||||
Try
|
||||
oSession.SwitchEvents(WMCOMEventWMSessionNeedIndex, False)
|
||||
_session.SwitchEvents(WMCOMEventWMSessionNeedIndex, False)
|
||||
' der Parameter WMEntityDocument definiert, dass nur Dokumenttypen und keine
|
||||
' Ordnertypen ausgelesen werden
|
||||
oDokumentTypen = oSession.GetWMObjectTypes(WINDREAMLib.WMEntity.WMEntityDocument)
|
||||
_DocumentTypes = _session.GetWMObjectTypes(WINDREAMLib.WMEntity.WMEntityDocument)
|
||||
Catch ex As Exception
|
||||
Return False
|
||||
End Try
|
||||
@ -288,7 +288,7 @@ Public Class ClassWindream
|
||||
''' <remarks></remarks>
|
||||
Public Shared Function GetObjecttypesAsObjects() As WMObjects
|
||||
Try
|
||||
Return oDokumentTypen
|
||||
Return _DocumentTypes
|
||||
Catch ex As Exception
|
||||
MsgBox("Fehlernachricht:" & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Unexpected error inm Auslesen der Objekttypen")
|
||||
Return Nothing
|
||||
@ -303,10 +303,10 @@ Public Class ClassWindream
|
||||
Public Function GetObjecttypesAsStrings() As String()
|
||||
|
||||
Try
|
||||
Dim objektTypenStr(Me.oDokumentTypen.Count) As String
|
||||
Dim objektTypenStr(_DocumentTypes.Count) As String
|
||||
|
||||
For i As Integer = 0 To Me.oDokumentTypen.Count
|
||||
objektTypenStr(i) = Me.oDokumentTypen.Item(i).aName
|
||||
For i As Integer = 0 To _DocumentTypes.Count
|
||||
objektTypenStr(i) = _DocumentTypes.Item(i).aName
|
||||
Next
|
||||
|
||||
Return objektTypenStr
|
||||
@ -319,7 +319,7 @@ Public Class ClassWindream
|
||||
End Function
|
||||
Public Function GetTypeOfIndex(ByVal indexname As String) As Integer
|
||||
Try
|
||||
Dim oAttribute = oSession.GetWMObjectByName(WINDREAMLib.WMEntity.WMEntityAttribute, indexname)
|
||||
Dim oAttribute = _session.GetWMObjectByName(WINDREAMLib.WMEntity.WMEntityAttribute, indexname)
|
||||
Dim vType = oAttribute.getVariableValue("dwAttrType")
|
||||
Return vType
|
||||
Catch ex As Exception
|
||||
@ -329,7 +329,7 @@ Public Class ClassWindream
|
||||
Public Shared Function GetSystemIndices(ByVal name As String)
|
||||
Dim oObjectType As WMObject
|
||||
' den Objekttyp laden
|
||||
oObjectType = oSession.GetWMObjectByName(WMEntityObjectType, name)
|
||||
oObjectType = _session.GetWMObjectByName(WMEntityObjectType, name)
|
||||
|
||||
|
||||
Dim msg As String
|
||||
@ -345,7 +345,7 @@ Public Class ClassWindream
|
||||
Public Shared Function GetTypIndexNames(ByVal name As String)
|
||||
Dim oObjectType As WMObject
|
||||
' den Objekttyp laden
|
||||
oObjectType = oSession.GetWMObjectByName(WMEntityObjectType, name)
|
||||
oObjectType = _session.GetWMObjectByName(WMEntityObjectType, name)
|
||||
|
||||
|
||||
Dim msg As String
|
||||
@ -361,7 +361,7 @@ Public Class ClassWindream
|
||||
''' <summary>
|
||||
''' Liefert alle Indexe eines Objekttypen.
|
||||
''' </summary>
|
||||
''' <param name="name">Name des Objekttyps</param>
|
||||
''' <param name="Objecttype_name">Name des Objekttyps</param>
|
||||
''' <returns>Array mit allen Objekttyp zugeordneten Indexen als String</returns>
|
||||
''' <remarks></remarks>
|
||||
Public Shared Function GetIndicesByObjecttype(ByVal Objecttype_name As String) As String()
|
||||
@ -373,7 +373,7 @@ Public Class ClassWindream
|
||||
Dim oRelProperties As WMObjectRelationClass
|
||||
|
||||
' den Objekttyp laden
|
||||
oObjectType = oSession.GetWMObjectByName(WMEntityObjectType, Objecttype_name)
|
||||
oObjectType = _session.GetWMObjectByName(WMEntityObjectType, Objecttype_name)
|
||||
|
||||
' Beziehung zu Indizes des Objekttyp auslesen
|
||||
oIndexAttributes = oObjectType.GetWMObjectRelationByName("TypeAttributes")
|
||||
@ -415,7 +415,7 @@ Public Class ClassWindream
|
||||
Public Function GetObjecttypeByName(ByVal objekttypName As String) As WMObject
|
||||
Try
|
||||
' alle Objekttypen auslesen
|
||||
Dim oObjectTypes As WMObjects = Me.oSession.GetWMObjectTypes(WINDREAMLib.WMEntity.WMEntityDocument)
|
||||
Dim oObjectTypes As WMObjects = _session.GetWMObjectTypes(WINDREAMLib.WMEntity.WMEntityDocument)
|
||||
|
||||
' alle Objekttypen durchlaufen und nach dem mit dem angegebenen Namen suchen
|
||||
For Each oObjectType As WMObject In oObjectTypes
|
||||
@ -467,7 +467,7 @@ Public Class ClassWindream
|
||||
''' <remarks></remarks>
|
||||
Public Shared Function IsLoggedIn() As Boolean
|
||||
Try
|
||||
Return oSession.aLoggedin
|
||||
Return _session.aLoggedin
|
||||
Catch ex As Exception
|
||||
MsgBox("Es konnte nicht erfolgreich geprüft werden, ob das Programm am windream-Server angemeldted ist." & vbNewLine & vbNewLine & "Fehlernachricht:" & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Unexpected error in Loggedin-Prüfung")
|
||||
End Try
|
||||
@ -527,7 +527,7 @@ Public Class ClassWindream
|
||||
'Dim oAttribute = Me.oSession.GetWMObjectByName(WINDREAMLib.WMEntity.WMEntityAttribute, indexname)
|
||||
'Dim vType = oAttribute.getVariableValue("vItems")
|
||||
'Return vType
|
||||
Dim oChoiceList = oSession.GetWMObjectByName(WMEntityChoiceList, _auswahlliste)
|
||||
Dim oChoiceList = _session.GetWMObjectByName(WMEntityChoiceList, _auswahlliste)
|
||||
If Err.Number = 0 And TypeName(oChoiceList) <> "Nothing" Then
|
||||
Dim Values = oChoiceList
|
||||
Values = oChoiceList.GetVariableValue("vItems")
|
||||
@ -558,41 +558,41 @@ Public Class ClassWindream
|
||||
End Try
|
||||
End Function
|
||||
#End Region
|
||||
Public Shared Function Stream_File(ByVal filenameQuelle As String, ByVal newfilename As String)
|
||||
Public Shared Function Stream_File(ByVal SourceFilePath As String, ByVal NewFileName As String)
|
||||
On Error Resume Next
|
||||
aktWMObject = Nothing
|
||||
Dim Zielverzeichnis As String = Path.GetDirectoryName(newfilename)
|
||||
If My.Computer.FileSystem.DirectoryExists(Zielverzeichnis) = False Then
|
||||
My.Computer.FileSystem.CreateDirectory(Zielverzeichnis)
|
||||
_currentWMObject = Nothing
|
||||
Dim oDestination As String = Path.GetDirectoryName(NewFileName)
|
||||
If My.Computer.FileSystem.DirectoryExists(oDestination) = False Then
|
||||
My.Computer.FileSystem.CreateDirectory(oDestination)
|
||||
LOGGER.Info(" - Zielverzeichnis neu erzeugt!")
|
||||
End If
|
||||
|
||||
Const STREAM_BinaryObject = "BinaryObject"
|
||||
|
||||
LOGGER.Info(" ...Stream_File wurde gestartet")
|
||||
Dim windreamFilename As String = ""
|
||||
Dim oWindreamFilename As String = ""
|
||||
' Objekt für Datei und Zielverzeichnis anlegen
|
||||
Dim Quelldatei_Name As String = Path.GetFileName(filenameQuelle)
|
||||
Dim oSourceFilename As String = Path.GetFileName(SourceFilePath)
|
||||
|
||||
LOGGER.Info(" ...Quelldatei gelesen")
|
||||
'"Version-KZ entfernen
|
||||
newfilename = newfilename.Replace("\\", "\")
|
||||
windreamFilename = newfilename.Substring(2)
|
||||
If windreamFilename.Contains("[%Version]") Then
|
||||
windreamFilename = windreamFilename.Replace("[%Version]", "")
|
||||
newfilename = windreamFilename
|
||||
NewFileName = NewFileName.Replace("\\", "\")
|
||||
oWindreamFilename = NewFileName.Substring(2)
|
||||
If oWindreamFilename.Contains("[%Version]") Then
|
||||
oWindreamFilename = oWindreamFilename.Replace("[%Version]", "")
|
||||
NewFileName = oWindreamFilename
|
||||
End If
|
||||
|
||||
If My.Computer.FileSystem.DirectoryExists(Zielverzeichnis) Then
|
||||
If My.Computer.FileSystem.DirectoryExists(oDestination) Then
|
||||
LOGGER.Info(" ...targetPath existiert")
|
||||
' Überprüfen ob der zu Kopieren notwendige Speicherplatz auf Ziellaufwerk vorhanden ist
|
||||
Dim dvr As New DriveInfo(vWLaufwerk & ":")
|
||||
Dim freeSpace = dvr.TotalFreeSpace
|
||||
Dim oDriveInfo As New DriveInfo(vWLaufwerk & ":")
|
||||
Dim oFreeSpace = oDriveInfo.TotalFreeSpace
|
||||
|
||||
Dim info As New FileInfo(filenameQuelle)
|
||||
Dim oFileInfo As New FileInfo(SourceFilePath)
|
||||
' Get length of the file.
|
||||
Dim length As Long = info.Length
|
||||
If freeSpace < length Then
|
||||
Dim oFileLength As Long = oFileInfo.Length
|
||||
If oFreeSpace < oFileLength Then
|
||||
If USER_LANGUAGE = "de-DE" Then
|
||||
MsgBox("Auf dem Zielverzeichnis ist nicht genug Speicherplatz zum Übertragen frei.", MsgBoxStyle.Exclamation, "Nicht genug Speicherplatz")
|
||||
Else
|
||||
@ -602,7 +602,7 @@ Public Class ClassWindream
|
||||
Return -10
|
||||
End If
|
||||
|
||||
LOGGER.Info(" ...Datei kopieren von '" & filenameQuelle & "' nach '" & newfilename & "'.")
|
||||
LOGGER.Info(" ...Datei kopieren von '" & SourceFilePath & "' nach '" & NewFileName & "'.")
|
||||
Dim Connect
|
||||
Dim Session
|
||||
Dim WMObject
|
||||
@ -642,7 +642,7 @@ Public Class ClassWindream
|
||||
LOGGER.Info(" >> Login on dms-Server failed")
|
||||
' MsgBox("Login failed. ")
|
||||
End If
|
||||
oSession = Session
|
||||
_session = Session
|
||||
Const WMCOMEventWMSessionNeedIndex = 1
|
||||
|
||||
'windream Objekte erstellen ohne Indexierungs-Event
|
||||
@ -650,10 +650,10 @@ Public Class ClassWindream
|
||||
'==================================================================
|
||||
' check if files exist
|
||||
'==================================================================
|
||||
LOGGER.Info(" ...ÜBERPRÜFTER DATEINAME => " & windreamFilename)
|
||||
LOGGER.Info(" ...ÜBERPRÜFTER DATEINAME => " & oWindreamFilename)
|
||||
Dim wdFilexists As Boolean
|
||||
LOGGER.Info(" ...Versuch auf die Datei in W: zuzugreifen und zu sperren...")
|
||||
wdFilexists = Session.WMObjectExists(WMEntityDocument, windreamFilename, 0, 0)
|
||||
wdFilexists = Session.WMObjectExists(WMEntityDocument, oWindreamFilename, 0, 0)
|
||||
Err.Clear()
|
||||
If wdFilexists = False Then
|
||||
LOGGER.Info(" ...Datei ist NICHT vorhanden, kann also einfach neu angelegt werden")
|
||||
@ -661,7 +661,7 @@ Public Class ClassWindream
|
||||
'==================================================================
|
||||
' create an object
|
||||
'==================================================================
|
||||
WMObject = Session.GetNewWMObjectFS(WMEntityDocument, windreamFilename, WMObjectEditModeObject) 'WMEntityDocument, windreamFilename, WMObjectEditModeObject
|
||||
WMObject = Session.GetNewWMObjectFS(WMEntityDocument, oWindreamFilename, WMObjectEditModeObject) 'WMEntityDocument, windreamFilename, WMObjectEditModeObject
|
||||
If Err.Number > 0 Then
|
||||
LOGGER.Info(" FEHLER: WMObject konnte nicht erzeugt werden - Error: '" & Err.Description & "'")
|
||||
'MsgBox(Err.Description)
|
||||
@ -670,43 +670,70 @@ Public Class ClassWindream
|
||||
Else
|
||||
' wenn auf die Datei zugeriffen werden konnte ist sie bereits vorhanden -> Datum anhängen
|
||||
LOGGER.Info(" ...Es konnte zugegriffen werden -> DATEI IST BEREITS VORHANDEN")
|
||||
If CURRENT_DOKART_DUPLICATE_HANDLING = "Default" Or CURRENT_DOKART_DUPLICATE_HANDLING = "Question" Then
|
||||
''##########
|
||||
Dim msg = String.Format("Eine Datei mit identischem Namen " & vbNewLine & "'{0}'" & vbNewLine & "existiert bereits!" & vbNewLine & "Wollen Sie die bestehende Datei ersetzen?", newfilename)
|
||||
If USER_LANGUAGE <> "de-DE" Then
|
||||
msg = "There is already a file with the same name! Would You like to replace the file?"
|
||||
End If
|
||||
Dim result As MsgBoxResult
|
||||
result = MessageBox.Show(msg, "File alredy exists:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
||||
If result = MsgBoxResult.No Then
|
||||
windreamFilename = ClassFilehandle.Versionierung_Datei(newfilename).ToString.Substring(2)
|
||||
Else
|
||||
If Delete_WDFile(windreamFilename) = False Then
|
||||
|
||||
Select Case CURRENT_DOKART_DUPLICATE_HANDLING
|
||||
Case "New version"
|
||||
LOGGER.Info("Creating new version of file [{0}]", NewFileName)
|
||||
oWindreamFilename = ClassFilehandle.Versionierung_Datei(NewFileName).ToString.Substring(2)
|
||||
Case "Question"
|
||||
Dim oMessage = $"Eine Datei mit identischem Namen {vbNewLine}'{NewFileName}'{vbNewLine}existiert bereits!{vbNewLine}Wollen Sie die bestehende Datei ersetzen?"
|
||||
If USER_LANGUAGE <> "de-DE" Then
|
||||
oMessage = $"There is already a file with the name {NewFileName}!{vbNewLine}Would You like to replace the file?"
|
||||
End If
|
||||
|
||||
Dim oResult = MessageBox.Show(oMessage, "File exists", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
||||
|
||||
If oResult = DialogResult.No Then
|
||||
oWindreamFilename = ClassFilehandle.Versionierung_Datei(NewFileName).ToString.Substring(2)
|
||||
Else
|
||||
If Delete_WDFile(oWindreamFilename) = False Then
|
||||
Return False
|
||||
End If
|
||||
End If
|
||||
Case Else
|
||||
If Delete_WDFile(oWindreamFilename) = False Then
|
||||
Return False
|
||||
End If
|
||||
End If
|
||||
ElseIf CURRENT_DOKART_DUPLICATE_HANDLING = "New version" Then
|
||||
windreamFilename = ClassFilehandle.Versionierung_Datei(newfilename).ToString.Substring(2)
|
||||
End If
|
||||
WMObject = Session.GetNewWMObjectFS(1, windreamFilename, 31) 'WMEntityDocument, windreamFilename, WMObjectEditModeObject
|
||||
End Select
|
||||
|
||||
'If CURRENT_DOKART_DUPLICATE_HANDLING = "Default" Or CURRENT_DOKART_DUPLICATE_HANDLING = "Question" Then
|
||||
' ''##########
|
||||
' Dim msg = String.Format("Eine Datei mit identischem Namen " & vbNewLine & "'{0}'" & vbNewLine & "existiert bereits!" & vbNewLine & "Wollen Sie die bestehende Datei ersetzen?", newfilename)
|
||||
' If USER_LANGUAGE <> "de-DE" Then
|
||||
' msg = "There is already a file with the same name! Would You like to replace the file?"
|
||||
' End If
|
||||
' Dim result As MsgBoxResult
|
||||
' result = MessageBox.Show(msg, "File alredy exists:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
||||
' If result = MsgBoxResult.No Then
|
||||
' windreamFilename = ClassFilehandle.Versionierung_Datei(newfilename).ToString.Substring(2)
|
||||
' Else
|
||||
' If Delete_WDFile(windreamFilename) = False Then
|
||||
' Return False
|
||||
' End If
|
||||
' End If
|
||||
'ElseIf CURRENT_DOKART_DUPLICATE_HANDLING = "New version" Then
|
||||
' windreamFilename = ClassFilehandle.Versionierung_Datei(newfilename).ToString.Substring(2)
|
||||
'End If
|
||||
|
||||
WMObject = Session.GetNewWMObjectFS(1, oWindreamFilename, 31) 'WMEntityDocument, windreamFilename, WMObjectEditModeObject
|
||||
If Err.Number > 0 Then
|
||||
LOGGER.Info(" FEHLER: Neues WMObject (Kopie) konnte nicht erzeugt werden - Error: '" & Err.Description & "'")
|
||||
'MsgBox(Err.Description)
|
||||
End If
|
||||
LOGGER.Info(" ...WMObject zugewiesen")
|
||||
End If
|
||||
LOGGER.Info(" ...ENDGÜLTIGER DATEINAME => " & windreamFilename)
|
||||
LOGGER.Info(" ...ENDGÜLTIGER DATEINAME => " & oWindreamFilename)
|
||||
If WMObject IsNot Nothing Then
|
||||
newfilename = vWLaufwerk & ":" & windreamFilename
|
||||
NewFileName = vWLaufwerk & ":" & oWindreamFilename
|
||||
' lock object for file system access (to change the file itself)
|
||||
WMObject.lock()
|
||||
' set fileIO the local source file
|
||||
aFileIO.bstrOriginalFileName = filenameQuelle
|
||||
aFileIO.bstrOriginalFileName = SourceFilePath
|
||||
If Err.Number > 0 Then
|
||||
LOGGER.Info(" FEHLER: fileIO konnte nicht gesetzt werden - Datei wird wieder gelöscht - Error: '" & Err.Description & "'")
|
||||
LOGGER.Info(" HINWEIS: Überprüfen Sie den Verweis auf die Bibliotheken 'WMOTool.WMFileIO' UND 'WMOTOOLLib.WMFileIO' und ändern diese in den Anwendungseinstellungen (DLL_WMOTOOL)'")
|
||||
WMObject.Unlock()
|
||||
Delete_WDFile(windreamFilename)
|
||||
Delete_WDFile(oWindreamFilename)
|
||||
|
||||
Return False
|
||||
' MsgBox(Err.Description)
|
||||
@ -716,7 +743,7 @@ Public Class ClassWindream
|
||||
If Err.Number > 0 Then
|
||||
LOGGER.Info(" Unexpected error in OpenStream - Datei wird wieder gelöscht - Error: '" & Err.Description & "'")
|
||||
WMObject.Unlock()
|
||||
Delete_WDFile(windreamFilename)
|
||||
Delete_WDFile(oWindreamFilename)
|
||||
Return False
|
||||
'MsgBox(Err.Description)
|
||||
End If
|
||||
@ -726,7 +753,7 @@ Public Class ClassWindream
|
||||
If Err.Number > 0 Then
|
||||
LOGGER.Info(" Unexpected error in Zuweisen aWMStream zu aFileIO - Datei wird wieder gelöscht - Error: '" & Err.Description & "'")
|
||||
WMObject.Unlock()
|
||||
Delete_WDFile(windreamFilename)
|
||||
Delete_WDFile(oWindreamFilename)
|
||||
Return False
|
||||
'MsgBox(Err.Description)
|
||||
End If
|
||||
@ -735,7 +762,7 @@ Public Class ClassWindream
|
||||
If Err.Number > 0 Then
|
||||
LOGGER.Info(" Unexpected error in FileIO.ImportOriginal(True) - Datei wird wieder gelöscht - Error: '" & Err.Description & "'")
|
||||
WMObject.Unlock()
|
||||
Delete_WDFile(windreamFilename)
|
||||
Delete_WDFile(oWindreamFilename)
|
||||
Return False
|
||||
' MsgBox(Err.Description)
|
||||
End If
|
||||
@ -745,7 +772,7 @@ Public Class ClassWindream
|
||||
If Err.Number > 0 Then
|
||||
LOGGER.Info(" Unexpected error in aWMStream.Close() - Datei wird wieder gelöscht - Error: '" & Err.Description & "'")
|
||||
WMObject.Unlock()
|
||||
Delete_WDFile(windreamFilename)
|
||||
Delete_WDFile(oWindreamFilename)
|
||||
Return False
|
||||
'MsgBox(Err.Description)
|
||||
End If
|
||||
@ -754,7 +781,7 @@ Public Class ClassWindream
|
||||
If Err.Number > 0 Then
|
||||
LOGGER.Info(" Unexpected error in WMObject.save - Datei wird wieder gelöscht - Error: '" & Err.Description & "'")
|
||||
WMObject.Unlock()
|
||||
Delete_WDFile(windreamFilename)
|
||||
Delete_WDFile(oWindreamFilename)
|
||||
Return False
|
||||
'MsgBox(Err.Description)
|
||||
End If
|
||||
@ -764,37 +791,37 @@ Public Class ClassWindream
|
||||
If Err.Number > 0 Then
|
||||
LOGGER.Info(" Unexpected error in WMObject.unlock - Datei wird wieder gelöscht - Error: '" & Err.Description & "'")
|
||||
WMObject.Unlock()
|
||||
Delete_WDFile(windreamFilename)
|
||||
Delete_WDFile(oWindreamFilename)
|
||||
Return False
|
||||
'MsgBox(Err.Description)
|
||||
End If
|
||||
'DATEI GRÖSSE ERMITTELN - MANCHMAL KOMMT ES VOR DAS DATEIGRÖße 0 ist
|
||||
Dim info2 As New FileInfo(newfilename)
|
||||
Dim info2 As New FileInfo(NewFileName)
|
||||
Dim length1 As Long = info2.Length
|
||||
LOGGER.Info(" ...Length der Zieldatei: " & length1.ToString)
|
||||
If length > 0 And Err.Number = 0 Then
|
||||
If oFileLength > 0 And Err.Number = 0 Then
|
||||
Dim p As String
|
||||
If windreamFilename.StartsWith("\") Then
|
||||
If windreamFilename.StartsWith("\\") Then
|
||||
p = windreamFilename.Replace("\\", "\")
|
||||
If oWindreamFilename.StartsWith("\") Then
|
||||
If oWindreamFilename.StartsWith("\\") Then
|
||||
p = oWindreamFilename.Replace("\\", "\")
|
||||
Else
|
||||
p = windreamFilename
|
||||
p = oWindreamFilename
|
||||
End If
|
||||
Else
|
||||
p = "\" & windreamFilename
|
||||
p = "\" & oWindreamFilename
|
||||
End If
|
||||
CURRENT_NEWFILENAME = vWLaufwerk & ":" & p
|
||||
LOGGER.Info(" >> Datei '" & CURRENT_NEWFILENAME & "' wurde erfolgreich importiert!")
|
||||
aktWMObject = WMObject
|
||||
_currentWMObject = WMObject
|
||||
Return True
|
||||
Else
|
||||
Delete_WDFile(windreamFilename)
|
||||
Delete_WDFile(oWindreamFilename)
|
||||
Console.WriteLine(Err.Number.ToString)
|
||||
LOGGER.Info(" Unexpected error in Datei-Übertragen - FileLength ist 0, Übertragene Datei wurde gelöscht")
|
||||
Return False
|
||||
End If
|
||||
Else
|
||||
LOGGER.Info(" Could not create a WMObject for file:'" & windreamFilename)
|
||||
LOGGER.Info(" Could not create a WMObject for file:'" & oWindreamFilename)
|
||||
If Not Err() Is Nothing Then
|
||||
If Not Err.Description Is Nothing Then
|
||||
LOGGER.Info(Err.Description)
|
||||
@ -815,7 +842,7 @@ Public Class ClassWindream
|
||||
End If
|
||||
Dim WMObject As WINDREAMLib.WMObject '= CreateObject("WINDREAMLib.WMObject") 'New WINDREAMLib.WMObject
|
||||
Try
|
||||
WMObject = oSession.GetWMObjectByPath(WINDREAMLib.WMEntity.WMEntityDocument, WD_File) 'WINDREAMLib.WMEntity.WMEntityDocument
|
||||
WMObject = _session.GetWMObjectByPath(WINDREAMLib.WMEntity.WMEntityDocument, WD_File) 'WINDREAMLib.WMEntity.WMEntityDocument
|
||||
Catch ex As Exception
|
||||
LOGGER.Info(">> Could not create WMObject for file '" & WD_File & "' - so it is not existing")
|
||||
LOGGER.Error(ex.Message)
|
||||
@ -848,7 +875,7 @@ Public Class ClassWindream
|
||||
' den Dokumenttyp schreiben
|
||||
LOGGER.Info(" ## Indexieren wird gestartet ##")
|
||||
' ein windream-Objekt der Datei anlegen
|
||||
WMObject = aktWMObject 'oSession.GetWMObjectByPath(WINDREAMLib.WMEntity.WMEntityDocument, WD_File)
|
||||
WMObject = _currentWMObject 'oSession.GetWMObjectByPath(WINDREAMLib.WMEntity.WMEntityDocument, WD_File)
|
||||
Try
|
||||
LOGGER.Info(" ...Datei wird gesperrt")
|
||||
' die Datei sperren
|
||||
@ -873,7 +900,7 @@ Public Class ClassWindream
|
||||
If WMObject.aObjectType.aName = "Standard" Then
|
||||
|
||||
' ihr den entsprechenden Dokumenttyp zuweisen
|
||||
WMObject.aObjectType = oSession.GetWMObjectByName(WINDREAMLib.WMEntity.WMEntityObjectType, _WDObjekttyp)
|
||||
WMObject.aObjectType = _session.GetWMObjectByName(WINDREAMLib.WMEntity.WMEntityObjectType, _WDObjekttyp)
|
||||
' WMObject.aObjectType = Me.selectedProfile.Dokumenttyp
|
||||
LOGGER.Info(" ...Objekttyp wurde gesetzt")
|
||||
Else
|
||||
@ -963,7 +990,7 @@ Public Class ClassWindream
|
||||
' wenn der Datei noch kein Dokumenttyp zugewiesen wurde
|
||||
If oDocument.aObjectType.aName <> _WDObjekttyp Then
|
||||
' ihr den entsprechenden Dokumenttyp zuweisen
|
||||
oDocument.aObjectType = oSession.GetWMObjectByName(WINDREAMLib.WMEntity.WMEntityObjectType, _WDObjekttyp)
|
||||
oDocument.aObjectType = _session.GetWMObjectByName(WINDREAMLib.WMEntity.WMEntityObjectType, _WDObjekttyp)
|
||||
' WMObject.aObjectType = Me.selectedProfile.Dokumenttyp
|
||||
LOGGER.Info(" ...Objekttyp '" & oDocument.aObjectType.aName & "' wurde in '" & _WDObjekttyp & "' geändert.")
|
||||
Else
|
||||
@ -986,7 +1013,7 @@ Public Class ClassWindream
|
||||
LOGGER.Info(" >> Indexierung von Index '" & indexname & "'")
|
||||
End If
|
||||
' das entsprechende Attribut aus windream auslesen
|
||||
Dim oAttribute = oSession.GetWMObjectByName(WINDREAMLib.WMEntity.WMEntityAttribute, Indizes(i))
|
||||
Dim oAttribute = _session.GetWMObjectByName(WINDREAMLib.WMEntity.WMEntityAttribute, Indizes(i))
|
||||
' den Variablentyp (String, Integer, ...) auslesen
|
||||
Dim vType = oAttribute.getVariableValue("dwAttrType")
|
||||
' wenn in aValues an Position i ein Wert steht
|
||||
@ -1461,7 +1488,7 @@ Public Class ClassWindream
|
||||
Loop
|
||||
' wenn die Datei existiert
|
||||
If fileExists Then
|
||||
WMObject = oSession.GetWMObjectByPath(WINDREAMLib.WMEntity.WMEntityDocument, filenameZiel)
|
||||
WMObject = _session.GetWMObjectByPath(WINDREAMLib.WMEntity.WMEntityDocument, filenameZiel)
|
||||
|
||||
' eine Variable für den umgewandelten Indexwert anlegen (kein Typ, da noch unklar ist was reingeschrieben wird)
|
||||
'Dim convertValue = Nothing
|
||||
@ -1472,7 +1499,7 @@ Public Class ClassWindream
|
||||
Try
|
||||
|
||||
' ein windream-Objekt der Datei anlegen
|
||||
WMObject = oSession.GetWMObjectByPath(WINDREAMLib.WMEntity.WMEntityDocument, filenameZiel)
|
||||
WMObject = _session.GetWMObjectByPath(WINDREAMLib.WMEntity.WMEntityDocument, filenameZiel)
|
||||
If LogErrorsOnly = False Then
|
||||
LOGGER.Info(" - windream-Objekt der Datei erzeugt")
|
||||
LOGGER.Info(" - Ziel: W:\" & filenameZiel)
|
||||
@ -1492,7 +1519,7 @@ Public Class ClassWindream
|
||||
' wenn der Datei noch kein Dokumenttyp zugewiesen wurde
|
||||
If WMObject.aObjectType.aName = "Standard" Then
|
||||
' ihr den entsprechenden Dokumenttyp zuweisen
|
||||
WMObject.aObjectType = oSession.GetWMObjectByName(WINDREAMLib.WMEntity.WMEntityObjectType, _WDObjekttyp)
|
||||
WMObject.aObjectType = _session.GetWMObjectByName(WINDREAMLib.WMEntity.WMEntityObjectType, _WDObjekttyp)
|
||||
' WMObject.aObjectType = Me.selectedProfile.Dokumenttyp
|
||||
End If
|
||||
|
||||
@ -1873,7 +1900,7 @@ Public Class ClassWindream
|
||||
''' <remarks></remarks>
|
||||
Public Shared Function GetTypeOfIndexAsIntByName(ByVal indexname As String) As Integer
|
||||
Try
|
||||
Dim oAttribute = oSession.GetWMObjectByName(WINDREAMLib.WMEntity.WMEntityAttribute, indexname)
|
||||
Dim oAttribute = _session.GetWMObjectByName(WINDREAMLib.WMEntity.WMEntityAttribute, indexname)
|
||||
Dim vType = oAttribute.getVariableValue("dwAttrType")
|
||||
Return vType
|
||||
Catch ex As Exception
|
||||
@ -1895,7 +1922,7 @@ Public Class ClassWindream
|
||||
Return input
|
||||
Catch ex As Exception
|
||||
LOGGER.Info("Fehler in CheckIndexValue: " & ex.Message)
|
||||
LOGGER.Error(ex.message)
|
||||
LOGGER.Error(ex.Message)
|
||||
Return Nothing
|
||||
End Try
|
||||
|
||||
|
||||
@ -2209,7 +2209,7 @@ Public Class frmIndex
|
||||
End If
|
||||
If exp2WD = True Then
|
||||
'Prüfen ob Session da ist - wenn nicht nochmal neu initiieren
|
||||
If ClassWindream.oSession Is Nothing Then
|
||||
If ClassWindream._session Is Nothing Then
|
||||
ClassWindream.Init()
|
||||
End If
|
||||
'Kein Fehler in Export2windream
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user