This commit is contained in:
2021-11-29 18:19:58 +00:00
parent 3f3304dcda
commit 762ebc676b
3 changed files with 47 additions and 28 deletions

View File

@@ -72,7 +72,7 @@ namespace AyaNova
} }
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine($"Unable to locate or create server file folders error was: {ex.Message}"); Console.WriteLine($"Unable to locate or create server file folders error was: {ex.Message}");
return; return;
} }
@@ -232,8 +232,26 @@ namespace AyaNova
//Log environmental settings //Log environmental settings
var UtilityFilesAvailableSpace = FileUtil.BackupFilesDriveAvailableSpace(); long UtilityFilesAvailableSpace = 0;
var AttachmentFilesAvailableSpace = FileUtil.AttachmentFilesDriveAvailableSpace(); try
{
UtilityFilesAvailableSpace = FileUtil.BackupFilesDriveAvailableSpace();
}
catch (Exception ex)
{
logger.Error(ex, "FileUtil::UtilityFilesDriveAvailableSpace error getting available space");
}
long AttachmentFilesAvailableSpace = 0;
try
{
AttachmentFilesAvailableSpace = FileUtil.AttachmentFilesDriveAvailableSpace();
}
catch (Exception ex)
{
logger.Error(ex, "FileUtil::AttachmentFilesDriveAvailableSpace error getting available space");
}
logger.Info("OS - {0}", Environment.OSVersion.ToString()); logger.Info("OS - {0}", Environment.OSVersion.ToString());
logger.Info("TimeZone - {0}", TimeZoneInfo.Local.DisplayName); logger.Info("TimeZone - {0}", TimeZoneInfo.Local.DisplayName);

View File

@@ -104,8 +104,25 @@ namespace AyaNova.Biz
var AttachmentFilesInfo = FileUtil.GetAttachmentFolderSizeInfo(); var AttachmentFilesInfo = FileUtil.GetAttachmentFolderSizeInfo();
//Available space //Available space
var UtilityFilesAvailableSpace = FileUtil.BackupFilesDriveAvailableSpace(); long UtilityFilesAvailableSpace = 0;
var AttachmentFilesAvailableSpace = FileUtil.AttachmentFilesDriveAvailableSpace(); try
{
UtilityFilesAvailableSpace = FileUtil.BackupFilesDriveAvailableSpace();
}
catch (Exception ex)
{
log.LogError(ex, "FileUtil::UtilityFilesDriveAvailableSpace error getting available space");
}
long AttachmentFilesAvailableSpace = 0;
try
{
AttachmentFilesAvailableSpace = FileUtil.AttachmentFilesDriveAvailableSpace();
}
catch (Exception ex)
{
log.LogError(ex, "FileUtil::AttachmentFilesDriveAvailableSpace error getting available space");
}
using (AyContext ct = ServiceProviderProvider.DBContext) using (AyContext ct = ServiceProviderProvider.DBContext)
{ {

View File

@@ -348,17 +348,9 @@ namespace AyaNova.Util
internal static long BackupFilesDriveAvailableSpace() internal static long BackupFilesDriveAvailableSpace()
{ {
try
{
return new System.IO.DriveInfo(Path.GetPathRoot(BackupFilesFolder)).AvailableFreeSpace;
}
catch (Exception ex)
{
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger("FileUtil::UtilityFilesDriveAvailableSpace"); return new System.IO.DriveInfo(Path.GetPathRoot(BackupFilesFolder)).AvailableFreeSpace;
log.LogError(ex, "FileUtil::UtilityFilesDriveAvailableSpace error getting available space");
return 0;
}
} }
#endregion Utility file handling #endregion Utility file handling
@@ -594,17 +586,7 @@ namespace AyaNova.Util
internal static long AttachmentFilesDriveAvailableSpace() internal static long AttachmentFilesDriveAvailableSpace()
{ {
try return new System.IO.DriveInfo(Path.GetPathRoot(AttachmentFilesFolder)).AvailableFreeSpace;
{
return new System.IO.DriveInfo(Path.GetPathRoot(AttachmentFilesFolder)).AvailableFreeSpace;
}
catch (Exception ex)
{
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger("FileUtil::AttachmentFilesDriveAvailableSpace");
log.LogError(ex, "FileUtil::AttachmentFilesDriveAvailableSpace error getting available space");
return 0;
}
} }
internal static IEnumerable<string> GetAllAttachmentFilePaths() internal static IEnumerable<string> GetAllAttachmentFilePaths()
@@ -822,8 +804,10 @@ namespace AyaNova.Util
return ret; return ret;
} }
public static string StringPathDecodeEnvironmentVariables(string path){ public static string StringPathDecodeEnvironmentVariables(string path)
if(string.IsNullOrWhiteSpace(path)){ {
if (string.IsNullOrWhiteSpace(path))
{
return string.Empty; return string.Empty;
} }