rework to have only 1 exe!

This commit is contained in:
Alex Bezdieniezhnykh
2024-12-04 20:51:26 +02:00
parent 3944df8efe
commit 60519461a1
25 changed files with 194 additions and 198 deletions
+40
View File
@@ -0,0 +1,40 @@
using System.Windows.Media;
using Newtonsoft.Json;
namespace Azaion.Common.DTO;
public class AnnotationResult
{
[JsonProperty(PropertyName = "f")]
public string Image { get; set; } = null!;
[JsonProperty(PropertyName = "t")]
public TimeSpan Time { get; set; }
public double Lat { get; set; }
public double Lon { get; set; }
public List<Detection> Detections { get; set; } = new();
#region For XAML Form
[JsonIgnore]
public string TimeStr => $"{Time:h\\:mm\\:ss}";
[JsonIgnore]
public string ClassName { get; set; } = null!;
[JsonIgnore]
public Color ClassColor0 { get; set; }
[JsonIgnore]
public Color ClassColor1 { get; set; }
[JsonIgnore]
public Color ClassColor2 { get; set; }
[JsonIgnore]
public Color ClassColor3 { get; set; }
#endregion
}
+4 -9
View File
@@ -1,12 +1,7 @@
using CommandLine;
namespace Azaion.Common.DTO;
namespace Azaion.Common.DTO;
public class ApiCredentials
public class ApiCredentials(string email, string password) : EventArgs
{
[Option('e', "email", Required = true, HelpText = "The email for authorization.")]
public string Email { get; set; } = null!;
[Option('p', "password", Required = true, HelpText = "The password for authorization.")]
public string Password { get; set; } = null!;
public string Email { get; set; } = email;
public string Password { get; set; } = password;
}
+24
View File
@@ -0,0 +1,24 @@
using System.Collections.ObjectModel;
using System.IO;
using System.Windows;
namespace Azaion.Common.DTO;
public class FormState
{
public MediaFileInfo? CurrentMedia { get; set; }
public string VideoName => string.IsNullOrEmpty(CurrentMedia?.Name)
? ""
: Path.GetFileNameWithoutExtension(CurrentMedia.Name).Replace(" ", "");
public string CurrentMrl { get; set; } = null!;
public Size CurrentVideoSize { get; set; }
public TimeSpan CurrentVideoLength { get; set; }
public TimeSpan? BackgroundTime { get; set; }
public int CurrentVolume { get; set; } = 100;
public ObservableCollection<AnnotationResult> AnnotationResults { get; set; } = [];
public WindowEnum ActiveWindow { get; set; }
public string GetTimeName(TimeSpan? ts) => $"{VideoName}_{ts:hmmssf}";
}
+11
View File
@@ -0,0 +1,11 @@
namespace Azaion.Common.DTO;
public class MediaFileInfo
{
public string Name { get; set; } = null!;
public string Path { get; set; } = null!;
public TimeSpan Duration { get; set; }
public string DurationStr => $"{Duration:h\\:mm\\:ss}";
public bool HasAnnotations { get; set; }
public MediaTypes MediaType { get; set; }
}
+8
View File
@@ -0,0 +1,8 @@
namespace Azaion.Common.DTO;
public enum MediaTypes
{
None = 0,
Video = 1,
Image = 2
}
+12
View File
@@ -0,0 +1,12 @@
namespace Azaion.Common.DTO;
public enum RoleEnum
{
None = 0,
Operator = 10, //only annotator is available. Could send annotations to queue.
Validator = 20, //annotator + dataset explorer. This role allows to receive annotations from the queue.
CompanionPC = 30,
Admin = 40, //
ResourceUploader = 50, //Uploading dll and ai models
ApiAdmin = 1000 //everything
}
+21
View File
@@ -0,0 +1,21 @@
using System.Security.Claims;
namespace Azaion.Common.DTO;
public class User
{
public Guid Id { get; set; }
public string Email { get; set; }
public RoleEnum Role { get; set; }
public User(IEnumerable<Claim> claims)
{
var claimDict = claims.ToDictionary(x => x.Type, x => x.Value);
Id = Guid.Parse(claimDict[Constants.CLAIM_NAME_ID]);
Email = claimDict[Constants.CLAIM_EMAIL];
if (!Enum.TryParse(claimDict[Constants.CLAIM_ROLE], out RoleEnum role))
role = RoleEnum.None;
Role = role;
}
}