mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 12:36:31 +00:00
remove fix, todo: test
This commit is contained in:
@@ -36,6 +36,30 @@ public class Annotation
|
||||
public string ImagePath => Path.Combine(_imagesDir, $"{Name}{ImageExtension}");
|
||||
public string LabelPath => Path.Combine(_labelsDir, $"{Name}.txt");
|
||||
public string ThumbPath => Path.Combine(_thumbDir, $"{Name}{Constants.THUMBNAIL_PREFIX}.jpg");
|
||||
|
||||
private TimeSpan? _time;
|
||||
public TimeSpan Time
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_time.HasValue)
|
||||
return _time.Value;
|
||||
|
||||
var timeStr = Name.Split("_").LastOrDefault();
|
||||
|
||||
//For some reason, TimeSpan.ParseExact doesn't work on every platform.
|
||||
if (!string.IsNullOrEmpty(timeStr) &&
|
||||
timeStr.Length == 6 &&
|
||||
int.TryParse(timeStr[..1], out var hours) &&
|
||||
int.TryParse(timeStr[1..3], out var minutes) &&
|
||||
int.TryParse(timeStr[3..5], out var seconds) &&
|
||||
int.TryParse(timeStr[5..], out var milliseconds))
|
||||
return new TimeSpan(0, hours, minutes, seconds, milliseconds * 100);
|
||||
|
||||
_time = TimeSpan.FromSeconds(0);
|
||||
return _time.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user