Create runtime variables and remove MessagePack.
This commit is contained in:
@@ -4,24 +4,24 @@ namespace Backend.Helper;
|
||||
|
||||
public static class FilesystemHelper
|
||||
{
|
||||
public static DatabaseSizes GetDatabaseSizes()
|
||||
public static DatabaseSizes GetDatabaseSizes(string basePath)
|
||||
{
|
||||
DatabaseSizes databaseSizes = new();
|
||||
|
||||
FileInfo fileInfo = new("../../../../Models/mydb.db");
|
||||
FileInfo fileInfo = new($"{basePath}/Models/mydb.db");
|
||||
databaseSizes.MyDbSize = fileInfo.Length.ToSize(SizeUnits.KB);
|
||||
|
||||
databaseSizes.DiscardedDbSize = GetDiscardedDbSizes().ToSize(SizeUnits.KB);
|
||||
databaseSizes.DiscardedDbSize = GetDiscardedDbSizes(basePath).ToSize(SizeUnits.KB);
|
||||
|
||||
fileInfo = new("../../../../Models/Filtered.db");
|
||||
fileInfo = new($"{basePath}/Models/Filtered.db");
|
||||
databaseSizes.FilteredDbSize = fileInfo.Length.ToSize(SizeUnits.KB);
|
||||
|
||||
return databaseSizes;
|
||||
}
|
||||
|
||||
private static long GetDiscardedDbSizes()
|
||||
private static long GetDiscardedDbSizes(string basePath)
|
||||
{
|
||||
const string folder = "../../../../Models";
|
||||
string folder = $"{basePath}/Models";
|
||||
string[] files = Directory.GetFiles(folder, "*.db");
|
||||
|
||||
long size = 0;
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace Backend.Helper;
|
||||
|
||||
public static class ProjectPathHelper
|
||||
{
|
||||
public static string GetProjectPath()
|
||||
{
|
||||
return new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory).Parent!.Parent!.Parent!.Parent!.FullName;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user