1 //------------------------------------------------------------------------------
3 // System.IO.FileSystemInfo.cs
5 // Copyright (C) 2001 Moonlight Enterprises, All Rights Reserved
7 // Author: Jim Richardson, develop@wtfo-guru.com
8 // Dan Lewis (dihlewis@yahoo.co.uk)
9 // Created: Monday, August 13, 2001
11 //------------------------------------------------------------------------------
18 public abstract class FileSystemInfo : MarshalByRefObject {
21 public abstract bool Exists { get; }
23 public abstract string Name { get; }
25 public virtual string FullName {
31 public string Extension {
33 return Path.GetExtension (Name);
37 public FileAttributes Attributes {
40 return stat.Attributes;
44 if (!MonoIO.SetFileAttributes (FullName, value))
45 throw MonoIO.GetException ();
49 public DateTime CreationTime {
52 return DateTime.FromFileTime (stat.CreationTime);
56 long filetime = value.ToFileTime ();
58 if (!MonoIO.SetFileTime (FullName, filetime, -1, -1))
59 throw MonoIO.GetException ();
63 public DateTime LastAccessTime {
66 return DateTime.FromFileTime (stat.LastAccessTime);
70 long filetime = value.ToFileTime ();
72 if (!MonoIO.SetFileTime (FullName, -1, filetime, -1))
73 throw MonoIO.GetException ();
77 public DateTime LastWriteTime {
80 return DateTime.FromFileTime (stat.LastWriteTime);
84 long filetime = value.ToFileTime ();
86 if (!MonoIO.SetFileTime (FullName, -1, -1, filetime))
87 throw MonoIO.GetException ();
93 public abstract void Delete ();
95 public void Refresh ()
102 protected FileSystemInfo ()
105 this.FullPath = null;
108 protected string FullPath;
109 protected string OriginalPath;
113 internal void Refresh (bool force)
118 MonoIO.GetFileStat (FullName, out stat);
122 internal void CheckPath (string path)
125 throw new ArgumentNullException ();
126 if (path.IndexOfAny (Path.InvalidPathChars) != -1)
127 throw new ArgumentException ("Invalid characters in path.");
130 internal MonoIOStat stat;