forked from ddrilling/AsbCloudServer
Рефакторинг EnabledSubsystems
This commit is contained in:
parent
c5a9f67ea0
commit
12a9e06f1d
@ -6,7 +6,7 @@ namespace AsbCloudApp.Data.DetectedOperation;
|
||||
public struct EnabledSubsystems
|
||||
{
|
||||
private int value;
|
||||
|
||||
|
||||
private EnabledSubsystems(int value)
|
||||
{
|
||||
this.value = value;
|
||||
@ -25,7 +25,7 @@ public struct EnabledSubsystems
|
||||
/// </summary>
|
||||
public bool IsAutoRotor
|
||||
{
|
||||
get => (value & (int)EnabledSubsystemsFlags.AutoRotor) > 0;
|
||||
get => IsEnabledSubsystem(EnabledSubsystemsFlags.AutoRotor);
|
||||
set => UpdateEnabledSubsystems(value, EnabledSubsystemsFlags.AutoRotor);
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@ public struct EnabledSubsystems
|
||||
/// </summary>
|
||||
public bool IsAutoSlide
|
||||
{
|
||||
get => (value & (int)EnabledSubsystemsFlags.AutoSlide) > 0;
|
||||
get => IsEnabledSubsystem(EnabledSubsystemsFlags.AutoSlide);
|
||||
set => UpdateEnabledSubsystems(value, EnabledSubsystemsFlags.AutoSlide);
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@ public struct EnabledSubsystems
|
||||
/// </summary>
|
||||
public bool IsAutoConditionig
|
||||
{
|
||||
get => (value & (int)EnabledSubsystemsFlags.AutoConditionig) > 0;
|
||||
get => IsEnabledSubsystem(EnabledSubsystemsFlags.AutoConditionig);
|
||||
set => UpdateEnabledSubsystems(value, EnabledSubsystemsFlags.AutoConditionig);
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ public struct EnabledSubsystems
|
||||
/// </summary>
|
||||
public bool IsAutoSinking
|
||||
{
|
||||
get => (value & (int)EnabledSubsystemsFlags.AutoSinking) > 0;
|
||||
get => IsEnabledSubsystem(EnabledSubsystemsFlags.AutoSinking);
|
||||
set => UpdateEnabledSubsystems(value, EnabledSubsystemsFlags.AutoSinking);
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ public struct EnabledSubsystems
|
||||
/// </summary>
|
||||
public bool IsAutoLifting
|
||||
{
|
||||
get => (value & (int)EnabledSubsystemsFlags.AutoLifting) > 0;
|
||||
get => IsEnabledSubsystem(EnabledSubsystemsFlags.AutoLifting);
|
||||
set => UpdateEnabledSubsystems(value, EnabledSubsystemsFlags.AutoLifting);
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@ public struct EnabledSubsystems
|
||||
/// </summary>
|
||||
public bool IsAutoLiftingWithConditionig
|
||||
{
|
||||
get => (value & (int)EnabledSubsystemsFlags.AutoLiftingWithConditionig) > 0;
|
||||
get => IsEnabledSubsystem(EnabledSubsystemsFlags.AutoLiftingWithConditionig);
|
||||
set => UpdateEnabledSubsystems(value, EnabledSubsystemsFlags.AutoLiftingWithConditionig);
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ public struct EnabledSubsystems
|
||||
/// </summary>
|
||||
public bool IsAutoBlocknig
|
||||
{
|
||||
get => (value & (int)EnabledSubsystemsFlags.AutoBlocknig) > 0;
|
||||
get => IsEnabledSubsystem(EnabledSubsystemsFlags.AutoBlocknig);
|
||||
set => UpdateEnabledSubsystems(value, EnabledSubsystemsFlags.AutoBlocknig);
|
||||
}
|
||||
|
||||
@ -88,10 +88,13 @@ public struct EnabledSubsystems
|
||||
/// </summary>
|
||||
public bool IsAutoOscillation
|
||||
{
|
||||
get => (value & (int)EnabledSubsystemsFlags.AutoOscillation) > 0;
|
||||
get => IsEnabledSubsystem(EnabledSubsystemsFlags.AutoOscillation);
|
||||
set => UpdateEnabledSubsystems(value, EnabledSubsystemsFlags.AutoOscillation);
|
||||
}
|
||||
|
||||
private bool IsEnabledSubsystem(EnabledSubsystemsFlags flag) =>
|
||||
(value & (int)flag) > 0;
|
||||
|
||||
private void UpdateEnabledSubsystems(bool isEnable, EnabledSubsystemsFlags flag)
|
||||
{
|
||||
if (isEnable)
|
||||
|
Loading…
Reference in New Issue
Block a user