Author: gonzalo
Date: 2006-09-21 22:54:31 -0400 (Thu, 21 Sep 2006)
New Revision: 65802
Modified:
Log:
2006-09-21 Gonzalo Paniagua Javier <gonzalo (AT) ximian (DOT) com>
* Test/System.I/FileInfoTest.cs:
* System.I/FileInfo.cs: added 2.0 IsR Patch by Joel Reed.
Modified:
2006-09-22 02:50:24 UTC (rev 65801)
2006-09-22 02:54:31 UTC (rev 65802)
@@ -1,5 +1,9 @@
2006-09-21 Gonzalo Paniagua Javier <gonzalo (AT) ximian (DOT) com>
+* FileInfo.cs: added 2.0 IsR Patch by Joel Reed.
+
+2006-09-21 Gonzalo Paniagua Javier <gonzalo (AT) ximian (DOT) com>
+
* FileInfo.cs: eol-style.
2006-09-19 Gert Driesen <drieseng (AT) users (DOT) sourceforge.net>
Modified:
2006-09-22 02:50:24 UTC (rev 65801)
2006-09-22 02:54:31 UTC (rev 65802)
@@ -78,6 +78,31 @@
}
}
+#if NET_2_0
+public bool IsR {
+get {
+if (!Exists)
+throw new FileNotFoundException ("Could not find file \"" + Path + "\".", Path);
+
+return ((stat.Attributes & FileAttributes.R) != 0);
+}
+
+set {
+if (!Exists)
+throw new FileNotFoundException ("Could not find file \"" + Path + "\".", Path);
+
+FileAttributes attrs = File.GetAttributes(FullPath);
+
+if (value)
+attrs |= FileAttributes.R;
+else
+attrs &= ~FileAttributes.R;
+
+File.SetAttributes(FullPath, attrs);
+}
+}
+#endif
+
public long Length {
get {
if (!Exists)
Modified:
2006-09-22 02:50:24 UTC (rev 65801)
2006-09-22 02:54:31 UTC (rev 65802)
@@ -105,8 +105,32 @@
DeleteFile (path);
}
}
+
+#if NET_2_0
[Test]
+public void IsR ()
+{
+string path = TempFolder + DSC + "FIT.IsRTest";
+DeleteFile (path);
+
+try {
+FileStream stream = File.Create (path);
+stream.WriteByte (12);
+stream.Close ();
+FileInfo info = new FileInfo (path);
+AssertEquals ("test#01", false, info.IsR);
+info.IsR = true;
+AssertEquals ("test#02", true, info.IsR);
+info.IsR = false;
+AssertEquals ("test#03", false, info.IsR);
+} finally {
+DeleteFile (path);
+}
+}
+#endif
+
+[Test]
public void Length ()
{
string path = TempFolder + DSC + "FIT.Length.Test";
Mono-patches maillist - Mono-patches (AT) lists (DOT) ximian.com