From 2e2c5d7164d76d66dc4cc239d2ef46a5e990aa41 Mon Sep 17 00:00:00 2001 From: _sega Date: Mon, 2 Feb 2026 11:21:45 +0300 Subject: [PATCH] =?UTF-8?q?=D0=92=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD?= =?UTF-8?q?=D0=BE=D1=81=D1=82=D1=8C=20=D0=B2=D0=BA=D0=BB=D1=8E=D1=87=D0=B0?= =?UTF-8?q?=D1=82=D1=8C/=D0=B2=D1=8B=D0=BA=D0=BB=D1=8E=D1=87=D0=B0=D1=82?= =?UTF-8?q?=D1=8C=20=D0=BE=D0=BF=D1=86=D0=B8=D1=8E=20=D1=81=D0=B5=D1=80?= =?UTF-8?q?=D0=B2=D0=B5=D1=80=D0=B0=20=D0=B8=D0=B7=20=D0=BF=D1=80=D0=B8?= =?UTF-8?q?=D0=BB=D0=BE=D0=B6=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BA=D0=BE=D0=BD?= =?UTF-8?q?=D1=84=D0=B8=D0=B3=D1=83=D1=80=D0=B0=D1=82=D0=BE=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/ExternalFilesGetter.cs | 28 +++++++++++++++++++++++++++ Assets/Scripts/Server/WebServer.cs | 6 ++++++ 2 files changed, 34 insertions(+) diff --git a/Assets/Scripts/ExternalFilesGetter.cs b/Assets/Scripts/ExternalFilesGetter.cs index 33e6cad..13230fd 100644 --- a/Assets/Scripts/ExternalFilesGetter.cs +++ b/Assets/Scripts/ExternalFilesGetter.cs @@ -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); diff --git a/Assets/Scripts/Server/WebServer.cs b/Assets/Scripts/Server/WebServer.cs index 416efba..e6cfdbd 100644 --- a/Assets/Scripts/Server/WebServer.cs +++ b/Assets/Scripts/Server/WebServer.cs @@ -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();