Revision 540b8cf8 trunk/Pithos.Core/FileState.cs

b/trunk/Pithos.Core/FileState.cs
43 43
using Castle.ActiveRecord.Framework;
44 44
using Pithos.Core.Agents;
45 45
using Pithos.Interfaces;
46
using Pithos.Network;
46 47
using log4net;
47 48

  
48 49
namespace Pithos.Core
......
104 105
            set { _tags = value; }
105 106
        }
106 107

  
108
        [Property]
109
        public DateTime Modified { get; set; }
110

  
111

  
112
        public FileSystemInfo GetFileSystemInfo()
113
        {
114
            if (String.IsNullOrWhiteSpace(FilePath))
115
                throw new InvalidOperationException();
116
            Contract.EndContractBlock();
107 117

  
118
            return Directory.Exists(FilePath) ?
119
                (FileSystemInfo)new DirectoryInfo(FilePath)
120
                : new FileInfo(FilePath);
121
        }
122

  
123
        public string GetRelativeUrl(AccountInfo accountInfo)
124
        {
125
            if (accountInfo==null)
126
                throw new ArgumentNullException("accountInfo");
127
            Contract.EndContractBlock();
128

  
129
            var fsi=GetFileSystemInfo();
130
            return fsi.AsRelativeUrlTo(accountInfo.AccountPath);
131
        }
108 132
        /*public static FileState FindByFilePath(string absolutePath)
109 133
        {
110 134
            if (string.IsNullOrWhiteSpace(absolutePath))

Also available in: Unified diff