[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/IO Directory.cs,1.16,
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/IO Directory.cs,1.16,1.17 DirectoryInfo.cs,1.2,1.3 File.cs,1.17,1.18 FileInfo.cs,1.1,1.2 FileSystemInfo.cs,1.1,1.2 IOException.cs,1.7,1.8TextWriter.cs,1.10,1.11 |
Date: |
Thu, 24 Apr 2003 02:05:06 -0400 |
Update of /cvsroot/dotgnu-pnet/pnetlib/runtime/System/IO
In directory subversions:/tmp/cvs-serv6297/runtime/System/IO
Modified Files:
Directory.cs DirectoryInfo.cs File.cs FileInfo.cs
FileSystemInfo.cs IOException.cs TextWriter.cs
Log Message:
Rewrite and/or improve various classes in "System.IO".
Index: Directory.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/IO/Directory.cs,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -r1.16 -r1.17
*** Directory.cs 6 Apr 2003 06:21:09 -0000 1.16
--- Directory.cs 24 Apr 2003 06:05:03 -0000 1.17
***************
*** 2,8 ****
* Directory.cs - Implementation of the "System.IO.Directory" class.
*
! * Copyright (C) 2001 Southern Storm Software, Pty Ltd.
! *
! * Contribution from Abhaya Agarwal <address@hidden>
*
* This program is free software; you can redistribute it and/or modify
--- 2,6 ----
* Directory.cs - Implementation of the "System.IO.Directory" class.
*
[...966 lines suppressed...]
! (String path, DateTime lastAccessTime)
{
! ValidatePath(path);
! long ticks = lastAccessTime.Ticks;
!
HandleErrorsDir(FileMethods.SetLastAccessTime(path, ticks));
}
!
! // Set a directory's UTC last write time.
! public static void SetLastWriteTimeUtc(String path, DateTime
lastWriteTime)
{
! ValidatePath(path);
! long ticks = lastWriteTime.Ticks;
!
HandleErrorsDir(FileMethods.SetLastWriteTime(path, ticks));
}
!
! #endif // !ECMA_COMPAT
!
! }; // class Directory
!
! }; // namespace System.IO
Index: DirectoryInfo.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/IO/DirectoryInfo.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** DirectoryInfo.cs 3 Apr 2003 16:31:20 -0000 1.2
--- DirectoryInfo.cs 24 Apr 2003 06:05:03 -0000 1.3
***************
*** 25,28 ****
--- 25,29 ----
using System;
+ using System.Runtime.Serialization;
[Serializable]
***************
*** 44,47 ****
--- 45,53 ----
FullPath = Path.GetFullPath(path);
}
+ internal DirectoryInfo(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ // Nothing to do here.
+ }
// Properties.
***************
*** 53,63 ****
}
}
- [TODO]
public override bool Exists
{
get
{
! // TODO - make sure that the path is a
directory.
! return File.Exists(FullPath);
}
}
--- 59,67 ----
}
}
public override bool Exists
{
get
{
! return Directory.Exists(FullPath);
}
}
***************
*** 78,93 ****
// Create a directory.
- [TODO]
public void Create()
{
Directory.CreateDirectory(FullPath);
- // TODO : refresh() ?
}
- [TODO]
public DirectoryInfo CreateSubdirectory(String name)
{
String dir = Path.Combine(FullPath,
Path.GetFileName(name));
Directory.CreateDirectory(dir);
- // TODO : refresh() ?
return new DirectoryInfo(dir);
}
--- 82,93 ----
***************
*** 112,142 ****
public FileInfo[] GetFiles()
{
! return GetFiles("*");
}
- [TODO]
public FileInfo[] GetFiles(String pattern)
{
! // TODO
! return null;
}
public DirectoryInfo[] GetDirectories()
{
! return GetDirectories("*");
}
- [TODO]
public DirectoryInfo[] GetDirectories(String pattern)
{
! // TODO
! return null;
}
public FileSystemInfo[] GetFileSystemInfos()
{
! return GetFileSystemInfos("*");
}
- [TODO]
public FileSystemInfo[] GetFileSystemInfos(String pattern)
{
! // TODO
! return null;
}
--- 112,160 ----
public FileInfo[] GetFiles()
{
! return
(FileInfo[])(Directory.ScanDirectoryForInfos
! (FullPath, null,
Directory.ScanType.Files,
! typeof(FileInfo)));
}
public FileInfo[] GetFiles(String pattern)
{
! if(pattern == null)
! {
! throw new
ArgumentNullException("pattern");
! }
! return
(FileInfo[])(Directory.ScanDirectoryForInfos
! (FullPath, pattern,
Directory.ScanType.Files,
! typeof(FileInfo)));
}
public DirectoryInfo[] GetDirectories()
{
! return
(DirectoryInfo[])(Directory.ScanDirectoryForInfos
! (FullPath, null,
Directory.ScanType.Directories,
! typeof(DirectoryInfo)));
}
public DirectoryInfo[] GetDirectories(String pattern)
{
! if(pattern == null)
! {
! throw new
ArgumentNullException("pattern");
! }
! return
(DirectoryInfo[])(Directory.ScanDirectoryForInfos
! (FullPath, pattern,
Directory.ScanType.Directories,
! typeof(DirectoryInfo)));
}
public FileSystemInfo[] GetFileSystemInfos()
{
! return
(FileSystemInfo[])(Directory.ScanDirectoryForInfos
! (FullPath, null,
Directory.ScanType.DirectoriesAndFiles,
! typeof(FileSystemInfo)));
}
public FileSystemInfo[] GetFileSystemInfos(String pattern)
{
! if(pattern == null)
! {
! throw new
ArgumentNullException("pattern");
! }
! return
(FileSystemInfo[])(Directory.ScanDirectoryForInfos
! (FullPath, null,
Directory.ScanType.DirectoriesAndFiles,
! typeof(FileSystemInfo)));
}
***************
*** 147,151 ****
}
! }; // class FileInfo
#endif // !ECMA_COMPAT
--- 165,169 ----
}
! }; // class DirectoryInfo
#endif // !ECMA_COMPAT
Index: File.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/IO/File.cs,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -r1.17 -r1.18
*** File.cs 1 Apr 2003 02:48:33 -0000 1.17
--- File.cs 24 Apr 2003 06:05:03 -0000 1.18
***************
*** 2,8 ****
* File.cs - Implementation of the "System.IO.File" class.
*
! * Copyright (C) 2002 Southern Storm Software, Pty Ltd.
! * Copyright (C) 2002 FreeDevelopers.net
! * Contributions from Charlie Carnow <address@hidden>
*
* This program is free software; you can redistribute it and/or modify
--- 2,6 ----
* File.cs - Implementation of the "System.IO.File" class.
*
! * Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
***************
*** 23,328 ****
namespace System.IO
{
- using Platform;
- using System;
- using System.Security;
-
- public sealed class File
- {
- private File()
- {
- // private constructor... do nothing
- }
- public static StreamWriter AppendText(string path)
- {
- return new StreamWriter(path, true);
- }
-
-
- public static void Copy(string source, string dest)
- {
- Exception e = ValidatePath(source, "source");
- if (e != null) { throw e; }
- e = ValidatePath(dest, "dest");
- if (e != null) { throw e; }
- Copy(source, dest, false);
- }
-
-
- public static void Copy(string source, string dest, bool
overwrite)
- {
-
- Exception e = ValidatePath(source, "source");
- if (e != null) { throw e; }
- e = ValidatePath(dest, "dest");
- if (e != null) { throw e; }
-
- Errno err = FileMethods.Copy(source, dest);
-
- switch(err)
- {
- // If Dest Exists
- case Errno.EEXIST:
- if (overwrite)
- {
- Move(source, dest);
- }
- else
- {
- throw new
IOException(String.Format(
-
_("IO_CopyFileExists"),dest));
- }
- break;
! // Directory or File not found
! case Errno.ENOENT:
! if (Exists(source))
{
! throw new
DirectoryNotFoundException(_("IO_DirNotFound"));
}
else
{
! throw new
FileNotFoundException(_("IO_FileNotFound"));
}
!
!
! case Errno.EIO:
! throw new IOException(_("IO_Error"));
!
! case Errno.EACCES:
! throw new
SecurityException(_("IO_PathnameSecurity"));
! case Errno.Success:
! return;
!
! // TODO: Change to a more appropriate exception
! // (Suggestions would be welcome)
! default:
! throw new ArgumentException();
! }
! }
!
! public static FileStream Create(string path)
! {
! return new FileStream(path, FileMode.Create,
FileAccess.ReadWrite, FileShare.None);
! }
!
! public static FileStream Create(string path, int buffersize)
! {
! return new FileStream(path, FileMode.Create,
FileAccess.ReadWrite, FileShare.None, buffersize);
! }
!
! public static StreamWriter CreateText(string path)
! {
! return new StreamWriter(path, false);
! }
!
!
! public static void Delete(string path)
! {
! Exception e = ValidatePath(path, "path");
! if (e != null) { throw e; }
!
! Errno err = DirMethods.Delete(path);
!
! switch(err)
! {
! case Errno.Success:
! /* Nothing */
! break;
! case Errno.EIO:
! throw new IOException(_("IO_Error"));
! case Errno.ENOENT:
! // Exists checks files
! if (Exists(path))
{
! throw new
DirectoryNotFoundException(_("IO_DirNotFound"));
}
! else
! {
! throw new
FileNotFoundException(_("IO_FileNotFound"));
! }
! case Errno.EACCES:
! throw new
SecurityException(_("IO_PathnameSecurity"));
!
! // TODO: Change to a more appropriate exception
! // (Suggestions would be welcome)
! default:
! throw new ArgumentException();
!
! }
! }
!
! public static bool Exists(string path)
! {
! Exception e = ValidatePath(path, "path");
! if (e != null) { throw e; }
! return FileMethods.Exists(path);
! }
!
! public static DateTime GetCreationTime(string path)
! {
! // platform-enforced security is the only security here
right now
! // afaik, some System.Security stuff needs to be added
here - Rich
!
! Exception e = ValidatePath(path, "path");
! if (e != null) { throw e; }
!
! long time;
! e =
GetTimeExceptionHandler(DirMethods.GetCreationTime(path, out time));
! if (e != null) { throw e; }
!
! return new DateTime(time);
! }
!
! public static DateTime GetLastAccessTime(string path)
! {
! // platform-enforced security is the only security here
right now
! // afaik, some System.Security stuff needs to be added
here - Rich
!
! Exception e = ValidatePath(path, "path");
! if (e != null) { throw e; }
!
! long time;
! e =
GetTimeExceptionHandler(DirMethods.GetLastAccess(path, out time));
! if (e != null) { throw e; }
!
! return new DateTime(time);
! }
!
! public static DateTime GetLastWriteTime(string path)
! {
! // platform-enforced security is the only security here
right now
! // afaik, some System.Security stuff needs to be added
here - Rich
!
! Exception e = ValidatePath(path, "path");
! if (e != null) { throw e; }
!
! long time;
! e =
GetTimeExceptionHandler(DirMethods.GetLastModification(path, out time));
! if (e != null) { throw e; }
!
! return new DateTime(time);
! }
!
! public static void Move(string src, string dest)
! {
! Exception e = ValidatePath(src, "src");
! if (e != null) { throw e; }
! e = ValidatePath(dest, "dest");
! if (e != null) { throw e; }
!
! DirMethods.Rename(src, dest);
! }
!
!
! public static FileStream Open(string path, FileMode mode)
! {
! return new FileStream(path, mode, FileAccess.ReadWrite,
FileShare.None);
! }
!
! public static FileStream Open(string path, FileMode mode,
! FileAccess access)
! {
! return new FileStream(path, mode, access,
! FileShare.None);
!
! }
!
!
! public static FileStream Open(string path, FileMode mode,
! FileAccess access, FileShare s)
! {
! return new FileStream(path, mode, access, s);
! }
!
! public static FileStream OpenRead(string path)
! {
! return new FileStream(path, FileMode.Open,
! FileAccess.Read, FileShare.Read);
! }
!
! public static StreamReader OpenText(string path)
! {
! return new StreamReader(path);
! }
!
! public static FileStream OpenWrite(string path)
! {
! return new FileStream(path, FileMode.OpenOrCreate,
! FileAccess.Write, FileShare.None);
! }
!
! public static void SetCreationTime(string path, DateTime
creationTime)
! {
! Exception e = ValidatePath(path, "path");
! if(e != null) { throw e; }
!
! Errno err = FileMethods.SetCreationTime(path,
creationTime.ToUniversalTime().Ticks);
! e = GetTimeExceptionHandler(err);
! if(e != null) { throw e; }
! }
!
! public static void SetLastAccessTime(string path, DateTime
lastAccessTime)
! {
! Exception e = ValidatePath(path, "path");
! if(e != null) { throw e; }
!
! Errno err = FileMethods.SetLastAccessTime(path,
lastAccessTime.ToUniversalTime().Ticks);
! e = GetTimeExceptionHandler(err);
! if(e != null) { throw e; }
! }
!
! public static void SetLastWriteTime(string path, DateTime
lastWriteTime)
! {
! Exception e = ValidatePath(path, "path");
! if(e != null) { throw e; }
!
! Errno err = FileMethods.SetLastWriteTime(path,
lastWriteTime.ToUniversalTime().Ticks);
! e = GetTimeExceptionHandler(err);
! if(e != null) { throw e; }
!
! }
!
! private static Exception GetTimeExceptionHandler(Errno err)
! {
! if (err == Errno.Success)
! {
! return null;
! }
! else if (err == Errno.ENOENT)
! {
! return new IOException(_("IO_PathNotFound"));
! }
! else if (err == Errno.ENAMETOOLONG)
! {
! return new
PathTooLongException(_("Exception_PathTooLong"));
! }
! else if (err == Errno.EACCES)
! {
! return new
SecurityException(_("IO_PathnameSecurity"));
! }
! else if (err == Errno.ENOMEM)
! {
! return new OutOfMemoryException();
! }
! else
! {
! return new IOException(_("Exception_IO"));
! }
! }
!
! private static Exception ValidatePath(string path, string
argumentName)
! {
! if (path == null)
! {
! return new
! ArgumentNullException(_("Arg_NotNull"),
argumentName);
! }
! if ((path.Trim() == "") ||
!(FileMethods.ValidatePathname(path)))
! {
! return new
!
ArgumentException(_("IO_InvalidPathname"), argumentName);
! }
! return null;
! }
! }
! }
--- 21,326 ----
namespace System.IO
{
! using System;
! using Platform;
!
! public sealed class File
! {
! // Cannot instantiate this class.
! private File() {}
!
! // Open a file for text appending.
! public static StreamWriter AppendText(String path)
! {
! return new StreamWriter(path, true);
! }
!
! // Make a copy of a file.
! public static void Copy(String sourceFileName, String destFileName)
! {
! Copy(sourceFileName, destFileName, false);
! }
! public static void Copy(String sourceFileName, String destFileName,
! bool overwrite)
! {
! // Open the source to be copied.
! FileStream src = new FileStream
! (sourceFileName, FileMode.Open,
FileAccess.Read);
!
! // Open the destination to be copied to.
! FileStream dest;
! try
! {
! if(overwrite)
{
! dest = new FileStream
! (destFileName,
FileMode.Create,
! FileAccess.Write);
}
else
{
! dest = new FileStream
! (destFileName,
FileMode.CreateNew,
! FileAccess.Write);
}
! }
! catch
! {
! // Could not open the destination, so
close the source.
! src.Close();
! throw;
! }
!
! // Copy the contents of the file.
! try
! {
! byte[] buffer = new byte
[FileStream.BUFSIZ];
! int len;
! while((len = src.Read(buffer, 0,
FileStream.BUFSIZ)) > 0)
{
! dest.Write(buffer, 0, len);
}
! }
! finally
! {
! src.Close();
! dest.Close();
! }
! }
!
! // Create a stream for a file.
! public static FileStream Create(String path)
! {
! return Create(path, FileStream.BUFSIZ);
! }
! public static FileStream Create(String path, int bufferSize)
! {
! return new FileStream
! (path, FileMode.Create,
FileAccess.ReadWrite,
! FileShare.None, bufferSize);
! }
!
! // Create a file for text writing.
! public static StreamWriter CreateText(String path)
! {
! return new StreamWriter(path, false);
! }
!
! // Delete a file.
! public static void Delete(String path)
! {
! Directory.ValidatePath(path);
!
Directory.HandleErrorsFile(DirMethods.Delete(path));
! }
!
! // Determine whether a file exists.
! public static bool Exists(String path)
! {
! try
! {
! Directory.ValidatePath(path);
! }
! catch(Exception)
! {
! return false;
! }
! FileType type = FileMethods.GetFileType(path);
! return (type != FileType.directory &&
! type != FileType.unknown);
! }
!
! // Get a file's creation time.
! public static DateTime GetCreationTime(String path)
! {
! long ticks;
! Directory.ValidatePath(path);
! Directory.HandleErrorsFile
! (DirMethods.GetCreationTime(path, out
ticks));
! return (new DateTime(ticks)).ToLocalTime();
! }
!
! // Get a file's last access time.
! public static DateTime GetLastAccessTime(String path)
! {
! long ticks;
! Directory.ValidatePath(path);
! Directory.HandleErrorsFile
! (DirMethods.GetLastAccess(path, out
ticks));
! return (new DateTime(ticks)).ToLocalTime();
! }
!
! // Get a file's last modification time.
! public static DateTime GetLastWriteTime(String path)
! {
! long ticks;
! Directory.ValidatePath(path);
! Directory.HandleErrorsFile
! (DirMethods.GetLastModification(path,
out ticks));
! return (new DateTime(ticks)).ToLocalTime();
! }
!
! // Move a file to a new location.
! public static void Move(String sourceFileName, String destFileName)
! {
! Directory.Move(sourceFileName, destFileName);
! }
!
! // Open a file stream.
! public static FileStream Open(String path, FileMode mode)
! {
! return new FileStream
! (path, mode, FileAccess.ReadWrite,
FileShare.None);
! }
! public static FileStream Open
! (String path, FileMode mode, FileAccess access)
! {
! return new FileStream(path, mode, access,
FileShare.None);
! }
! public static FileStream Open
! (String path, FileMode mode,
! FileAccess access, FileShare share)
! {
! return new FileStream(path, mode, access,
share);
! }
!
! // Open a file for reading.
! public static FileStream OpenRead(String path)
! {
! return new FileStream
! (path, FileMode.Open, FileAccess.Read,
FileShare.None);
! }
!
! // Open a text file for reading.
! public static StreamReader OpenText(String path)
! {
! return new StreamReader(path);
! }
!
! // Open a file for writing.
! public static FileStream OpenWrite(String path)
! {
! return new FileStream
! (path, FileMode.OpenOrCreate,
! FileAccess.Write, FileShare.None);
! }
!
! // Set the creation time on a file.
! public static void SetCreationTime(String path, DateTime creationTime)
! {
! Directory.ValidatePath(path);
! Directory.HandleErrorsFile
! (FileMethods.SetCreationTime
! (path,
creationTime.ToUniversalTime().Ticks));
! }
!
! // Set the last access time on a file.
! public static void SetLastAccessTime(String path, DateTime
lastAccessTime)
! {
! Directory.ValidatePath(path);
! Directory.HandleErrorsFile
! (FileMethods.SetLastAccessTime
! (path,
lastAccessTime.ToUniversalTime().Ticks));
! }
!
! // Set the last modification time on a file.
! public static void SetLastWriteTime(String path, DateTime lastWriteTime)
! {
! Directory.ValidatePath(path);
! Directory.HandleErrorsFile
! (FileMethods.SetLastWriteTime
! (path,
lastWriteTime.ToUniversalTime().Ticks));
! }
!
! #if !ECMA_COMPAT
!
! // Get the attributes for a file.
! public static FileAttributes GetAttributes(String path)
! {
! int attrs;
! Directory.ValidatePath(path);
! Directory.HandleErrorsFile
! (FileMethods.GetAttributes(path, out
attrs));
! return (FileAttributes)attrs;
! }
!
! // Get a file's UTC creation time.
! public static DateTime GetCreationTimeUtc(String path)
! {
! long ticks;
! Directory.ValidatePath(path);
! Directory.HandleErrorsFile
! (DirMethods.GetCreationTime(path, out
ticks));
! return new DateTime(ticks);
! }
!
! // Get a file's UTC last access time.
! public static DateTime GetLastAccessTimeUtc(String path)
! {
! long ticks;
! Directory.ValidatePath(path);
! Directory.HandleErrorsFile
! (DirMethods.GetLastAccess(path, out
ticks));
! return new DateTime(ticks);
! }
!
! // Get a file's UTC last modification time.
! public static DateTime GetLastWriteTimeUtc(String path)
! {
! long ticks;
! Directory.ValidatePath(path);
! Directory.HandleErrorsFile
! (DirMethods.GetLastModification(path,
out ticks));
! return new DateTime(ticks);
! }
!
! // Set the attributes on a file.
! public static void SetAttributes
! (String path, FileAttributes fileAttributes)
! {
! Directory.ValidatePath(path);
! Directory.HandleErrorsFile
! (FileMethods.SetAttributes(path,
(int)fileAttributes));
! }
!
! // Set the UTC creation time on a file.
! public static void SetCreationTimeUtc(String path, DateTime
creationTime)
! {
! Directory.ValidatePath(path);
! Directory.HandleErrorsFile
! (FileMethods.SetCreationTime(path,
creationTime.Ticks));
! }
!
! // Set the UTC last access time on a file.
! public static void SetLastAccessTimeUtc
! (String path, DateTime lastAccessTime)
! {
! Directory.ValidatePath(path);
! Directory.HandleErrorsFile
! (FileMethods.SetLastAccessTime
! (path, lastAccessTime.Ticks));
! }
!
! // Set the UTC last modification time on a file.
! public static void SetLastWriteTimeUtc(String path, DateTime
lastWriteTime)
! {
! Directory.ValidatePath(path);
! Directory.HandleErrorsFile
! (FileMethods.SetLastWriteTime
! (path, lastWriteTime.Ticks));
! }
!
! // Get the length of a file.
! internal static long GetLength(String path)
! {
! long length;
! Directory.ValidatePath(path);
! Directory.HandleErrorsFile
! (FileMethods.GetLength(path, out
length));
! return length;
! }
!
! #endif // !ECMA_COMPAT
!
! }; // class File
!
! }; // namespace System.IO
Index: FileInfo.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/IO/FileInfo.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** FileInfo.cs 1 Feb 2003 02:04:50 -0000 1.1
--- FileInfo.cs 24 Apr 2003 06:05:03 -0000 1.2
***************
*** 25,28 ****
--- 25,29 ----
using System;
+ using System.Runtime.Serialization;
[Serializable]
***************
*** 44,47 ****
--- 45,53 ----
FullPath = Path.GetFullPath(path);
}
+ internal FileInfo(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ // Nothing to do here.
+ }
// Properties.
***************
*** 60,79 ****
}
}
- [TODO]
public override bool Exists
{
get
{
- // TODO - make sure that the path is
not a directory.
return File.Exists(FullPath);
}
}
- [TODO]
public long Length
{
get
{
! // TODO
! return 0;
}
}
--- 66,81 ----
}
}
public override bool Exists
{
get
{
return File.Exists(FullPath);
}
}
public long Length
{
get
{
! return File.GetLength(FullPath);
}
}
Index: FileSystemInfo.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/IO/FileSystemInfo.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** FileSystemInfo.cs 1 Feb 2003 02:04:50 -0000 1.1
--- FileSystemInfo.cs 24 Apr 2003 06:05:03 -0000 1.2
***************
*** 25,31 ****
using System;
[Serializable]
! public abstract class FileSystemInfo : MarshalByRefObject
{
// Internal state.
--- 25,33 ----
using System;
+ using System.Runtime.InteropServices;
+ using System.Runtime.Serialization;
[Serializable]
! public abstract class FileSystemInfo : MarshalByRefObject, ISerializable
{
// Internal state.
***************
*** 39,55 ****
OriginalPath = null;
}
// Properties.
- [TODO]
public FileAttributes Attributes
{
get
{
! // TODO
! return 0;
}
set
{
! // TODO
}
}
--- 41,64 ----
OriginalPath = null;
}
+ protected FileSystemInfo(SerializationInfo info, StreamingContext
context)
+ {
+ if(info == null)
+ {
+ throw new ArgumentNullException("info");
+ }
+ OriginalPath = info.GetString("OriginalPath");
+ FullPath = info.GetString("FullPath");
+ }
// Properties.
public FileAttributes Attributes
{
get
{
! return File.GetAttributes(FullPath);
}
set
{
! File.SetAttributes(FullPath, value);
}
}
***************
*** 65,68 ****
--- 74,89 ----
}
}
+ [ComVisible(false)]
+ public DateTime CreationTimeUtc
+ {
+ get
+ {
+ return
File.GetCreationTimeUtc(FullPath);
+ }
+ set
+ {
+ File.SetCreationTimeUtc(FullPath,
value);
+ }
+ }
public abstract bool Exists { get; }
public String Extension
***************
*** 91,94 ****
--- 112,127 ----
}
}
+ [ComVisible(false)]
+ public DateTime LastAccessTimeUtc
+ {
+ get
+ {
+ return
File.GetLastAccessTimeUtc(FullPath);
+ }
+ set
+ {
+ File.SetLastAccessTimeUtc(FullPath,
value);
+ }
+ }
public DateTime LastWriteTime
{
***************
*** 102,105 ****
--- 135,150 ----
}
}
+ [ComVisible(false)]
+ public DateTime LastWriteTimeUtc
+ {
+ get
+ {
+ return
File.GetLastWriteTimeUtc(FullPath);
+ }
+ set
+ {
+ File.SetLastWriteTimeUtc(FullPath,
value);
+ }
+ }
public abstract String Name { get; }
***************
*** 111,114 ****
--- 156,172 ----
{
// Nothing to do here - we don't cache values.
+ }
+
+ // Get the serialization data for this instance.
+ [ComVisible(false)]
+ public virtual void GetObjectData(SerializationInfo info,
+
StreamingContext context)
+ {
+ if(info == null)
+ {
+ throw new ArgumentNullException("info");
+ }
+ info.AddValue("OriginalPath", OriginalPath);
+ info.AddValue("FullPath", FullPath);
}
Index: IOException.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/IO/IOException.cs,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** IOException.cs 7 Apr 2003 04:22:51 -0000 1.7
--- IOException.cs 24 Apr 2003 06:05:03 -0000 1.8
***************
*** 48,51 ****
--- 48,57 ----
}
#if !ECMA_COMPAT
+ public IOException(String msg, int hresult)
+ : base(msg)
+ {
+ errno = Errno.EIO;
+ HResult = hresult;
+ }
protected IOException(SerializationInfo info, StreamingContext context)
: base(info, context) {}
Index: TextWriter.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/IO/TextWriter.cs,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** TextWriter.cs 15 Apr 2003 07:27:54 -0000 1.10
--- TextWriter.cs 24 Apr 2003 06:05:03 -0000 1.11
***************
*** 324,330 ****
else
{
! //TODO
! //return
CultureInfo.CurrentCulture;
return null;
}
}
--- 324,332 ----
else
{
! #if CONFIG_REFLECTION
! return
CultureInfo.CurrentCulture;
! #else
return null;
+ #endif
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/IO Directory.cs,1.16,1.17 DirectoryInfo.cs,1.2,1.3 File.cs,1.17,1.18 FileInfo.cs,1.1,1.2 FileSystemInfo.cs,1.1,1.2 IOException.cs,1.7,1.8TextWriter.cs,1.10,1.11,
Rhys Weatherley <address@hidden> <=