ModelInfo: ModelType→EntityType(枚举) + Description;ImportModel 支持传参
This commit is contained in:
parent
c8e066be64
commit
846d79a8d7
@ -13,7 +13,10 @@ namespace CounterDrone.Core.Models
|
|||||||
[NotNull]
|
[NotNull]
|
||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string ModelType { get; set; } = string.Empty;
|
/// <summary>对应 EntityType 枚举:0=Drone 1=Platform 2=DetectionEquip</summary>
|
||||||
|
public int EntityType { get; set; }
|
||||||
|
|
||||||
|
public string Description { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string FilePath { get; set; } = string.Empty;
|
public string FilePath { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
|||||||
@ -7,6 +7,7 @@ namespace CounterDrone.Core.Services
|
|||||||
public interface IModelService
|
public interface IModelService
|
||||||
{
|
{
|
||||||
ModelInfo ImportModel(string filePath, string name);
|
ModelInfo ImportModel(string filePath, string name);
|
||||||
|
ModelInfo ImportModel(string filePath, string name, int entityType, string description);
|
||||||
ModelInfo AddModel(ModelInfo model);
|
ModelInfo AddModel(ModelInfo model);
|
||||||
void DeleteModel(string id);
|
void DeleteModel(string id);
|
||||||
List<ModelInfo> GetAllModels();
|
List<ModelInfo> GetAllModels();
|
||||||
|
|||||||
@ -18,6 +18,9 @@ namespace CounterDrone.Core.Services
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ModelInfo ImportModel(string filePath, string name)
|
public ModelInfo ImportModel(string filePath, string name)
|
||||||
|
=> ImportModel(filePath, name, 0, "");
|
||||||
|
|
||||||
|
public ModelInfo ImportModel(string filePath, string name, int entityType, string description)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(name))
|
if (string.IsNullOrWhiteSpace(name))
|
||||||
throw new ArgumentException("模型名称不能为空");
|
throw new ArgumentException("模型名称不能为空");
|
||||||
@ -33,6 +36,8 @@ namespace CounterDrone.Core.Services
|
|||||||
var model = new ModelInfo
|
var model = new ModelInfo
|
||||||
{
|
{
|
||||||
Name = name,
|
Name = name,
|
||||||
|
EntityType = entityType,
|
||||||
|
Description = description,
|
||||||
FilePath = filePath,
|
FilePath = filePath,
|
||||||
FileSize = fileInfo.Length / (1024.0 * 1024.0),
|
FileSize = fileInfo.Length / (1024.0 * 1024.0),
|
||||||
};
|
};
|
||||||
|
|||||||
@ -28,6 +28,8 @@ namespace CounterDrone.Unity
|
|||||||
void OnDisable() { SqliteConnectionTracker.Untrack(_db); _db?.Dispose(); _db = null; }
|
void OnDisable() { SqliteConnectionTracker.Untrack(_db); _db?.Dispose(); _db = null; }
|
||||||
|
|
||||||
public ModelInfo Import(string filePath, string name) => _service.ImportModel(filePath, name);
|
public ModelInfo Import(string filePath, string name) => _service.ImportModel(filePath, name);
|
||||||
|
public ModelInfo Import(string filePath, string name, int entityType, string desc)
|
||||||
|
=> _service.ImportModel(filePath, name, entityType, desc);
|
||||||
public ModelInfo Add(ModelInfo model) => _service.AddModel(model);
|
public ModelInfo Add(ModelInfo model) => _service.AddModel(model);
|
||||||
public void Delete(string id) => _service.DeleteModel(id);
|
public void Delete(string id) => _service.DeleteModel(id);
|
||||||
public List<ModelInfo> GetAll() => _service.GetAllModels();
|
public List<ModelInfo> GetAll() => _service.GetAllModels();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user