Improve method visibility

This commit is contained in:
Kamil Trzciński 2022-11-27 09:19:34 +01:00
parent 509bc588a3
commit 8f69ec772b
7 changed files with 28 additions and 24 deletions

View file

@ -83,7 +83,7 @@ namespace SteamController.Devices
get { return mouseButtons.ToArray(); }
}
public MouseController()
internal MouseController()
{
}

View file

@ -9,11 +9,11 @@ namespace SteamController.Devices
{
public const ushort SteamVendorID = 0x28DE;
public const ushort SteamProductID = 0x1205;
public const int ReadTimeout = 50;
private const int ReadTimeout = 50;
private hidapi.HidDevice neptuneDevice;
public SteamController()
internal SteamController()
{
InitializeButtons();
InitializeActions();

View file

@ -12,8 +12,8 @@ namespace SteamController.Devices
public String Name { get; internal set; } = "";
/// This is action controlled by Lizard mode
public bool LizardButton { get; set; }
public bool LizardMouse { get; set; }
public bool LizardButton { get; internal set; }
public bool LizardMouse { get; internal set; }
public DateTime LastUpdated { get; protected set; } = DateTime.Now;
public double DeltaTime { get; protected set; }
@ -21,6 +21,10 @@ namespace SteamController.Devices
internal abstract bool BeforeUpdate(byte[] buffer);
internal abstract void Update();
internal SteamAction()
{
}
protected void UpdateTime()
{
var now = DateTime.Now;
@ -59,13 +63,13 @@ namespace SteamController.Devices
}
/// Last press was already consumed by other
public object? Consumed { get; private set; }
internal object? Consumed { get; private set; }
/// Set on raising edge
public DateTime? HoldSince { get; private set; }
public DateTime? HoldRepeated { get; private set; }
private DateTime? HoldSince { get; set; }
private DateTime? HoldRepeated { get; set; }
public SteamButton()
internal SteamButton()
{
}
@ -95,7 +99,7 @@ namespace SteamController.Devices
return true;
}
public bool Consume(object consume)
private bool Consume(object consume)
{
if (Consumed is not null && Consumed != consume)
return false;
@ -145,7 +149,7 @@ namespace SteamController.Devices
/// Generated when button was hold for a given period
/// but triggered exactly after previously being hold
public bool HoldNext(TimeSpan? duration, object previousConsume, object replaceConsme)
public bool HoldChain(TimeSpan? duration, object previousConsume, object replaceConsme)
{
if (!Hold(duration, previousConsume))
return false;
@ -233,7 +237,7 @@ namespace SteamController.Devices
private int offset;
private uint mask;
public SteamButton2(int offset, object mask)
internal SteamButton2(int offset, object mask)
{
this.offset = offset;
this.mask = (uint)mask.GetHashCode();
@ -271,8 +275,8 @@ namespace SteamController.Devices
public SteamButton? ActiveButton { get; internal set; }
public SteamButton? VirtualLeft { get; internal set; }
public SteamButton? VirtualRight { get; internal set; }
public short Deadzone { get; set; }
public short MinChange { get; set; }
public short Deadzone { get; internal set; }
public short MinChange { get; internal set; }
public short Value
{

View file

@ -129,10 +129,10 @@ namespace SteamController.Devices
}
public bool Connected { get; set; }
public byte? FeedbackLargeMotor { get; internal set; }
public byte? FeedbackSmallMotor { get; internal set; }
public byte LedNumber { get; internal set; }
public DateTime? FeedbackReceived { get; set; }
public byte? FeedbackLargeMotor { get; private set; }
public byte? FeedbackSmallMotor { get; private set; }
public byte LedNumber { get; private set; }
public DateTime? FeedbackReceived { get; private set; }
public bool this[Xbox360Button button]
{

View file

@ -32,7 +32,7 @@ namespace SteamController.Profiles
}
return Status.Done;
}
else if (c.Steam.BtnOptions.HoldNext(HoldToSwitchDesktop, ShortcutConsumed, "SwitchToDesktop"))
else if (c.Steam.BtnOptions.HoldChain(HoldToSwitchDesktop, ShortcutConsumed, "SwitchToDesktop"))
{
c.ToggleDesktopMode();
return Status.Done;

View file

@ -10,9 +10,9 @@ namespace SteamController.Profiles
public bool IsDone { get; set; }
}
public String Name { get; set; } = "";
public bool Visible { get; set; } = true;
public bool IsDesktop { get; set; }
public virtual String Name { get; set; } = "";
public virtual bool Visible { get; set; } = true;
public virtual bool IsDesktop { get; set; }
public abstract bool Selected(Context context);

View file

@ -21,7 +21,6 @@ namespace SteamController.Profiles
Log.TraceLine("X360: Feedback Large: {0}", context.X360.FeedbackLargeMotor.Value);
context.Steam.SetHaptic(
1, GetHapticAmplitude(context.X360.FeedbackLargeMotor), FeedbackPeriod, FeedbackCount);
context.X360.FeedbackLargeMotor = null;
}
if (context.X360.FeedbackSmallMotor.HasValue)
@ -29,9 +28,10 @@ namespace SteamController.Profiles
Log.TraceLine("X360: Feedback Small: {0}", context.X360.FeedbackSmallMotor.Value);
context.Steam.SetHaptic(
0, GetHapticAmplitude(context.X360.FeedbackSmallMotor), FeedbackPeriod, FeedbackCount);
context.X360.FeedbackSmallMotor = null;
}
context.X360.ResetFeedback();
return Status.Continue;
}