DirectoryInfo.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. //------------------------------------------------------------------------------
  2. //
  3. // System.IO.DirectoryInfo.cs
  4. //
  5. // Copyright (C) 2001 Moonlight Enterprises, All Rights Reserved
  6. //
  7. // Author: Jim Richardson, [email protected]
  8. // Created: Monday, August 13, 2001
  9. //
  10. //------------------------------------------------------------------------------
  11. using System;
  12. using System.Diagnostics;
  13. using System.IO.Private;
  14. namespace System.IO
  15. {
  16. /// <summary>
  17. ///
  18. /// </summary>
  19. public sealed class DirectoryInfo : FileSystemInfo
  20. {
  21. public DirectoryInfo(string path)
  22. {
  23. CheckArgument.Path(path, false);
  24. //LAMESPEC: Does not throw directory not found exception
  25. // Does not throw security exception in constructor
  26. OriginalPath = path;
  27. }
  28. public override bool Exists
  29. {
  30. get
  31. {
  32. bool bRetCode;
  33. try
  34. {
  35. Refresh();
  36. bRetCode = ((Attributes & FileAttributes.Directory) != 0);
  37. }
  38. catch(ArgumentException ex)
  39. {
  40. Debug.WriteLine(ex); // eliminates not used warning
  41. bRetCode = false;
  42. }
  43. return bRetCode;
  44. }
  45. }
  46. public override string Name
  47. {
  48. get
  49. { //TODO: Implement this as per the documenation
  50. return FullPath;
  51. }
  52. }
  53. public DirectoryInfo Root
  54. {
  55. get
  56. { //TODO: Implement
  57. return null;
  58. }
  59. }
  60. public void Create()
  61. {
  62. //TODO: Implement
  63. }
  64. DirectoryInfo CreateSubdirectory(string path)
  65. {
  66. return null; //TODO: Implement
  67. }
  68. public override void Delete()
  69. {
  70. Directory.Delete(FullPath);
  71. }
  72. public void Delete(bool bRecurse)
  73. {
  74. Directory.Delete(FullPath, bRecurse);
  75. }
  76. /// <summary>
  77. /// Returns an array of DirectoryInfos for subdirectories
  78. /// </summary>
  79. public DirectoryInfo[] GetDirectories()
  80. {
  81. return null; //TODO: Implement
  82. }
  83. /// <summary>
  84. /// Returns an array of DirectoryInfos
  85. /// matching the filter specified by mask
  86. /// </summary>
  87. public static DirectoryInfo[] GetDirectories(string mask)
  88. {
  89. return null; //TODO: Implement
  90. }
  91. /// <summary>
  92. /// Returns an array of FileInfo for subdirectories
  93. /// </summary>
  94. public FileInfo[] GetFiles()
  95. {
  96. return null;
  97. }
  98. /// <summary>
  99. /// Returns an array of FileInfo
  100. /// matching the filter specified by mask
  101. /// </summary>
  102. public static FileInfo[] GetFiles(string mask)
  103. {
  104. return null; //TODO: Implement
  105. }
  106. /// <summary>
  107. /// Returns an array of FileSystemInfo for subdirectories
  108. /// </summary>
  109. public FileSystemInfo[] GetFileSystemInfos()
  110. {
  111. return null; //TODO: Implement
  112. }
  113. /// <summary>
  114. /// Returns an array of FileSystemInfo
  115. /// matching the filter specified by mask
  116. /// </summary>
  117. public static FileSystemInfo[] GetFileSystemInfos(string mask)
  118. {
  119. return null; //TODO: Implement
  120. }
  121. public void MoveTo(string destDirName)
  122. {
  123. Directory.Move(FullName, destDirName);
  124. }
  125. public override string ToString()
  126. {
  127. return FullName;
  128. }
  129. }
  130. }