Возможность включать/выключать опцию сервера из приложения конфигуратора
This commit is contained in:
parent
ee79e312f1
commit
2e2c5d7164
@ -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);
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user