1
0

initial commit

This commit is contained in:
2026-02-25 21:51:27 +01:00
commit 863063f124
15 changed files with 1330 additions and 0 deletions

37
StateTracker.cs Normal file
View File

@@ -0,0 +1,37 @@
namespace Toak;
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);
}
}
}