Возможность включать/выключать опцию сервера из приложения конфигуратора

This commit is contained in:
_sega 2026-02-02 11:21:45 +03:00
parent ee79e312f1
commit 2e2c5d7164
2 changed files with 34 additions and 0 deletions

View File

@ -114,6 +114,33 @@ public static class ExternalFilesGetter
}
}
public static bool NeedToStartServer()
{
string docPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
string filePath = Path.Combine(docPath, GAMEDATA_FOLDER, "serverOn.rr");
try
{
// Проверяем существование файла
if (!File.Exists(filePath)) return false;
// Читаем содержимое файла
string content = File.ReadAllText(filePath).Trim();
if (string.IsNullOrWhiteSpace(content)) return false;
if(content == "1")
return true;
else
return false;
}
catch (Exception ex)
{
Debug.LogError($"Ошибка при чтении файла пароля: {ex.Message}");
return false;
}
}
public static string GetElektroVersion()
{
string docPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
@ -149,6 +176,7 @@ public static class ExternalFilesGetter
}
}
public static char GetSensorPositiveValue()
{
string docPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

View File

@ -33,6 +33,12 @@ public class WebServer : MonoBehaviour
async void Start()
{
if(ExternalFilesGetter.NeedToStartServer() == false)
{
Debug.Log("Web сервер не запущен (по настройке)");
return;
}
AdminPassword = AuthManager.LoadPasswordOrFallback(adminPasswordFallback, passwordFileName);
LoadCss();