1
0

Refactor: Reorganize project structure by moving core components into dedicated directories and introducing new configuration and API models.

This commit is contained in:
2026-02-26 21:51:36 +01:00
parent fbff8c98ff
commit d60730c4bf
13 changed files with 83 additions and 60 deletions

37
Core/StateTracker.cs Normal file
View File

@@ -0,0 +1,37 @@
namespace Toak.Core;
public static class StateTracker
{
private static readonly string StateFilePath = Path.Combine(Path.GetTempPath(), "toak_state.pid");
public static bool IsRecording()
{
return File.Exists(StateFilePath);
}
public static void SetRecording(int ffmpegPid)
{
File.WriteAllText(StateFilePath, ffmpegPid.ToString());
}
public static int? GetRecordingPid()
{
if (File.Exists(StateFilePath))
{
var content = File.ReadAllText(StateFilePath).Trim();
if (int.TryParse(content, out var pid))
{
return pid;
}
}
return null;
}
public static void ClearRecording()
{
if (File.Exists(StateFilePath))
{
File.Delete(StateFilePath);
}
}
}