partial commit enterprise storage

This commit is contained in:
robvde 2013-08-20 09:22:41 +04:00
parent 8b9677c92c
commit c912242fa2
4 changed files with 138 additions and 2 deletions

View file

@ -1,5 +1,6 @@
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using Microsoft.Win32;
@ -21,6 +22,52 @@ namespace WebsitePanel.Providers.EnterpriseStorage.Windows2012
#endregion
#region Folders
public SystemFile[] GetFolders(string organizationId)
{
ArrayList items = new ArrayList();
DirectoryInfo root = new DirectoryInfo(string.Format("{0}\\{1}", UsersHome, organizationId));
// get directories
DirectoryInfo[] dirs = root.GetDirectories();
foreach (DirectoryInfo dir in dirs)
{
string fullName = System.IO.Path.Combine(string.Format("{0}\\{1}", UsersHome, organizationId), dir.Name);
SystemFile fi = new SystemFile(dir.Name, fullName, true, 0, dir.CreationTime, dir.LastWriteTime);
items.Add(fi);
// check if the directory is empty
fi.IsEmpty = (Directory.GetFileSystemEntries(fullName).Length == 0);
}
return (SystemFile[])items.ToArray(typeof(SystemFile));
}
public SystemFile GetFolder(string organizationId, string folder)
{
DirectoryInfo root = new DirectoryInfo(string.Format("{0}\\{1}\\{2}", UsersHome, organizationId, folder));
string fullName = string.Format("{0}\\{1}\\{2}", UsersHome, organizationId, folder);
return new SystemFile(root.Name, fullName, true, 0, root.CreationTime, root.LastWriteTime);
}
public void CreateFolder(string organizationId, string folder)
{
FileUtils.CreateDirectory(string.Format("{0}\\{1}\\{2}", UsersHome, organizationId, folder));
}
public void DeleteFolder(string organizationId, string folder)
{
FileUtils.DeleteDirectoryRecursive(string.Format("{0}\\{1}\\{2}", UsersHome, organizationId, folder));
}
public void SetFolderQuota(string organizationId, string folder, long quota)
{
}
#endregion
#region HostingServiceProvider methods
public override string[] Install()
{