Files
AmiReel/Services/SourceRecordingFinder.cs
T
klevze a590904e89 Add video preview, source crop, find-videos, and render toasts
Bring the Video tab closer to Shorts with 4K preview stills and crop
modes (none, auto, center, plus the visual editor). Settings store a
default source folder so Find videos can collect output.avi sequences.
Cap the FFmpeg log with auto-scroll, hide repeat spam, and show a
Windows notification when a video or short finishes or fails.
2026-08-16 09:20:56 +02:00

43 lines
1.3 KiB
C#

namespace AmiReel.Services;
/// <summary>
/// Locates sequential WinUAE-style recordings: output.avi, output_1.avi, output_2.avi, ...
/// Stopping at the first missing name.
/// </summary>
public static class SourceRecordingFinder
{
public const string BaseFileName = "output";
public const string FileExtension = ".avi";
public const int MaximumFiles = 500;
/// <summary>
/// Returns existing sequential recordings in <paramref name="folder"/>, or an empty
/// list when the folder is missing or <c>output.avi</c> is not present.
/// </summary>
public static IReadOnlyList<string> FindSequentialOutputs(string? folder)
{
if (string.IsNullOrWhiteSpace(folder) || !Directory.Exists(folder))
return [];
string directory = Path.GetFullPath(folder);
List<string> found = [];
string first = Path.Combine(directory, BaseFileName + FileExtension);
if (!File.Exists(first))
return found;
found.Add(first);
for (int index = 1; index < MaximumFiles; index++)
{
string next = Path.Combine(directory, $"{BaseFileName}_{index}{FileExtension}");
if (!File.Exists(next))
break;
found.Add(next);
}
return found;
}
}