PageRenderTime 28ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/IZWebFileManager/FileManagerItemInfo.cs

http://izwebfilemanager.googlecode.com/
C# | 76 lines | 51 code | 10 blank | 15 comment | 5 complexity | c4837ca7d95ed884d94909e5cd2916ad MD5 | raw file
  1. // Copyright (C) 2006 Igor Zelmanovich <izwebfilemanager@gmail.com>
  2. //
  3. // This program is free software; you can redistribute it and/or modify
  4. // it under the terms of the GNU General Public License as published by
  5. // the Free Software Foundation; either version 2 of the License, or
  6. // (at your option) any later version.
  7. //
  8. // This program is distributed in the hope that it will be useful,
  9. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. // GNU General Public License for more details.
  12. //
  13. // You should have received a copy of the GNU General Public License
  14. // along with this program; if not, write to the Free Software
  15. // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  16. using System;
  17. using System.Collections.Generic;
  18. using System.Text;
  19. using System.IO;
  20. namespace IZ.WebFileManager
  21. {
  22. public sealed class FileManagerItemInfo
  23. {
  24. private string _fileManagerPath;
  25. private string _virtualPath;
  26. private string _physicalPath;
  27. private FileInfo _file;
  28. private DirectoryInfo _directory;
  29. public string FileManagerPath {
  30. get { return _fileManagerPath; }
  31. }
  32. [Obsolete ("this property is obsolete, use VirtualPath instead")]
  33. public string AbsolutePath {
  34. get { return VirtualPath; }
  35. }
  36. public string VirtualPath {
  37. get { return _virtualPath; }
  38. }
  39. internal FileInfo File {
  40. get {
  41. if (_file == null)
  42. _file = new FileInfo (PhysicalPath);
  43. return _file;
  44. }
  45. }
  46. internal DirectoryInfo Directory {
  47. get {
  48. if (_directory == null)
  49. _directory = new DirectoryInfo (PhysicalPath);
  50. return _directory;
  51. }
  52. }
  53. public string PhysicalPath {
  54. get { return _physicalPath; }
  55. }
  56. internal FileManagerItemInfo (string fileManagerPath, string virtualPath, string phisicalPath) {
  57. _fileManagerPath = fileManagerPath;
  58. _virtualPath = virtualPath;
  59. _physicalPath = phisicalPath;
  60. }
  61. internal void EnsureDirectoryExists () {
  62. if (!Directory.Exists)
  63. Directory.Create ();
  64. }
  65. }
  66. }