Идентификация объектов для команд переделана на UniversalObjectIdentifier

This commit is contained in:
2025-03-10 18:26:57 +03:00
parent c33d282a5c
commit 81a9698de4
3 changed files with 9 additions and 7 deletions
@@ -66,8 +66,10 @@ namespace mROA.Implementation.Backend
if (invoker == null)
throw new Exception($"Command {command.CommandId} not found");
var context = command.ObjectId != -1
? contextRepository.GetObject<object>(command.ObjectId)
IContextRepository repository;
var context = command.ObjectId.ContextId != -1
? contextRepository.GetObject<object>(command.ObjectId.ContextId)
: contextRepository.GetSingleObject(invoker.SuitableType);
if (context == null)
@@ -102,7 +104,7 @@ namespace mROA.Implementation.Backend
#if TRACE
Console.WriteLine("Disposing object");
#endif
contextRepository.ClearObject(command.ObjectId);
contextRepository.ClearObject(command.ObjectId.ContextId);
}
return result;
+3 -3
View File
@@ -9,7 +9,7 @@ namespace mROA.Implementation
{
Guid Id { get; }
int CommandId { get; }
int ObjectId { get; }
UniversalObjectIdentifier ObjectId { get; }
object?[]? Parameters { get; }
}
@@ -17,7 +17,7 @@ namespace mROA.Implementation
{
public Guid Id { get; set; } = Guid.NewGuid();
public int CommandId { get; set; }
public int ObjectId { get; set; } = -1;
public UniversalObjectIdentifier ObjectId { get; set; } = UniversalObjectIdentifier.Null;
public object?[]? Parameters { get; set; }
@@ -31,7 +31,7 @@ namespace mROA.Implementation
{
public Guid Id { get; set; }
public int CommandId { get; set; } = -2;
public int ObjectId { get; set; } = -2;
public UniversalObjectIdentifier ObjectId { get; set; } = UniversalObjectIdentifier.Null;
public object?[]? Parameters { get; set; } = null;
public override string ToString()
+1 -1
View File
@@ -21,7 +21,7 @@
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DefineConstants>TRACE;</DefineConstants>
<DefineConstants></DefineConstants>
</PropertyGroup>
<ItemGroup>