Apply R# clean-up for reliability (#877)

* Apply R# clean-up for reliability

- Migrate to NUnit4 Assert.That
- Update dependencise versions
- Fix LangVersion to 9.0 (until net core migration)
- Reformat code
- Apply 'var' style (easier for refactoring)
- Remove redundant parentheses
- Add braces on every condition blocks (1 line)
- Uses new null checking patterns
- Uses AutoProperties when possible
- Uses string scalar type instead of class
- Clean usings
- Add .orig files in git ignore
- Rename some properties to respect defined conventions and US format definition
	- ID -> Id
	- BPM -> Bpm
	- Finish -> End

* Update R# settings according to the clean-up made
This commit is contained in:
Quentin Bray authored and GitHub committed 2026-06-22 19:52:06 +02:00
1 parent b9b0f7c8df
commit 6ffa63b923
236 files changed
+14194 -7278

No files matched your search

+26 -23
View File
@@ -71,7 +71,7 @@ namespace VocaluxeLib.Menu.SingNotes
public class CSingNotes : CMenuElementBase, IMenuElement, IThemeable
{
private readonly int _PartyModeID;
private readonly int _PartyModeId;
private SThemeSingBar _Theme;
public readonly List<CNoteBars> PlayerNotes = new List<CNoteBars>();
@@ -95,16 +95,16 @@ namespace VocaluxeLib.Menu.SingNotes
/// </remarks>
private SRectF[,,] _BarPos { get; set; }
public CSingNotes(int partyModeID)
public CSingNotes(int partyModeId)
{
_PartyModeID = partyModeID;
_PartyModeId = partyModeId;
_Theme = new SThemeSingBar { BarPos = new SBarPosition[CHelper.Sum(CBase.Settings.GetMaxNumPlayer() * CBase.Settings.GetMaxNumScreens())] };
ThemeLoaded = false;
}
public CSingNotes(SThemeSingBar theme, int partyModeID)
public CSingNotes(SThemeSingBar theme, int partyModeId)
{
_PartyModeID = partyModeID;
_PartyModeId = partyModeId;
_Theme = theme;
_BarPos = new SRectF[CBase.Settings.GetMaxNumScreens(), CBase.Settings.GetMaxNumPlayer(), CBase.Settings.GetMaxNumPlayer()];
@@ -121,45 +121,46 @@ namespace VocaluxeLib.Menu.SingNotes
public void Init(int numPlayers, int numScreens = 0)
{
PlayerNotes.Clear();
if (numPlayers > 0 && numScreens > 0)
{
int[] screenAssignment = new int[numPlayers];
int screenPlayers = numPlayers / numScreens;
int remainingPlayers = numPlayers - (screenPlayers * numScreens);
int player = 0;
var screenAssignment = new int[numPlayers];
var screenPlayers = numPlayers / numScreens;
var remainingPlayers = numPlayers - screenPlayers * numScreens;
var player = 0;
for (int s = 0; s < numScreens; s++)
for (var s = 0; s < numScreens; s++)
{
for (int p = 0; p < screenPlayers; p++)
for (var p = 0; p < screenPlayers; p++)
{
if (remainingPlayers > 0)
{
PlayerNotes.Add(new CNoteBars(_PartyModeID, player++, _BarPos[s, p, screenPlayers], _Theme));
PlayerNotes.Add(new CNoteBars(_PartyModeId, player++, _BarPos[s, p, screenPlayers], _Theme));
if (p == screenPlayers - 1)
{
PlayerNotes.Add(new CNoteBars(_PartyModeID, player++, _BarPos[s, p + 1, screenPlayers], _Theme));
PlayerNotes.Add(new CNoteBars(_PartyModeId, player++, _BarPos[s, p + 1, screenPlayers], _Theme));
remainingPlayers--;
}
}
else
{
PlayerNotes.Add(new CNoteBars(_PartyModeID, player++, _BarPos[s, p, screenPlayers - 1], _Theme));
PlayerNotes.Add(new CNoteBars(_PartyModeId, player++, _BarPos[s, p, screenPlayers - 1], _Theme));
}
}
//Handle when players < screens
if (screenPlayers == 0 && remainingPlayers > 0)
{
PlayerNotes.Add(new CNoteBars(_PartyModeID, player++, _BarPos[s, 0, 0], _Theme));
PlayerNotes.Add(new CNoteBars(_PartyModeId, player++, _BarPos[s, 0, 0], _Theme));
remainingPlayers--;
}
}
}
if (numPlayers == 0)
{
_Rect = new SRectF(0, 0, 0, 0, Rect.Z);
}
else
{
_Rect.X = PlayerNotes.Select(bp => bp.Rect.X).Min();
@@ -172,8 +173,10 @@ namespace VocaluxeLib.Menu.SingNotes
public void Draw()
{
foreach (CNoteBars noteBars in PlayerNotes)
foreach (var noteBars in PlayerNotes)
{
noteBars.Draw();
}
}
public void UnloadSkin() { }
@@ -186,11 +189,11 @@ namespace VocaluxeLib.Menu.SingNotes
W = X - _Theme.BarPos.Select(bp => bp.Rect.Right).Max();
H = Y - _Theme.BarPos.Select(bp => bp.Rect.Bottom).Max();
Z = _Theme.BarPos.Select(bp => bp.Rect.Z).Average();
foreach (SBarPosition bp in _Theme.BarPos)
foreach (var bp in _Theme.BarPos)
{
int n = Int32.Parse(bp.Name.Substring(3, 1)) - 1;
int p = Int32.Parse(bp.Name.Substring(1, 1)) - 1;
for (int s = 0; s < CBase.Settings.GetMaxNumScreens(); s++)
var n = Int32.Parse(bp.Name.Substring(3, 1)) - 1;
var p = Int32.Parse(bp.Name.Substring(1, 1)) - 1;
for (var s = 0; s < CBase.Settings.GetMaxNumScreens(); s++)
{
_BarPos[s, p, n] = bp.Rect;
_BarPos[s, p, n].X += s * CBase.Settings.GetRenderW();
@@ -215,4 +218,4 @@ namespace VocaluxeLib.Menu.SingNotes
public void ResizeElement(int stepW, int stepH) { }
#endregion ThemeEdit
}
}
}