Welcome
Welcome to MicroAPL's Support Forum for APLX.


You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, communicate privately with other members (PM), upload content, and access many other special features. Registration is fast, simple, and absolutely free, so please, join our community today!

Disk And File Input/Output Utility Class Written Using .Net

Use this forum for uploading and downloading APLX-related files. Max size 256KB

Disk And File Input/Output Utility Class Written Using .Net

Postby PGilbert on Thu Aug 13, 2009 10:18 pm

Find attached a WS that contains a class called DIO. This is a class for Disk and File Input/Output written using .Net. There are 41 methods in that class as follow:

BFileRead           ⍝ Reads The Contents of a Binary File Into a Byte Array Object Without Encoding.
BFileWrite ⍝ Creates a New File, Write The Specified Byte Array to The File Without Encoding.
DialogFolderBrowser ⍝ Selects a Directory with FolderBrowserDialog.
DialogOpenFile ⍝ Selects a File to Open With OpenFileDialog.
DialogSaveFile ⍝ Selects a File to Save With SaveFileDialog.
DirCopy ⍝ Copies a Directory And Its Contents to a New Location. SubDirectories Are Not Copied.
DirCreate ⍝ Creates All Directories And Subdirectories as Specified By Path.
DirDelete ⍝ Deletes The Specified Directory And Any Subdirectories in The Directory.
DirExists ⍝ Determines Whether The Given Path Refers to an Existing Directory on Disk.
DirMove ⍝ Moves a Directory And Its Contents to a New Location. SubDirectories Are Moved.
DirRename ⍝ Renames a Directory (This Method is Identical to DirMove).
DirSize ⍝ Returns The Size in Bytes of a Directory And It's Subdirectories.
EncodingDetector ⍝ Returns The Encoding of a File And it's Content as a String Object.
FileCopy ⍝ Copies an Existing File to a New File.
FileDelete ⍝ Deletes a File.
FileExists ⍝ Verifies if One or Many File(s) Exists.
FileMove ⍝ Moves a File to a New Location.
FileRename ⍝ Renames a File (This Method is Identical to FileMove).
FileSize ⍝ Returns The Size of a File in Bytes.
FileVersion ⍝ Returns The File Version of a File in Characters.
GetAttributes ⍝ Returns The FileAttributes of a File in Numeric And Litteral Form.
GetCreationTime ⍝ Returns The Creation Date And Time of a File as a DateTime Object.
GetDirCurrent ⍝ Returns The Current Directory Path.
GetDirectories ⍝ Returns The SubDirectories of a Directory.
GetDrives ⍝ Returns The Names of The Logical Drives on This Computer in The Form "<drive letter>:\".
GetExtension ⍝ Returns The Extension of a Path String.
GetFiles ⍝ Returns The Full Names of Files in a Directory.
GetFilesS ⍝ Same as GetFiles But The Files Names Are Without Their Directory Prefix (Short).
GetLastError ⍝ Returns The Last Error Message From a .Net Error.
GetTempFileName ⍝ Returns a Uniquely Named, Zero-Byte Temporary File on Disk With Full Path.
GetTempPath ⍝ Returns The Path of The Current System's Temporary Folder.
MakeByteArray ⍝ Builds a .Net Byte Array Object.
MakeString ⍝ Builds a .Net String Object.
SetAttributes ⍝ Sets The FileAttributes of a File.
SetDirCurrent ⍝ Sets The Current Directory Path.
TFileAppend ⍝ Appends The Specified Text to a File Using The Default Windows Code Page.
TFileRead ⍝ Reads The Contents of a Text File Into a String Object Using the Default Windows Code Page.
TFileWrite ⍝ Creates a New File, Write The Text to The File Using The Default Windows Code Page.
UFileAppend ⍝ Appends The Specified Text to a File Using The UTF-8 Encoding.
UFileRead ⍝ Reads The Contents of a Unicode Text File Into a String Object.
UFileWrite ⍝ Creates a New File, Writes The Specified String to The File Using The UTF8 Encoding.


The goal was to create a single class where all the File and Disk operation are maintained.

Comments, suggestions and bug report are welcomed on this thread.

Pierre Gilbert

The requirements are: APLX v5 and .Net 2.0
Attachments
DIO_1_0.aws
(386.38 KiB) Downloaded 4 times
PGilbert
 
Posts: 59
Joined: Thu Jul 10, 2008 8:34 pm
Location: Montreal, Quebec, Canada

Return to Download Area