PageRenderTime 82ms CodeModel.GetById 40ms app.highlight 3ms RepoModel.GetById 37ms 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
17using System;
18using System.Collections.Generic;
19using System.Text;
20using System.IO;
21
22namespace IZ.WebFileManager
23{
24	public sealed class FileManagerItemInfo
25	{
26		private string _fileManagerPath;
27		private string _virtualPath;
28		private string _physicalPath;
29		private FileInfo _file;
30		private DirectoryInfo _directory;
31
32		public string FileManagerPath {
33			get { return _fileManagerPath; }
34		}
35
36		[Obsolete ("this property is obsolete, use VirtualPath instead")]
37		public string AbsolutePath {
38			get { return VirtualPath; }
39		}
40
41		public string VirtualPath {
42			get { return _virtualPath; }
43		}
44
45		internal FileInfo File {
46			get {
47				if (_file == null)
48					_file = new FileInfo (PhysicalPath);
49				return _file;
50			}
51		}
52
53		internal DirectoryInfo Directory {
54			get {
55				if (_directory == null)
56					_directory = new DirectoryInfo (PhysicalPath);
57				return _directory;
58			}
59		}
60
61		public string PhysicalPath {
62			get { return _physicalPath; }
63		}
64
65		internal FileManagerItemInfo (string fileManagerPath, string virtualPath, string phisicalPath) {
66			_fileManagerPath = fileManagerPath;
67			_virtualPath = virtualPath;
68			_physicalPath = phisicalPath;
69		}
70
71		internal void EnsureDirectoryExists () {
72			if (!Directory.Exists)
73				Directory.Create ();
74		}
75	}
76}