// FileSystem.cs\r
//\r
// Author:\r
-// Chris J Breisch (cjbreisch@altavista.net)\r
+// \r
+// Daniel Campos ( danielcampos@myway.com )\r
+// \r
//\r
-// (C) 2002 Chris J Breisch\r
-//
-
-using System;
-
+\r
+using System;\r
+using System.IO;\r
namespace Microsoft.VisualBasic \r
-{
- [Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute]
- sealed public class FileSystem {
- // Declarations
- // Constructors
- // Properties
- // Methods
- [MonoTODO]
- public static void ChDir (System.String Path) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void ChDrive (System.Char Drive) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void ChDrive (System.String Drive) { throw new NotImplementedException (); }
- [MonoTODO]
- public static System.String CurDir () { throw new NotImplementedException (); }
- [MonoTODO]
- public static System.String CurDir (System.Char Drive) { throw new NotImplementedException (); }
- [MonoTODO]
- public static System.String Dir () { throw new NotImplementedException (); }
- [MonoTODO]
- public static System.String Dir (System.String Pathname, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(0)] Microsoft.VisualBasic.FileAttribute Attributes) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void MkDir (System.String Path) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void RmDir (System.String Path) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void FileCopy (System.String Source, System.String Destination) { throw new NotImplementedException (); }
- [MonoTODO]
- public static System.DateTime FileDateTime (System.String PathName) { throw new NotImplementedException (); }
- [MonoTODO]
- public static System.Int64 FileLen (System.String PathName) { throw new NotImplementedException (); }
- [MonoTODO]
- public static Microsoft.VisualBasic.FileAttribute GetAttr (System.String PathName) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void Kill (System.String PathName) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void SetAttr (System.String PathName, Microsoft.VisualBasic.FileAttribute Attributes) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void FileOpen (System.Int32 FileNumber, System.String FileName, Microsoft.VisualBasic.OpenMode Mode, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] Microsoft.VisualBasic.OpenAccess Access, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] Microsoft.VisualBasic.OpenShare Share, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int32 RecordLength) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void FileClose (params System.Int32[] FileNumbers) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void FileGetObject (System.Int32 FileNumber, ref System.Object Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] ref System.Int64 RecordNumber) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void FileGet (System.Int32 FileNumber, ref System.ValueType Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] ref System.Int64 RecordNumber) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void FileGet (System.Int32 FileNumber, ref System.Array Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] ref System.Int64 RecordNumber, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(false)] ref System.Boolean ArrayIsDynamic, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(false)] ref System.Boolean StringIsFixedLength) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void FileGet (System.Int32 FileNumber, ref System.Boolean Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] ref System.Int64 RecordNumber) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void FileGet (System.Int32 FileNumber, ref System.Byte Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] ref System.Int64 RecordNumber) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void FileGet (System.Int32 FileNumber, ref System.Int16 Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] ref System.Int64 RecordNumber) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void FileGet (System.Int32 FileNumber, ref System.Int32 Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] ref System.Int64 RecordNumber) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void FileGet (System.Int32 FileNumber, ref System.Int64 Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] ref System.Int64 RecordNumber) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void FileGet (System.Int32 FileNumber, ref System.Char Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] ref System.Int64 RecordNumber) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void FileGet (System.Int32 FileNumber, ref System.Single Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] ref System.Int64 RecordNumber) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void FileGet (System.Int32 FileNumber, ref System.Double Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] ref System.Int64 RecordNumber) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void FileGet (System.Int32 FileNumber, ref System.Decimal Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] ref System.Int64 RecordNumber) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void FileGet (System.Int32 FileNumber, ref System.String Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] ref System.Int64 RecordNumber, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(false)] ref System.Boolean StringIsFixedLength) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void FileGet (System.Int32 FileNumber, ref System.DateTime Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] ref System.Int64 RecordNumber) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void FilePutObject (System.Int32 FileNumber, System.Object Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int64 RecordNumber) { throw new NotImplementedException (); }
- [MonoTODO]
- [System.ObsoleteAttribute("Use FilePutObject to write Object types, or coerce FileNumber and RecordNumber to Integer for writing non-Object types", false)]
- public static void FilePut (System.Object FileNumber, System.Object Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Object RecordNumber) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void FilePut (System.Int32 FileNumber, System.ValueType Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int64 RecordNumber) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void FilePut (System.Int32 FileNumber, System.Array Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int64 RecordNumber, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(false)] System.Boolean ArrayIsDynamic, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(false)] System.Boolean StringIsFixedLength) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void FilePut (System.Int32 FileNumber, System.Boolean Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int64 RecordNumber) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void FilePut (System.Int32 FileNumber, System.Byte Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int64 RecordNumber) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void FilePut (System.Int32 FileNumber, System.Int16 Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int64 RecordNumber) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void FilePut (System.Int32 FileNumber, System.Int32 Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int64 RecordNumber) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void FilePut (System.Int32 FileNumber, System.Int64 Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int64 RecordNumber) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void FilePut (System.Int32 FileNumber, System.Char Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int64 RecordNumber) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void FilePut (System.Int32 FileNumber, System.Single Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int64 RecordNumber) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void FilePut (System.Int32 FileNumber, System.Double Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int64 RecordNumber) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void FilePut (System.Int32 FileNumber, System.Decimal Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int64 RecordNumber) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void FilePut (System.Int32 FileNumber, System.String Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int64 RecordNumber, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(false)] System.Boolean StringIsFixedLength) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void FilePut (System.Int32 FileNumber, System.DateTime Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int64 RecordNumber) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void Print (System.Int32 FileNumber, params System.Object[] Output) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void PrintLine (System.Int32 FileNumber, params System.Object[] Output) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void Input (System.Int32 FileNumber, ref System.Object Value) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void Input (System.Int32 FileNumber, ref System.Boolean Value) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void Input (System.Int32 FileNumber, ref System.Byte Value) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void Input (System.Int32 FileNumber, ref System.Int16 Value) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void Input (System.Int32 FileNumber, ref System.Int32 Value) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void Input (System.Int32 FileNumber, ref System.Int64 Value) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void Input (System.Int32 FileNumber, ref System.Char Value) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void Input (System.Int32 FileNumber, ref System.Single Value) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void Input (System.Int32 FileNumber, ref System.Double Value) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void Input (System.Int32 FileNumber, ref System.Decimal Value) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void Input (System.Int32 FileNumber, ref System.String Value) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void Input (System.Int32 FileNumber, ref System.DateTime Value) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void Write (System.Int32 FileNumber, params System.Object[] Output) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void WriteLine (System.Int32 FileNumber, params System.Object[] Output) { throw new NotImplementedException (); }
- [MonoTODO]
- public static System.String InputString (System.Int32 FileNumber, System.Int32 CharCount) { throw new NotImplementedException (); }
- [MonoTODO]
- public static System.String LineInput (System.Int32 FileNumber) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void Lock (System.Int32 FileNumber) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void Lock (System.Int32 FileNumber, System.Int64 Record) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void Lock (System.Int32 FileNumber, System.Int64 FromRecord, System.Int64 ToRecord) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void Unlock (System.Int32 FileNumber) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void Unlock (System.Int32 FileNumber, System.Int64 Record) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void Unlock (System.Int32 FileNumber, System.Int64 FromRecord, System.Int64 ToRecord) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void FileWidth (System.Int32 FileNumber, System.Int32 RecordWidth) { throw new NotImplementedException (); }
- [MonoTODO]
- public static System.Int32 FreeFile () { throw new NotImplementedException (); }
- [MonoTODO]
- public static void Seek (System.Int32 FileNumber, System.Int64 Position) { throw new NotImplementedException (); }
- [MonoTODO]
- public static System.Int64 Seek (System.Int32 FileNumber) { throw new NotImplementedException (); }
- [MonoTODO]
- public static System.Boolean EOF (System.Int32 FileNumber) { throw new NotImplementedException (); }
- [MonoTODO]
- public static System.Int64 Loc (System.Int32 FileNumber) { throw new NotImplementedException (); }
- [MonoTODO]
- public static System.Int64 LOF (System.Int32 FileNumber) { throw new NotImplementedException (); }
- [MonoTODO]
- public static Microsoft.VisualBasic.TabInfo TAB () { throw new NotImplementedException (); }
- [MonoTODO]
- public static Microsoft.VisualBasic.TabInfo TAB (System.Int16 Column) { throw new NotImplementedException (); }
- [MonoTODO]
- public static Microsoft.VisualBasic.SpcInfo SPC (System.Int16 Count) { throw new NotImplementedException (); }
- [MonoTODO]
- public static Microsoft.VisualBasic.OpenMode FileAttr (System.Int32 FileNumber) { throw new NotImplementedException (); }
- [MonoTODO]
- public static void Reset () { throw new NotImplementedException (); }
- [MonoTODO]
- public static void Rename (System.String OldPath, System.String NewPath) { throw new NotImplementedException (); }
- // Events
- };
-}
+{\r
+ [Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute] \r
+ sealed public class FileSystem {\r
+ private static System.IO.FileStream[] FHandle=new FileStream[255];\r
+ // Declarations\r
+ // Constructors\r
+ // Properties\r
+ // Methods\r
+ [MonoTODO("Needs testing")]\r
+ public static void ChDir (System.String Path) \r
+ {\r
+ if ( (Path=="") || (Path==null))\r
+ throw new System.ArgumentException("Path is empty"); \r
+ try\r
+ {\r
+ Environment.CurrentDirectory=Path;\r
+ }\r
+ catch ( Exception e){ throw new System.IO.FileNotFoundException ("Invalid drive is specified, or drive is unavailable");}\r
+ \r
+ }\r
+ \r
+ [MonoTODO]\r
+ public static void ChDrive (System.Char Drive) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void ChDrive (System.String Drive) { throw new NotImplementedException (); }\r
+ \r
+ [MonoTODO("Needs testing")]\r
+ public static System.String CurDir () \r
+ { \r
+ return Environment.CurrentDirectory;\r
+ }\r
+ \r
+ [MonoTODO]\r
+ public static System.String CurDir (System.Char Drive) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static System.String Dir () { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static System.String Dir (System.String Pathname, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(0)] Microsoft.VisualBasic.FileAttribute Attributes) { throw new NotImplementedException (); }\r
+ \r
+ [MonoTODO("Needs testing")]\r
+ public static void MkDir (System.String Path) \r
+ { \r
+ // if a file called like 'path' does exist\r
+ // no exception is generated using .net\r
+ // A little extrange?\r
+ if (Path==null || Path=="")\r
+ {\r
+ throw new System.ArgumentException(); \r
+ }\r
+ else\r
+ {\r
+ if (System.IO.Directory.Exists (Path))\r
+ throw new System.IO.IOException("Directory already exists");\r
+ else\r
+ System.IO.Directory.CreateDirectory(Path);\r
+ }\r
+ }\r
+ \r
+ [MonoTODO("Needs testing")]\r
+ public static void RmDir (System.String Path) \r
+ { \r
+ System.IO.Directory.Delete(Path); \r
+ }\r
+ \r
+ [MonoTODO("Needs testing")]\r
+ public static void FileCopy (System.String Source, System.String Destination) \r
+ { \r
+ // using VB, filecopy always overwrites Destination\r
+ System.IO.File.Copy(Source,Destination,true); \r
+ }\r
+ \r
+ [MonoTODO("Needs testing")]\r
+ public static System.DateTime FileDateTime (System.String PathName) \r
+ {\r
+ // A better exception handling is needed : exceptions\r
+ // are not the same as 'GetLastWriteTime'\r
+ return System.IO.File.GetLastWriteTime (PathName);\r
+ }\r
+ \r
+ [MonoTODO]\r
+ public static System.Int64 FileLen (System.String PathName) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static Microsoft.VisualBasic.FileAttribute GetAttr (System.String PathName) { throw new NotImplementedException (); }\r
+ \r
+ [MonoTODO("Needs testing")]\r
+ public static void Kill (System.String PathName) \r
+ {\r
+ if (!System.IO.File.Exists(PathName))\r
+ throw new System.IO.FileNotFoundException();\r
+ else\r
+ System.IO.File.Delete(PathName);\r
+ }\r
+ \r
+ [MonoTODO]\r
+ public static void SetAttr (System.String PathName, Microsoft.VisualBasic.FileAttribute Attributes) { throw new NotImplementedException (); }\r
+ \r
+ [MonoTODO("Needs testing")]\r
+ public static void FileOpen (System.Int32 FileNumber, System.String FileName, Microsoft.VisualBasic.OpenMode Mode, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] Microsoft.VisualBasic.OpenAccess Access, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] Microsoft.VisualBasic.OpenShare Share, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int32 RecordLength)\r
+ { \r
+ // at this moment you can open a file\r
+ // only for Append, Input or Output\r
+ System.IO.FileMode MyMode;\r
+ System.IO.FileAccess MyAccess; \r
+ System.IO.FileShare MyShare;\r
+ if ( RecordLength < -1 )\r
+ throw new System.ArgumentException("Record Length is negative (nad not equal to -1)");\r
+ if ( RecordLength > 32767)\r
+ throw new System.ArgumentException ("Invalid Record Length");\r
+ if (FileNumber <0 || FileNumber > 255)\r
+ throw new System.IO.IOException(FileNumber.ToString() + " is invalid (<-1 or >255)",5); \r
+ \r
+ FileNumber--;\r
+ if (FHandle[FileNumber] != null)\r
+ throw new System.IO.IOException (FileNumber.ToString() + " is in use",5); \r
+ \r
+ switch (Mode)\r
+ {\r
+ case Microsoft.VisualBasic.OpenMode.Append :\r
+ MyMode=System.IO.FileMode.Append ; \r
+ break;\r
+ case Microsoft.VisualBasic.OpenMode.Binary :\r
+ throw new NotImplementedException ();\r
+ \r
+ case Microsoft.VisualBasic.OpenMode.Input :\r
+ MyMode=System.IO.FileMode.Open ;\r
+ break;\r
+ case Microsoft.VisualBasic.OpenMode.Output :\r
+ MyMode=System.IO.FileMode.OpenOrCreate ;\r
+ break;\r
+ case Microsoft.VisualBasic.OpenMode.Random :\r
+ throw new NotImplementedException (); \r
+ default:\r
+ throw new System.ArgumentException("Invalid Share"); \r
+ }\r
+ switch (Access)\r
+ {\r
+ case Microsoft.VisualBasic.OpenAccess.ReadWrite : \r
+ case Microsoft.VisualBasic.OpenAccess.Default :\r
+ MyAccess=System.IO.FileAccess.ReadWrite;\r
+ break;\r
+ case Microsoft.VisualBasic.OpenAccess.Read :\r
+ MyAccess=System.IO.FileAccess.Read;\r
+ break;\r
+ case Microsoft.VisualBasic.OpenAccess.Write :\r
+ MyAccess=System.IO.FileAccess.Write;\r
+ break;\r
+ default:\r
+ throw new System.ArgumentException("Invalid Access");\r
+ \r
+ }\r
+ switch(Share)\r
+ {\r
+ case Microsoft.VisualBasic.OpenShare.Default :\r
+ case Microsoft.VisualBasic.OpenShare.Shared :\r
+ MyShare=System.IO.FileShare.ReadWrite ; \r
+ break;\r
+ case Microsoft.VisualBasic.OpenShare.LockRead :\r
+ MyShare=System.IO.FileShare.Write; \r
+ break;\r
+ case Microsoft.VisualBasic.OpenShare.LockReadWrite :\r
+ MyShare=System.IO.FileShare.None ;\r
+ break;\r
+ case Microsoft.VisualBasic.OpenShare.LockWrite :\r
+ MyShare=System.IO.FileShare.Read;\r
+ break;\r
+ default:\r
+ throw new System.ArgumentException("Invalid Share");\r
+ }\r
+ FHandle[FileNumber]=new System.IO.FileStream (FileName,MyMode,MyAccess,MyShare);\r
+ \r
+ \r
+ \r
+ \r
+ }\r
+ \r
+ [MonoTODO("Needs testing")]\r
+ public static void FileClose (params System.Int32[] FileNumbers) \r
+ { \r
+ int bucle=0;\r
+ if (FileNumbers.Length == 0)\r
+ {\r
+ for(bucle=0;bucle<255;bucle++)\r
+ {\r
+ if (FHandle[bucle]!=null)\r
+ try\r
+ {\r
+ FHandle[bucle].Close(); \r
+ }\r
+ catch (Exception e) {e.GetType (); FHandle[bucle]=null ;}\r
+ }\r
+ }\r
+ else\r
+ {\r
+ for(bucle=0;bucle<FileNumbers.Length;bucle++)\r
+ {\r
+ if ( FHandle [ FileNumbers[bucle] - 1 ] != null )\r
+ {\r
+ if (FileNumbers[bucle]>0 && FileNumbers[bucle]<256)\r
+ {\r
+ try\r
+ {\r
+ FHandle[ FileNumbers[bucle] - 1].Close();\r
+ FHandle[ FileNumbers[bucle] - 1]=null;\r
+ }\r
+ catch (Exception e){e.GetType (); FHandle[ FileNumbers[bucle] - 1]= null ;}\r
+ }\r
+ else\r
+ throw new System.IO.IOException (FileNumbers[bucle].ToString() + " Does not exist",52);\r
+ }\r
+ else\r
+ throw new System.IO.IOException (FileNumbers[bucle].ToString() + " Does not exist",52); \r
+ }\r
+ }\r
+ }\r
+ \r
+ [MonoTODO]\r
+ public static void FileGetObject (System.Int32 FileNumber, ref System.Object Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] ref System.Int64 RecordNumber) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void FileGet (System.Int32 FileNumber, ref System.ValueType Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] ref System.Int64 RecordNumber) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void FileGet (System.Int32 FileNumber, ref System.Array Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] ref System.Int64 RecordNumber, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(false)] ref System.Boolean ArrayIsDynamic, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(false)] ref System.Boolean StringIsFixedLength) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void FileGet (System.Int32 FileNumber, ref System.Boolean Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] ref System.Int64 RecordNumber) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void FileGet (System.Int32 FileNumber, ref System.Byte Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] ref System.Int64 RecordNumber) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void FileGet (System.Int32 FileNumber, ref System.Int16 Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] ref System.Int64 RecordNumber) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void FileGet (System.Int32 FileNumber, ref System.Int32 Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] ref System.Int64 RecordNumber) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void FileGet (System.Int32 FileNumber, ref System.Int64 Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] ref System.Int64 RecordNumber) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void FileGet (System.Int32 FileNumber, ref System.Char Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] ref System.Int64 RecordNumber) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void FileGet (System.Int32 FileNumber, ref System.Single Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] ref System.Int64 RecordNumber) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void FileGet (System.Int32 FileNumber, ref System.Double Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] ref System.Int64 RecordNumber) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void FileGet (System.Int32 FileNumber, ref System.Decimal Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] ref System.Int64 RecordNumber) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void FileGet (System.Int32 FileNumber, ref System.String Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] ref System.Int64 RecordNumber, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(false)] ref System.Boolean StringIsFixedLength) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void FileGet (System.Int32 FileNumber, ref System.DateTime Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] ref System.Int64 RecordNumber) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void FilePutObject (System.Int32 FileNumber, System.Object Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int64 RecordNumber) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ [System.ObsoleteAttribute("Use FilePutObject to write Object types, or coerce FileNumber and RecordNumber to Integer for writing non-Object types", false)] \r
+ public static void FilePut (System.Object FileNumber, System.Object Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Object RecordNumber) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void FilePut (System.Int32 FileNumber, System.ValueType Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int64 RecordNumber) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void FilePut (System.Int32 FileNumber, System.Array Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int64 RecordNumber, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(false)] System.Boolean ArrayIsDynamic, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(false)] System.Boolean StringIsFixedLength) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void FilePut (System.Int32 FileNumber, System.Boolean Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int64 RecordNumber) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void FilePut (System.Int32 FileNumber, System.Byte Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int64 RecordNumber) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void FilePut (System.Int32 FileNumber, System.Int16 Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int64 RecordNumber) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void FilePut (System.Int32 FileNumber, System.Int32 Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int64 RecordNumber) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void FilePut (System.Int32 FileNumber, System.Int64 Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int64 RecordNumber) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void FilePut (System.Int32 FileNumber, System.Char Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int64 RecordNumber) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void FilePut (System.Int32 FileNumber, System.Single Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int64 RecordNumber) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void FilePut (System.Int32 FileNumber, System.Double Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int64 RecordNumber) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void FilePut (System.Int32 FileNumber, System.Decimal Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int64 RecordNumber) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void FilePut (System.Int32 FileNumber, System.String Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int64 RecordNumber, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(false)] System.Boolean StringIsFixedLength) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void FilePut (System.Int32 FileNumber, System.DateTime Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int64 RecordNumber) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void Print (System.Int32 FileNumber, params System.Object[] Output) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void PrintLine (System.Int32 FileNumber, params System.Object[] Output) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void Input (System.Int32 FileNumber, ref System.Object Value) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void Input (System.Int32 FileNumber, ref System.Boolean Value) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void Input (System.Int32 FileNumber, ref System.Byte Value) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void Input (System.Int32 FileNumber, ref System.Int16 Value) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void Input (System.Int32 FileNumber, ref System.Int32 Value) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void Input (System.Int32 FileNumber, ref System.Int64 Value) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void Input (System.Int32 FileNumber, ref System.Char Value) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void Input (System.Int32 FileNumber, ref System.Single Value) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void Input (System.Int32 FileNumber, ref System.Double Value) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void Input (System.Int32 FileNumber, ref System.Decimal Value) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void Input (System.Int32 FileNumber, ref System.String Value) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void Input (System.Int32 FileNumber, ref System.DateTime Value) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void Write (System.Int32 FileNumber, params System.Object[] Output) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void WriteLine (System.Int32 FileNumber, params System.Object[] Output) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static System.String InputString (System.Int32 FileNumber, System.Int32 CharCount) { throw new NotImplementedException (); }\r
+ \r
+ [MonoTODO("Needs testing")]\r
+ public static System.String LineInput (System.Int32 FileNumber) \r
+ { \r
+ string retval="";\r
+ int buf='\x00'; \r
+ bool found=false;\r
+ if ( FileNumber<1 || FileNumber>255)\r
+ throw new System.IO.IOException (FileNumber.ToString() + " does not exists",52);\r
+ if ( FHandle[FileNumber - 1] == null)\r
+ throw new System.IO.IOException (FileNumber.ToString() + " does not exists",52);\r
+ \r
+ if ( EOF(FileNumber) )\r
+ throw new System.IO.EndOfStreamException();\r
+ \r
+ while (!found)\r
+ {\r
+ \r
+ buf=FHandle[FileNumber - 1].ReadByte();\r
+ if ( (buf == -1) || (buf == '\x0A' ) )\r
+ found=true;\r
+ else\r
+ retval+= ((char)buf).ToString();\r
+ }\r
+ if ( retval.Length > 0 )\r
+ if ( (buf == '\x0A') && (retval[retval.Length -1 ] == '\x0D') )\r
+ retval=retval.Substring(0,retval.Length -1) ;\r
+ Console.WriteLine (retval);\r
+ return retval;\r
+ \r
+ }\r
+ \r
+ [MonoTODO]\r
+ public static void Lock (System.Int32 FileNumber) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void Lock (System.Int32 FileNumber, System.Int64 Record) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void Lock (System.Int32 FileNumber, System.Int64 FromRecord, System.Int64 ToRecord) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void Unlock (System.Int32 FileNumber) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void Unlock (System.Int32 FileNumber, System.Int64 Record) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void Unlock (System.Int32 FileNumber, System.Int64 FromRecord, System.Int64 ToRecord) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void FileWidth (System.Int32 FileNumber, System.Int32 RecordWidth) { throw new NotImplementedException (); }\r
+ \r
+ [MonoTODO("Needs testing")] \r
+ public static System.Int32 FreeFile () \r
+ { \r
+ int bucle=0;\r
+ bool found=false;\r
+ for (bucle=0;bucle<255;bucle++)\r
+ if (FHandle[bucle]==null)\r
+ {\r
+ found=true;\r
+ break;\r
+ }\r
+ if (!found)\r
+ throw new System.IO.IOException ("More than 255 files are in use",67);\r
+ else\r
+ return bucle+1;\r
+ }\r
+ [MonoTODO]\r
+ public static void Seek (System.Int32 FileNumber, System.Int64 Position) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static System.Int64 Seek (System.Int32 FileNumber) { throw new NotImplementedException (); }\r
+ \r
+ [MonoTODO("Needs testing")]\r
+ public static System.Boolean EOF ( System.Int32 FileNumber) \r
+ { \r
+ if (FileNumber<1 || FileNumber>255)\r
+ throw new System.IO.IOException (FileNumber.ToString() + " does not exists",52);\r
+ if ( FHandle[FileNumber - 1] == null)\r
+ throw new System.IO.IOException (FileNumber.ToString() + " does not exists",52);\r
+ if ( FHandle[FileNumber - 1].Length == FHandle[FileNumber - 1].Position)\r
+ return true;\r
+ else\r
+ return false;\r
+ \r
+ }\r
+ \r
+ [MonoTODO]\r
+ public static System.Int64 Loc (System.Int32 FileNumber) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static System.Int64 LOF (System.Int32 FileNumber) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static Microsoft.VisualBasic.TabInfo TAB () { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static Microsoft.VisualBasic.TabInfo TAB (System.Int16 Column) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static Microsoft.VisualBasic.SpcInfo SPC (System.Int16 Count) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static Microsoft.VisualBasic.OpenMode FileAttr (System.Int32 FileNumber) { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void Reset () { throw new NotImplementedException (); }\r
+ [MonoTODO]\r
+ public static void Rename (System.String OldPath, System.String NewPath) { throw new NotImplementedException (); }\r
+ // Events\r
+ \r
+ };\r
+}\r