Enable CA1044 and fix noncompliance

getters with lower visibility than setters, or set-only props
This commit is contained in:
YoshiRulz 2022-03-08 10:37:58 +10:00
parent dd455580d6
commit 191f1f3020
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
14 changed files with 26 additions and 22 deletions

View File

@ -113,7 +113,7 @@
<Rule Id="CA1043" Action="Hidden" />
<!-- Properties should not be write only -->
<Rule Id="CA1044" Action="Hidden" />
<Rule Id="CA1044" Action="Error" />
<!-- Do not declare visible instance fields -->
<Rule Id="CA1051" Action="Hidden" />

View File

@ -18,7 +18,7 @@ namespace BizHawk.Client.Common
bool EmulatorPaused { get; }
/// <remarks>only referenced from <c>EmuClientApi</c></remarks>
bool InvisibleEmulation { set; }
bool InvisibleEmulation { get; set; }
/// <remarks>only referenced from <c>EmuClientApi</c></remarks>
bool IsSeeking { get; }
@ -30,7 +30,7 @@ namespace BizHawk.Client.Common
(HttpCommunication HTTP, MemoryMappedFiles MMF, SocketServer Sockets) NetworkingHelpers { get; }
/// <remarks>only referenced from <c>EmuClientApi</c></remarks>
bool PauseAvi { set; }
bool PauseAvi { get; set; }
/// <remarks>only referenced from <c>EmuClientApi</c></remarks>
void ClearHolds();

View File

@ -25,7 +25,7 @@ namespace BizHawk.Client.Common
public abstract string Name { get; }
public ApiContainer APIs { protected get; set; }
public ApiContainer APIs { get; set; }
protected readonly Action<string> LogOutputCallback;

View File

@ -50,7 +50,7 @@ namespace BizHawk.Client.Common
public IDictionary<string, object> UserBag { get; set; } = new Dictionary<string, object>();
public IInputAdapter MovieIn { private get; set; }
public IInputAdapter MovieIn { get; set; }
public IInputAdapter MovieOut { get; } = new CopyControllerAdapter();
public IStickyAdapter StickySource { get; set; }

View File

@ -37,7 +37,7 @@ namespace BizHawk.Client.Common
/// the movie for the purpose of recording, if active,
/// or to simply pass through if inactive
/// </summary>
IInputAdapter MovieIn { set; }
IInputAdapter MovieIn { get; set; }
/// <summary>
/// Represents the movie input in the input chain

View File

@ -13,8 +13,8 @@ namespace BizHawk.Client.Common
IMovieChangeLog ChangeLog { get; }
IStateManager TasStateManager { get; }
Func<string> ClientSettingsForSave { set; }
Action<string> GetClientSettingsOnLoad { set; }
Func<string> ClientSettingsForSave { get; set; }
Action<string> GetClientSettingsOnLoad { get; set; }
ITasMovieRecord this[int index] { get; }
ITasSession TasSession { get; }
TasMovieMarkerList Markers { get; }

View File

@ -34,6 +34,7 @@
/// </summary>
public int UnscaledWidth
{
get => UIHelper.UnscaleX(Width);
set => Width = UIHelper.ScaleX(value);
}
}

View File

@ -25,7 +25,7 @@ namespace BizHawk.Client.EmuHawk
bool GameIsClosing { get; }
/// <remarks>only referenced from <see cref="PlaybackBox"/></remarks>
bool HoldFrameAdvance { set; }
bool HoldFrameAdvance { get; set; }
/// <remarks>only referenced from <see cref="BasicBot"/></remarks>
bool InvisibleEmulation { get; set; }
@ -39,7 +39,7 @@ namespace BizHawk.Client.EmuHawk
int? PauseOnFrame { get; set; }
/// <remarks>only referenced from <see cref="PlaybackBox"/></remarks>
bool PressRewind { set; }
bool PressRewind { get; set; }
/// <remarks>only referenced from <see cref="TAStudio"/></remarks>
IQuickBmpFile QuickBmpFile { get; }

View File

@ -43,5 +43,8 @@ namespace BizHawk.Client.EmuHawk
using var form = new Form { AutoScaleMode = autoScaleMode };
return form.CurrentAutoScaleDimensions;
}
public static int UnscaleX(int size)
=> (int) Math.Round(size / AutoScaleFactorX);
}
}

View File

@ -24,7 +24,7 @@ namespace BizHawk.Client.EmuHawk
/// <remarks>TODO <see cref="UserControl">UserControls</see> can be <see cref="IDialogParent">IDialogParents</see> too, the modal should still be tied to the parent <see cref="Form"/> if used that way</remarks>
[Browsable(false)]
public IDialogParent DialogParent { private get; set; }
public IDialogParent DialogParent { get; set; }
[Browsable(false)]
public bool SyncSettingsChanged { get; private set; }

View File

@ -17,7 +17,7 @@ namespace BizHawk.Client.EmuHawk
private readonly Dictionary<Color, SolidBrush> _solidBrushes = new Dictionary<Color, SolidBrush>();
private readonly Dictionary<Color, Pen> _pens = new Dictionary<Color, Pen>();
internal NLuaTableHelper TableHelper { private get; set; }
internal NLuaTableHelper TableHelper { get; set; }
private SolidBrush GetBrush([LuaColorParam] object color)
{

View File

@ -11,17 +11,17 @@ namespace BizHawk.Client.EmuHawk
{
public class ToolFormBase : FormBase, IToolForm, IDialogParent
{
public ToolManager Tools { protected get; set; }
public ToolManager Tools { get; set; }
public DisplayManager DisplayManager { protected get; set; }
public DisplayManager DisplayManager { get; set; }
public InputManager InputManager { protected get; set; }
public InputManager InputManager { get; set; }
public IMainFormForTools MainForm { protected get; set; }
public IMainFormForTools MainForm { get; set; }
public IMovieSession MovieSession { protected get; set; }
public IMovieSession MovieSession { get; set; }
public IGameInfo Game { protected get; set; }
public IGameInfo Game { get; set; }
public IDialogController DialogController => MainForm;

View File

@ -41,7 +41,7 @@ namespace BizHawk.Client.EmuHawk
public bool HasValue { get; set; }
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool ReadOnly { private get; set; }
public bool ReadOnly { get; set; }
public string XName { get; private set; } = string.Empty;
public string YName { get; private set; } = string.Empty;
@ -140,7 +140,7 @@ namespace BizHawk.Client.EmuHawk
private readonly Bitmap _grayDot = new Bitmap(7, 7);
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public Action ClearCallback { private get; set; }
public Action ClearCallback { get; set; }
public AnalogStickPanel()
{

View File

@ -72,8 +72,8 @@ namespace BizHawk.Emulation.Cores.Calculators.TI83
private int _linkOutput;
internal int LinkOutput => _linkOutput;
internal bool LinkActive { private get; set; }
internal int LinkInput { private get; set; }
internal bool LinkActive { get; set; }
internal int LinkInput { get; set; }
internal int LinkState => (_linkOutput | LinkInput) ^ 3;