improve MCX Mini and Mocha.NET
This commit is contained in:
parent
82b3e27ca9
commit
83f9322b7a
@ -1 +1 @@
|
|||||||
Subproject commit 8c138247e0ca8104f7cbecbdb54ccd7760d331c3
|
Subproject commit 57b16fc34e40d636778167d1fc30014e4994531a
|
||||||
@ -180,7 +180,7 @@ namespace Mocha.Core
|
|||||||
|
|
||||||
public static Guid Prompt_Value__has__Prompt { get; } = new Guid("{7CD62362-DDCE-4BFC-87B9-B5499B0BC141}");
|
public static Guid Prompt_Value__has__Prompt { get; } = new Guid("{7CD62362-DDCE-4BFC-87B9-B5499B0BC141}");
|
||||||
|
|
||||||
public static Guid User__has_display_name__Translatable_Text_Constant { get; } = new Guid("{6C29856C-3B10-4F5B-A291-DD3CA4C04A2F}");
|
public static Guid User__has_display_name__Translation { get; } = new Guid("{6C29856C-3B10-4F5B-A291-DD3CA4C04A2F}");
|
||||||
public static Guid User_Login__has__User { get; } = new Guid("{85B40E4B-849B-4006-A9C0-4E201B25975F}");
|
public static Guid User_Login__has__User { get; } = new Guid("{85B40E4B-849B-4006-A9C0-4E201B25975F}");
|
||||||
|
|
||||||
public static Guid User__has_default__Page { get; } = new Guid("{f00cda6f-eded-4e0f-b6c5-9675ed664a75}");
|
public static Guid User__has_default__Page { get; } = new Guid("{f00cda6f-eded-4e0f-b6c5-9675ed664a75}");
|
||||||
@ -214,7 +214,7 @@ namespace Mocha.Core
|
|||||||
|
|
||||||
public static Guid Tenant__has_company_logo_image__File { get; } = new Guid("{3540c81c-b229-4eac-b9b5-9d4b4c6ad1eb}");
|
public static Guid Tenant__has_company_logo_image__File { get; } = new Guid("{3540c81c-b229-4eac-b9b5-9d4b4c6ad1eb}");
|
||||||
|
|
||||||
public static Guid Menu_Item__has_title__Translatable_Text_Constant { get; } = new Guid("{65E3C87E-A2F7-4A33-9FA7-781EFA801E02}");
|
public static Guid Menu_Item__has_title__Translation { get; } = new Guid("{65E3C87E-A2F7-4A33-9FA7-781EFA801E02}");
|
||||||
|
|
||||||
public static Guid Menu__has__Menu_Item { get; } = new Guid("{5b659d7c-58f9-453c-9826-dd3205c3c97f}");
|
public static Guid Menu__has__Menu_Item { get; } = new Guid("{5b659d7c-58f9-453c-9826-dd3205c3c97f}");
|
||||||
public static Guid Menu_Item__for__Menu { get; } = new Guid("{a22d949f-f8d1-4dcc-a3eb-d9f910228dfd}");
|
public static Guid Menu_Item__for__Menu { get; } = new Guid("{a22d949f-f8d1-4dcc-a3eb-d9f910228dfd}");
|
||||||
@ -236,7 +236,7 @@ namespace Mocha.Core
|
|||||||
public static Guid Page_Component__has__Style { get; } = new Guid("{818CFF50-7D42-43B2-B6A7-92C3C54D450D}");
|
public static Guid Page_Component__has__Style { get; } = new Guid("{818CFF50-7D42-43B2-B6A7-92C3C54D450D}");
|
||||||
public static Guid Style__for__Page_Component { get; } = new Guid("{007563E7-7277-4436-8C82-06D5F156D8E1}");
|
public static Guid Style__for__Page_Component { get; } = new Guid("{007563E7-7277-4436-8C82-06D5F156D8E1}");
|
||||||
|
|
||||||
public static Guid Button_Page_Component__has_text__Translatable_Text_Constant { get; } = new Guid("{C25230B1-4D23-4CFE-8B75-56C33E8293AF}");
|
public static Guid Button_Page_Component__has_text__Translation { get; } = new Guid("{C25230B1-4D23-4CFE-8B75-56C33E8293AF}");
|
||||||
public static Guid Image_Page_Component__has_source__Method { get; } = new Guid("{481E3FBE-B82A-4C76-9DDF-D66C6BA8C590}");
|
public static Guid Image_Page_Component__has_source__Method { get; } = new Guid("{481E3FBE-B82A-4C76-9DDF-D66C6BA8C590}");
|
||||||
|
|
||||||
public static Guid Sequential_Container_Page_Component__has__Sequential_Container_Orientation { get; } = new Guid("{DD55F506-8718-4240-A894-21346656E804}");
|
public static Guid Sequential_Container_Page_Component__has__Sequential_Container_Orientation { get; } = new Guid("{DD55F506-8718-4240-A894-21346656E804}");
|
||||||
@ -262,13 +262,13 @@ namespace Mocha.Core
|
|||||||
public static Guid Tenant__has_mega__Menu { get; } = new Guid("{cdd743cb-c74a-4671-9922-652c7db9f2d8}");
|
public static Guid Tenant__has_mega__Menu { get; } = new Guid("{cdd743cb-c74a-4671-9922-652c7db9f2d8}");
|
||||||
public static Guid Menu__mega_for__Tenant { get; } = new Guid("{788db047-ed7f-4e0c-a8b0-68478d486da7}");
|
public static Guid Menu__mega_for__Tenant { get; } = new Guid("{788db047-ed7f-4e0c-a8b0-68478d486da7}");
|
||||||
|
|
||||||
public static Guid Tenant_Type__has_title__Translatable_Text_Constant { get; } = new Guid("{79AAE09C-5690-471C-8442-1B230610456C}");
|
public static Guid Tenant_Type__has_title__Translation { get; } = new Guid("{79AAE09C-5690-471C-8442-1B230610456C}");
|
||||||
|
|
||||||
public static Guid Prompt__has_title__Translatable_Text_Constant { get; } = new Guid("{081ee211-7534-43c4-99b5-24bd9537babc}");
|
public static Guid Prompt__has_title__Translation { get; } = new Guid("{081ee211-7534-43c4-99b5-24bd9537babc}");
|
||||||
|
|
||||||
public static Guid Report__has_title__Translatable_Text_Constant { get; } = new Guid("{DF93EFB0-8B5E-49E7-8BC0-553F9E7602F9}");
|
public static Guid Report__has_title__Translation { get; } = new Guid("{DF93EFB0-8B5E-49E7-8BC0-553F9E7602F9}");
|
||||||
public static Guid Report__has_description__Translatable_Text_Constant { get; } = new Guid("{D5AA18A7-7ACD-4792-B039-6C620A151BAD}");
|
public static Guid Report__has_description__Translation { get; } = new Guid("{D5AA18A7-7ACD-4792-B039-6C620A151BAD}");
|
||||||
public static Guid Report_Field__has_title__Translatable_Text_Constant { get; } = new Guid("{6780BFC2-DBC0-40AE-83EE-BFEF979F0054}");
|
public static Guid Report_Field__has_title__Translation { get; } = new Guid("{6780BFC2-DBC0-40AE-83EE-BFEF979F0054}");
|
||||||
|
|
||||||
public static Guid Content_Page_Component__gets_content_from__Method { get; } = new Guid("{0E002E6F-AA79-457C-93B8-2CCE1AEF5F7E}");
|
public static Guid Content_Page_Component__gets_content_from__Method { get; } = new Guid("{0E002E6F-AA79-457C-93B8-2CCE1AEF5F7E}");
|
||||||
public static Guid Method__provides_content_for__Content_Page_Component { get; } = new Guid("{5E75000D-2421-4AD4-9E5F-B9FDD9CB4744}");
|
public static Guid Method__provides_content_for__Content_Page_Component { get; } = new Guid("{5E75000D-2421-4AD4-9E5F-B9FDD9CB4744}");
|
||||||
|
|||||||
@ -27,20 +27,4 @@ public abstract class MethodImplementation
|
|||||||
return ExecuteInternal(oms, context, method);
|
return ExecuteInternal(oms, context, method);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected InstanceHandle r_Method__for__Class;
|
|
||||||
|
|
||||||
public bool Initialized { get; private set; } = false;
|
|
||||||
protected virtual void InitializeInternal(Oms oms)
|
|
||||||
{
|
|
||||||
r_Method__for__Class = oms.GetInstance(KnownRelationshipGuids.Method__for__Class);
|
|
||||||
}
|
|
||||||
public void Initialize(Oms oms)
|
|
||||||
{
|
|
||||||
if (Initialized)
|
|
||||||
return;
|
|
||||||
|
|
||||||
InitializeInternal(oms);
|
|
||||||
Initialized = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -20,15 +20,14 @@ namespace Mocha.Core.MethodImplementations;
|
|||||||
public class GetSpecifiedInstancesMethodImplementation : MethodImplementation
|
public class GetSpecifiedInstancesMethodImplementation : MethodImplementation
|
||||||
{
|
{
|
||||||
public override Guid MethodClassGuid => KnownInstanceGuids.MethodClasses.GetSpecifiedInstancesMethod;
|
public override Guid MethodClassGuid => KnownInstanceGuids.MethodClasses.GetSpecifiedInstancesMethod;
|
||||||
protected InstanceHandle r_Get_Specified_Instances_Method__returns__Work_Set, r_Get_Specified_Instances_Method__uses__Instance;
|
|
||||||
protected override void InitializeInternal(Oms oms)
|
|
||||||
{
|
|
||||||
base.InitializeInternal(oms);
|
|
||||||
r_Get_Specified_Instances_Method__returns__Work_Set = oms.GetInstance(KnownRelationshipGuids.Get_Specified_Instances_Method__returns__Work_Set);
|
|
||||||
r_Get_Specified_Instances_Method__uses__Instance = oms.GetInstance(KnownRelationshipGuids.Get_Specified_Instances_Method__uses__Instance);
|
|
||||||
}
|
|
||||||
protected override InstanceHandle ExecuteInternal(Oms oms, OmsContext context, InstanceHandle method)
|
protected override InstanceHandle ExecuteInternal(Oms oms, OmsContext context, InstanceHandle method)
|
||||||
{
|
{
|
||||||
|
InstanceHandle r_Method__for__Class = oms.GetInstance(KnownRelationshipGuids.Method__for__Class);
|
||||||
|
InstanceHandle r_Get_Specified_Instances_Method__returns__Work_Set = oms.GetInstance(KnownRelationshipGuids.Get_Specified_Instances_Method__returns__Work_Set);
|
||||||
|
InstanceHandle r_Get_Specified_Instances_Method__uses__Instance = oms.GetInstance(KnownRelationshipGuids.Get_Specified_Instances_Method__uses__Instance);
|
||||||
|
|
||||||
InstanceHandle irForClass = oms.GetRelatedInstance(method, r_Method__for__Class);
|
InstanceHandle irForClass = oms.GetRelatedInstance(method, r_Method__for__Class);
|
||||||
InstanceHandle returnsWorkSet = oms.GetRelatedInstance(method, r_Get_Specified_Instances_Method__returns__Work_Set);
|
InstanceHandle returnsWorkSet = oms.GetRelatedInstance(method, r_Get_Specified_Instances_Method__returns__Work_Set);
|
||||||
IReadOnlyCollection<InstanceHandle> irUsesInstance = oms.GetRelatedInstances(method, r_Get_Specified_Instances_Method__uses__Instance);
|
IReadOnlyCollection<InstanceHandle> irUsesInstance = oms.GetRelatedInstances(method, r_Get_Specified_Instances_Method__uses__Instance);
|
||||||
|
|||||||
@ -48,6 +48,15 @@ public abstract class Oms
|
|||||||
|
|
||||||
public bool ValidateConstraints { get; protected set; } = true;
|
public bool ValidateConstraints { get; protected set; } = true;
|
||||||
|
|
||||||
|
public Oms()
|
||||||
|
{
|
||||||
|
MethodImplementation[] methodImplementations = MBS.Core.Reflection.TypeLoader.GetAvailableTypes<MethodImplementation>(new System.Reflection.Assembly[] { Assembly.GetExecutingAssembly() });
|
||||||
|
foreach (MethodImplementation impl in methodImplementations)
|
||||||
|
{
|
||||||
|
RegisterMethodImplementation(impl.MethodClassGuid, impl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected virtual void InitializeInternal()
|
protected virtual void InitializeInternal()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -55,12 +64,6 @@ public abstract class Oms
|
|||||||
{
|
{
|
||||||
InitializeInternal();
|
InitializeInternal();
|
||||||
DebugOms = this;
|
DebugOms = this;
|
||||||
|
|
||||||
MethodImplementation[] methodImplementations = MBS.Core.Reflection.TypeLoader.GetAvailableTypes<MethodImplementation>(new System.Reflection.Assembly[] { Assembly.GetExecutingAssembly() });
|
|
||||||
foreach (MethodImplementation impl in methodImplementations)
|
|
||||||
{
|
|
||||||
RegisterMethodImplementation(impl.MethodClassGuid, impl);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Dictionary<string, TenantHandle> _tenantsByName = new Dictionary<string, TenantHandle>();
|
private Dictionary<string, TenantHandle> _tenantsByName = new Dictionary<string, TenantHandle>();
|
||||||
@ -396,12 +399,16 @@ public abstract class Oms
|
|||||||
|
|
||||||
InstanceHandle sourceParentClass = GetParentClass(source);
|
InstanceHandle sourceParentClass = GetParentClass(source);
|
||||||
|
|
||||||
|
bool Verify_Classes_Contain_Attributes = false;
|
||||||
|
if (Verify_Classes_Contain_Attributes)
|
||||||
|
{
|
||||||
if (!RecursiveClassHasAttribute(sourceParentClass, attribute))
|
if (!RecursiveClassHasAttribute(sourceParentClass, attribute))
|
||||||
{
|
{
|
||||||
string name = GetAttributeValue<string>(attribute, GetInstance(KnownAttributeGuids.Text.Name));
|
string name = GetAttributeValue<string>(attribute, GetInstance(KnownAttributeGuids.Text.Name));
|
||||||
string sourceParentClassName = GetAttributeValue<string>(sourceParentClass, GetInstance(KnownAttributeGuids.Text.Name));
|
string sourceParentClassName = GetAttributeValue<string>(sourceParentClass, GetInstance(KnownAttributeGuids.Text.Name));
|
||||||
throw new ArgumentException(String.Format("Undefined attribute `{0}` on class `{1}`", name ?? GetGlobalIdentifier(attribute).ToString("b"), sourceParentClassName ?? GetGlobalIdentifier(sourceParentClass).ToString("b")));
|
throw new ArgumentException(String.Format("Undefined attribute `{0}` on class `{1}`", name ?? GetGlobalIdentifier(attribute).ToString("b"), sourceParentClassName ?? GetGlobalIdentifier(sourceParentClass).ToString("b")));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (IsInstanceOf(attribute, a_TextAttribute))
|
if (IsInstanceOf(attribute, a_TextAttribute))
|
||||||
{
|
{
|
||||||
@ -667,7 +674,6 @@ public abstract class Oms
|
|||||||
private void RegisterMethodImplementation(Guid methodClassId, MethodImplementation implementation)
|
private void RegisterMethodImplementation(Guid methodClassId, MethodImplementation implementation)
|
||||||
{
|
{
|
||||||
methodImplementations[methodClassId] = implementation;
|
methodImplementations[methodClassId] = implementation;
|
||||||
implementation.Initialize(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public InstanceHandle Execute(OmsContext context, MethodBinding methodBinding, InstanceHandle? targetInstance = null)
|
public InstanceHandle Execute(OmsContext context, MethodBinding methodBinding, InstanceHandle? targetInstance = null)
|
||||||
|
|||||||
@ -352,7 +352,7 @@ public class MemoryOms : Oms
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return v;
|
||||||
}
|
}
|
||||||
protected override bool TryGetInstanceInternal(InstanceKey ik, out InstanceHandle ih)
|
protected override bool TryGetInstanceInternal(InstanceKey ik, out InstanceHandle ih)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -25,6 +25,7 @@ public class McxMiniLibraryPlugin : LibraryPlugin
|
|||||||
public string Name;
|
public string Name;
|
||||||
public int Offset;
|
public int Offset;
|
||||||
public int Length;
|
public int Length;
|
||||||
|
public int DecompressedLength;
|
||||||
public int Count;
|
public int Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,6 +54,7 @@ public class McxMiniLibraryPlugin : LibraryPlugin
|
|||||||
McxMiniFlags flags = (McxMiniFlags)r.ReadInt32();
|
McxMiniFlags flags = (McxMiniFlags)r.ReadInt32();
|
||||||
|
|
||||||
int sectionsCount = r.ReadInt32();
|
int sectionsCount = r.ReadInt32();
|
||||||
|
Guid libraryGuid = r.ReadGuid();
|
||||||
|
|
||||||
Dictionary<string, McxSection> sections = new Dictionary<string, McxSection>();
|
Dictionary<string, McxSection> sections = new Dictionary<string, McxSection>();
|
||||||
for (int i = 0; i < sectionsCount; i++)
|
for (int i = 0; i < sectionsCount; i++)
|
||||||
@ -69,15 +71,8 @@ public class McxMiniLibraryPlugin : LibraryPlugin
|
|||||||
|
|
||||||
section.Offset = r.ReadInt32();
|
section.Offset = r.ReadInt32();
|
||||||
section.Length = r.ReadInt32();
|
section.Length = r.ReadInt32();
|
||||||
if ((flags & McxMiniFlags.HasCounts) == McxMiniFlags.HasCounts)
|
section.DecompressedLength = r.ReadInt32();
|
||||||
{
|
|
||||||
section.Count = r.ReadInt32();
|
section.Count = r.ReadInt32();
|
||||||
}
|
|
||||||
if (((flags & McxMiniFlags.HasNames) == McxMiniFlags.HasNames)
|
|
||||||
&& ((flags & McxMiniFlags.HasCounts) == McxMiniFlags.HasCounts))
|
|
||||||
{
|
|
||||||
int reserved = r.ReadInt32(); // padding
|
|
||||||
}
|
|
||||||
sections[section.Name] = section;
|
sections[section.Name] = section;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -27,6 +27,9 @@ public abstract class OmsTestsBase
|
|||||||
{
|
{
|
||||||
EmbeddedMiniOms oms = new EmbeddedMiniOms();
|
EmbeddedMiniOms oms = new EmbeddedMiniOms();
|
||||||
oms.Initialize();
|
oms.Initialize();
|
||||||
|
|
||||||
|
oms.CreateClass("Test Class", TEST_CLASS_GUID);
|
||||||
|
oms.CreateClass("Test Class 2", TEST_CLASS2_GUID);
|
||||||
return oms;
|
return oms;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,7 +47,6 @@ public abstract class OmsTestsBase
|
|||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
Oms = CreateOms();
|
Oms = CreateOms();
|
||||||
Oms.Initialize();
|
|
||||||
|
|
||||||
// create the Test Class
|
// create the Test Class
|
||||||
InstanceHandle c_Class = Oms.GetInstance(KnownInstanceGuids.Classes.Class);
|
InstanceHandle c_Class = Oms.GetInstance(KnownInstanceGuids.Classes.Class);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user