diff options
author | Miguel de Icaza <miguel@gnome.org> | 2002-01-23 23:05:45 +0300 |
---|---|---|
committer | Miguel de Icaza <miguel@gnome.org> | 2002-01-23 23:05:45 +0300 |
commit | 96b7ca21ac3cb02854c9334cbf33faa50cb3ea18 (patch) | |
tree | fe2c2b0fee0bff7822f919e6d4f4f7c0392ff90b /mcs/class/corlib/System.IO/FileInfo.cs | |
parent | c7c4eb0e94e26d7cb254f5ea616faee85af91a55 (diff) |
2002-01-23 Miguel de Icaza <miguel@ximian.com>
* DirectoryInfo.cs (GetFiles, GetDirectories, GetFileSystemInfos,
Delete, Create, Parent, Exists, MoveTo): Implement.
* Directory.cs (GetListing): implement new utility function.
(GetDirectories): Implement.
(GetFileSystemEntries): Implement.
(GetFiles): Implement.
* CheckArgument.cs (Path): Do not allow null by default.
2002-01-23 Miguel de Icaza <miguel@ximian.com>
* Unix/Wrapper.cs: Updated to new Wrapper
svn path=/trunk/mcs/; revision=2132
Diffstat (limited to 'mcs/class/corlib/System.IO/FileInfo.cs')
-rw-r--r-- | mcs/class/corlib/System.IO/FileInfo.cs | 98 |
1 files changed, 48 insertions, 50 deletions
diff --git a/mcs/class/corlib/System.IO/FileInfo.cs b/mcs/class/corlib/System.IO/FileInfo.cs index 590fd8e9f38..41c69268188 100644 --- a/mcs/class/corlib/System.IO/FileInfo.cs +++ b/mcs/class/corlib/System.IO/FileInfo.cs @@ -23,25 +23,25 @@ namespace System.IO {
private OpSys _os = Platform.OS;
- public FileInfo(string fileName)
+ public FileInfo (string fileName)
{
- CheckArgument.Path(fileName, false);
+ CheckArgument.Path (fileName, false);
//LAMESPEC: Does not throw security exception in constructor
OriginalPath = fileName;
}
- private bool existsOnDisk(bool exNotFound, bool exIsDirectory)
+ private bool existsOnDisk (bool exNotFound, bool exIsDirectory)
{
bool bRetCode;
try
{
- Refresh();
- if((getAttributes() & FileAttributes.Directory) != 0)
+ Refresh ();
+ if ((getAttributes () & FileAttributes.Directory) != 0)
{
- if(exIsDirectory)
+ if (exIsDirectory)
{
- throw new UnauthorizedAccessException();
+ throw new UnauthorizedAccessException ();
}
bRetCode = false;
}
@@ -50,12 +50,11 @@ namespace System.IO bRetCode = true;
}
}
- catch(ArgumentException ex)
+ catch (ArgumentException)
{
- //Debug.WriteLine(ex); // eliminates not used warning
- if(exNotFound)
+ if (exNotFound)
{
- throw new FileNotFoundException();
+ throw new FileNotFoundException ();
}
bRetCode = false;
}
@@ -66,7 +65,7 @@ namespace System.IO {
get
{
- return existsOnDisk(false, false);
+ return existsOnDisk (false, false);
}
}
@@ -74,7 +73,7 @@ namespace System.IO {
get
{
- return Path.GetFileName(getPathName());
+ return Path.GetFileName (getPathName ());
}
}
@@ -85,7 +84,7 @@ namespace System.IO {
get
{
- return new DirectoryInfo(Path.GetDirectoryName(getPathName()));
+ return new DirectoryInfo (Path.GetDirectoryName (getPathName ()));
}
}
@@ -96,7 +95,7 @@ namespace System.IO {
get
{
- return Path.GetDirectoryName(getPathName());
+ return Path.GetDirectoryName (getPathName ());
}
}
@@ -109,93 +108,92 @@ namespace System.IO {
try
{
- Refresh();
+ Refresh ();
}
- catch(ArgumentException ex)
+ catch (ArgumentException)
{
- //Debug.WriteLine(ex); // eliminates not used compiler warning
- throw new FileNotFoundException();
+ throw new FileNotFoundException ();
}
- return _os.FileLength(getPathName());
+ return _os.FileLength (getPathName ());
}
}
[MonoTODO]
- public StreamWriter AppendText()
+ public StreamWriter AppendText ()
{ // TODO: verify using correct FileMode here might be Create & Append
- return new StreamWriter(Open(FileMode.Append, FileAccess.Write));
+ return new StreamWriter (Open (FileMode.Append, FileAccess.Write));
}
[MonoTODO]
- public FileStream Create()
+ public FileStream Create ()
{
// TODO: verify using correct FileMode here
- return Open(FileMode.OpenOrCreate, FileAccess.ReadWrite);
+ return Open (FileMode.OpenOrCreate, FileAccess.ReadWrite);
}
[MonoTODO]
- public StreamWriter CreateText()
+ public StreamWriter CreateText ()
{ //TODO: According to doc even CreateText throws a file not found ex
// sounds suspicious so i'll have to check it out later
- //existsOnDisk(true, true); // throw not found, is directory
- return new StreamWriter(Open(FileMode.Create, FileAccess.Write));
+ //existsOnDisk (true, true); // throw not found, is directory
+ return new StreamWriter (Open (FileMode.Create, FileAccess.Write));
}
- public FileStream Open(FileMode mode)
+ public FileStream Open (FileMode mode)
{
- return Open(mode, FileAccess.ReadWrite);
+ return Open (mode, FileAccess.ReadWrite);
}
- public FileStream Open(FileMode mode, FileAccess access)
+ public FileStream Open (FileMode mode, FileAccess access)
{
- return Open(mode, access, FileShare.None);
+ return Open (mode, access, FileShare.None);
}
- public FileStream Open(FileMode mode, FileAccess access, FileShare share)
+ public FileStream Open (FileMode mode, FileAccess access, FileShare share)
{
- bool bExists = existsOnDisk(false, true); // throw is directory;
- string path = getPathName();
- CheckPermission.ModeAccess(mode, access, path, bExists);
- return new FileStream(path, mode, access, share);
+ bool bExists = existsOnDisk (false, true); // throw is directory;
+ string path = getPathName ();
+ CheckPermission.ModeAccess (mode, access, path, bExists);
+ return new FileStream (path, mode, access, share);
}
[MonoTODO]
- public FileStream OpenRead()
+ public FileStream OpenRead ()
{ // TODO: find out what default share should be
- return Open(FileMode.Open, FileAccess.Read, FileShare.Read);
+ return Open (FileMode.Open, FileAccess.Read, FileShare.Read);
}
[MonoTODO]
- public StreamReader OpenText()
+ public StreamReader OpenText ()
{ // TODO: verify mode and access values
- return new StreamReader(Open(FileMode.OpenOrCreate, FileAccess.ReadWrite));
+ return new StreamReader (Open (FileMode.OpenOrCreate, FileAccess.ReadWrite));
}
- public FileStream OpenWrite()
+ public FileStream OpenWrite ()
{
- return Open(FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None);
+ return Open (FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None);
}
- public FileInfo CopyTo(string destFile)
+ public FileInfo CopyTo (string destFile)
{
- return CopyTo(destFile, false);
+ return CopyTo (destFile, false);
}
[MonoTODO]
- public FileInfo CopyTo(string destFile, bool bOverwrite)
+ public FileInfo CopyTo (string destFile, bool bOverwrite)
{ // TODO: Implement
return null;
}
- public override void Delete()
+ public override void Delete ()
{
- existsOnDisk(true, true); // throw not found, is directory
- CheckPermission.Demand(FileIOPermissionAccess.AllAccess, getPathName());
- _os.DeleteFile(getPathName());
+ existsOnDisk (true, true); // throw not found, is directory
+ CheckPermission.Demand (FileIOPermissionAccess.AllAccess, getPathName ());
+ _os.DeleteFile (getPathName ());
}
[MonoTODO]
- public void MoveTo(string destName)
+ public void MoveTo (string destName)
{ // TODO: Implement
}
}
|