Movensys.FSMHelper.Core
1.0.5
dotnet add package Movensys.FSMHelper.Core --version 1.0.5
NuGet\Install-Package Movensys.FSMHelper.Core -Version 1.0.5
<PackageReference Include="Movensys.FSMHelper.Core" Version="1.0.5" />
<PackageVersion Include="Movensys.FSMHelper.Core" Version="1.0.5" />
<PackageReference Include="Movensys.FSMHelper.Core" />
paket add Movensys.FSMHelper.Core --version 1.0.5
#r "nuget: Movensys.FSMHelper.Core, 1.0.5"
#:package Movensys.FSMHelper.Core@1.0.5
#addin nuget:?package=Movensys.FSMHelper.Core&version=1.0.5
#tool nuget:?package=Movensys.FSMHelper.Core&version=1.0.5
Movensys.FSMHelper
This is a generic enum-based finite state machine (FSM) developed by the Movensys Application Team.
Features
- Easy to use based on enum
- State Management
- State Transition
- State Query
- Timeout Management
- Events
Code Highlighting
using Movensys.FSMHelper;
namespace WinFormsApp1
{
public enum DeviceState
{
Idle,
Running,
Error,
Stopped
}
var fsm = new Fsm<DeviceState>(DeviceState.Idle);
fsm.Set(DeviceState.Running);
var currentState = fsm.Get();
if (fsm.IsTimeout(5000))
{
Console.WriteLine("Timeout");
}
fsm.SetCheckEvent += (sender, e) =>
{
Console.WriteLine($"State : {e.previousCmd} -> {e.currentCmd}");
};
}
Tip
Set()already callsResetTimeout()internally, so the timeout always measures the time since the last transition, not since the FSM started. CallingResetTimeout()right before or afterSet()is redundant.Set()returnsfalsewhen the new state equals the current state. No transition occurs andSetCheckEventis not raised.- After a reset, the first
IsTimeout()call only starts the measurement and always returnsfalse. Elapsed time is therefore counted from that first call, not from the transition itself. IsTimeout()restarts its internal timer when it returnstrue, so the result is not latched. Be careful withif (IsTimeout(3000) && cond)- whencondisfalsethe timeout is still consumed and the next one takes another 3000 ms.- There are no transition rules. Any state can move to any other state, and illegal transitions are not detected. Validate them on the caller side if required.
- This class is not thread-safe. Drive it from a single thread, or synchronize on the caller side.
Release History
Jul 16, 2026 - 1.0.5 ver<br> The initial state passed to the Fsm constructor is now applied to the current state. It was previously ignored, so Get() returned the default enum value (0) until the first Set() call.
May 20, 2025 - 1.0.4 ver<br> A message field has been added to the SetCheckEventArgs event class. The default value is an empty string ("").
May 2, 2025 - 1.0.3 ver<br> Only the Function function is separated from the existing FSMHelper 1.0.2 (for cross-platform)
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Framework | net45 is compatible. net451 is compatible. net452 is compatible. net46 is compatible. net461 is compatible. net462 is compatible. net463 was computed. net47 is compatible. net471 is compatible. net472 is compatible. net48 is compatible. net481 is compatible. |
-
.NETFramework 4.5
- No dependencies.
-
.NETFramework 4.5.1
- No dependencies.
-
.NETFramework 4.5.2
- No dependencies.
-
.NETFramework 4.6
- No dependencies.
-
.NETFramework 4.6.1
- No dependencies.
-
.NETFramework 4.6.2
- No dependencies.
-
.NETFramework 4.7
- No dependencies.
-
.NETFramework 4.7.1
- No dependencies.
-
.NETFramework 4.7.2
- No dependencies.
-
.NETFramework 4.8
- No dependencies.
-
.NETFramework 4.8.1
- No dependencies.
-
net5.0
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.