diff --git a/Core/Main/PTMagic.cs b/Core/Main/PTMagic.cs index c9103d4..14d2bf4 100644 --- a/Core/Main/PTMagic.cs +++ b/Core/Main/PTMagic.cs @@ -125,21 +125,26 @@ namespace Core.Main _state = value; } } - public void WriteStateToFile() + public void WriteStateToFile() +{ + try { - try - { mutex.WaitOne(); // Acquire the mutex - string filePath = "_data/AnalyzerState."; + string dirPath = "_data"; + string filePath = Path.Combine(dirPath, "AnalyzerState."); + + // Ensure the directory exists + Directory.CreateDirectory(dirPath); + File.WriteAllText(filePath, this.State.ToString()); - } - finally - { - mutex.ReleaseMutex(); // Release the mutex even if exceptions occur - } } + finally + { + mutex.ReleaseMutex(); // Release the mutex even if exceptions occur + } +} public int RunCount diff --git a/Monitor/Pages/_get/DashboardBottom.cshtml b/Monitor/Pages/_get/DashboardBottom.cshtml index 6b66682..046e4c7 100644 --- a/Monitor/Pages/_get/DashboardBottom.cshtml +++ b/Monitor/Pages/_get/DashboardBottom.cshtml @@ -349,6 +349,7 @@