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
|
public struct EnabledSubsystems
|
||||||
{
|
{
|
||||||
private int value;
|
private int value;
|
||||||
|
|
||||||
private EnabledSubsystems(int value)
|
private EnabledSubsystems(int value)
|
||||||
{
|
{
|
||||||
this.value = value;
|
this.value = value;
|
||||||
@ -25,7 +25,7 @@ public struct EnabledSubsystems
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsAutoRotor
|
public bool IsAutoRotor
|
||||||
{
|
{
|
||||||
get => (value & (int)EnabledSubsystemsFlags.AutoRotor) > 0;
|
get => IsEnabledSubsystem(EnabledSubsystemsFlags.AutoRotor);
|
||||||
set => UpdateEnabledSubsystems(value, EnabledSubsystemsFlags.AutoRotor);
|
set => UpdateEnabledSubsystems(value, EnabledSubsystemsFlags.AutoRotor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ public struct EnabledSubsystems
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsAutoSlide
|
public bool IsAutoSlide
|
||||||
{
|
{
|
||||||
get => (value & (int)EnabledSubsystemsFlags.AutoSlide) > 0;
|
get => IsEnabledSubsystem(EnabledSubsystemsFlags.AutoSlide);
|
||||||
set => UpdateEnabledSubsystems(value, EnabledSubsystemsFlags.AutoSlide);
|
set => UpdateEnabledSubsystems(value, EnabledSubsystemsFlags.AutoSlide);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ public struct EnabledSubsystems
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsAutoConditionig
|
public bool IsAutoConditionig
|
||||||
{
|
{
|
||||||
get => (value & (int)EnabledSubsystemsFlags.AutoConditionig) > 0;
|
get => IsEnabledSubsystem(EnabledSubsystemsFlags.AutoConditionig);
|
||||||
set => UpdateEnabledSubsystems(value, EnabledSubsystemsFlags.AutoConditionig);
|
set => UpdateEnabledSubsystems(value, EnabledSubsystemsFlags.AutoConditionig);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ public struct EnabledSubsystems
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsAutoSinking
|
public bool IsAutoSinking
|
||||||
{
|
{
|
||||||
get => (value & (int)EnabledSubsystemsFlags.AutoSinking) > 0;
|
get => IsEnabledSubsystem(EnabledSubsystemsFlags.AutoSinking);
|
||||||
set => UpdateEnabledSubsystems(value, EnabledSubsystemsFlags.AutoSinking);
|
set => UpdateEnabledSubsystems(value, EnabledSubsystemsFlags.AutoSinking);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ public struct EnabledSubsystems
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsAutoLifting
|
public bool IsAutoLifting
|
||||||
{
|
{
|
||||||
get => (value & (int)EnabledSubsystemsFlags.AutoLifting) > 0;
|
get => IsEnabledSubsystem(EnabledSubsystemsFlags.AutoLifting);
|
||||||
set => UpdateEnabledSubsystems(value, EnabledSubsystemsFlags.AutoLifting);
|
set => UpdateEnabledSubsystems(value, EnabledSubsystemsFlags.AutoLifting);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ public struct EnabledSubsystems
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsAutoLiftingWithConditionig
|
public bool IsAutoLiftingWithConditionig
|
||||||
{
|
{
|
||||||
get => (value & (int)EnabledSubsystemsFlags.AutoLiftingWithConditionig) > 0;
|
get => IsEnabledSubsystem(EnabledSubsystemsFlags.AutoLiftingWithConditionig);
|
||||||
set => UpdateEnabledSubsystems(value, EnabledSubsystemsFlags.AutoLiftingWithConditionig);
|
set => UpdateEnabledSubsystems(value, EnabledSubsystemsFlags.AutoLiftingWithConditionig);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ public struct EnabledSubsystems
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsAutoBlocknig
|
public bool IsAutoBlocknig
|
||||||
{
|
{
|
||||||
get => (value & (int)EnabledSubsystemsFlags.AutoBlocknig) > 0;
|
get => IsEnabledSubsystem(EnabledSubsystemsFlags.AutoBlocknig);
|
||||||
set => UpdateEnabledSubsystems(value, EnabledSubsystemsFlags.AutoBlocknig);
|
set => UpdateEnabledSubsystems(value, EnabledSubsystemsFlags.AutoBlocknig);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,10 +88,13 @@ public struct EnabledSubsystems
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsAutoOscillation
|
public bool IsAutoOscillation
|
||||||
{
|
{
|
||||||
get => (value & (int)EnabledSubsystemsFlags.AutoOscillation) > 0;
|
get => IsEnabledSubsystem(EnabledSubsystemsFlags.AutoOscillation);
|
||||||
set => UpdateEnabledSubsystems(value, EnabledSubsystemsFlags.AutoOscillation);
|
set => UpdateEnabledSubsystems(value, EnabledSubsystemsFlags.AutoOscillation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool IsEnabledSubsystem(EnabledSubsystemsFlags flag) =>
|
||||||
|
(value & (int)flag) > 0;
|
||||||
|
|
||||||
private void UpdateEnabledSubsystems(bool isEnable, EnabledSubsystemsFlags flag)
|
private void UpdateEnabledSubsystems(bool isEnable, EnabledSubsystemsFlags flag)
|
||||||
{
|
{
|
||||||
if (isEnable)
|
if (isEnable)
|
||||||
|
Loading…
Reference in New Issue
Block a user