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:
1 parent
b9b0f7c8df
commit
6ffa63b923
236 files changed
+14194
-7278
No files matched your search
@@ -23,20 +23,16 @@ namespace VocaluxeLib.PartyModes
|
||||
{
|
||||
public abstract class CPartyMode : IPartyMode
|
||||
{
|
||||
private readonly int _ID;
|
||||
protected SScreenSongOptions _ScreenSongOptions = new SScreenSongOptions {Selection = new SSelectionOptions(), Sorting = new SSortingOptions()};
|
||||
protected SScreenSongOptions _ScreenSongOptions = new SScreenSongOptions { Selection = new SSelectionOptions(), Sorting = new SSortingOptions() };
|
||||
protected readonly Dictionary<string, CMenuParty> _Screens = new Dictionary<string, CMenuParty>();
|
||||
|
||||
protected CPartyMode(int id)
|
||||
{
|
||||
_ID = id;
|
||||
Id = id;
|
||||
}
|
||||
|
||||
#region Implementation
|
||||
public int ID
|
||||
{
|
||||
get { return _ID; }
|
||||
}
|
||||
public int Id { get; }
|
||||
|
||||
public int NumPlayers { get; set; }
|
||||
public int NumTeams { get; set; }
|
||||
@@ -55,8 +51,8 @@ namespace VocaluxeLib.PartyModes
|
||||
|
||||
public void LoadTheme()
|
||||
{
|
||||
string xmlPath = CBase.Themes.GetThemeScreensPath(ID);
|
||||
foreach (CMenuParty menu in _Screens.Values)
|
||||
var xmlPath = CBase.Themes.GetThemeScreensPath(Id);
|
||||
foreach (var menu in _Screens.Values)
|
||||
{
|
||||
menu.Init();
|
||||
menu.LoadTheme(xmlPath);
|
||||
@@ -65,15 +61,19 @@ namespace VocaluxeLib.PartyModes
|
||||
|
||||
public void ReloadSkin()
|
||||
{
|
||||
foreach (CMenuParty menu in _Screens.Values)
|
||||
foreach (var menu in _Screens.Values)
|
||||
{
|
||||
menu.ReloadSkin();
|
||||
}
|
||||
}
|
||||
|
||||
public void ReloadTheme()
|
||||
{
|
||||
string xmlPath = CBase.Themes.GetThemeScreensPath(ID);
|
||||
foreach (CMenuParty menu in _Screens.Values)
|
||||
var xmlPath = CBase.Themes.GetThemeScreensPath(Id);
|
||||
foreach (var menu in _Screens.Values)
|
||||
{
|
||||
menu.ReloadTheme(xmlPath);
|
||||
}
|
||||
}
|
||||
|
||||
public void AddScreen(CMenuParty screen, string screenName)
|
||||
@@ -83,20 +83,28 @@ namespace VocaluxeLib.PartyModes
|
||||
|
||||
public void SaveScreens()
|
||||
{
|
||||
foreach (KeyValuePair<string, CMenuParty> entry in _Screens)
|
||||
foreach (var entry in _Screens)
|
||||
{
|
||||
entry.Value.SaveTheme();
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void JokerUsed(int teamNr)
|
||||
{
|
||||
if (_ScreenSongOptions.Selection.NumJokers == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_ScreenSongOptions.Selection.NumJokers.Length < teamNr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_ScreenSongOptions.Selection.NumJokers[teamNr] > 0)
|
||||
{
|
||||
_ScreenSongOptions.Selection.NumJokers[teamNr]--;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void FinishedSinging()
|
||||
@@ -132,7 +140,7 @@ namespace VocaluxeLib.PartyModes
|
||||
public abstract void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions);
|
||||
public abstract void SetSearchString(string searchString, bool visible);
|
||||
|
||||
public abstract void SongSelected(int songID);
|
||||
public abstract void SongSelected(int songId);
|
||||
#endregion Abstract members
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,6 @@
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using VocaluxeLib.Menu;
|
||||
|
||||
namespace VocaluxeLib.PartyModes
|
||||
@@ -65,10 +64,10 @@ namespace VocaluxeLib.PartyModes
|
||||
_ScreenSongOptions.Selection.SongIndex = -1;
|
||||
_ScreenSongOptions.Selection.CategoryIndex = -1;
|
||||
|
||||
_ScreenSongOptions.Sorting.SearchString = String.Empty;
|
||||
_ScreenSongOptions.Sorting.SearchString = string.Empty;
|
||||
_ScreenSongOptions.Sorting.SearchActive = false;
|
||||
_ScreenSongOptions.Sorting.DuetOptions = EDuetOptions.All;
|
||||
_ScreenSongOptions.Sorting.FilterPlaylistID = -1;
|
||||
_ScreenSongOptions.Sorting.FilterPlaylistId = -1;
|
||||
}
|
||||
|
||||
public override bool Init()
|
||||
@@ -76,7 +75,7 @@ namespace VocaluxeLib.PartyModes
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void UpdateGame() {}
|
||||
public override void UpdateGame() { }
|
||||
|
||||
public override IMenu GetStartScreen()
|
||||
{
|
||||
@@ -89,16 +88,18 @@ namespace VocaluxeLib.PartyModes
|
||||
_ScreenSongOptions.Sorting.Tabs = CBase.Config.GetTabs();
|
||||
|
||||
if (_ScreenSongOptions.Sorting.SearchActive)
|
||||
{
|
||||
_ScreenSongOptions.Sorting.Tabs = EOffOn.TR_CONFIG_OFF;
|
||||
}
|
||||
|
||||
_ScreenSongOptions.Sorting.IgnoreArticles = CBase.Config.GetIgnoreArticles();
|
||||
|
||||
return _ScreenSongOptions;
|
||||
}
|
||||
|
||||
public override void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions) {}
|
||||
public override void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions) { }
|
||||
|
||||
public override void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions) {}
|
||||
public override void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions) { }
|
||||
|
||||
public override void SetSearchString(string searchString, bool visible)
|
||||
{
|
||||
@@ -106,7 +107,7 @@ namespace VocaluxeLib.PartyModes
|
||||
_ScreenSongOptions.Sorting.SearchActive = visible;
|
||||
}
|
||||
|
||||
public override void SongSelected(int songID)
|
||||
public override void SongSelected(int songId)
|
||||
{
|
||||
CBase.Graphics.FadeTo(EScreen.Sing);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ using VocaluxeLib.Menu;
|
||||
|
||||
namespace VocaluxeLib.PartyModes
|
||||
{
|
||||
|
||||
#region Structs
|
||||
public struct SScreenSongOptions
|
||||
{
|
||||
@@ -34,7 +33,7 @@ namespace VocaluxeLib.PartyModes
|
||||
public EOffOn IgnoreArticles;
|
||||
public string SearchString;
|
||||
public bool SearchActive;
|
||||
public int FilterPlaylistID; //show only songs that are in this playlist, -1 for all songs
|
||||
public int FilterPlaylistId; //show only songs that are in this playlist, -1 for all songs
|
||||
public EDuetOptions DuetOptions;
|
||||
}
|
||||
|
||||
@@ -87,7 +86,7 @@ namespace VocaluxeLib.PartyModes
|
||||
|
||||
public interface IPartyModeInfo
|
||||
{
|
||||
int ID { get; }
|
||||
int Id { get; }
|
||||
int MinMics { get; }
|
||||
int MaxMics { get; }
|
||||
int MinPlayers { get; }
|
||||
@@ -124,7 +123,7 @@ namespace VocaluxeLib.PartyModes
|
||||
void SetSearchString(string searchString, bool visible);
|
||||
|
||||
void JokerUsed(int teamNr);
|
||||
void SongSelected(int songID);
|
||||
void SongSelected(int songId);
|
||||
void FinishedSinging();
|
||||
void LeavingScore();
|
||||
void LeavingHighscore();
|
||||
|
||||
Reference in new issue
Block a user