From f642cd110d9be748574fa4394caadfa555b136bb Mon Sep 17 00:00:00 2001 From: immisterio <96652250+immisterio@users.noreply.github.com> Date: Sat, 4 Feb 2023 11:26:02 +0200 Subject: [PATCH] fdbPathLevels --- AppInit.cs | 2 ++ Engine/FileDB/staticDB.cs | 13 +++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/AppInit.cs b/AppInit.cs index 0131f05..cc82cf5 100644 --- a/AppInit.cs +++ b/AppInit.cs @@ -53,6 +53,8 @@ public static AppInit conf public bool evercache = false; + public int fdbPathLevels = 2; + public int timeStatsUpdate = 20; // минут public int timeSync = 10; // минут diff --git a/Engine/FileDB/staticDB.cs b/Engine/FileDB/staticDB.cs index 3f1c596..b3339d4 100644 --- a/Engine/FileDB/staticDB.cs +++ b/Engine/FileDB/staticDB.cs @@ -31,8 +31,17 @@ static FileDB() static string pathDb(string key) { string md5key = HashTo.md5(key); - Directory.CreateDirectory($"Data/fdb/{md5key[0]}"); - return $"Data/fdb/{md5key[0]}/{md5key}"; + + if (AppInit.conf.fdbPathLevels == 2) + { + Directory.CreateDirectory($"Data/fdb/{md5key.Substring(0, 2)}"); + return $"Data/fdb/{md5key.Substring(0, 2)}/{md5key.Substring(2)}"; + } + else + { + Directory.CreateDirectory($"Data/fdb/{md5key[0]}"); + return $"Data/fdb/{md5key[0]}/{md5key}"; + } } static string keyDb(string name, string originalname)