This commit is contained in:
2020-05-29 14:29:36 +00:00
parent 44f09c45ef
commit 2e780ab348
2 changed files with 32 additions and 2 deletions

View File

@@ -146,6 +146,10 @@ namespace AyaNova.Biz
//FILES ON DISK
var UtilFilesInfo = FileUtil.GetUtilityFolderSizeInfo();
var AttachmentFilesInfo = FileUtil.GetAttachmentFolderSizeInfo();
//Available space
using (AyContext ct = ServiceProviderProvider.DBContext)
{
//write to db

View File

@@ -180,7 +180,7 @@ namespace AyaNova.Util
DateTime LastBackup = DateTime.MinValue;
var BackupPath = UtilityFilesFolder;
foreach (string file in Directory.EnumerateFiles(UtilityFilesFolder, "db-*.backup"))
{
{
var ThisFileTime = File.GetCreationTimeUtc(file);
if (ThisFileTime > LastBackup)
{
@@ -260,7 +260,20 @@ namespace AyaNova.Util
}
internal static long UtilityFilesDriveAvailableSpace()
{
try
{
return new System.IO.DriveInfo(Path.GetPathRoot(UtilityFilesFolder)).AvailableFreeSpace;
}
catch (Exception ex)
{
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger("FileUtil::UtilityFilesDriveAvailableSpace");
log.LogError(ex, "FileUtil::UtilityFilesDriveAvailableSpace error getting available space");
return 0;
}
}
#endregion Utility file handling
@@ -505,7 +518,7 @@ namespace AyaNova.Util
}
internal static void BackupAttachments(string demandFileNamePrepend,ILogger log = null)
internal static void BackupAttachments(string demandFileNamePrepend, ILogger log = null)
{
try
{
@@ -524,7 +537,20 @@ namespace AyaNova.Util
}
}
internal static long AttachmentFilesDriveAvailableSpace()
{
try
{
return new System.IO.DriveInfo(Path.GetPathRoot(UserFilesFolder)).AvailableFreeSpace;
}
catch (Exception ex)
{
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger("FileUtil::AttachmentFilesDriveAvailableSpace");
log.LogError(ex, "FileUtil::AttachmentFilesDriveAvailableSpace error getting available space");
return 0;
}
}
#endregion attachment stuff
#region General utilities