From 39b00b6750f91b3994f6742b626eec1d9bf3faa4 Mon Sep 17 00:00:00 2001 From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com> Date: Mon, 5 Feb 2024 02:41:59 +0900 Subject: [PATCH] data folder --- Core/Main/PTMagic.cs | 23 ++++++++++++++--------- PTMagic/Program.cs | 2 +- 2 files changed, 15 insertions(+), 10 deletions(-) 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/PTMagic/Program.cs b/PTMagic/Program.cs index 919933d..3b488ea 100644 --- a/PTMagic/Program.cs +++ b/PTMagic/Program.cs @@ -6,7 +6,7 @@ using Core.Helper; using Microsoft.Extensions.DependencyInjection; -[assembly: AssemblyVersion("2.8.1")] +[assembly: AssemblyVersion("2.8.2")] [assembly: AssemblyProduct("PT Magic")] namespace PTMagic