Esempio n. 1
0
        public virtual FileEntry GetFile(Site site, string relativePath)
        {
            FileEntry entry = new FileEntry(GetRootDir(site), relativePath);
            if (entry.Exists())
            {
                var fi = new FileInfo(entry.PhysicalPath);
                entry.Name = fi.Name;
                entry.FileName = fi.FullName;
                entry.FileExtension = fi.Extension;
                entry.Read();

            }
            return entry;
        }
Esempio n. 2
0
 public virtual void DeleteFile(Site site, string fileRelativePath)
 {
     var file = new FileEntry(GetRootDir(site), fileRelativePath);
     file.Delete();
 }
Esempio n. 3
0
 public virtual FileEntry EditFile(Site site, string dirRelativePath, string oldRelativePath, string oldFileName, string body)
 {
     var @new = new FileEntry(GetRootDir(site), GetRelativePath(dirRelativePath, oldFileName));
     var old = new FileEntry(GetRootDir(site), oldRelativePath);
     File.Move(old.PhysicalPath, @new.PhysicalPath);
     @new.Body = body;
     @new.Save();
     return @new;
 }
Esempio n. 4
0
 public virtual void AddFile(Site site, string dirRelativePath, string fileName, Stream fileStream)
 {
     var file = new FileEntry(GetRootDir(site), GetRelativePath(dirRelativePath, fileName));
     if (fileStream != null)
     {
         file.Save(fileStream);
     }
     else
     {
         file.Save();
     }
 }
Esempio n. 5
0
 public virtual void AddFile(Site site, string dirRelativePath, string fileName, string body)
 {
     var file = new FileEntry(GetRootDir(site), GetRelativePath(dirRelativePath, fileName));
     file.Body = body;
     file.Save();
 }
Esempio n. 6
0
 public virtual void RenameFile(Site site, string relativePath, string newName)
 {
     var file = new FileEntry(GetRootDir(site), relativePath);
     file.Rename(newName);
     FlushWebResourceCache(site, file);
 }
Esempio n. 7
0
 public virtual bool IsFileExists(Site site, string parentRelativePath, string name)
 {
     FileEntry file = new FileEntry(GetRootDir(site), GetRelativePath(parentRelativePath, name));
     return file.Exists();
 }
Esempio n. 8
0
        public virtual FileEntry EditFile(Site site, string relativePath, string body)
        {
            FileEntry entry = new FileEntry(GetRootDir(site), relativePath);
            entry.Body = body;
            entry.Save();

            FlushWebResourceCache(site, entry);
            return entry;
        }
Esempio n. 9
0
 public virtual void DeleteFile(Site site, string fileRelativePath)
 {
     var file = new FileEntry(GetRootDir(site), fileRelativePath);
     file.Delete();
     FlushWebResourceCache(site, file);
 }
Esempio n. 10
0
        public virtual bool IsFileExists(Site site, string parentRelativePath, string name)
        {
            FileEntry file = new FileEntry(GetRootDir(site), GetRelativePath(parentRelativePath, name));

            return(file.Exists());
        }