diff --git a/.github/workflows/unittests6x.yml b/.github/workflows/unittests6x.yml
deleted file mode 100644
index 3a5f7ae..0000000
--- a/.github/workflows/unittests6x.yml
+++ /dev/null
@@ -1,28 +0,0 @@
-name: .NET-Test-6x
-
-on:
- push:
- branches: [ 'master' ]
- pull_request:
- branches: [ 'master' ]
-
-jobs:
- build:
-
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/checkout@v3
- - name: Setup .NET
- uses: actions/setup-dotnet@v2
- with:
- dotnet-version: |
- 6.0.x
- - name: Restore dependencies
- run: dotnet restore -p:TargetFramework=net6.0 UnitTest
- - name: Build-6.0
- run: dotnet build --framework net6.0 --no-restore UnitTest
- - name: Test-6.0
- run: dotnet test --framework net6.0 --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=opencover UnitTest
- - name: Codecov coverage upload
- uses: codecov/codecov-action@v3.1.1
diff --git a/.github/workflows/unittests7x.yml b/.github/workflows/unittests7x.yml
deleted file mode 100644
index 289b7a6..0000000
--- a/.github/workflows/unittests7x.yml
+++ /dev/null
@@ -1,26 +0,0 @@
-name: .NET-Test-7x
-
-on:
- push:
- branches: [ 'master' ]
- pull_request:
- branches: [ 'master' ]
-
-jobs:
- build:
-
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/checkout@v3
- - name: Setup .NET
- uses: actions/setup-dotnet@v2
- with:
- dotnet-version: |
- 7.0.x
- - name: Restore dependencies
- run: dotnet restore -p:TargetFramework=net7.0 UnitTest
- - name: Build-7.0
- run: dotnet build --framework net7.0 --no-restore UnitTest
- - name: Test-7.0
- run: dotnet test --framework net7.0 --no-build --verbosity normal UnitTest
\ No newline at end of file
diff --git a/.github/workflows/unittestsCodeio.yml b/.github/workflows/unittestsCodeio.yml
index 29879d2..1d8b03e 100644
--- a/.github/workflows/unittestsCodeio.yml
+++ b/.github/workflows/unittestsCodeio.yml
@@ -19,12 +19,12 @@ jobs:
uses: actions/setup-dotnet@v2
with:
dotnet-version: |
- 6.0.x
+ 8.0.x
- name: Restore dependencies
- run: dotnet restore -p:TargetFramework=net6.0 UnitTest
- - name: Build-6.0
- run: dotnet build --framework net6.0 --no-restore UnitTest
- - name: Test-6.0
- run: dotnet test --framework net6.0 --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=opencover UnitTest
+ run: dotnet restore -p:TargetFramework=net8.0 UnitTest
+ - name: Build-8.0
+ run: dotnet build --framework net8.0 --no-restore UnitTest
+ - name: Test-8.0
+ run: dotnet test --framework net8.0 --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=opencover UnitTest
- name: Codecov coverage upload
uses: codecov/codecov-action@v3.1.1
diff --git a/.github/workflows/unittestsJint.yml b/.github/workflows/unittestsJint.yml
index e9f0348..7dc5d57 100644
--- a/.github/workflows/unittestsJint.yml
+++ b/.github/workflows/unittestsJint.yml
@@ -17,10 +17,10 @@ jobs:
uses: actions/setup-dotnet@v2
with:
dotnet-version: |
- 6.0.x
+ 8.0.x
- name: Restore dependencies
- run: dotnet restore -p:TargetFramework=net6.0 UnitTest
- - name: Build-6.0
- run: dotnet build --framework net6.0 --no-restore UnitTest
- - name: Test-6.0
- run: dotnet test --framework net6.0 --no-build --verbosity normal --filter "FullyQualifiedName=UnitTest.Extensions.Scripts.TestJavascript" UnitTest
+ run: dotnet restore -p:TargetFramework=net8.0 UnitTest
+ - name: Build-8.0
+ run: dotnet build --framework net8.0 --no-restore UnitTest
+ - name: Test-8.0
+ run: dotnet test --framework net8.0 --no-build --verbosity normal --filter "FullyQualifiedName=UnitTest.Extensions.Scripts.TestJavascript" UnitTest
diff --git a/BPMNEngine/.editorconfig b/BPMNEngine/.editorconfig
new file mode 100644
index 0000000..9f8c174
--- /dev/null
+++ b/BPMNEngine/.editorconfig
@@ -0,0 +1,4 @@
+[*.cs]
+
+# IDE0022: Use block body for method
+csharp_style_expression_bodied_methods = when_on_single_line
diff --git a/BPMNEngine/.vs/BPMNEngine/DesignTimeBuild/.dtbcache.v2 b/BPMNEngine/.vs/BPMNEngine/DesignTimeBuild/.dtbcache.v2
index 9f4f4ed..b5991ed 100644
Binary files a/BPMNEngine/.vs/BPMNEngine/DesignTimeBuild/.dtbcache.v2 and b/BPMNEngine/.vs/BPMNEngine/DesignTimeBuild/.dtbcache.v2 differ
diff --git a/BPMNEngine/.vs/BPMNEngine/v17/.futdcache.v2 b/BPMNEngine/.vs/BPMNEngine/v17/.futdcache.v2
index 4f5d01f..64ee2d9 100644
Binary files a/BPMNEngine/.vs/BPMNEngine/v17/.futdcache.v2 and b/BPMNEngine/.vs/BPMNEngine/v17/.futdcache.v2 differ
diff --git a/BPMNEngine/.vs/BPMNEngine/v17/.suo b/BPMNEngine/.vs/BPMNEngine/v17/.suo
index a2e6505..37738ee 100644
Binary files a/BPMNEngine/.vs/BPMNEngine/v17/.suo and b/BPMNEngine/.vs/BPMNEngine/v17/.suo differ
diff --git a/BPMNEngine/.vs/BPMNEngine/v17/DocumentLayout.json b/BPMNEngine/.vs/BPMNEngine/v17/DocumentLayout.json
new file mode 100644
index 0000000..0cdc273
--- /dev/null
+++ b/BPMNEngine/.vs/BPMNEngine/v17/DocumentLayout.json
@@ -0,0 +1,61 @@
+{
+ "Version": 1,
+ "WorkspaceRootPath": "C:\\Users\\Roger Castaldo\\source\\repos\\BPMEngine\\BPMNEngine\\",
+ "Documents": [],
+ "DocumentGroupContainers": [
+ {
+ "Orientation": 1,
+ "VerticalTabListWidth": 256,
+ "DocumentGroups": [
+ {
+ "DockedHeight": 275,
+ "SelectedChildIndex": -1,
+ "Children": [
+ {
+ "$type": "Bookmark",
+ "Name": "ST:128:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
+ },
+ {
+ "$type": "Bookmark",
+ "Name": "ST:129:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
+ },
+ {
+ "$type": "Bookmark",
+ "Name": "ST:128:0:{1fc202d4-d401-403c-9834-5b218574bb67}"
+ },
+ {
+ "$type": "Bookmark",
+ "Name": "ST:0:0:{004be353-6879-467c-9d1e-9ac23cdf6d49}"
+ },
+ {
+ "$type": "Bookmark",
+ "Name": "ST:0:0:{e1b7d1f8-9b3c-49b1-8f4f-bfc63a88835d}"
+ }
+ ]
+ },
+ {
+ "DockedHeight": 275,
+ "SelectedChildIndex": -1,
+ "Children": [
+ {
+ "$type": "Bookmark",
+ "Name": "ST:0:0:{a80febb4-e7e0-4147-b476-21aaf2453969}"
+ },
+ {
+ "$type": "Bookmark",
+ "Name": "ST:0:0:{d78612c7-9962-4b83-95d9-268046dad23a}"
+ },
+ {
+ "$type": "Bookmark",
+ "Name": "ST:0:0:{34e76e81-ee4a-11d0-ae2e-00a0c90fffc3}"
+ },
+ {
+ "$type": "Bookmark",
+ "Name": "ST:0:0:{320fd13f-632f-4b16-9527-a1adfe555f6c}"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/BPMNEngine/.vs/BPMNEngine/v17/TestStore/0/testlog.manifest b/BPMNEngine/.vs/BPMNEngine/v17/TestStore/0/testlog.manifest
index a503c59..729b370 100644
Binary files a/BPMNEngine/.vs/BPMNEngine/v17/TestStore/0/testlog.manifest and b/BPMNEngine/.vs/BPMNEngine/v17/TestStore/0/testlog.manifest differ
diff --git a/BPMNEngine/.vs/ProjectEvaluation/bpmnengine.metadata.v7.bin b/BPMNEngine/.vs/ProjectEvaluation/bpmnengine.metadata.v7.bin
deleted file mode 100644
index f68e6a3..0000000
Binary files a/BPMNEngine/.vs/ProjectEvaluation/bpmnengine.metadata.v7.bin and /dev/null differ
diff --git a/BPMNEngine/.vs/ProjectEvaluation/bpmnengine.projects.v7.bin b/BPMNEngine/.vs/ProjectEvaluation/bpmnengine.projects.v7.bin
deleted file mode 100644
index 0d0ca95..0000000
Binary files a/BPMNEngine/.vs/ProjectEvaluation/bpmnengine.projects.v7.bin and /dev/null differ
diff --git a/BPMNEngine/Attributes/AttributeRegex.cs b/BPMNEngine/Attributes/AttributeRegex.cs
deleted file mode 100644
index 240a697..0000000
--- a/BPMNEngine/Attributes/AttributeRegex.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-using BPMNEngine.Elements;
-using System.Text.RegularExpressions;
-
-namespace BPMNEngine.Attributes
-{
- [AttributeUsage(AttributeTargets.Class,AllowMultiple=true,Inherited=true)]
- internal class AttributeRegex : Attribute
- {
- public string Name { get; private init; }
- public Regex Reg { get; private init; }
-
- public AttributeRegex(string name, string regex)
- {
- Name = name;
- Reg=new Regex(regex,RegexOptions.Compiled|RegexOptions.ECMAScript);
- }
-
- public bool IsValid(AElement elem)
- {
- if (elem[Name]!=null)
- return Reg.IsMatch(elem[Name]);
- return true;
- }
- }
-}
diff --git a/BPMNEngine/Attributes/AttributeRegexAttribute.cs b/BPMNEngine/Attributes/AttributeRegexAttribute.cs
new file mode 100644
index 0000000..c56a157
--- /dev/null
+++ b/BPMNEngine/Attributes/AttributeRegexAttribute.cs
@@ -0,0 +1,15 @@
+using BPMNEngine.Elements;
+using System.Text.RegularExpressions;
+
+namespace BPMNEngine.Attributes
+{
+ [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
+ internal class AttributeRegexAttribute(string name, string regex) : Attribute
+ {
+ public string Name { get; private init; } = name;
+ public Regex Reg { get; private init; } = new Regex(regex, RegexOptions.Compiled|RegexOptions.ECMAScript);
+
+ public bool IsValid(AElement elem)
+ => elem[Name]!=null && Reg.IsMatch(elem[Name]);
+ }
+}
diff --git a/BPMNEngine/Attributes/RequiredAttribute.cs b/BPMNEngine/Attributes/RequiredAttribute.cs
deleted file mode 100644
index de792ac..0000000
--- a/BPMNEngine/Attributes/RequiredAttribute.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-namespace BPMNEngine.Attributes
-{
- [AttributeUsage(AttributeTargets.Class,AllowMultiple=true,Inherited=true)]
- internal class RequiredAttribute : Attribute
- {
- public string Name { get; private init; }
-
- public RequiredAttribute(string name)
- {
- Name = name;
- }
- }
-}
diff --git a/BPMNEngine/Attributes/RequiredAttributeAttribute.cs b/BPMNEngine/Attributes/RequiredAttributeAttribute.cs
new file mode 100644
index 0000000..1662441
--- /dev/null
+++ b/BPMNEngine/Attributes/RequiredAttributeAttribute.cs
@@ -0,0 +1,8 @@
+namespace BPMNEngine.Attributes
+{
+ [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
+ internal class RequiredAttributeAttribute(string name) : Attribute
+ {
+ public string Name { get; private init; } = name;
+ }
+}
diff --git a/BPMNEngine/Attributes/ValidParentAttribute.cs b/BPMNEngine/Attributes/ValidParentAttribute.cs
index c2b7d5e..4469e89 100644
--- a/BPMNEngine/Attributes/ValidParentAttribute.cs
+++ b/BPMNEngine/Attributes/ValidParentAttribute.cs
@@ -1,13 +1,8 @@
namespace BPMNEngine.Attributes
{
- [AttributeUsage(AttributeTargets.Class,AllowMultiple=true,Inherited =true)]
- internal class ValidParentAttribute : Attribute
+ [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
+ internal class ValidParentAttribute(Type parent) : Attribute
{
- public Type Parent { get; private init; }
-
- public ValidParentAttribute(Type parent)
- {
- Parent = parent;
- }
+ public Type Parent { get; private init; } = parent;
}
}
diff --git a/BPMNEngine/Attributes/XMLTag.cs b/BPMNEngine/Attributes/XMLTag.cs
deleted file mode 100644
index ffeacea..0000000
--- a/BPMNEngine/Attributes/XMLTag.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-namespace BPMNEngine.Attributes
-{
- [AttributeUsage(AttributeTargets.Class,Inherited=false,AllowMultiple=false)]
- internal class XMLTag : Attribute
- {
- public string Name { get; private init; }
- public string Prefix { get; private init; }
-
- public XMLTag(string prefix,string name)
- {
- Name = name;
- Prefix = prefix;
- }
-
- public override string ToString()
- {
- return (Prefix==null ? Name : $"{Prefix}:{Name}");
- }
-
- internal bool Matches(XmlPrefixMap map, string tagName)
- {
- return tagName.Equals(ToString(),StringComparison.CurrentCultureIgnoreCase)
- ||tagName.Equals(Name,StringComparison.CurrentCultureIgnoreCase)
- ||(Prefix != null && map.IsMatch(Prefix, Name, tagName));
- }
- }
-}
diff --git a/BPMNEngine/Attributes/XMLTagAttribute.cs b/BPMNEngine/Attributes/XMLTagAttribute.cs
new file mode 100644
index 0000000..0e00368
--- /dev/null
+++ b/BPMNEngine/Attributes/XMLTagAttribute.cs
@@ -0,0 +1,17 @@
+namespace BPMNEngine.Attributes
+{
+ [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
+ internal class XMLTagAttribute(string prefix, string name) : Attribute
+ {
+ public string Name { get; private init; } = name;
+ public string Prefix { get; private init; } = prefix;
+
+ public override string ToString()
+ => (Prefix==null ? Name : $"{Prefix}:{Name}");
+
+ internal bool Matches(XmlPrefixMap map, string tagName)
+ => tagName.Equals(ToString(), StringComparison.CurrentCultureIgnoreCase)
+ ||tagName.Equals(Name, StringComparison.CurrentCultureIgnoreCase)
+ ||(Prefix != null && map.IsMatch(Prefix, Name, tagName));
+ }
+}
diff --git a/BPMNEngine/BPMNEngine.csproj b/BPMNEngine/BPMNEngine.csproj
index a135139..0b236c7 100644
--- a/BPMNEngine/BPMNEngine.csproj
+++ b/BPMNEngine/BPMNEngine.csproj
@@ -1,17 +1,17 @@
- net6.0;net7.0;net8.0
+ net8.0
BPMNEngine
BPMNEngine
- 3.0.0
+ 3.1.0
Roger Castaldo
A BPMN Engine written in .net. The engine attempts to read in a bpmn notation xml document defining both the process(s) as well as the diagrams. From here you can then load/unload the state, render the diagram in its current state or animated into a gif. Using the delegates for a process, you intercept and handle task and condition checking by reading additional xml held within flow and task objects.
https://github.com/roger-castaldo/BPMEngine
https://github.com/roger-castaldo/BPMEngine
BPMN
Major revision to a new library with breaking changes, including the concept of a process instance and creating named parameters for supplying all delegates. Improved memory management and performance has been acheived using built in dotnet concepts that also display improved performances when running inside .net8 vs .net7 vs .net6.
- 3.0.0
- 3.0.0
+ 3.1.0
+ 3.1.0
true
true
snupkg
@@ -56,18 +56,18 @@
-
-
-
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
-
-
-
+
+
+
diff --git a/BPMNEngine/BPMNEngine.sln b/BPMNEngine/BPMNEngine.sln
index ced4282..2639cf2 100644
--- a/BPMNEngine/BPMNEngine.sln
+++ b/BPMNEngine/BPMNEngine.sln
@@ -7,6 +7,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPMNEngine", "BPMNEngine.cs
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTest", "..\UnitTest\UnitTest.csproj", "{25AF2381-DB41-418D-B0D4-F7BA5129EF6B}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{444BE3E3-36E7-4230-8CCC-D0F9CBCB03E9}"
+ ProjectSection(SolutionItems) = preProject
+ .editorconfig = .editorconfig
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
diff --git a/BPMNEngine/BusinessProcess.Actions.cs b/BPMNEngine/BusinessProcess.Actions.cs
index e1a3a52..648d56a 100644
--- a/BPMNEngine/BusinessProcess.Actions.cs
+++ b/BPMNEngine/BusinessProcess.Actions.cs
@@ -1,18 +1,18 @@
-using BPMNEngine.Elements.Collaborations;
+using BPMNEngine.Elements;
+using BPMNEngine.Elements.Collaborations;
+using BPMNEngine.Elements.Processes;
using BPMNEngine.Elements.Processes.Events;
+using BPMNEngine.Elements.Processes.Gateways;
using BPMNEngine.Elements.Processes.Tasks;
-using BPMNEngine.Elements.Processes;
-using BPMNEngine.Elements;
-using BPMNEngine.Scheduling;
using BPMNEngine.Interfaces.Elements;
using BPMNEngine.Interfaces.Variables;
-using BPMNEngine.Elements.Processes.Gateways;
+using BPMNEngine.Scheduling;
namespace BPMNEngine
{
public sealed partial class BusinessProcess
{
- private static void TriggerDelegateAsync(Delegate dgate, params object?[]? pars)
+ private static void TriggerDelegateAsync(Delegate dgate, params object[] pars)
{
if (dgate!=null)
{
@@ -33,7 +33,7 @@ private IEnumerable GetEventHandlers(EventSubTypes type, object
{
case EventSubTypes.Timer:
if (handlerGroup!=null && handlerGroup.Key>0)
- return Array.Empty();
+ return [];
break;
}
@@ -61,8 +61,8 @@ internal void ProcessStepComplete(ProcessInstance instance, string sourceID, str
{
ReadOnlyProcessVariablesContainer vars = new(sourceID, instance);
subProcess.Children
- .Where(child=>instance.State.Path.AbortableSteps.Contains(child.ID))
- .ForEach(child=>AbortStep(instance, sourceID, child, vars));
+ .Where(child => instance.State.Path.AbortableSteps.Contains(child.ID))
+ .ForEach(child => AbortStep(instance, sourceID, child, vars));
}
}
WriteLogLine(sourceID, LogLevel.Debug, new StackFrame(1, true), DateTime.Now, string.Format("Process Step[{0}] has been completed", sourceID));
@@ -96,14 +96,14 @@ internal void ProcessStepError(ProcessInstance instance, IElement step, Exceptio
if (((IStepElement)step).SubProcess!=null)
BusinessProcess.TriggerDelegateAsync(
instance.Delegates.Events.SubProcesses.Error,
- (IStepElement)((IStepElement)step).SubProcess,
+ (IStepElement)((IStepElement)step).SubProcess,
new ReadOnlyProcessVariablesContainer(step.ID, instance, ex)
);
else
BusinessProcess.TriggerDelegateAsync(
- instance.Delegates.Events.Processes.Error,
- ((IStepElement)step).Process,
- step,
+ instance.Delegates.Events.Processes.Error,
+ ((IStepElement)step).Process,
+ step,
new ReadOnlyProcessVariablesContainer(step.ID, instance, ex)
);
}
@@ -118,7 +118,7 @@ private void ProcessElement(ProcessInstance instance, string sourceID, IElement
}
else
{
- instance.WriteLogLine(sourceID, LogLevel.Debug, new StackFrame(1, true), DateTime.Now, string.Format("Processing Element {0} from source {1}", new object[] { elem.ID, sourceID }));
+ instance.WriteLogLine(sourceID, LogLevel.Debug, new StackFrame(1, true), DateTime.Now, $"Processing Element {elem.ID} from source {sourceID}");
bool abort = false;
if (elem is AFlowNode node)
{
@@ -166,20 +166,20 @@ private static void ProcessSubProcess(ProcessInstance instance, string sourceID,
instance.WriteLogLine(startEvent, LogLevel.Information, new StackFrame(1, true), DateTime.Now, string.Format("Valid Sub Process Start[{0}] located, beginning process", startEvent.ID));
instance.State.Path.StartFlowNode(esp, sourceID);
BusinessProcess.TriggerDelegateAsync(
- instance.Delegates.Events.SubProcesses.Started,
- esp,
+ instance.Delegates.Events.SubProcesses.Started,
+ esp,
variables
);
instance.State.Path.StartFlowNode(startEvent, null);
BusinessProcess.TriggerDelegateAsync(
instance.Delegates.Events.Events.Started,
- startEvent,
+ startEvent,
variables
);
instance.State.Path.SucceedFlowNode(startEvent);
BusinessProcess.TriggerDelegateAsync(
- instance.Delegates.Events.Events.Completed,
- startEvent,
+ instance.Delegates.Events.Events.Completed,
+ startEvent,
variables
);
}
@@ -190,64 +190,49 @@ private static void ProcessTask(ProcessInstance instance, string sourceID, ATask
{
instance.State.Path.StartFlowNode(tsk, sourceID);
BusinessProcess.TriggerDelegateAsync(
- instance.Delegates.Events.Tasks.Started,
- tsk,
+ instance.Delegates.Events.Tasks.Started,
+ tsk,
new ReadOnlyProcessVariablesContainer(tsk.ID, instance)
);
try
{
ProcessVariablesContainer variables = new(tsk.ID, instance);
- Tasks.ExternalTask task = null;
- switch (tsk.GetType().Name)
+ Tasks.ExternalTask task = (tsk) switch
{
- case "BusinessRuleTask":
- case "ReceiveTask":
- case "SendTask":
- case "ServiceTask":
- case "Task":
- case "ScriptTask":
- case "CallActivity":
- task = new Tasks.ExternalTask(tsk, variables, instance);
- break;
- }
- ProcessTask delTask = null;
- switch (tsk.GetType().Name)
+ (BusinessRuleTask) => new Tasks.ExternalTask(tsk, variables, instance),
+ (ReceiveTask) => new Tasks.ExternalTask(tsk, variables, instance),
+ (SendTask) => new Tasks.ExternalTask(tsk, variables, instance),
+ (ServiceTask) => new Tasks.ExternalTask(tsk, variables, instance),
+ (Task) => new Tasks.ExternalTask(tsk, variables, instance),
+ (ScriptTask) => new Tasks.ExternalTask(tsk, variables, instance),
+ (CallActivity) => new Tasks.ExternalTask(tsk, variables, instance),
+ _ => null
+
+ };
+ ProcessTask delTask = (tsk) switch
{
- case "BusinessRuleTask":
- delTask = instance.Delegates.Tasks.ProcessBusinessRuleTask;
- break;
- case "ManualTask":
- BusinessProcess.TriggerDelegateAsync(
- instance.Delegates.Tasks.BeginManualTask,
- new Tasks.ManualTask(tsk, variables, instance)
- );
- break;
- case "ReceiveTask":
- delTask = instance.Delegates.Tasks.ProcessReceiveTask;
- break;
- case "ScriptTask":
- ((ScriptTask)tsk).ProcessTask(task, instance.Delegates.Tasks.ProcessScriptTask);
- break;
- case "SendTask":
- delTask = instance.Delegates.Tasks.ProcessSendTask;
- break;
- case "ServiceTask":
- delTask = instance.Delegates.Tasks.ProcessServiceTask;
- break;
- case "Task":
- delTask = instance.Delegates.Tasks.ProcessTask;
- break;
- case "CallActivity":
- delTask = instance.Delegates.Tasks.CallActivity;
- break;
- case "UserTask":
- BusinessProcess.TriggerDelegateAsync(
- instance.Delegates.Tasks.BeginUserTask,
- new Tasks.UserTask(tsk, variables, instance)
- );
- break;
- }
- delTask?.Invoke(task);
+ (BusinessRuleTask) => instance.Delegates.Tasks.ProcessBusinessRuleTask,
+ (ReceiveTask) => instance.Delegates.Tasks.ProcessReceiveTask,
+ (SendTask) => instance.Delegates.Tasks.ProcessSendTask,
+ (ServiceTask) => instance.Delegates.Tasks.ProcessServiceTask,
+ (Task) => instance.Delegates.Tasks.ProcessTask,
+ (CallActivity) => instance.Delegates.Tasks.CallActivity,
+ _ => null
+ };
+ if (tsk is ManualTask)
+ TriggerDelegateAsync(
+ instance.Delegates.Tasks.BeginManualTask,
+ new Tasks.ManualTask(tsk, variables, instance)
+ );
+ else if (tsk is ScriptTask scriptTask)
+ scriptTask.ProcessTask(task, instance.Delegates.Tasks.ProcessScriptTask);
+ else if (tsk is UserTask)
+ TriggerDelegateAsync(
+ instance.Delegates.Tasks.BeginUserTask,
+ new Tasks.UserTask(tsk, variables, instance)
+ );
+ else
+ delTask?.Invoke(task);
if (task!=null && !task.Aborted)
instance.MergeVariables(task);
}
@@ -255,9 +240,9 @@ private static void ProcessTask(ProcessInstance instance, string sourceID, ATask
{
instance.WriteLogException(tsk, new StackFrame(1, true), DateTime.Now, e);
BusinessProcess.TriggerDelegateAsync(
- instance.Delegates.Events.Tasks.Error,
- tsk,
- new ReadOnlyProcessVariablesContainer(tsk.ID, instance, e)
+ instance.Delegates.Events.Tasks.Error,
+ tsk,
+ new ReadOnlyProcessVariablesContainer(tsk.ID, instance, e)
);
instance.State.Path.FailFlowNode(tsk, error: e);
}
@@ -272,17 +257,17 @@ internal void ProcessEvent(ProcessInstance instance, string sourceID, AEvent evn
instance.State.Path.StartFlowNode(sp, sourceID);
}
instance.State.Path.StartFlowNode(evnt, sourceID);
- BusinessProcess.TriggerDelegateAsync(
+ TriggerDelegateAsync(
instance.Delegates.Events.Events.Started,
- evnt,
+ evnt,
new ReadOnlyProcessVariablesContainer(evnt.ID, instance)
);
if (evnt is BoundaryEvent @event && @event.CancelActivity)
AbortStep(instance, sourceID, GetElement(@event.AttachedToID), new ReadOnlyProcessVariablesContainer(evnt.ID, instance));
bool success = true;
- TimeSpan? ts = null;
- if (evnt is IntermediateCatchEvent || evnt is IntermediateThrowEvent)
- ts = evnt.GetTimeout(new ReadOnlyProcessVariablesContainer(evnt.ID, instance));
+ TimeSpan? ts = ((evnt is IntermediateCatchEvent || evnt is IntermediateThrowEvent) ?
+ evnt.GetTimeout(new ReadOnlyProcessVariablesContainer(evnt.ID, instance))
+ : null);
if (ts.HasValue)
{
instance.State.SuspendStep(sourceID, evnt.ID, ts.Value);
@@ -294,10 +279,10 @@ internal void ProcessEvent(ProcessInstance instance, string sourceID, AEvent evn
else
success = true;
}
- else if (evnt is IntermediateThrowEvent event1)
+ else if (evnt is IntermediateThrowEvent intermediateThrowEvent)
{
- if (evnt.SubType.HasValue)
- GetEventHandlers(evnt.SubType.Value, event1.Message, evnt, new ReadOnlyProcessVariablesContainer(evnt.ID, instance))
+ if (intermediateThrowEvent.SubType.HasValue)
+ GetEventHandlers(evnt.SubType.Value, intermediateThrowEvent.Message, evnt, new ReadOnlyProcessVariablesContainer(evnt.ID, instance))
.ForEach(tsk => { ProcessEvent(instance, evnt.ID, tsk); });
}
else if (instance.Delegates.Validations.IsEventStartValid != null && (evnt is IntermediateCatchEvent || evnt is StartEvent))
@@ -315,31 +300,32 @@ internal void ProcessEvent(ProcessInstance instance, string sourceID, AEvent evn
if (!success)
{
instance.State.Path.FailFlowNode(evnt);
- BusinessProcess.TriggerDelegateAsync(
+ TriggerDelegateAsync(
instance.Delegates.Events.Events.Error,
- evnt,
+ evnt,
new ReadOnlyProcessVariablesContainer(evnt.ID, instance)
);
}
else
{
instance.State.Path.SucceedFlowNode(evnt);
- BusinessProcess.TriggerDelegateAsync(
- instance.Delegates.Events.Events.Completed,
- evnt,
+ TriggerDelegateAsync(
+ instance.Delegates.Events.Events.Completed,
+ evnt,
new ReadOnlyProcessVariablesContainer(evnt.ID, instance)
);
if (evnt is EndEvent endEvent)
{
var sp = endEvent.SubProcess as SubProcess;
- if (sp!=null &&
+ if (sp!=null &&
(
!endEvent.IsProcessEnd
||(endEvent.IsProcessEnd && !endEvent.IsTermination)
)
- ){
+ )
+ {
instance.State.Path.SucceedFlowNode(sp);
- BusinessProcess.TriggerDelegateAsync(
+ TriggerDelegateAsync(
instance.Delegates.Events.SubProcesses.Completed,
sp,
new ReadOnlyProcessVariablesContainer(sp.ID, instance)
@@ -351,7 +337,7 @@ internal void ProcessEvent(ProcessInstance instance, string sourceID, AEvent evn
{
if (sp==null)
{
- BusinessProcess.TriggerDelegateAsync(
+ TriggerDelegateAsync(
instance.Delegates.Events.Processes.Completed,
endEvent.Process,
new ReadOnlyProcessVariablesContainer(evnt.ID, instance)
@@ -363,7 +349,7 @@ internal void ProcessEvent(ProcessInstance instance, string sourceID, AEvent evn
{
ReadOnlyProcessVariablesContainer vars = new(evnt.ID, instance);
instance.State.AbortableSteps.ForEach(str => { AbortStep(instance, evnt.ID, GetElement(str), vars); });
- BusinessProcess.TriggerDelegateAsync(
+ TriggerDelegateAsync(
instance.Delegates.Events.Processes.Completed,
endEvent.Process,
new ReadOnlyProcessVariablesContainer(evnt.ID, instance)
@@ -379,8 +365,8 @@ private void AbortStep(ProcessInstance instance, string sourceID, IElement eleme
{
instance.State.Path.AbortStep(sourceID, element.ID);
BusinessProcess.TriggerDelegateAsync(
- instance.Delegates.Events.OnStepAborted,
- element, GetElement(sourceID),
+ instance.Delegates.Events.OnStepAborted,
+ element, GetElement(sourceID),
variables
);
if (element is SubProcess process)
@@ -409,9 +395,9 @@ private void ProcessGateway(ProcessInstance instance, string sourceID, AGateway
{
if (instance.State.Path.ProcessGateway(gw, sourceID))
{
- BusinessProcess.TriggerDelegateAsync(
- instance.Delegates.Events.Gateways.Started,
- gw,
+ TriggerDelegateAsync(
+ instance.Delegates.Events.Gateways.Started,
+ gw,
new ReadOnlyProcessVariablesContainer(gw.ID, instance)
);
IEnumerable outgoings = null;
@@ -422,9 +408,9 @@ private void ProcessGateway(ProcessInstance instance, string sourceID, AGateway
catch (Exception e)
{
instance.WriteLogException(gw, new StackFrame(1, true), DateTime.Now, e);
- BusinessProcess.TriggerDelegateAsync(
- instance.Delegates.Events.Gateways.Error,
- gw,
+ TriggerDelegateAsync(
+ instance.Delegates.Events.Gateways.Error,
+ gw,
new ReadOnlyProcessVariablesContainer(gw.ID, instance, e)
);
outgoings = null;
@@ -432,18 +418,18 @@ private void ProcessGateway(ProcessInstance instance, string sourceID, AGateway
if (outgoings==null || !outgoings.Any())
{
instance.State.Path.FailFlowNode(gw);
- BusinessProcess.TriggerDelegateAsync(
- instance.Delegates.Events.Gateways.Error,
- gw,
+ TriggerDelegateAsync(
+ instance.Delegates.Events.Gateways.Error,
+ gw,
new ReadOnlyProcessVariablesContainer(gw.ID, instance, new Exception("No valid outgoing path located"))
);
}
else
{
instance.State.Path.SucceedFlowNode(gw, outgoing: outgoings);
- BusinessProcess.TriggerDelegateAsync(
- instance.Delegates.Events.Gateways.Completed,
- gw,
+ TriggerDelegateAsync(
+ instance.Delegates.Events.Gateways.Completed,
+ gw,
new ReadOnlyProcessVariablesContainer(gw.ID, instance)
);
}
@@ -458,9 +444,9 @@ private static void ProcessFlowElement(ProcessInstance instance, IFlowElement fl
delCall = instance.Delegates.Events.Flows.MessageFlow;
else if (flowElement is Association)
delCall = instance.Delegates.Events.Flows.AssociationFlow;
- BusinessProcess.TriggerDelegateAsync(
- delCall,
- flowElement,
+ TriggerDelegateAsync(
+ delCall,
+ flowElement,
new ReadOnlyProcessVariablesContainer(flowElement.ID, instance)
);
}
diff --git a/BPMNEngine/BusinessProcess.Drawing.cs b/BPMNEngine/BusinessProcess.Drawing.cs
index 8431878..56b4bc8 100644
--- a/BPMNEngine/BusinessProcess.Drawing.cs
+++ b/BPMNEngine/BusinessProcess.Drawing.cs
@@ -27,8 +27,8 @@ internal byte[] Diagram(bool outputVariables, ProcessState state, ImageFormat ty
private IImage Diagram(bool outputVariables, ProcessState state = null)
{
- state??=new ProcessState(null,this, null, null, null);
- WriteLogLine((IElement)null, LogLevel.Information, new StackFrame(1, true), DateTime.Now, string.Format("Rendering Business Process Diagram{0}", new object[] { (outputVariables ? " with variables" : " without variables") }));
+ state??=new ProcessState(null, this, null, null, null);
+ WriteLogLine((IElement)null, LogLevel.Information, new StackFrame(1, true), DateTime.Now, string.Format("Rendering Business Process Diagram{0}", [(outputVariables ? " with variables" : " without variables")]));
double width = 0;
double height = 0;
width = definition.Diagrams.Max(d => d.Size.Width+DEFAULT_PADDING);
@@ -41,13 +41,14 @@ private IImage Diagram(bool outputVariables, ProcessState state = null)
surface.FillColor=Colors.White;
surface.FillRectangle(new Rect(0, 0, width, height));
float padding = DEFAULT_PADDING / 2;
- definition.Diagrams.ForEach(d => {
+ definition.Diagrams.ForEach(d =>
+ {
surface.DrawImage(d.Render(state.Path, this.definition), DEFAULT_PADDING / 2, padding, d.Size.Width, d.Size.Height);
padding += d.Size.Height + DEFAULT_PADDING;
});
ret = image.Image;
if (outputVariables)
- ret = BusinessProcess.AppendVariables(ret, state);
+ ret = AppendVariables(ret, state);
}
catch (Exception e)
{
@@ -146,13 +147,13 @@ private static IImage AppendVariables(IImage diagram, ProcessState state)
internal byte[] Animate(bool outputVariables, ProcessState state)
{
- WriteLogLine((IElement)null, LogLevel.Information, new StackFrame(1, true), DateTime.Now, string.Format("Rendering Business Process Animation{0}", new object[] { (outputVariables ? " with variables" : " without variables") }));
+ WriteLogLine((IElement)null, LogLevel.Information, new StackFrame(1, true), DateTime.Now, string.Format("Rendering Business Process Animation{0}", [(outputVariables ? " with variables" : " without variables")]));
var result = Array.Empty();
try
{
state.Path.StartAnimation();
IImage bd = Diagram(false, state)??throw new DiagramException("Unable to create first diagram frame");
- AnimatedPNG apng = new((outputVariables ? BusinessProcess.AppendVariables(bd, state) : bd))
+ AnimatedPNG apng = new((outputVariables ? AppendVariables(bd, state) : bd))
{
DefaultFrameDelay= ANIMATION_DELAY
};
@@ -173,7 +174,7 @@ internal byte[] Animate(bool outputVariables, ProcessState state)
}
}
if (outputVariables)
- apng.AddFrame(BusinessProcess.ProduceVariablesImage(state), (int)Math.Ceiling(bd.Width + DEFAULT_PADDING), (int)DEFAULT_PADDING, delay: new TimeSpan(0, 0, 0));
+ apng.AddFrame(ProduceVariablesImage(state), (int)Math.Ceiling(bd.Width + DEFAULT_PADDING), (int)DEFAULT_PADDING, delay: new TimeSpan(0, 0, 0));
}
}
state.Path.FinishAnimation();
diff --git a/BPMNEngine/BusinessProcess.Logging.cs b/BPMNEngine/BusinessProcess.Logging.cs
index 19f0c7d..545c1b9 100644
--- a/BPMNEngine/BusinessProcess.Logging.cs
+++ b/BPMNEngine/BusinessProcess.Logging.cs
@@ -5,13 +5,13 @@ namespace BPMNEngine
public sealed partial class BusinessProcess
{
internal void WriteLogLine(string elementID, LogLevel level, StackFrame sf, DateTime timestamp, string message)
- => WriteLogLine((IElement)(elementID == null ? null : GetElement(elementID)), level, sf, timestamp, message);
+ => WriteLogLine((elementID == null ? null : GetElement(elementID)), level, sf, timestamp, message);
internal void WriteLogLine(IElement element, LogLevel level, StackFrame sf, DateTime timestamp, string message)
=> delegates.Logging.LogLine?.Invoke(element, sf.GetMethod().DeclaringType.Assembly.GetName(), sf.GetFileName(), sf.GetFileLineNumber(), level, timestamp, message);
internal Exception WriteLogException(string elementID, StackFrame sf, DateTime timestamp, Exception exception)
- => WriteLogException((IElement)(elementID == null ? null : GetElement(elementID)), sf, timestamp, exception);
+ => WriteLogException((elementID == null ? null : GetElement(elementID)), sf, timestamp, exception);
internal Exception WriteLogException(IElement element, StackFrame sf, DateTime timestamp, Exception exception)
{
diff --git a/BPMNEngine/BusinessProcess.State.cs b/BPMNEngine/BusinessProcess.State.cs
index a16849b..2983f89 100644
--- a/BPMNEngine/BusinessProcess.State.cs
+++ b/BPMNEngine/BusinessProcess.State.cs
@@ -1,4 +1,5 @@
using BPMNEngine.Interfaces.State;
+using System.Collections.Immutable;
using System.Text.Json;
namespace BPMNEngine
@@ -6,17 +7,19 @@ namespace BPMNEngine
public sealed partial class BusinessProcess
{
#region Xml State
- private static IInternalState LoadState(XmlDocument doc,int? stepIndex=null)
- {
- return ProcessState.LoadState(doc,stepIndex:stepIndex);
- }
+#pragma warning disable S4136 // Method overloads should be grouped together
+ private static IState LoadState(XmlDocument doc, int? stepIndex = null)
+#pragma warning restore S4136 // Method overloads should be grouped together
+ => ProcessState.LoadState(doc, stepIndex: stepIndex);
///
/// A Utility call used to extract the variable values from a Business Process State Document.
///
/// The State XML Document file to extract the values from
/// The variables extracted from the Process State Document
- public static Dictionary ExtractProcessVariablesFromStateDocument(XmlDocument doc)
+#pragma warning disable S4136 // Method overloads should be grouped together
+ public static IImmutableDictionary ExtractProcessVariablesFromStateDocument(XmlDocument doc)
+#pragma warning restore S4136 // Method overloads should be grouped together
=> LoadState(doc).Variables;
///
@@ -25,15 +28,17 @@ public static Dictionary ExtractProcessVariablesFromStateDocumen
/// The State XML Document file to extract the values from
/// The step index to extract the values at
/// The variables extracted from the Process State Document
- public static Dictionary ExtractProcessVariablesFromStateDocument(XmlDocument doc, int stepIndex)
- => LoadState(doc,stepIndex:stepIndex).Variables;
+ public static IImmutableDictionary ExtractProcessVariablesFromStateDocument(XmlDocument doc, int stepIndex)
+ => LoadState(doc, stepIndex: stepIndex).Variables;
///
/// A Utility call used to extract the steps from a Business Process State Document
///
/// The State XML Document file to extract the values from
/// The steps from the Process State Document
- public static IEnumerable ExtractProcessSteps(XmlDocument doc)
+#pragma warning disable S4136 // Method overloads should be grouped together
+ public static IImmutableList ExtractProcessSteps(XmlDocument doc)
+#pragma warning restore S4136 // Method overloads should be grouped together
=> LoadState(doc).Steps;
///
@@ -41,23 +46,23 @@ public static IEnumerable ExtractProcessSteps(XmlDocument doc)
///
/// The State XML Document file to extract the values from
/// The log from the Process State Document
+#pragma warning disable S4136 // Method overloads should be grouped together
public static string ExtractProcessLog(XmlDocument doc)
+#pragma warning restore S4136 // Method overloads should be grouped together
=> LoadState(doc).Log;
#endregion
#region Json State
- private static IInternalState LoadState(Utf8JsonReader reader, int? stepIndex = null)
- {
- return ProcessState.LoadState(reader, stepIndex: stepIndex);
- }
+ private static IState LoadState(Utf8JsonReader reader, int? stepIndex = null)
+ => ProcessState.LoadState(reader, stepIndex: stepIndex);
///
/// A Utility call used to extract the variable values from a Business Process State Document.
///
/// The State Json Document file to extract the values from
/// The variables extracted from the Process State Document
- public static Dictionary ExtractProcessVariablesFromStateDocument(Utf8JsonReader reader)
+ public static IImmutableDictionary ExtractProcessVariablesFromStateDocument(Utf8JsonReader reader)
=> LoadState(reader).Variables;
///
@@ -66,7 +71,7 @@ public static Dictionary ExtractProcessVariablesFromStateDocumen
/// The State Json Document file to extract the values from
/// The step index to extract the values at
/// The variables extracted from the Process State Document
- public static Dictionary ExtractProcessVariablesFromStateDocument(Utf8JsonReader reader, int stepIndex)
+ public static IImmutableDictionary ExtractProcessVariablesFromStateDocument(Utf8JsonReader reader, int stepIndex)
=> LoadState(reader, stepIndex: stepIndex).Variables;
///
@@ -74,7 +79,7 @@ public static Dictionary ExtractProcessVariablesFromStateDocumen
///
/// The State Json Document file to extract the values from
/// The steps from the Process State Document
- public static IEnumerable ExtractProcessSteps(Utf8JsonReader reader)
+ public static IImmutableList ExtractProcessSteps(Utf8JsonReader reader)
=> LoadState(reader).Steps;
///
diff --git a/BPMNEngine/BusinessProcess.cs b/BPMNEngine/BusinessProcess.cs
index 7cf1dba..dbf99aa 100644
--- a/BPMNEngine/BusinessProcess.cs
+++ b/BPMNEngine/BusinessProcess.cs
@@ -25,8 +25,8 @@ public sealed partial class BusinessProcess : IDisposable
private readonly IEnumerable eventHandlers = null;
private readonly Definition definition;
- internal IElement GetElement(string id) => Elements.FirstOrDefault(elem=>elem.ID==id);
- private IEnumerable Elements
+ internal IElement GetElement(string id) => Elements.FirstOrDefault(elem => elem.ID==id);
+ private IEnumerable Elements
=> components.OfType()
.Traverse(elem => (elem is IParentElement element ? element.Children : Array.Empty()));
@@ -49,7 +49,7 @@ public object this[string name]
return constants.FirstOrDefault(c => c.Name==name).Value;
if (definition==null || definition.ExtensionElement==null)
return null;
- var definitionVariable = ((ExtensionElements)definition.ExtensionElement).Children
+ var definitionVariable = definition.ExtensionElement.Children
.FirstOrDefault(elem =>
(elem is DefinitionVariable variable && variable.Name==name) ||
(elem is DefinitionFile file &&
@@ -64,31 +64,31 @@ public object this[string name]
}
}
-
+
internal IEnumerable Keys
{
get
{
if (definition==null || definition.ExtensionElement==null)
- return constants==null ? Array.Empty() : constants.Select(c => c.Name);
- return (constants==null ? Array.Empty() : constants.Select(c => c.Name))
+ return constants==null ? [] : constants.Select(c => c.Name);
+ return (constants==null ? [] : constants.Select(c => c.Name))
.Concat(
- ((ExtensionElements)definition.ExtensionElement)
+ definition.ExtensionElement
.Children
.OfType()
.Select(d => d.Name)
)
.Concat(
- ((ExtensionElements)definition.ExtensionElement)
+ definition.ExtensionElement
.Children
.OfType()
.Select(d => d.Name)
)
.Concat(
- ((ExtensionElements)definition.ExtensionElement)
+ definition.ExtensionElement
.Children
.OfType()
- .Select(d => string.Format("{0}.{1}", d.Name,d.Extension))
+ .Select(d => string.Format("{0}.{1}", d.Name, d.Extension))
)
.Distinct();
}
@@ -104,7 +104,7 @@ internal ATask GetTask(string taskID)
return null;
}
- internal void HandleTaskEmission(ProcessInstance instance, ITask task, object data, EventSubTypes type,out bool isAborted)
+ internal void HandleTaskEmission(ProcessInstance instance, ITask task, object data, EventSubTypes type, out bool isAborted)
{
var events = GetEventHandlers(type, data, (AFlowNode)GetElement(task.ID), new ReadOnlyProcessVariablesContainer(task.Variables));
events.ForEach(ahe => ProcessEvent(instance, task.ID, ahe));
@@ -123,29 +123,29 @@ internal void HandleTaskEmission(ProcessInstance instance, ITask task, object da
public BusinessProcess(XmlDocument doc,
IEnumerable constants = null,
ProcessEvents events = null,
- StepValidations validations=null,
- ProcessTasks tasks=null,
- ProcessLogging logging=null
+ StepValidations validations = null,
+ ProcessTasks tasks = null,
+ ProcessLogging logging = null
)
{
id = Guid.NewGuid();
this.constants = constants;
delegates = new DelegateContainer()
{
- Events=ProcessEvents.Merge(null,events),
- Validations=StepValidations.Merge(null,validations),
- Tasks=ProcessTasks.Merge(null,tasks),
- Logging=ProcessLogging.Merge(null,logging)
+ Events=ProcessEvents.Merge(null, events),
+ Validations=StepValidations.Merge(null, validations),
+ Tasks=ProcessTasks.Merge(null, tasks),
+ Logging=ProcessLogging.Merge(null, logging)
};
- IEnumerable exceptions = Array.Empty();
+ IEnumerable exceptions = [];
Document = new XmlDocument();
Document.LoadXml(doc.OuterXml);
var elementMapCache = new BPMNEngine.ElementTypeCache();
- DateTime start = DateTime.Now;
- WriteLogLine((IElement)null,LogLevel.Information,new StackFrame(1,true),DateTime.Now,"Producing new Business Process from XML Document");
- components = new List
- public class ProcessLogging
+ public record ProcessLogging
{
///
/// A delegate called to append a log line entry from the process
@@ -17,7 +17,7 @@ public class ProcessLogging
///
public LogException LogException { get; init; }
- internal static ProcessLogging Merge(ProcessLogging source,ProcessLogging append)
+ internal static ProcessLogging Merge(ProcessLogging source, ProcessLogging append)
{
source??=new ProcessLogging();
append??=new ProcessLogging();
diff --git a/BPMNEngine/DelegateContainers/ProcessTasks.cs b/BPMNEngine/DelegateContainers/ProcessTasks.cs
index dc0a809..a03bb8b 100644
--- a/BPMNEngine/DelegateContainers/ProcessTasks.cs
+++ b/BPMNEngine/DelegateContainers/ProcessTasks.cs
@@ -6,7 +6,7 @@
/// against all instances or at the BeginProcess level to defining it against a
/// specific instance
///
- public class ProcessTasks
+ public record ProcessTasks
{
///
/// A delegate called to execute a Business Rule Task
diff --git a/BPMNEngine/DelegateContainers/StepValidations.cs b/BPMNEngine/DelegateContainers/StepValidations.cs
index da9eaf2..b08cc4c 100644
--- a/BPMNEngine/DelegateContainers/StepValidations.cs
+++ b/BPMNEngine/DelegateContainers/StepValidations.cs
@@ -9,7 +9,7 @@ namespace BPMNEngine.DelegateContainers
/// against all instances or at the BeginProcess level to defining it against a
/// specific instance
///
- public class StepValidations
+ public record StepValidations
{
///
/// A delegate called to validate if an event can start
@@ -98,7 +98,7 @@ public class StepValidations
///
public IsFlowValid IsFlowValid { get; init; } = null;
- private static readonly Func DEFAULT_ACTION = new((elem, variables) => true);
+ private static readonly Func DEFAULT_ACTION = new((elem, variables) => true);
internal static StepValidations Merge(StepValidations source, StepValidations append)
{
source??=new();
diff --git a/BPMNEngine/Delegates.cs b/BPMNEngine/Delegates.cs
index de0992d..b599bb7 100644
--- a/BPMNEngine/Delegates.cs
+++ b/BPMNEngine/Delegates.cs
@@ -46,7 +46,7 @@ namespace BPMNEngine
/// }
///
///
- public delegate void OnElementAborted(IElement element,IElement source, IReadonlyVariables variables);
+ public delegate void OnElementAborted(IElement element, IElement source, IReadonlyVariables variables);
///
/// This delegate is implemented to get triggered when a Process has been started or completed.
@@ -107,7 +107,7 @@ namespace BPMNEngine
/// }
///
///
- public delegate void OnProcessErrorEvent(IElement process,IElement sourceElement, IReadonlyVariables variables);
+ public delegate void OnProcessErrorEvent(IElement process, IElement sourceElement, IReadonlyVariables variables);
///
/// This delegate is implemented to get triggered when the Process State changes. The state may not be usable externally without understanding its structure, however, capturing these events allows for the storage of a process state externally to be brought back in on a process restart.
@@ -373,8 +373,8 @@ namespace BPMNEngine
#endregion
#region internals
- internal delegate void ProcessStepComplete(string sourceID,string outgoingID);
- internal delegate void ProcessStepError(IElement step,Exception ex);
+ internal delegate void ProcessStepComplete(string sourceID, string outgoingID);
+ internal delegate void ProcessStepError(IElement step, Exception ex);
#endregion
#region Logging
@@ -389,7 +389,7 @@ namespace BPMNEngine
/// The log level for the entry
/// The timestamp of when the log entry occured
/// The log entry
- public delegate void LogLine(IElement callingElement,AssemblyName assembly, string fileName, int lineNumber, LogLevel level, DateTime timestamp, string message);
+ public delegate void LogLine(IElement callingElement, AssemblyName assembly, string fileName, int lineNumber, LogLevel level, DateTime timestamp, string message);
///
/// This delegate is implemented to be called when a Log Exception is made by a process. This can be used to log exceptions externally, to a file, database, or logging engine implemented outside of the library.
diff --git a/BPMNEngine/Drawing/AnimatedFrame.cs b/BPMNEngine/Drawing/AnimatedFrame.cs
index 9f23cd7..1c05e78 100644
--- a/BPMNEngine/Drawing/AnimatedFrame.cs
+++ b/BPMNEngine/Drawing/AnimatedFrame.cs
@@ -10,10 +10,10 @@ internal class AnimatedFrame : IDisposable
public TimeSpan? Delay { get; private init; }
public Size Size { get; private init; }
- private readonly Stream data;
+ private readonly MemoryStream data;
private bool disposedValue;
- public byte[] IHDR =>Find("IHDR")?[0];
+ public byte[] IHDR => Find("IHDR")?[0];
public List IDAT => Find("IDAT");
@@ -27,8 +27,8 @@ public AnimatedFrame(IImage image, int x, int y, TimeSpan? delay = null)
X = x;
Y = y;
Delay=delay;
- data = new MemoryStream();
- image.Save(data,ImageFormat.Png);
+ data = new();
+ image.Save(data, ImageFormat.Png);
}
private List Find(string search)
@@ -42,7 +42,7 @@ private List Find(string search)
{
data.Flush();
data.Position = i;
- var debug = data.Read(bytes, 0, search.Length);
+ data.Read(bytes, 0, search.Length);
i++;
if (bytes.SequenceEqual(searchBytes))
{
diff --git a/BPMNEngine/Drawing/AnimatedPNG.cs b/BPMNEngine/Drawing/AnimatedPNG.cs
index 89449ef..340e403 100644
--- a/BPMNEngine/Drawing/AnimatedPNG.cs
+++ b/BPMNEngine/Drawing/AnimatedPNG.cs
@@ -1,10 +1,12 @@
-using Microsoft.Maui.Graphics;
-using BPMNEngine.Elements;
+using BPMNEngine.Elements;
+using Microsoft.Maui.Graphics;
using System.IO;
namespace BPMNEngine.Drawing
{
+#pragma warning disable S101 // Types should be named in PascalCase
internal class AnimatedPNG : IDisposable
+#pragma warning restore S101 // Types should be named in PascalCase
{
internal class CrcCalculator
{
@@ -51,79 +53,66 @@ public AnimatedPNG(IImage initialImage)
surface.FillColor = Colors.White;
surface.FillRectangle(0, 0, initialImage.Width, initialImage.Height);
surface.DrawImage(initialImage, 0, 0, g.Width, g.Height);
- parts = new List()
- {
- new AnimatedFrame(g.Image)
- };
+ parts = [new(g.Image)];
}
- public void AddFrame(IImage image,int x,int y,TimeSpan? delay=null)
- {
- parts.Add(new AnimatedFrame(image,x,y,delay:delay));
- }
+ public void AddFrame(IImage image, int x, int y, TimeSpan? delay = null)
+ => parts.Add(new AnimatedFrame(image, x, y, delay: delay));
- private static readonly byte[] SIGNATURE = { 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A };
- private static readonly Byte[] IEND = { 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4E, 0x44, 0xAE, 0x42, 0x60, 0x82 };
+ private static readonly byte[] SIGNATURE = [0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A];
+ private static readonly Byte[] IEND = [0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4E, 0x44, 0xAE, 0x42, 0x60, 0x82];
+ private bool disposedValue;
public byte[] ToBinary()
{
- byte[] result = null;
- using (var memoryStream = new MemoryStream())
+ using var memoryStream = new MemoryStream();
+ WriteHeader(memoryStream);
+ var idx = 0;
+ int chunkSequenceNumber = 0;
+ parts.ForEach(part =>
{
- WriteHeader(memoryStream);
-
- var idx = 0;
- int chunkSequenceNumber = 0;
- parts.ForEach(part =>
- {
- WriteFrameHeader(memoryStream, part, ref chunkSequenceNumber);
- AnimatedPNG.WriteFrame(memoryStream, idx, part, ref chunkSequenceNumber);
- idx++;
- });
- AnimatedPNG.Write(memoryStream, IEND);
-
- result = memoryStream.ToArray();
- }
- return result;
+ WriteFrameHeader(memoryStream, part, ref chunkSequenceNumber);
+ AnimatedPNG.WriteFrame(memoryStream, idx, part, ref chunkSequenceNumber);
+ idx++;
+ });
+ AnimatedPNG.Write(memoryStream, IEND);
+ return memoryStream.ToArray();
}
- private static void WriteFrame(Stream output,int idx,AnimatedFrame part,ref int chunkSequenceNumber)
+ private static void WriteFrame(Stream output, int idx, AnimatedFrame part, ref int chunkSequenceNumber)
{
if (idx==0)
- AnimatedPNG.Write(output, part.IDAT.SelectMany(c=>c));
+ AnimatedPNG.Write(output, part.IDAT.SelectMany(c => c));
else
{
var sequenceNumber = chunkSequenceNumber;
- part.IDAT.ForEach(idat =>
- {
- if (idat != null)
+ part.IDAT
+ .Where(idat => idat!=null)
+ .ForEach(idat =>
{
- using (var memoryStream = new MemoryStream())
- {
+ using var memoryStream = new MemoryStream();
- var length = idat.Length - 8;
- AnimatedPNG.Write(memoryStream, length);
- AnimatedPNG.Write(memoryStream, "fdAT");
- AnimatedPNG.Write(memoryStream, sequenceNumber);
+ var length = idat.Length - 8;
+ AnimatedPNG.Write(memoryStream, length);
+ AnimatedPNG.Write(memoryStream, "fdAT");
+ AnimatedPNG.Write(memoryStream, sequenceNumber);
- AnimatedPNG.Write(memoryStream, idat.Take(idat.Length-4).Skip(8));
+ AnimatedPNG.Write(memoryStream, idat.Take(idat.Length-4).Skip(8));
- var data = memoryStream.ToArray();
+ var data = memoryStream.ToArray();
- AnimatedPNG.Write(output, data);
- AnimatedPNG.WriteCRC(output, data);
- }
+ AnimatedPNG.Write(output, data);
+ AnimatedPNG.WriteCRC(output, data);
sequenceNumber++;
- }
- });
+ });
chunkSequenceNumber=sequenceNumber;
}
}
- private void WriteFrameHeader(Stream output, AnimatedFrame part,ref int chunkSequenceNumber)
+ private void WriteFrameHeader(Stream output, AnimatedFrame part, ref int chunkSequenceNumber)
{
- AnimatedPNG.Write(output, new byte[] { 0, 0, 0, 26 });
+ AnimatedPNG.Write(output, [0, 0, 0, 26]);
using var memoryStream = new MemoryStream();
AnimatedPNG.Write(memoryStream, "fcTL");
AnimatedPNG.Write(memoryStream, chunkSequenceNumber);
@@ -132,7 +121,7 @@ private void WriteFrameHeader(Stream output, AnimatedFrame part,ref int chunkSeq
AnimatedPNG.Write(memoryStream, part.X);
AnimatedPNG.Write(memoryStream, part.Y);
AnimatedPNG.Write(memoryStream, part.Delay ?? DefaultFrameDelay);
- AnimatedPNG.Write(memoryStream, new byte[] { 0, 1 });
+ AnimatedPNG.Write(memoryStream, [0, 1]);
chunkSequenceNumber++;
var data = memoryStream.ToArray();
AnimatedPNG.Write(output, data);
@@ -143,11 +132,11 @@ private void WriteHeader(Stream output)
{
AnimatedPNG.Write(output, SIGNATURE);
- var frame = parts.First();
+ var frame = parts[0];
AnimatedPNG.Write(output, frame.IHDR);
- var textSignature = "Software Reddragonit " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Name + "_" +
+ var textSignature = "Software Roger Castaldo " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Name + "_" +
System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
AnimatedPNG.Write(output, textSignature.Length);
@@ -155,16 +144,14 @@ private void WriteHeader(Stream output)
AnimatedPNG.WriteCRC(output, "tEXt"+textSignature);
AnimatedPNG.Write(output, 8);
- AnimatedPNG.Write(output,"acTL");
- AnimatedPNG.Write(output,parts.Count);
+ AnimatedPNG.Write(output, "acTL");
+ AnimatedPNG.Write(output, parts.Count);
AnimatedPNG.Write(output, 0);
AnimatedPNG.Write(output, 0);
}
- private static void Write(Stream output,IEnumerable data)
- {
- AnimatedPNG.Write(output,data.ToArray());
- }
+ private static void Write(Stream output, IEnumerable data)
+ => AnimatedPNG.Write(output, data.ToArray());
private static void Write(Stream output, byte[] data)
{
@@ -172,41 +159,45 @@ private static void Write(Stream output, byte[] data)
output.Write(data, 0, data.Length);
}
- private static void Write(Stream output,int value)
- {
- AnimatedPNG.Write(output, BitConverter.GetBytes(value).Reverse().ToArray());
- }
+ private static void Write(Stream output, int value)
+ => AnimatedPNG.Write(output, BitConverter.GetBytes(value).Reverse().ToArray());
private static void Write(Stream output, uint value)
- {
- AnimatedPNG.Write(output, BitConverter.GetBytes(value).Reverse().ToArray());
- }
+ => AnimatedPNG.Write(output, BitConverter.GetBytes(value).Reverse().ToArray());
- private static void Write(Stream output,string value)
- {
- AnimatedPNG.Write(output,value.ToCharArray().Select(c=>(byte)c).ToArray());
- }
+ private static void Write(Stream output, string value)
+ => AnimatedPNG.Write(output, value.ToCharArray().Select(c => (byte)c).ToArray());
- private static void Write(Stream output,TimeSpan timespan)
+ private static void Write(Stream output, TimeSpan timespan)
{
- AnimatedPNG.Write(output,BitConverter.GetBytes((short)timespan.TotalSeconds).Reverse().ToArray());
+ AnimatedPNG.Write(output, BitConverter.GetBytes((short)timespan.TotalSeconds).Reverse().ToArray());
AnimatedPNG.Write(output, BitConverter.GetBytes((short)1).Reverse().ToArray());
}
private static void WriteCRC(Stream output, byte[] value)
- {
- AnimatedPNG.Write(output, new CrcCalculator().GetCRC32(value));
- }
+ => AnimatedPNG.Write(output, new CrcCalculator().GetCRC32(value));
+
+ private static void WriteCRC(Stream output, string value)
+ => AnimatedPNG.WriteCRC(output, value.ToCharArray().Select(c => (byte)c).ToArray());
- private static void WriteCRC(Stream output,string value)
+ protected virtual void Dispose(bool disposing)
{
- AnimatedPNG.WriteCRC(output, value.ToCharArray().Select(c => (byte)c).ToArray());
+ if (!disposedValue)
+ {
+ if (disposing)
+ {
+ parts.ForEach(part => part.Dispose());
+ parts.Clear();
+ }
+ disposedValue=true;
+ }
}
public void Dispose()
{
- parts.ForEach(part => part.Dispose());
- parts.Clear();
+ // Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
+ Dispose(disposing: true);
+ GC.SuppressFinalize(this);
}
}
}
diff --git a/BPMNEngine/Drawing/IRenderingElement.cs b/BPMNEngine/Drawing/IRenderingElement.cs
index 6cd0ddf..409d69e 100644
--- a/BPMNEngine/Drawing/IRenderingElement.cs
+++ b/BPMNEngine/Drawing/IRenderingElement.cs
@@ -1,6 +1,6 @@
-using Microsoft.Maui.Graphics;
-using BPMNEngine.Elements;
+using BPMNEngine.Elements;
using BPMNEngine.State;
+using Microsoft.Maui.Graphics;
namespace BPMNEngine.Drawing
{
diff --git a/BPMNEngine/Drawing/IconGraphic.cs b/BPMNEngine/Drawing/IconGraphic.cs
index abad16b..926c160 100644
--- a/BPMNEngine/Drawing/IconGraphic.cs
+++ b/BPMNEngine/Drawing/IconGraphic.cs
@@ -1,29 +1,24 @@
-using Microsoft.Maui.Graphics;
-using BPMNEngine.Drawing.Icons;
-
+using BPMNEngine.Drawing.Icons;
using BPMNEngine.Elements.Diagrams;
+using Microsoft.Maui.Graphics;
using System.Reflection;
namespace BPMNEngine.Drawing
{
internal static class IconGraphic
{
- private static readonly Dictionary icons;
-
- static IconGraphic()
- {
- icons = new Dictionary();
- Assembly.GetAssembly(typeof(IconGraphic)).GetTypes().Where(t => t.IsSubclassOf(typeof(AIcon))).ForEach(t =>
- {
- object obj = t.GetCustomAttribute(typeof(IconTypeAttribute));
- if (obj != null)
- icons.Add(((IconTypeAttribute)obj).Icon, (AIcon)Activator.CreateInstance(t));
- });
- }
+ private static readonly Dictionary icons
+ = new(
+ Assembly.GetAssembly(typeof(IconGraphic)).GetTypes()
+ .Where(t => t.IsSubclassOf(typeof(AIcon)))
+ .Select(t => new { Type = t, IconType = t.GetCustomAttribute() })
+ .Where(ai => ai.IconType!=null)
+ .Select(ai => new KeyValuePair(ai.IconType.Icon, (AIcon)Activator.CreateInstance(ai.Type)))
+ );
- public static void AppendIcon(Rect destination,BPMIcons icon, ICanvas surface,Color color)
+ public static void AppendIcon(Rect destination, BPMIcons icon, ICanvas surface, Color color)
{
- if (icons.TryGetValue(icon,out AIcon aIcon))
+ if (icons.TryGetValue(icon, out AIcon aIcon))
aIcon.Draw(destination, surface, color);
}
}
diff --git a/BPMNEngine/Drawing/Icons/AIcon.cs b/BPMNEngine/Drawing/Icons/AIcon.cs
index 580e57d..668b9cf 100644
--- a/BPMNEngine/Drawing/Icons/AIcon.cs
+++ b/BPMNEngine/Drawing/Icons/AIcon.cs
@@ -1,7 +1,7 @@
-using Microsoft.Maui.Graphics;
-using Microsoft.Maui.Graphics.Skia;
-using BPMNEngine.Drawing.Icons.IconParts;
+using BPMNEngine.Drawing.Icons.IconParts;
using BPMNEngine.Elements;
+using Microsoft.Maui.Graphics;
+using Microsoft.Maui.Graphics.Skia;
namespace BPMNEngine.Drawing.Icons
{
@@ -9,27 +9,26 @@ internal abstract class AIcon
{
public const int IMAGE_SIZE = 46;
- private readonly Dictionary cache = new();
+ private readonly Dictionary cache = [];
protected virtual int ImageSize => IMAGE_SIZE;
- protected virtual IIconPart[] Parts => Array.Empty();
+ protected virtual IIconPart[] Parts => [];
protected virtual void InternalDraw(ICanvas surface, Color color)
- {
- Parts.ForEach(part => { part.Add(surface, ImageSize, color); });
- }
+ => Parts.ForEach(part => { part.Add(surface, ImageSize, color); });
public void Draw(RectF container, ICanvas surface, Color color)
{
lock (cache)
{
- if (!cache.ContainsKey(color))
+ if (!cache.TryGetValue(color, out SkiaBitmapExportContext value))
{
- var image = Diagram.ProduceImage(ImageSize, ImageSize);
+ var image = Diagram.ProduceImage(ImageSize, ImageSize);
var canvas = image.Canvas;
canvas.FillColor = Colors.White;
- canvas.FillRectangle(0,0,ImageSize, ImageSize);
+ canvas.FillRectangle(0, 0, ImageSize, ImageSize);
InternalDraw(canvas, color);
- cache.Add(color, image);
+ value=image;
+ cache.Add(color, value);
}
- surface.DrawImage(cache[color].Image, container.X,container.Y,container.Width,container.Height);
+ surface.DrawImage(value.Image, container.X, container.Y, container.Width, container.Height);
}
}
}
diff --git a/BPMNEngine/Drawing/Icons/Events/CompensationEndEvent.cs b/BPMNEngine/Drawing/Icons/Events/CompensationEndEvent.cs
index eb0e3aa..3acc0ef 100644
--- a/BPMNEngine/Drawing/Icons/Events/CompensationEndEvent.cs
+++ b/BPMNEngine/Drawing/Icons/Events/CompensationEndEvent.cs
@@ -5,14 +5,11 @@ namespace BPMNEngine.Drawing.Icons.Events
[IconTypeAttribute(Elements.Diagrams.BPMIcons.CompensationEndEvent)]
internal class CompensationEndEvent : AIcon
{
- private static readonly IIconPart[] _PARTS = new IIconPart[] {
+ private static readonly IIconPart[] _PARTS = [
new ThickCircle(),
new Rewind(true)
- };
+ ];
- protected override IIconPart[] Parts
- {
- get { return _PARTS; }
- }
+ protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/Drawing/Icons/Events/CompensationIntermediateThrowEvent.cs b/BPMNEngine/Drawing/Icons/Events/CompensationIntermediateThrowEvent.cs
index e429c51..36c3d80 100644
--- a/BPMNEngine/Drawing/Icons/Events/CompensationIntermediateThrowEvent.cs
+++ b/BPMNEngine/Drawing/Icons/Events/CompensationIntermediateThrowEvent.cs
@@ -5,15 +5,12 @@ namespace BPMNEngine.Drawing.Icons.Events
[IconTypeAttribute(Elements.Diagrams.BPMIcons.CompensationIntermediateThrowEvent)]
internal class CompensationIntermediateThrowEvent : AIcon
{
- private static readonly IIconPart[] _PARTS = new IIconPart[] {
+ private static readonly IIconPart[] _PARTS = [
new OuterCircle(),
new InnerCircle(),
new Rewind(true)
- };
+ ];
- protected override IIconPart[] Parts
- {
- get { return _PARTS; }
- }
+ protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/Drawing/Icons/Events/ConditionalIntermediateCatchEvent.cs b/BPMNEngine/Drawing/Icons/Events/ConditionalIntermediateCatchEvent.cs
index c24b0e3..fb2b82c 100644
--- a/BPMNEngine/Drawing/Icons/Events/ConditionalIntermediateCatchEvent.cs
+++ b/BPMNEngine/Drawing/Icons/Events/ConditionalIntermediateCatchEvent.cs
@@ -5,15 +5,12 @@ namespace BPMNEngine.Drawing.Icons.Events
[IconTypeAttribute(Elements.Diagrams.BPMIcons.ConditionalIntermediateCatchEvent)]
internal class ConditionalIntermediateCatchEvent : AIcon
{
- private static readonly IIconPart[] _PARTS = new IIconPart[] {
+ private static readonly IIconPart[] _PARTS = [
new OuterCircle(),
new InnerCircle(),
new Note()
- };
+ ];
- protected override IIconPart[] Parts
- {
- get { return _PARTS; }
- }
+ protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/Drawing/Icons/Events/ConditionalStartEvent.cs b/BPMNEngine/Drawing/Icons/Events/ConditionalStartEvent.cs
index cc0d471..1e39bb1 100644
--- a/BPMNEngine/Drawing/Icons/Events/ConditionalStartEvent.cs
+++ b/BPMNEngine/Drawing/Icons/Events/ConditionalStartEvent.cs
@@ -5,14 +5,11 @@ namespace BPMNEngine.Drawing.Icons.Events
[IconTypeAttribute(Elements.Diagrams.BPMIcons.ConditionalStartEvent)]
internal class ConditionalStartEvent : AIcon
{
- private static readonly IIconPart[] _PARTS = new IIconPart[] {
+ private static readonly IIconPart[] _PARTS = [
new OuterCircle(),
new Note()
- };
+ ];
- protected override IIconPart[] Parts
- {
- get { return _PARTS; }
- }
+ protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/Drawing/Icons/Events/EndEvent.cs b/BPMNEngine/Drawing/Icons/Events/EndEvent.cs
index 6d9cb9b..e97b09d 100644
--- a/BPMNEngine/Drawing/Icons/Events/EndEvent.cs
+++ b/BPMNEngine/Drawing/Icons/Events/EndEvent.cs
@@ -5,11 +5,11 @@ namespace BPMNEngine.Drawing.Icons.Events
[IconTypeAttribute(Elements.Diagrams.BPMIcons.EndEvent)]
internal class EndEvent : AIcon
{
- private static readonly IIconPart[] _PARTS = new IIconPart[]
- {
+ private static readonly IIconPart[] _PARTS =
+ [
new ThickCircle()
- };
+ ];
- protected override IIconPart[] Parts { get { return _PARTS; } }
+ protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/Drawing/Icons/Events/ErrorEndEvent.cs b/BPMNEngine/Drawing/Icons/Events/ErrorEndEvent.cs
index 2688f04..1fc8c9d 100644
--- a/BPMNEngine/Drawing/Icons/Events/ErrorEndEvent.cs
+++ b/BPMNEngine/Drawing/Icons/Events/ErrorEndEvent.cs
@@ -5,14 +5,11 @@ namespace BPMNEngine.Drawing.Icons.Events
[IconTypeAttribute(Elements.Diagrams.BPMIcons.ErrorEndEvent)]
internal class ErrorEndEvent : AIcon
{
- private static readonly IIconPart[] _PARTS = new IIconPart[] {
+ private static readonly IIconPart[] _PARTS = [
new ThickCircle(),
new Bolt(true)
- };
+ ];
- protected override IIconPart[] Parts
- {
- get { return _PARTS; }
- }
+ protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/Drawing/Icons/Events/EscalationEndEvent.cs b/BPMNEngine/Drawing/Icons/Events/EscalationEndEvent.cs
index 5005e86..5f8654a 100644
--- a/BPMNEngine/Drawing/Icons/Events/EscalationEndEvent.cs
+++ b/BPMNEngine/Drawing/Icons/Events/EscalationEndEvent.cs
@@ -5,14 +5,11 @@ namespace BPMNEngine.Drawing.Icons.Events
[IconTypeAttribute(Elements.Diagrams.BPMIcons.EscalationEndEvent)]
internal class EscalationEndEvent : AIcon
{
- private static readonly IIconPart[] _PARTS = new IIconPart[] {
+ private static readonly IIconPart[] _PARTS = [
new ThickCircle(),
new UpArrow(true)
- };
+ ];
- protected override IIconPart[] Parts
- {
- get { return _PARTS; }
- }
+ protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/Drawing/Icons/Events/EscalationIntermediateThrowEvent.cs b/BPMNEngine/Drawing/Icons/Events/EscalationIntermediateThrowEvent.cs
index a070126..b1f1a51 100644
--- a/BPMNEngine/Drawing/Icons/Events/EscalationIntermediateThrowEvent.cs
+++ b/BPMNEngine/Drawing/Icons/Events/EscalationIntermediateThrowEvent.cs
@@ -5,15 +5,12 @@ namespace BPMNEngine.Drawing.Icons.Events
[IconTypeAttribute(Elements.Diagrams.BPMIcons.EscalationIntermediateThrowEvent)]
internal class EscalationIntermediateThrowEvent : AIcon
{
- private static readonly IIconPart[] _PARTS = new IIconPart[] {
+ private static readonly IIconPart[] _PARTS = [
new OuterCircle(),
new InnerCircle(),
new UpArrow(true)
- };
+ ];
- protected override IIconPart[] Parts
- {
- get { return _PARTS; }
- }
+ protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/Drawing/Icons/Events/IntermediateThrowEvent.cs b/BPMNEngine/Drawing/Icons/Events/IntermediateThrowEvent.cs
index 17f246e..17d32c0 100644
--- a/BPMNEngine/Drawing/Icons/Events/IntermediateThrowEvent.cs
+++ b/BPMNEngine/Drawing/Icons/Events/IntermediateThrowEvent.cs
@@ -5,14 +5,11 @@ namespace BPMNEngine.Drawing.Icons.Events
[IconTypeAttribute(Elements.Diagrams.BPMIcons.IntermediateThrowEvent)]
internal class IntermediateThrowEvent : AIcon
{
- private static readonly IIconPart[] _PARTS = new IIconPart[] {
+ private static readonly IIconPart[] _PARTS = [
new OuterCircle(),
new InnerCircle()
- };
+ ];
- protected override IIconPart[] Parts
- {
- get { return _PARTS; }
- }
+ protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/Drawing/Icons/Events/InteruptingCompensationBoundaryEvent.cs b/BPMNEngine/Drawing/Icons/Events/InteruptingCompensationBoundaryEvent.cs
index 84034a9..7947786 100644
--- a/BPMNEngine/Drawing/Icons/Events/InteruptingCompensationBoundaryEvent.cs
+++ b/BPMNEngine/Drawing/Icons/Events/InteruptingCompensationBoundaryEvent.cs
@@ -5,15 +5,12 @@ namespace BPMNEngine.Drawing.Icons.Events
[IconTypeAttribute(Elements.Diagrams.BPMIcons.InteruptingCompensationBoundaryEvent)]
internal class InteruptingCompensationBoundaryEvent : AIcon
{
- private static readonly IIconPart[] _PARTS = new IIconPart[] {
+ private static readonly IIconPart[] _PARTS = [
new OuterCircle(),
new InnerCircle(),
new Rewind(false)
- };
+ ];
- protected override IIconPart[] Parts
- {
- get { return _PARTS; }
- }
+ protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/Drawing/Icons/Events/InteruptingConditionalBoundaryEvent.cs b/BPMNEngine/Drawing/Icons/Events/InteruptingConditionalBoundaryEvent.cs
index 0c73d03..07437cc 100644
--- a/BPMNEngine/Drawing/Icons/Events/InteruptingConditionalBoundaryEvent.cs
+++ b/BPMNEngine/Drawing/Icons/Events/InteruptingConditionalBoundaryEvent.cs
@@ -5,15 +5,12 @@ namespace BPMNEngine.Drawing.Icons.Events
[IconTypeAttribute(Elements.Diagrams.BPMIcons.InteruptingConditionalBoundaryEvent)]
internal class InteruptingConditionalBoundaryEvent : AIcon
{
- private static readonly IIconPart[] _PARTS = new IIconPart[] {
+ private static readonly IIconPart[] _PARTS = [
new OuterCircle(),
new InnerCircle(),
new Note()
- };
+ ];
- protected override IIconPart[] Parts
- {
- get { return _PARTS; }
- }
+ protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/Drawing/Icons/Events/InteruptingErrorBoundaryEvent.cs b/BPMNEngine/Drawing/Icons/Events/InteruptingErrorBoundaryEvent.cs
index d82121e..87cb521 100644
--- a/BPMNEngine/Drawing/Icons/Events/InteruptingErrorBoundaryEvent.cs
+++ b/BPMNEngine/Drawing/Icons/Events/InteruptingErrorBoundaryEvent.cs
@@ -5,15 +5,12 @@ namespace BPMNEngine.Drawing.Icons.Events
[IconTypeAttribute(Elements.Diagrams.BPMIcons.InteruptingErrorBoundaryEvent)]
internal class InteruptingErrorBoundaryEvent : AIcon
{
- private static readonly IIconPart[] _PARTS = new IIconPart[] {
+ private static readonly IIconPart[] _PARTS = [
new OuterCircle(),
new InnerCircle(),
new Bolt(false)
- };
+ ];
- protected override IIconPart[] Parts
- {
- get { return _PARTS; }
- }
+ protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/Drawing/Icons/Events/InteruptingEscalationBoundaryEvent.cs b/BPMNEngine/Drawing/Icons/Events/InteruptingEscalationBoundaryEvent.cs
index 986faca..3b1c370 100644
--- a/BPMNEngine/Drawing/Icons/Events/InteruptingEscalationBoundaryEvent.cs
+++ b/BPMNEngine/Drawing/Icons/Events/InteruptingEscalationBoundaryEvent.cs
@@ -5,15 +5,12 @@ namespace BPMNEngine.Drawing.Icons.Events
[IconTypeAttribute(Elements.Diagrams.BPMIcons.InteruptingEscalationBoundaryEvent)]
internal class InteruptingEscalationBoundaryEvent : AIcon
{
- private static readonly IIconPart[] _PARTS = new IIconPart[] {
+ private static readonly IIconPart[] _PARTS = [
new OuterCircle(),
new InnerCircle(),
new UpArrow(false)
- };
+ ];
- protected override IIconPart[] Parts
- {
- get { return _PARTS; }
- }
+ protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/Drawing/Icons/Events/InteruptingMessageBoundaryEvent.cs b/BPMNEngine/Drawing/Icons/Events/InteruptingMessageBoundaryEvent.cs
index df5dfe4..7281ab2 100644
--- a/BPMNEngine/Drawing/Icons/Events/InteruptingMessageBoundaryEvent.cs
+++ b/BPMNEngine/Drawing/Icons/Events/InteruptingMessageBoundaryEvent.cs
@@ -5,15 +5,12 @@ namespace BPMNEngine.Drawing.Icons.Events
[IconTypeAttribute(Elements.Diagrams.BPMIcons.InteruptingMessageBoundaryEvent)]
internal class InteruptingMessageBoundaryEvent : AIcon
{
- private static readonly IIconPart[] _PARTS = new IIconPart[] {
+ private static readonly IIconPart[] _PARTS = [
new OuterCircle(),
new InnerCircle(),
new Envelope(false,false)
- };
+ ];
- protected override IIconPart[] Parts
- {
- get { return _PARTS; }
- }
+ protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/Drawing/Icons/Events/InteruptingSignalBoundaryEvent.cs b/BPMNEngine/Drawing/Icons/Events/InteruptingSignalBoundaryEvent.cs
index ed7b32b..153fcde 100644
--- a/BPMNEngine/Drawing/Icons/Events/InteruptingSignalBoundaryEvent.cs
+++ b/BPMNEngine/Drawing/Icons/Events/InteruptingSignalBoundaryEvent.cs
@@ -5,15 +5,12 @@ namespace BPMNEngine.Drawing.Icons.Events
[IconTypeAttribute(Elements.Diagrams.BPMIcons.InteruptingSignalBoundaryEvent)]
internal class InteruptingSignalBoundaryEvent : AIcon
{
- private static readonly IIconPart[] _PARTS = new IIconPart[] {
+ private static readonly IIconPart[] _PARTS = [
new OuterCircle(),
new InnerCircle(),
new Triangle(false)
- };
+ ];
- protected override IIconPart[] Parts
- {
- get { return _PARTS; }
- }
+ protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/Drawing/Icons/Events/InteruptingTimerBoundaryEvent.cs b/BPMNEngine/Drawing/Icons/Events/InteruptingTimerBoundaryEvent.cs
index 2189317..a4f6aa0 100644
--- a/BPMNEngine/Drawing/Icons/Events/InteruptingTimerBoundaryEvent.cs
+++ b/BPMNEngine/Drawing/Icons/Events/InteruptingTimerBoundaryEvent.cs
@@ -5,15 +5,12 @@ namespace BPMNEngine.Drawing.Icons.Events
[IconTypeAttribute(Elements.Diagrams.BPMIcons.InteruptingTimerBoundaryEvent)]
internal class InteruptingTimerBoundaryEvent : AIcon
{
- private static readonly IIconPart[] _PARTS = new IIconPart[] {
+ private static readonly IIconPart[] _PARTS = [
new OuterCircle(),
new InnerCircle(),
new Clock()
- };
+ ];
- protected override IIconPart[] Parts
- {
- get { return _PARTS; }
- }
+ protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/Drawing/Icons/Events/LinkIntermediateCatchEvent.cs b/BPMNEngine/Drawing/Icons/Events/LinkIntermediateCatchEvent.cs
index 93768f7..0c4c5a2 100644
--- a/BPMNEngine/Drawing/Icons/Events/LinkIntermediateCatchEvent.cs
+++ b/BPMNEngine/Drawing/Icons/Events/LinkIntermediateCatchEvent.cs
@@ -5,15 +5,12 @@ namespace BPMNEngine.Drawing.Icons.Events
[IconTypeAttribute(Elements.Diagrams.BPMIcons.LinkIntermediateCatchEvent)]
internal class LinkIntermediateCatchEvent : AIcon
{
- private static readonly IIconPart[] _PARTS = new IIconPart[] {
+ private static readonly IIconPart[] _PARTS = [
new OuterCircle(),
new InnerCircle(),
new RightArrow(false)
- };
+ ];
- protected override IIconPart[] Parts
- {
- get { return _PARTS; }
- }
+ protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/Drawing/Icons/Events/LinkIntermediateThrowEvent.cs b/BPMNEngine/Drawing/Icons/Events/LinkIntermediateThrowEvent.cs
index 0cbabfc..c5349db 100644
--- a/BPMNEngine/Drawing/Icons/Events/LinkIntermediateThrowEvent.cs
+++ b/BPMNEngine/Drawing/Icons/Events/LinkIntermediateThrowEvent.cs
@@ -5,15 +5,12 @@ namespace BPMNEngine.Drawing.Icons.Events
[IconTypeAttribute(Elements.Diagrams.BPMIcons.LinkIntermediateThrowEvent)]
internal class LinkIntermediateThrowEvent : AIcon
{
- private static readonly IIconPart[] _PARTS = new IIconPart[] {
+ private static readonly IIconPart[] _PARTS = [
new OuterCircle(),
new InnerCircle(),
new RightArrow(true)
- };
+ ];
- protected override IIconPart[] Parts
- {
- get { return _PARTS; }
- }
+ protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/Drawing/Icons/Events/MessageEndEvent.cs b/BPMNEngine/Drawing/Icons/Events/MessageEndEvent.cs
index 5c7f70a..fa2df42 100644
--- a/BPMNEngine/Drawing/Icons/Events/MessageEndEvent.cs
+++ b/BPMNEngine/Drawing/Icons/Events/MessageEndEvent.cs
@@ -5,14 +5,11 @@ namespace BPMNEngine.Drawing.Icons.Events
[IconTypeAttribute(Elements.Diagrams.BPMIcons.MessageEndEvent)]
internal class MessageEndEvent : AIcon
{
- private static readonly IIconPart[] _PARTS = new IIconPart[] {
+ private static readonly IIconPart[] _PARTS = [
new ThickCircle(),
new Envelope(true,false)
- };
+ ];
- protected override IIconPart[] Parts
- {
- get { return _PARTS; }
- }
+ protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/Drawing/Icons/Events/MessageIntermediateCatchEvent.cs b/BPMNEngine/Drawing/Icons/Events/MessageIntermediateCatchEvent.cs
index 06d54e5..508e12d 100644
--- a/BPMNEngine/Drawing/Icons/Events/MessageIntermediateCatchEvent.cs
+++ b/BPMNEngine/Drawing/Icons/Events/MessageIntermediateCatchEvent.cs
@@ -5,15 +5,12 @@ namespace BPMNEngine.Drawing.Icons.Events
[IconTypeAttribute(Elements.Diagrams.BPMIcons.MessageIntermediateCatchEvent)]
internal class MessageIntermediateCatchEvent : AIcon
{
- private static readonly IIconPart[] _PARTS = new IIconPart[] {
+ private static readonly IIconPart[] _PARTS = [
new OuterCircle(),
new InnerCircle(),
new Envelope(false,false)
- };
+ ];
- protected override IIconPart[] Parts
- {
- get { return _PARTS; }
- }
+ protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/Drawing/Icons/Events/MessageIntermediateThrowEvent.cs b/BPMNEngine/Drawing/Icons/Events/MessageIntermediateThrowEvent.cs
index 88b3dc3..583df99 100644
--- a/BPMNEngine/Drawing/Icons/Events/MessageIntermediateThrowEvent.cs
+++ b/BPMNEngine/Drawing/Icons/Events/MessageIntermediateThrowEvent.cs
@@ -5,15 +5,12 @@ namespace BPMNEngine.Drawing.Icons.Events
[IconTypeAttribute(Elements.Diagrams.BPMIcons.MessageIntermediateThrowEvent)]
internal class MessageIntermediateThrowEvent : AIcon
{
- private static readonly IIconPart[] _PARTS = new IIconPart[] {
+ private static readonly IIconPart[] _PARTS = [
new OuterCircle(),
new InnerCircle(),
new Envelope(true,false)
- };
+ ];
- protected override IIconPart[] Parts
- {
- get { return _PARTS; }
- }
+ protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/Drawing/Icons/Events/MessageStartEvent.cs b/BPMNEngine/Drawing/Icons/Events/MessageStartEvent.cs
index fc70ef7..b0f3602 100644
--- a/BPMNEngine/Drawing/Icons/Events/MessageStartEvent.cs
+++ b/BPMNEngine/Drawing/Icons/Events/MessageStartEvent.cs
@@ -5,14 +5,11 @@ namespace BPMNEngine.Drawing.Icons.Events
[IconTypeAttribute(Elements.Diagrams.BPMIcons.MessageStartEvent)]
internal class MessageStartEvent : AIcon
{
- private static readonly IIconPart[] _PARTS = new IIconPart[] {
+ private static readonly IIconPart[] _PARTS = [
new OuterCircle(),
new Envelope(false,false)
- };
+ ];
- protected override IIconPart[] Parts
- {
- get { return _PARTS; }
- }
+ protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/Drawing/Icons/Events/NonInteruptingConditionalBoundaryEvent.cs b/BPMNEngine/Drawing/Icons/Events/NonInteruptingConditionalBoundaryEvent.cs
index 5162885..c9ee9fd 100644
--- a/BPMNEngine/Drawing/Icons/Events/NonInteruptingConditionalBoundaryEvent.cs
+++ b/BPMNEngine/Drawing/Icons/Events/NonInteruptingConditionalBoundaryEvent.cs
@@ -5,15 +5,12 @@ namespace BPMNEngine.Drawing.Icons.Events
[IconTypeAttribute(Elements.Diagrams.BPMIcons.NonInteruptingConditionalBoundaryEvent)]
internal class NonInteruptingConditionalBoundaryEvent : AIcon
{
- private static readonly IIconPart[] _PARTS = new IIconPart[] {
+ private static readonly IIconPart[] _PARTS = [
new OuterCircle(true),
new InnerCircle(true),
new Note()
- };
+ ];
- protected override IIconPart[] Parts
- {
- get { return _PARTS; }
- }
+ protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/Drawing/Icons/Events/NonInteruptingEscalationBoundaryEvent.cs b/BPMNEngine/Drawing/Icons/Events/NonInteruptingEscalationBoundaryEvent.cs
index fe8b739..bd36d23 100644
--- a/BPMNEngine/Drawing/Icons/Events/NonInteruptingEscalationBoundaryEvent.cs
+++ b/BPMNEngine/Drawing/Icons/Events/NonInteruptingEscalationBoundaryEvent.cs
@@ -5,15 +5,12 @@ namespace BPMNEngine.Drawing.Icons.Events
[IconTypeAttribute(Elements.Diagrams.BPMIcons.NonInteruptingEscalationBoundaryEvent)]
internal class NonInteruptingEscalationBoundaryEvent : AIcon
{
- private static readonly IIconPart[] _PARTS = new IIconPart[] {
+ private static readonly IIconPart[] _PARTS = [
new OuterCircle(true),
new InnerCircle(true),
new UpArrow(false)
- };
+ ];
- protected override IIconPart[] Parts
- {
- get { return _PARTS; }
- }
+ protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/Drawing/Icons/Events/NonInteruptingMessageBoundaryEvent.cs b/BPMNEngine/Drawing/Icons/Events/NonInteruptingMessageBoundaryEvent.cs
index 423dea6..48fe6c5 100644
--- a/BPMNEngine/Drawing/Icons/Events/NonInteruptingMessageBoundaryEvent.cs
+++ b/BPMNEngine/Drawing/Icons/Events/NonInteruptingMessageBoundaryEvent.cs
@@ -5,15 +5,12 @@ namespace BPMNEngine.Drawing.Icons.Events
[IconTypeAttribute(Elements.Diagrams.BPMIcons.NonInteruptingMessageBoundaryEvent)]
internal class NonInteruptingMessageBoundaryEvent : AIcon
{
- private static readonly IIconPart[] _PARTS = new IIconPart[] {
+ private static readonly IIconPart[] _PARTS = [
new OuterCircle(true),
new InnerCircle(true),
new Envelope(false,false)
- };
+ ];
- protected override IIconPart[] Parts
- {
- get { return _PARTS; }
- }
+ protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/Drawing/Icons/Events/NonInteruptingSignalBoundaryEvent.cs b/BPMNEngine/Drawing/Icons/Events/NonInteruptingSignalBoundaryEvent.cs
index bf58db4..de6a034 100644
--- a/BPMNEngine/Drawing/Icons/Events/NonInteruptingSignalBoundaryEvent.cs
+++ b/BPMNEngine/Drawing/Icons/Events/NonInteruptingSignalBoundaryEvent.cs
@@ -5,15 +5,12 @@ namespace BPMNEngine.Drawing.Icons.Events
[IconTypeAttribute(Elements.Diagrams.BPMIcons.NonInteruptingSignalBoundaryEvent)]
internal class NonInteruptingSignalBoundaryEvent : AIcon
{
- private static readonly IIconPart[] _PARTS = new IIconPart[] {
+ private static readonly IIconPart[] _PARTS = [
new OuterCircle(true),
new InnerCircle(true),
new Triangle(false)
- };
+ ];
- protected override IIconPart[] Parts
- {
- get { return _PARTS; }
- }
+ protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/Drawing/Icons/Events/NonInteruptingTimerBoundaryEvent.cs b/BPMNEngine/Drawing/Icons/Events/NonInteruptingTimerBoundaryEvent.cs
index 0613a42..96c9826 100644
--- a/BPMNEngine/Drawing/Icons/Events/NonInteruptingTimerBoundaryEvent.cs
+++ b/BPMNEngine/Drawing/Icons/Events/NonInteruptingTimerBoundaryEvent.cs
@@ -5,15 +5,12 @@ namespace BPMNEngine.Drawing.Icons.Events
[IconTypeAttribute(Elements.Diagrams.BPMIcons.NonInteruptingTimerBoundaryEvent)]
internal class NonInteruptingTimerBoundaryEvent : AIcon
{
- private static readonly IIconPart[] _PARTS = new IIconPart[] {
+ private static readonly IIconPart[] _PARTS = [
new OuterCircle(true),
new InnerCircle(true),
new Clock()
- };
+ ];
- protected override IIconPart[] Parts
- {
- get { return _PARTS; }
- }
+ protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/Drawing/Icons/Events/SignalEndEvent.cs b/BPMNEngine/Drawing/Icons/Events/SignalEndEvent.cs
index b67d97b..9d25d21 100644
--- a/BPMNEngine/Drawing/Icons/Events/SignalEndEvent.cs
+++ b/BPMNEngine/Drawing/Icons/Events/SignalEndEvent.cs
@@ -5,15 +5,12 @@ namespace BPMNEngine.Drawing.Icons.Events
[IconTypeAttribute(Elements.Diagrams.BPMIcons.SignalEndEvent)]
internal class SignalEndEvent : AIcon
{
- private static readonly IIconPart[] _PARTS = new IIconPart[] {
+ private static readonly IIconPart[] _PARTS = [
new OuterCircle(),
new InnerCircle(),
new Triangle(true)
- };
+ ];
- protected override IIconPart[] Parts
- {
- get { return _PARTS; }
- }
+ protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/Drawing/Icons/Events/SignalIntermediateCatchEvent.cs b/BPMNEngine/Drawing/Icons/Events/SignalIntermediateCatchEvent.cs
index ca38f68..9df8e96 100644
--- a/BPMNEngine/Drawing/Icons/Events/SignalIntermediateCatchEvent.cs
+++ b/BPMNEngine/Drawing/Icons/Events/SignalIntermediateCatchEvent.cs
@@ -5,15 +5,12 @@ namespace BPMNEngine.Drawing.Icons.Events
[IconTypeAttribute(Elements.Diagrams.BPMIcons.SignalIntermediateCatchEvent)]
internal class SignalIntermediateCatchEvent : AIcon
{
- private static readonly IIconPart[] _PARTS = new IIconPart[] {
+ private static readonly IIconPart[] _PARTS = [
new OuterCircle(),
new InnerCircle(),
new Triangle(false)
- };
+ ];
- protected override IIconPart[] Parts
- {
- get { return _PARTS; }
- }
+ protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/Drawing/Icons/Events/SignalIntermediateThrowEvent.cs b/BPMNEngine/Drawing/Icons/Events/SignalIntermediateThrowEvent.cs
index 104d818..071d0a9 100644
--- a/BPMNEngine/Drawing/Icons/Events/SignalIntermediateThrowEvent.cs
+++ b/BPMNEngine/Drawing/Icons/Events/SignalIntermediateThrowEvent.cs
@@ -5,15 +5,12 @@ namespace BPMNEngine.Drawing.Icons.Events
[IconTypeAttribute(Elements.Diagrams.BPMIcons.SignalIntermediateThrowEvent)]
internal class SignalIntermediateThrowEvent : AIcon
{
- private static readonly IIconPart[] _PARTS = new IIconPart[] {
+ private static readonly IIconPart[] _PARTS = [
new OuterCircle(),
new InnerCircle(),
new Triangle(true)
- };
+ ];
- protected override IIconPart[] Parts
- {
- get { return _PARTS; }
- }
+ protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/Drawing/Icons/Events/SignalStartEvent.cs b/BPMNEngine/Drawing/Icons/Events/SignalStartEvent.cs
index 9ac24a9..fd29926 100644
--- a/BPMNEngine/Drawing/Icons/Events/SignalStartEvent.cs
+++ b/BPMNEngine/Drawing/Icons/Events/SignalStartEvent.cs
@@ -5,14 +5,11 @@ namespace BPMNEngine.Drawing.Icons.Events
[IconTypeAttribute(Elements.Diagrams.BPMIcons.SignalStartEvent)]
internal class SignalStartEvent : AIcon
{
- private static readonly IIconPart[] _PARTS = new IIconPart[] {
+ private static readonly IIconPart[] _PARTS = [
new OuterCircle(),
new Triangle(false)
- };
+ ];
- protected override IIconPart[] Parts
- {
- get { return _PARTS; }
- }
+ protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/Drawing/Icons/Events/StartEvent.cs b/BPMNEngine/Drawing/Icons/Events/StartEvent.cs
index 94c5916..9d7a642 100644
--- a/BPMNEngine/Drawing/Icons/Events/StartEvent.cs
+++ b/BPMNEngine/Drawing/Icons/Events/StartEvent.cs
@@ -5,11 +5,11 @@ namespace BPMNEngine.Drawing.Icons.Events
[IconTypeAttribute(Elements.Diagrams.BPMIcons.StartEvent)]
internal class StartEvent : AIcon
{
- private static readonly IIconPart[] _PARTS = new IIconPart[]
- {
+ private static readonly IIconPart[] _PARTS =
+ [
new OuterCircle()
- };
+ ];
- protected override IIconPart[] Parts { get { return _PARTS; } }
+ protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/Drawing/Icons/Events/TerminateEndEvent.cs b/BPMNEngine/Drawing/Icons/Events/TerminateEndEvent.cs
index 979dcb5..d8985ab 100644
--- a/BPMNEngine/Drawing/Icons/Events/TerminateEndEvent.cs
+++ b/BPMNEngine/Drawing/Icons/Events/TerminateEndEvent.cs
@@ -5,12 +5,12 @@ namespace BPMNEngine.Drawing.Icons.Events
[IconTypeAttribute(Elements.Diagrams.BPMIcons.TerminateEndEvent)]
internal class TerminateEndEvent : AIcon
{
- private static readonly IIconPart[] _PARTS = new IIconPart[]
- {
+ private static readonly IIconPart[] _PARTS =
+ [
new ThickCircle(),
new FilledCircle()
- };
+ ];
- protected override IIconPart[] Parts { get { return _PARTS; } }
+ protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/Drawing/Icons/Events/TimerIntermediateCatchEvent.cs b/BPMNEngine/Drawing/Icons/Events/TimerIntermediateCatchEvent.cs
index d3e84e3..c2da5fd 100644
--- a/BPMNEngine/Drawing/Icons/Events/TimerIntermediateCatchEvent.cs
+++ b/BPMNEngine/Drawing/Icons/Events/TimerIntermediateCatchEvent.cs
@@ -5,15 +5,12 @@ namespace BPMNEngine.Drawing.Icons.Events
[IconTypeAttribute(Elements.Diagrams.BPMIcons.TimerIntermediateCatchEvent)]
internal class TimerIntermediateCatchEvent : AIcon
{
- private static readonly IIconPart[] _PARTS = new IIconPart[] {
+ private static readonly IIconPart[] _PARTS = [
new OuterCircle(),
new InnerCircle(),
new Clock()
- };
+ ];
- protected override IIconPart[] Parts
- {
- get { return _PARTS; }
- }
+ protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/Drawing/Icons/Events/TimerStartEvent.cs b/BPMNEngine/Drawing/Icons/Events/TimerStartEvent.cs
index 8ff058b..a628d1e 100644
--- a/BPMNEngine/Drawing/Icons/Events/TimerStartEvent.cs
+++ b/BPMNEngine/Drawing/Icons/Events/TimerStartEvent.cs
@@ -5,14 +5,11 @@ namespace BPMNEngine.Drawing.Icons.Events
[IconTypeAttribute(Elements.Diagrams.BPMIcons.TimerStartEvent)]
internal class TimerStartEvent : AIcon
{
- private static readonly IIconPart[] _PARTS = new IIconPart[] {
+ private static readonly IIconPart[] _PARTS = [
new OuterCircle(),
new Clock()
- };
+ ];
- protected override IIconPart[] Parts
- {
- get { return _PARTS; }
- }
+ protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/Drawing/Icons/Gateways/AGateway.cs b/BPMNEngine/Drawing/Icons/Gateways/AGateway.cs
index c1e1a8f..8220693 100644
--- a/BPMNEngine/Drawing/Icons/Gateways/AGateway.cs
+++ b/BPMNEngine/Drawing/Icons/Gateways/AGateway.cs
@@ -1,25 +1,23 @@
-using Microsoft.Maui.Graphics;
-using BPMNEngine.Elements;
+using BPMNEngine.Elements;
+using Microsoft.Maui.Graphics;
namespace BPMNEngine.Drawing.Icons.Gateways
{
internal abstract class AGateway : AIcon
{
private const float _PEN_SIZE = 2.0f;
- public new const int IMAGE_SIZE = 63;
+ public new const float IMAGE_SIZE = 63;
- private static readonly Point[] _POINTS = new Point[] {
- new Point((float)AGateway.IMAGE_SIZE/2f,0),
- new Point((float)AGateway.IMAGE_SIZE-2,(float)AGateway.IMAGE_SIZE/2f),
- new Point((float)AGateway.IMAGE_SIZE/2f,(float)AGateway.IMAGE_SIZE-2),
- new Point(0,(float)AGateway.IMAGE_SIZE/2f),
- new Point((float)AGateway.IMAGE_SIZE/2f,0)
- };
+ private static readonly Point[] _POINTS = [
+ new(AGateway.IMAGE_SIZE/2f,0),
+ new(AGateway.IMAGE_SIZE-2,AGateway.IMAGE_SIZE/2f),
+ new(AGateway.IMAGE_SIZE/2f,AGateway.IMAGE_SIZE-2),
+ new(0,AGateway.IMAGE_SIZE/2f),
+ new(AGateway.IMAGE_SIZE/2f,0)
+ ];
protected override sealed int ImageSize
- {
- get { return IMAGE_SIZE; }
- }
+ => (int)IMAGE_SIZE;
protected override void InternalDraw(ICanvas surface, Color color)
{
diff --git a/BPMNEngine/Drawing/Icons/Gateways/ComplexGateway.cs b/BPMNEngine/Drawing/Icons/Gateways/ComplexGateway.cs
index 4d7a877..463a4b2 100644
--- a/BPMNEngine/Drawing/Icons/Gateways/ComplexGateway.cs
+++ b/BPMNEngine/Drawing/Icons/Gateways/ComplexGateway.cs
@@ -5,13 +5,10 @@ namespace BPMNEngine.Drawing.Icons.Gateways
[IconTypeAttribute(Elements.Diagrams.BPMIcons.ComplexGateway)]
internal class ComplexGateway : AGateway
{
- private static readonly IIconPart[] _PARTS = new IIconPart[] {
+ private static readonly IIconPart[] _PARTS = [
new CenterStar()
- };
+ ];
- protected override IIconPart[] Parts
- {
- get { return _PARTS; }
- }
+ protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/Drawing/Icons/Gateways/EventBasedGateway.cs b/BPMNEngine/Drawing/Icons/Gateways/EventBasedGateway.cs
index f074d50..463fbc9 100644
--- a/BPMNEngine/Drawing/Icons/Gateways/EventBasedGateway.cs
+++ b/BPMNEngine/Drawing/Icons/Gateways/EventBasedGateway.cs
@@ -1,5 +1,5 @@
-using Microsoft.Maui.Graphics;
-using BPMNEngine.Elements;
+using BPMNEngine.Elements;
+using Microsoft.Maui.Graphics;
namespace BPMNEngine.Drawing.Icons.Gateways
{
@@ -8,15 +8,15 @@ internal class EventBasedGateway : AGateway
{
private const float _CIRCLE_PEN_SIZE = 1.0f;
- private static readonly Point[] _POINTS = new Point[]
- {
- new Point(23f,26f),
- new Point(32f,21f),
- new Point(40f,26f),
- new Point(37f,38f),
- new Point(25f,38f),
- new Point(23f,26f)
- };
+ private static readonly Point[] _POINTS =
+ [
+ new(23f,26f),
+ new(32f,21f),
+ new(40f,26f),
+ new(37f,38f),
+ new(25f,38f),
+ new(23f,26f)
+ ];
protected override void InternalDraw(ICanvas surface, Color color)
{
diff --git a/BPMNEngine/Drawing/Icons/Gateways/ExclusiveGateway.cs b/BPMNEngine/Drawing/Icons/Gateways/ExclusiveGateway.cs
index 079539a..b76ace8 100644
--- a/BPMNEngine/Drawing/Icons/Gateways/ExclusiveGateway.cs
+++ b/BPMNEngine/Drawing/Icons/Gateways/ExclusiveGateway.cs
@@ -5,13 +5,10 @@ namespace BPMNEngine.Drawing.Icons.Gateways
[IconTypeAttribute(Elements.Diagrams.BPMIcons.ExclusiveGateway)]
internal class ExclusiveGateway : AGateway
{
- private static readonly IIconPart[] _PARTS = new IIconPart[] {
+ private static readonly IIconPart[] _PARTS = [
new CenterX()
- };
+ ];
- protected override IIconPart[] Parts
- {
- get { return _PARTS; }
- }
+ protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/Drawing/Icons/Gateways/ParallelGateway.cs b/BPMNEngine/Drawing/Icons/Gateways/ParallelGateway.cs
index f6e1fde..c996300 100644
--- a/BPMNEngine/Drawing/Icons/Gateways/ParallelGateway.cs
+++ b/BPMNEngine/Drawing/Icons/Gateways/ParallelGateway.cs
@@ -5,13 +5,10 @@ namespace BPMNEngine.Drawing.Icons.Gateways
[IconTypeAttribute(Elements.Diagrams.BPMIcons.ParallelGateway)]
internal class ParallelGateway : AGateway
{
- private static readonly IIconPart[] _PARTS = new IIconPart[] {
+ private static readonly IIconPart[] _PARTS = [
new CenterPlus()
- };
+ ];
- protected override IIconPart[] Parts
- {
- get { return _PARTS; }
- }
+ protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/Drawing/Icons/IconParts/Bolt.cs b/BPMNEngine/Drawing/Icons/IconParts/Bolt.cs
index dc407e4..d0f361f 100644
--- a/BPMNEngine/Drawing/Icons/IconParts/Bolt.cs
+++ b/BPMNEngine/Drawing/Icons/IconParts/Bolt.cs
@@ -3,39 +3,35 @@
namespace BPMNEngine.Drawing.Icons.IconParts
{
- internal class Bolt : IIconPart
+ internal class Bolt(bool filled) : IIconPart
{
private const float _PEN_SIZE = 1.0f;
- private static readonly PointF[] _POINTS = new PointF[]
- {
- new PointF(11f,33f),
- new PointF(18f,12f),
- new PointF(27f,23f),
- new PointF(34f,11f),
- new PointF(28f,32f),
- new PointF(19f,22f),
- new PointF(11f,33f)
- };
+ private static readonly PointF[] _POINTS =
+ [
+ new(11f,33f),
+ new(18f,12f),
+ new(27f,23f),
+ new(34f,11f),
+ new(28f,32f),
+ new(19f,22f),
+ new(11f,33f)
+ ];
private static readonly PathF _PATH;
+#pragma warning disable S3963 // "static" fields should be initialized inline
static Bolt()
+#pragma warning restore S3963 // "static" fields should be initialized inline
{
_PATH = new PathF(_POINTS[0]);
- _POINTS.Skip(1).ForEach(p=>_PATH.LineTo(p));
+ _POINTS.Skip(1).ForEach(p => _PATH.LineTo(p));
_PATH.Close();
}
- private readonly bool _filled;
- public Bolt(bool filled)
- {
- _filled=filled;
- }
-
public void Add(ICanvas surface, int iconSize, Color color)
{
- if (_filled)
+ if (filled)
{
surface.FillColor= color;
surface.FillPath(_PATH);
diff --git a/BPMNEngine/Drawing/Icons/IconParts/Clock.cs b/BPMNEngine/Drawing/Icons/IconParts/Clock.cs
index 9bed0b9..ce48661 100644
--- a/BPMNEngine/Drawing/Icons/IconParts/Clock.cs
+++ b/BPMNEngine/Drawing/Icons/IconParts/Clock.cs
@@ -21,8 +21,8 @@ public SAngleFactorPair(double degrees)
}
}
- private static readonly SAngleFactorPair[] _ANGLES = new SAngleFactorPair[]
- {
+ private static readonly SAngleFactorPair[] _ANGLES =
+ [
new(30),
new(60),
new(90),
@@ -35,14 +35,14 @@ public SAngleFactorPair(double degrees)
new(300),
new(330),
new(360)
- };
+ ];
private static readonly SAngleFactorPair _HOUR_HAND = new(15);
private static readonly SAngleFactorPair _MINUTE_HAND = new(290);
public void Add(ICanvas surface, int iconSize, Color color)
{
- Rect rect = new(8f,8f,30f,30f);
+ Rect rect = new(8f, 8f, 30f, 30f);
Point c = new(rect.X + (rect.Width / 2), rect.Y + (rect.Height / 2));
surface.StrokeColor = color;
@@ -50,7 +50,8 @@ public void Add(ICanvas surface, int iconSize, Color color)
surface.StrokeSize = _TICK_SIZE;
float rad = (float)rect.Width / 2f;
- _ANGLES.ForEach(angle => {
+ _ANGLES.ForEach(angle =>
+ {
surface.DrawLine(
new Point(c.X + (rad * angle.X), c.Y + (rad * angle.Y)),
new Point(c.X + ((rad-3) * angle.X), c.Y + ((rad - 3) * angle.Y))
@@ -65,7 +66,7 @@ public void Add(ICanvas surface, int iconSize, Color color)
new Point(c.X + ((rad - 2) * _MINUTE_HAND.X), c.Y + ((rad - 2) * _MINUTE_HAND.Y))
);
surface.DrawLine(
- new Point(c.X, c.Y),
+ new Point(c.X, c.Y),
new Point(c.X +((rad - 5) * _HOUR_HAND.X), c.Y +((rad - 5) * _HOUR_HAND.Y))
);
}
diff --git a/BPMNEngine/Drawing/Icons/IconParts/EmbeddedResourceIcon.cs b/BPMNEngine/Drawing/Icons/IconParts/EmbeddedResourceIcon.cs
index e5fcd26..09d299d 100644
--- a/BPMNEngine/Drawing/Icons/IconParts/EmbeddedResourceIcon.cs
+++ b/BPMNEngine/Drawing/Icons/IconParts/EmbeddedResourceIcon.cs
@@ -1,7 +1,7 @@
+using BPMNEngine.Elements;
using Microsoft.Maui.Graphics;
using Microsoft.Maui.Graphics.Skia;
-using BPMNEngine.Elements;
using SkiaSharp;
using System.Reflection;
@@ -12,28 +12,28 @@ internal abstract class EmbeddedResourceIcon
{
protected abstract string ResourceName { get; }
- public void Add(ICanvas surface,int iconSize, Color color)
+ public void Add(ICanvas surface, int iconSize, Color color)
{
var icon = SKImage.FromEncodedData(GetType().GetTypeInfo().Assembly.GetManifestResourceStream(string.Format("BPMNEngine.Drawing.Icons.IconParts.resources.{0}", ResourceName)));
var bmp = SKBitmap.FromImage(icon);
- var image = Diagram.ProduceImage(icon.Width,icon.Height);
- for(int x = 0; x _PATH.LineTo(p));
_PATH.Close();
}
- private readonly bool _filled;
-
- public Rewind(bool filled)
+ public void Add(ICanvas surface, int iconSize, Color color)
{
- _filled=filled;
- }
-
- public void Add(ICanvas surface,int iconSize, Color color)
- {
- if (_filled) {
+ if (filled)
+ {
surface.FillColor=color;
surface.FillPath(_PATH);
}
diff --git a/BPMNEngine/Drawing/Icons/IconParts/RightArrow.cs b/BPMNEngine/Drawing/Icons/IconParts/RightArrow.cs
index b985dc1..a38f1c8 100644
--- a/BPMNEngine/Drawing/Icons/IconParts/RightArrow.cs
+++ b/BPMNEngine/Drawing/Icons/IconParts/RightArrow.cs
@@ -2,39 +2,35 @@
namespace BPMNEngine.Drawing.Icons.IconParts
{
- internal class RightArrow : IIconPart
+ internal class RightArrow(bool filled) : IIconPart
{
private const float _PEN_SIZE = 1.0f;
- private static readonly Point[] _POINTS = new Point[] {
- new Point(11F,18f),
- new Point(26F,18f),
- new Point(26F,11f),
- new Point(39F,23f),
- new Point(26F,35f),
- new Point(26F,29f),
- new Point(11F,29f),
- new Point(11F,18f)
- };
+ private static readonly Point[] _POINTS = [
+ new(11F,18f),
+ new(26F,18f),
+ new(26F,11f),
+ new(39F,23f),
+ new(26F,35f),
+ new(26F,29f),
+ new(11F,29f),
+ new(11F,18f)
+ ];
private static readonly PathF _PATH;
+#pragma warning disable S3963 // "static" fields should be initialized inline
static RightArrow()
+#pragma warning restore S3963 // "static" fields should be initialized inline
{
_PATH = new PathF(_POINTS[0]);
_POINTS.Skip(1).ForEach(p => _PATH.LineTo(p));
_PATH.Close();
}
- private readonly bool _filled;
- public RightArrow(bool filled)
- {
- _filled = filled;
- }
-
public void Add(ICanvas surface, int iconSize, Color color)
{
- if (_filled)
+ if (filled)
{
surface.FillColor=color;
surface.FillPath(_PATH);
diff --git a/BPMNEngine/Drawing/Icons/IconParts/ThickCircle.cs b/BPMNEngine/Drawing/Icons/IconParts/ThickCircle.cs
index c3d9a6b..2354974 100644
--- a/BPMNEngine/Drawing/Icons/IconParts/ThickCircle.cs
+++ b/BPMNEngine/Drawing/Icons/IconParts/ThickCircle.cs
@@ -12,7 +12,7 @@ public void Add(ICanvas surface, int iconSize, Color color)
surface.StrokeDashPattern=null;
surface.StrokeSize= _PEN_SIZE;
- surface.DrawEllipse(new Rect(2,2,AIcon.IMAGE_SIZE-5,AIcon.IMAGE_SIZE-5));
+ surface.DrawEllipse(new Rect(2, 2, AIcon.IMAGE_SIZE-5, AIcon.IMAGE_SIZE-5));
}
}
}
diff --git a/BPMNEngine/Drawing/Icons/IconParts/Triangle.cs b/BPMNEngine/Drawing/Icons/IconParts/Triangle.cs
index 2962820..810faa5 100644
--- a/BPMNEngine/Drawing/Icons/IconParts/Triangle.cs
+++ b/BPMNEngine/Drawing/Icons/IconParts/Triangle.cs
@@ -2,36 +2,31 @@
namespace BPMNEngine.Drawing.Icons.IconParts
{
- internal class Triangle : IIconPart
+ internal class Triangle(bool filled) : IIconPart
{
private const float _PEN_SIZE = 1.0f;
- private static readonly Point[] _POINTS = new Point[] {
+ private static readonly Point[] _POINTS = [
new(24f,9f),
new(34f,30f),
new(13f,30f),
new(24f,9f)
- };
+ ];
private static readonly PathF _PATH;
+#pragma warning disable S3963 // "static" fields should be initialized inline
static Triangle()
+#pragma warning restore S3963 // "static" fields should be initialized inline
{
_PATH = new PathF(_POINTS[0]);
_POINTS.Skip(1).ForEach(p => _PATH.LineTo(p));
_PATH.Close();
}
- private readonly bool _filled;
-
- public Triangle(bool filled)
- {
- _filled = filled;
- }
-
public void Add(ICanvas surface, int iconSize, Color color)
{
- if (_filled)
+ if (filled)
{
surface.FillColor=color;
surface.FillPath(_PATH);
diff --git a/BPMNEngine/Drawing/Icons/IconParts/UpArrow.cs b/BPMNEngine/Drawing/Icons/IconParts/UpArrow.cs
index bfc2e52..23114be 100644
--- a/BPMNEngine/Drawing/Icons/IconParts/UpArrow.cs
+++ b/BPMNEngine/Drawing/Icons/IconParts/UpArrow.cs
@@ -2,36 +2,32 @@
namespace BPMNEngine.Drawing.Icons.IconParts
{
- internal class UpArrow : IIconPart
+ internal class UpArrow(bool filled) : IIconPart
{
private const float _PEN_SIZE = 1.0f;
- private static readonly Point[] _POINTS = new Point[] {
+ private static readonly Point[] _POINTS = [
new(23f,9f),
new(33f,34f),
new(23f,25f),
new(13f,34f),
new(23f,9f)
- };
+ ];
private static readonly PathF _PATH;
+#pragma warning disable S3963 // "static" fields should be initialized inline
static UpArrow()
+#pragma warning restore S3963 // "static" fields should be initialized inline
{
_PATH = new PathF(_POINTS[0]);
_POINTS.Skip(1).ForEach(p => _PATH.LineTo(p));
_PATH.Close();
}
- private readonly bool _filled;
- public UpArrow(bool filled)
- {
- _filled=filled;
- }
-
public void Add(ICanvas surface, int iconSize, Color color)
{
- if (_filled)
+ if (filled)
{
surface.FillColor=color;
surface.FillPath(_PATH);
diff --git a/BPMNEngine/Drawing/Icons/IconTypeAttribute.cs b/BPMNEngine/Drawing/Icons/IconTypeAttribute.cs
index 31bab7e..22d939d 100644
--- a/BPMNEngine/Drawing/Icons/IconTypeAttribute.cs
+++ b/BPMNEngine/Drawing/Icons/IconTypeAttribute.cs
@@ -3,12 +3,8 @@
namespace BPMNEngine.Drawing.Icons
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
- internal class IconTypeAttribute : Attribute
+ internal class IconTypeAttribute(BPMIcons icon) : Attribute
{
- public BPMIcons Icon { get; private init; }
- public IconTypeAttribute(BPMIcons icon)
- {
- Icon = icon;
- }
+ public BPMIcons Icon { get; private init; } = icon;
}
}
diff --git a/BPMNEngine/Drawing/Icons/Tasks/BusinessRuleTask.cs b/BPMNEngine/Drawing/Icons/Tasks/BusinessRuleTask.cs
index c31bf77..1baeac3 100644
--- a/BPMNEngine/Drawing/Icons/Tasks/BusinessRuleTask.cs
+++ b/BPMNEngine/Drawing/Icons/Tasks/BusinessRuleTask.cs
@@ -5,9 +5,9 @@ namespace BPMNEngine.Drawing.Icons.Tasks
[IconTypeAttribute(Elements.Diagrams.BPMIcons.BusinessRuleTask)]
internal class BusinessRuleTask : AIcon
{
- private static readonly IIconPart[] _PARTS = new[] {
+ private static readonly IIconPart[] _PARTS = [
new Table()
- };
+ ];
protected override IIconPart[] Parts => _PARTS;
}
diff --git a/BPMNEngine/Drawing/Icons/Tasks/ManualTask.cs b/BPMNEngine/Drawing/Icons/Tasks/ManualTask.cs
index e28962d..2c2f435 100644
--- a/BPMNEngine/Drawing/Icons/Tasks/ManualTask.cs
+++ b/BPMNEngine/Drawing/Icons/Tasks/ManualTask.cs
@@ -5,9 +5,9 @@ namespace BPMNEngine.Drawing.Icons.Tasks
[IconTypeAttribute(Elements.Diagrams.BPMIcons.ManualTask)]
internal class ManualTask : AIcon
{
- private static readonly IIconPart[] _PARTS = new[] {
+ private static readonly IIconPart[] _PARTS = [
new Hand()
- };
+ ];
protected override IIconPart[] Parts => _PARTS;
}
diff --git a/BPMNEngine/Drawing/Icons/Tasks/RecieveTask.cs b/BPMNEngine/Drawing/Icons/Tasks/RecieveTask.cs
index b777df3..4770710 100644
--- a/BPMNEngine/Drawing/Icons/Tasks/RecieveTask.cs
+++ b/BPMNEngine/Drawing/Icons/Tasks/RecieveTask.cs
@@ -5,7 +5,7 @@ namespace BPMNEngine.Drawing.Icons.Tasks
[IconTypeAttribute(Elements.Diagrams.BPMIcons.ReceiveTask)]
internal class ReceiveTask : AIcon
{
- private static readonly IIconPart[] _PARTS = new[] { new Envelope(false, true) };
+ private static readonly IIconPart[] _PARTS = [new Envelope(false, true)];
protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/Drawing/Icons/Tasks/ScriptTask.cs b/BPMNEngine/Drawing/Icons/Tasks/ScriptTask.cs
index 7b89077..aabd337 100644
--- a/BPMNEngine/Drawing/Icons/Tasks/ScriptTask.cs
+++ b/BPMNEngine/Drawing/Icons/Tasks/ScriptTask.cs
@@ -5,7 +5,7 @@ namespace BPMNEngine.Drawing.Icons.Tasks
[IconTypeAttribute(Elements.Diagrams.BPMIcons.ScriptTask)]
internal class ScriptTask : AIcon
{
- private static readonly IIconPart[] _PARTS = new[] { new Script() };
+ private static readonly IIconPart[] _PARTS = [new Script()];
protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/Drawing/Icons/Tasks/SendTask.cs b/BPMNEngine/Drawing/Icons/Tasks/SendTask.cs
index ba2f83e..36673e0 100644
--- a/BPMNEngine/Drawing/Icons/Tasks/SendTask.cs
+++ b/BPMNEngine/Drawing/Icons/Tasks/SendTask.cs
@@ -5,7 +5,7 @@ namespace BPMNEngine.Drawing.Icons.Tasks
[IconTypeAttribute(Elements.Diagrams.BPMIcons.SendTask)]
internal class SendTask : AIcon
{
- private static readonly IIconPart[] _PARTS = new[] { new Envelope(true, true) };
+ private static readonly IIconPart[] _PARTS = [new Envelope(true, true)];
protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/Drawing/Icons/Tasks/ServiceTask.cs b/BPMNEngine/Drawing/Icons/Tasks/ServiceTask.cs
index 56324c6..2486b55 100644
--- a/BPMNEngine/Drawing/Icons/Tasks/ServiceTask.cs
+++ b/BPMNEngine/Drawing/Icons/Tasks/ServiceTask.cs
@@ -5,7 +5,7 @@ namespace BPMNEngine.Drawing.Icons.Tasks
[IconTypeAttribute(Elements.Diagrams.BPMIcons.ServiceTask)]
internal class ServiceTask : AIcon
{
- private static readonly IIconPart[] _PARTS = new[] { new Cog() };
+ private static readonly IIconPart[] _PARTS = [new Cog()];
protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/Drawing/Icons/Tasks/UserTask.cs b/BPMNEngine/Drawing/Icons/Tasks/UserTask.cs
index 1c0f889..0704c47 100644
--- a/BPMNEngine/Drawing/Icons/Tasks/UserTask.cs
+++ b/BPMNEngine/Drawing/Icons/Tasks/UserTask.cs
@@ -5,7 +5,7 @@ namespace BPMNEngine.Drawing.Icons.Tasks
[IconTypeAttribute(Elements.Diagrams.BPMIcons.UserTask)]
internal class UserTask : AIcon
{
- private static readonly IIconPart[] _PARTS = new[] { new Person() };
+ private static readonly IIconPart[] _PARTS = [new Person()];
protected override IIconPart[] Parts => _PARTS;
}
}
diff --git a/BPMNEngine/ElementTypeCache.cs b/BPMNEngine/ElementTypeCache.cs
index cd3e3a1..42adeb4 100644
--- a/BPMNEngine/ElementTypeCache.cs
+++ b/BPMNEngine/ElementTypeCache.cs
@@ -4,18 +4,18 @@ internal class ElementTypeCache
{
private readonly struct SCachedType
{
- public SCachedType(){}
+ public SCachedType() { }
public string Tag { get; init; } = string.Empty;
public Type Type { get; init; } = null;
}
private readonly List cache;
- public ElementTypeCache() { cache=new(); }
+ public ElementTypeCache() { cache= []; }
- public Type this[string xmlTag] => cache.FirstOrDefault(ct=>ct.Tag.Equals(xmlTag,StringComparison.CurrentCultureIgnoreCase)).Type;
+ public Type this[string xmlTag] => cache.Find(ct => ct.Tag.Equals(xmlTag, StringComparison.CurrentCultureIgnoreCase)).Type;
- public bool IsCached(string xmlTag) => cache.Any(ct=>ct.Tag.Equals(xmlTag,StringComparison.CurrentCultureIgnoreCase));
+ public bool IsCached(string xmlTag) => cache.Exists(ct => ct.Tag.Equals(xmlTag, StringComparison.CurrentCultureIgnoreCase));
public void MapIdeals(XmlPrefixMap map)
{
@@ -30,7 +30,7 @@ public void MapIdeals(XmlPrefixMap map)
prefixPair.Value.ForEach(tagPair =>
{
var tag = $"{trans}:{tagPair.Key}";
- if (!cache.Any(ct => ct.Tag.Equals(tag, StringComparison.CurrentCultureIgnoreCase)))
+ if (!cache.Exists(ct => ct.Tag.Equals(tag, StringComparison.CurrentCultureIgnoreCase)))
cache.Add(new()
{
Tag=tag,
@@ -43,7 +43,7 @@ public void MapIdeals(XmlPrefixMap map)
{
prefixPair.Value.ForEach(tagPair =>
{
- cache.Add(new() { Tag=$"{prefixPair.Key}:{tagPair.Key}",Type=tagPair.Value });
+ cache.Add(new() { Tag=$"{prefixPair.Key}:{tagPair.Key}", Type=tagPair.Value });
cache.Add(new() { Tag=tagPair.Key, Type=tagPair.Value });
});
}
diff --git a/BPMNEngine/Elements/AElement.cs b/BPMNEngine/Elements/AElement.cs
index 559bba4..2296f3e 100644
--- a/BPMNEngine/Elements/AElement.cs
+++ b/BPMNEngine/Elements/AElement.cs
@@ -4,55 +4,52 @@
namespace BPMNEngine.Elements
{
- internal abstract class AElement : IElement
+ internal abstract record AElement
+ : IElement
{
public AElement Parent { get; private init; }
+ internal XmlElement Element { get; private init; }
+ public ImmutableArray SubNodes { get; private init; }
+ public IParentElement ExtensionElement { get; private init; }
- public Definition Definition
- => (this is Definition definition) ? definition : Parent?.Definition;
+ protected AElement(XmlElement elem, XmlPrefixMap map, AElement parent)
+ {
+ Parent=parent;
+ Element=elem;
+ SubNodes=elem.ChildNodes.Cast().ToImmutableArray();
+ ExtensionElement = SubNodes.OfType()
+ .Where(n => Array.Exists(Utility.GetTagAttributes(typeof(ExtensionElements)), xt => xt.Matches(map, n.Name)))
+ .Select(extElem => new ExtensionElements(extElem, map, this))
+ .FirstOrDefault();
+ }
- internal XmlElement Element { get; private init; }
+ public virtual Definition OwningDefinition
+ => Parent?.OwningDefinition;
- private string _cachedID=null;
+ private string _cachedID = null;
public string ID
{
- get {
+ get
+ {
var ret = _cachedID??this["id"];
if (ret==null)
- _cachedID = Utility.FindXPath(Definition, Element);
+ _cachedID = Utility.FindXPath(OwningDefinition, Element);
return ret??_cachedID;
}
}
- public ImmutableArray SubNodes { get; private init; }
+
public string this[string attributeName] => Element.Attributes.Cast()
- .Where(att => att.Name.ToLower()==attributeName.ToLower())
+ .Where(att => string.Equals(att.Name, attributeName, StringComparison.InvariantCultureIgnoreCase))
.Select(att => att.Value)
.FirstOrDefault()??null;
- public IElement ExtensionElement { get; private init; }
-
- public AElement(XmlElement elem,XmlPrefixMap map,AElement parent)
- {
- Element = elem;
- ExtensionElement = null;
- Parent = parent;
- SubNodes = elem.ChildNodes.Cast().ToImmutableArray();
- if (SubNodes != null)
- {
- var tags = Utility.GetTagAttributes(typeof(ExtensionElements));
- var extElem = SubNodes
- .FirstOrDefault(n => n.NodeType==XmlNodeType.Element && tags.Any(xt => xt.Matches(map, n.Name)));
- if (extElem!=null)
- ExtensionElement=new ExtensionElements((XmlElement)extElem, map,this);
- }
- }
public sealed override string ToString()
{
if (this.GetType().Name == "TextAnnotation")
- return (string)this.GetType().GetProperty("Content").GetValue(this, Array.Empty