Class Name: |
HL7PlusFolderInfo |
HL7+ Category: |
Unrestricted (contains no features which require the HL7PlusController object) PROGRAMMING NOTE: While this object is unrestricted, the primary method PollFolderForFiles() returns a list of HL7PlusFileInfo objects which IS a Partially Restricted object class |
Description: |
General purpose Directory information object with some HL7+ specific features. |
*All example code is in Visual Basic.Net Dim fInfo As New HL7PlusFolderInfo("C:\HL7Data")
Dim oL1 As List(Of HL7PlusFolderInfo) = fInfo.ChildFolders MessageBox.Show(fInfo.FolderPath & " has " & oL1.Count.ToString & " Sub-folders")
With fInfo .IgnoreReadOnlyFiles = True 'This is FALSE by default .IgnoreHiddenFiles = True 'It was True by default .IgnoreSystemFiles = True 'It was True by default .IgnoreZeroByteFiles = True 'This is FALSE by default ' I only want files that are AT LEAST 1 second old .MinimumFileAge = 1 'The default sort is by Last Modified Date but 'I want my list to be in File Name order .ResultSortOrder = HL7PlusFolderInfo.FolderPollResultSortOrder.enFileName '----Now Get Some Files Out of the Folder Dim oFIles As List(Of HL7PlusFileInfo) 'If I want a list of all of the files in the folder oFIles = .PollFolderForFiles() 'If I want to see only HL7 files. oFIles = .PollFolderForFiles("hl7") 'If I want a list of *.HL7, *.TXT, and *.DAT files Dim oExtensions As New List(Of String) With oExtensions .Add("hl7") .Add("TXT") 'It is not case-sensitive .Add("Dat") End With oFIles = .PollFolderForFiles(oExtensions) If fInfo.IsError Then MessageBox.Show("An error occurred: " & .LastError, "Error") Return End If If oFIles.Count = 0 Then MessageBox.Show("No matching files found in: " & .FolderPath, "Error") Return End If '-Finally..Process the files Dim o As HL7PlusFileInfo For Each o In oFIles '...Code.. '...Code.. '...Code.. '..When I'm done delete the file If Not o.DeleteFile() Then MessageBox.Show(o.LastError, "Error Deleting") Return End If Next End With
|
Enumerator Name: FolderPollResultSortOrder
Description: Used to tell the object the sort order to use on file request operations. Members: enSystem = -1 enFileModified = 0 enFileName = 1 enFileSize = 2 enFileModifiedDescending = 3 enFileNameDescending = 4 enFileSizeDescending = 5
|
|
|
|
This object class uses our standard HL7PlusException Class interface for error handling wherever possible.
See the HL7PlusException Implementation Reference
|