mirror of
https://github.com/azaion/annotations.git
synced 2026-04-23 00:46:31 +00:00
Add annotationResult and put them into json
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.IO;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
|
||||
namespace Azaion.Annotator.DTO;
|
||||
@@ -12,6 +13,26 @@ public class FormState
|
||||
public string VideoName => Path.GetFileNameWithoutExtension(CurrentFile).Replace(" ", "");
|
||||
public TimeSpan CurrentVideoLength { get; set; }
|
||||
public int CurrentVolume { get; set; } = 100;
|
||||
|
||||
public List<AnnotationResult> AnnotationResults { get; set; } = [];
|
||||
|
||||
public string GetTimeName(TimeSpan ts) => $"{VideoName}_{ts:hmmssf}";
|
||||
|
||||
public TimeSpan? GetTime(string name)
|
||||
{
|
||||
var timeStr = name.Split("_").LastOrDefault();
|
||||
if (string.IsNullOrEmpty(timeStr))
|
||||
return null;
|
||||
|
||||
try
|
||||
{
|
||||
//For some reason, TimeSpan.ParseExact doesn't work on every platform.
|
||||
return new TimeSpan(
|
||||
days: 0,
|
||||
hours: int.Parse(timeStr[0..1]),
|
||||
minutes: int.Parse(timeStr[1..3]),
|
||||
seconds: int.Parse(timeStr[3..5]),
|
||||
milliseconds: int.Parse(timeStr[5..6]) * 100);
|
||||
}
|
||||
catch (Exception e) { return null; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user