Skip to content

Commit 020aba4

Browse files
committed
Revert "accidential commits for async feature on main branch at this stage"
This reverts commit 657d3ab174f8852dbb3f0788c80471db3b4667a8.
1 parent d884f30 commit 020aba4

2 files changed

Lines changed: 0 additions & 298 deletions

File tree

CompuMaster.Dms.Providers/Providers/BaseDmsProvider.vb

Lines changed: 0 additions & 200 deletions
Original file line numberDiff line numberDiff line change
@@ -122,26 +122,6 @@ Namespace Providers
122122
Return RemoteItem IsNot Nothing
123123
End Function
124124

125-
''' <summary>
126-
''' Async alternative to <see cref="RemoteItemExists"/>
127-
''' </summary>
128-
''' <param name="remotePath"></param>
129-
Public Overridable Async Function RemoteItemExistsAsync(remotePath As String) As Task(Of Boolean)
130-
Dim RemoteItem As DmsResourceItem = Await Me.ListRemoteItemAsync(remotePath)
131-
Return RemoteItem IsNot Nothing
132-
End Function
133-
134-
''' <summary>
135-
''' Async alternative to <see cref="ListRemoteItem"/>
136-
''' Default implementation calls the synchronous implementation on a background task to preserve compatibility.
137-
''' </summary>
138-
''' <param name="remotePath"></param>
139-
Public Overridable Async Function ListRemoteItemAsync(remotePath As String) As Task(Of DmsResourceItem)
140-
Return Await Task.Run(Function()
141-
Return Me.ListRemoteItem(remotePath)
142-
End Function)
143-
End Function
144-
145125
''' <summary>
146126
''' An existance check for a remote item
147127
''' </summary>
@@ -157,18 +137,6 @@ Namespace Providers
157137
End If
158138
End Function
159139

160-
''' <summary>
161-
''' Async alternative to <see cref="RemoteItemExistsAs"/>
162-
''' </summary>
163-
Public Overridable Async Function RemoteItemExistsAsAsync(remotePath As String) As Task(Of DmsResourceItem.FoundItemType)
164-
Dim RemoteItem As DmsResourceItem = Await Me.ListRemoteItemAsync(remotePath)
165-
If RemoteItem Is Nothing Then
166-
Return DmsResourceItem.FoundItemType.NotFound
167-
Else
168-
Return CType(CType(RemoteItem.ItemType, Byte), DmsResourceItem.FoundItemType)
169-
End If
170-
End Function
171-
172140
''' <summary>
173141
''' An existance check for a remote item (collissions with remote items under the very same name are checked)
174142
''' </summary>
@@ -186,20 +154,6 @@ Namespace Providers
186154
End If
187155
End Function
188156

189-
''' <summary>
190-
''' Async alternative to <see cref="RemoteItemExistsUniquelyAs"/>
191-
''' </summary>
192-
Public Overridable Async Function RemoteItemExistsUniquelyAsAsync(remotePath As String) As Task(Of DmsResourceItem.FoundItemResult)
193-
Dim RemoteItem As DmsResourceItem = Await Me.ListRemoteItemAsync(remotePath)
194-
If RemoteItem Is Nothing Then
195-
Return DmsResourceItem.FoundItemResult.NotFound
196-
ElseIf RemoteItem.ExtendedInfosCollisionDetected Then
197-
Return DmsResourceItem.FoundItemResult.WithNameCollisions
198-
Else
199-
Return CType(CType(RemoteItem.ItemType, Byte), DmsResourceItem.FoundItemResult)
200-
End If
201-
End Function
202-
203157
''' <summary>
204158
''' Reset file system cache and force refresh on next access
205159
''' </summary>
@@ -216,33 +170,13 @@ Namespace Providers
216170
End Select
217171
End Sub
218172

219-
''' <summary>
220-
''' Async alternative to <see cref="ResetCachesForRemoteItems"/>
221-
''' Default implementation runs the sync override in a background task.
222-
''' </summary>
223-
Public Overridable Async Function ResetCachesForRemoteItemsAsync(remoteItem As DmsResourceItem, searchType As SearchItemType) As Task
224-
Await Task.Run(Sub()
225-
Me.ResetCachesForRemoteItems(remoteItem, searchType)
226-
End Sub)
227-
End Function
228-
229173
''' <summary>
230174
''' Reset file system cache and force refresh on next access
231175
''' </summary>
232176
''' <param name="remoteFolderPath"></param>
233177
''' <param name="searchType"></param>
234178
Public MustOverride Sub ResetCachesForRemoteItems(remoteFolderPath As String, searchType As SearchItemType)
235179

236-
''' <summary>
237-
''' Async alternative to <see cref="ResetCachesForRemoteItems(String,SearchItemType)"/>
238-
''' Default implementation calls synchronous override on background thread.
239-
''' </summary>
240-
Public Overridable Async Function ResetCachesForRemoteItemsAsync(remoteFolderPath As String, searchType As SearchItemType) As Task
241-
Await Task.Run(Sub()
242-
Me.ResetCachesForRemoteItems(remoteFolderPath, searchType)
243-
End Sub)
244-
End Function
245-
246180
''' <summary>
247181
''' List all child items (files/folders/collections) for a remote path
248182
''' </summary>
@@ -251,16 +185,6 @@ Namespace Providers
251185
''' <returns></returns>
252186
Public MustOverride Function ListAllRemoteItems(remoteFolderPath As String, searchType As SearchItemType) As List(Of DmsResourceItem)
253187

254-
''' <summary>
255-
''' Async alternative to <see cref="ListAllRemoteItems"/>
256-
''' Default implementation calls synchronous override on background thread.
257-
''' </summary>
258-
Public Overridable Async Function ListAllRemoteItemsAsync(remoteFolderPath As String, searchType As SearchItemType) As Task(Of List(Of DmsResourceItem))
259-
Return Await Task.Run(Function()
260-
Return Me.ListAllRemoteItems(remoteFolderPath, searchType)
261-
End Function)
262-
End Function
263-
264188
''' <summary>
265189
''' List all child collections for a remote path
266190
''' </summary>
@@ -276,19 +200,6 @@ Namespace Providers
276200
Return Result
277201
End Function
278202

279-
''' <summary>
280-
''' Async alternative to <see cref="ListAllCollectionItems"/>
281-
''' </summary>
282-
Public Overridable Async Function ListAllCollectionItemsAsync(remoteFolderPath As String) As Task(Of List(Of DmsResourceItem))
283-
Dim Result As New List(Of DmsResourceItem)
284-
For Each Item In Await Me.ListAllRemoteItemsAsync(remoteFolderPath, SearchItemType.Collections)
285-
If Item.ItemType = DmsResourceItem.ItemTypes.Collection Then
286-
Result.Add(Item)
287-
End If
288-
Next
289-
Return Result
290-
End Function
291-
292203
''' <summary>
293204
''' List all child folders for a remote path
294205
''' </summary>
@@ -304,19 +215,6 @@ Namespace Providers
304215
Return Result
305216
End Function
306217

307-
''' <summary>
308-
''' Async alternative to <see cref="ListAllFolderItems"/>
309-
''' </summary>
310-
Public Overridable Async Function ListAllFolderItemsAsync(remoteFolderPath As String) As Task(Of List(Of DmsResourceItem))
311-
Dim Result As New List(Of DmsResourceItem)
312-
For Each Item In Await Me.ListAllRemoteItemsAsync(remoteFolderPath, SearchItemType.Folders)
313-
If Item.ItemType = DmsResourceItem.ItemTypes.Folder Then
314-
Result.Add(Item)
315-
End If
316-
Next
317-
Return Result
318-
End Function
319-
320218
''' <summary>
321219
''' List all child files for a remote path
322220
''' </summary>
@@ -332,19 +230,6 @@ Namespace Providers
332230
Return Result
333231
End Function
334232

335-
''' <summary>
336-
''' Async alternative to <see cref="ListAllFileItems"/>
337-
''' </summary>
338-
Public Overridable Async Function ListAllFileItemsAsync(remoteFolderPath As String) As Task(Of List(Of DmsResourceItem))
339-
Dim Result As New List(Of DmsResourceItem)
340-
For Each Item In Await Me.ListAllRemoteItemsAsync(remoteFolderPath, SearchItemType.Files)
341-
If Item.ItemType = DmsResourceItem.ItemTypes.File Then
342-
Result.Add(Item)
343-
End If
344-
Next
345-
Return Result
346-
End Function
347-
348233
''' <summary>
349234
''' List all child collection names for a remote path
350235
''' </summary>
@@ -360,19 +245,6 @@ Namespace Providers
360245
Return Result
361246
End Function
362247

363-
''' <summary>
364-
''' Async alternative to <see cref="ListAllCollectionNames"/>
365-
''' </summary>
366-
Public Overridable Async Function ListAllCollectionNamesAsync(remoteFolderPath As String) As Task(Of List(Of String))
367-
Dim Result As New List(Of String)
368-
For Each Item In Await Me.ListAllCollectionItemsAsync(remoteFolderPath)
369-
If Item.ItemType = DmsResourceItem.ItemTypes.Collection Then
370-
Result.Add(Item.Name)
371-
End If
372-
Next
373-
Return Result
374-
End Function
375-
376248
''' <summary>
377249
''' List all child folder names for a remote path
378250
''' </summary>
@@ -388,19 +260,6 @@ Namespace Providers
388260
Return Result
389261
End Function
390262

391-
''' <summary>
392-
''' Async alternative to <see cref="ListAllFolderNames"/>
393-
''' </summary>
394-
Public Overridable Async Function ListAllFolderNamesAsync(remoteFolderPath As String) As Task(Of List(Of String))
395-
Dim Result As New List(Of String)
396-
For Each Item In Await Me.ListAllFolderItemsAsync(remoteFolderPath)
397-
If Item.ItemType = DmsResourceItem.ItemTypes.Folder Then
398-
Result.Add(Item.Name)
399-
End If
400-
Next
401-
Return Result
402-
End Function
403-
404263
''' <summary>
405264
''' List all child file names for a remote path
406265
''' </summary>
@@ -416,19 +275,6 @@ Namespace Providers
416275
Return Result
417276
End Function
418277

419-
''' <summary>
420-
''' Async alternative to <see cref="ListAllFileNames"/>
421-
''' </summary>
422-
Public Overridable Async Function ListAllFileNamesAsync(remoteFolderPath As String) As Task(Of List(Of String))
423-
Dim Result As New List(Of String)
424-
For Each Item In Await Me.ListAllFileItemsAsync(remoteFolderPath)
425-
If Item.ItemType = DmsResourceItem.ItemTypes.File Then
426-
Result.Add(Item.Name)
427-
End If
428-
Next
429-
Return Result
430-
End Function
431-
432278
''' <summary>
433279
''' Load a remote collection item based on its ID
434280
''' </summary>
@@ -783,37 +629,6 @@ Namespace Providers
783629
End Select
784630
End Sub
785631

786-
''' <summary>
787-
''' Async alternative to Move
788-
''' </summary>
789-
Public Async Function MoveAsync(remoteSourcePath As String, remoteDestinationPath As String) As Task
790-
Await Me.MoveAsync(remoteSourcePath, remoteDestinationPath, False, False)
791-
End Function
792-
793-
''' <summary>
794-
''' Async alternative to Move
795-
''' </summary>
796-
Public Overridable Async Function MoveAsync(remoteSourcePath As String, remoteDestinationPath As String, allowOverwrite As Boolean?, allowCreationOfRemoteDirectory As Boolean) As Task
797-
Dim FoundRemoteSourceItem As DmsResourceItem.FoundItemResult = Await Me.RemoteItemExistsUniquelyAsAsync(remoteSourcePath)
798-
Me.CopyMoveArgumentsCheck(FoundRemoteSourceItem, remoteSourcePath, remoteDestinationPath, allowOverwrite, allowCreationOfRemoteDirectory)
799-
Dim ParentDirPathSource As String = Me.ParentDirectoryPath(remoteSourcePath)
800-
Dim ParentDirPathDestination As String = Me.ParentDirectoryPath(remoteDestinationPath)
801-
Select Case FoundRemoteSourceItem
802-
Case DmsResourceItem.FoundItemResult.File
803-
Await Me.MoveFileItemAsync(remoteSourcePath, remoteDestinationPath, allowOverwrite)
804-
Await Me.ResetCachesForRemoteItemsAsync(ParentDirPathSource, SearchItemType.Files)
805-
Await Me.ResetCachesForRemoteItemsAsync(ParentDirPathDestination, SearchItemType.Files)
806-
Case DmsResourceItem.FoundItemResult.Folder, DmsResourceItem.FoundItemResult.Collection
807-
Await Me.MoveDirectoryItemAsync(remoteSourcePath, remoteDestinationPath)
808-
Await Me.ResetCachesForRemoteItemsAsync(ParentDirPathSource, SearchItemType.Folders)
809-
Await Me.ResetCachesForRemoteItemsAsync(ParentDirPathDestination, SearchItemType.Folders)
810-
Await Me.ResetCachesForRemoteItemsAsync(ParentDirPathSource, SearchItemType.Collections)
811-
Await Me.ResetCachesForRemoteItemsAsync(ParentDirPathDestination, SearchItemType.Collections)
812-
Case Else
813-
Throw New NotImplementedException
814-
End Select
815-
End Function
816-
817632
''' <summary>
818633
''' Move a remote DMS item
819634
''' </summary>
@@ -849,13 +664,6 @@ Namespace Providers
849664
''' <param name="remoteDestinationPath"></param>
850665
''' <param name="allowOverwrite"></param>
851666
Protected MustOverride Sub MoveFileItem(remoteSourcePath As String, remoteDestinationPath As String, allowOverwrite As Boolean?)
852-
''' <summary>
853-
''' Async alternative to MoveFileItem. Default implementation calls synchronous override on background thread.
854-
''' </summary>
855-
Protected Overridable Async Function MoveFileItemAsync(remoteSourcePath As String, remoteDestinationPath As String, allowOverwrite As Boolean?) As Task
856-
Await Task.Run(Sub()
857-
Me.MoveFileItem(remoteSourcePath, remoteDestinationPath, allowOverwrite)
858-
End Sub)
859667

860668
''' <summary>
861669
''' Move a remote DMS item
@@ -864,14 +672,6 @@ Namespace Providers
864672
''' <param name="remoteDestinationPath"></param>
865673
Protected MustOverride Sub MoveDirectoryItem(remoteSourcePath As String, remoteDestinationPath As String)
866674

867-
''' <summary>
868-
''' Async alternative to MoveDirectoryItem. Default implementation calls synchronous override on background thread.
869-
''' </summary>
870-
Protected Overridable Async Function MoveDirectoryItemAsync(remoteSourcePath As String, remoteDestinationPath As String) As Task
871-
Await Task.Run(Sub()
872-
Me.MoveDirectoryItem(remoteSourcePath, remoteDestinationPath)
873-
End Sub)
874-
875675
''' <summary>
876676
''' Delete a remote item (folder, collection or file)
877677
''' </summary>

0 commit comments

Comments
 (0)