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
+51
-22
@@ -24,7 +24,8 @@ namespace VocaluxeLib.Menu
|
||||
[XmlType("Button")]
|
||||
public struct SThemeButton
|
||||
{
|
||||
[XmlAttribute(AttributeName = "Name")] public string Name;
|
||||
[XmlAttribute(AttributeName = "Name")]
|
||||
public string Name;
|
||||
|
||||
public string Skin;
|
||||
public string SkinSelected;
|
||||
@@ -40,7 +41,7 @@ namespace VocaluxeLib.Menu
|
||||
public sealed class CButton : CMenuElementBase, IMenuElement, IThemeable
|
||||
{
|
||||
private SThemeButton _Theme;
|
||||
private readonly int _PartyModeID;
|
||||
private readonly int _PartyModeId;
|
||||
|
||||
public CTextureRef Texture;
|
||||
public CTextureRef SelTexture;
|
||||
@@ -67,7 +68,9 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
Text.EditMode = value;
|
||||
if (_SelText != null)
|
||||
{
|
||||
_SelText.EditMode = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +91,9 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
_Selectable = value;
|
||||
if (!_Selectable)
|
||||
{
|
||||
Selected = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,22 +104,22 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
public bool ThemeLoaded { get; private set; }
|
||||
|
||||
public CButton(int partyModeID)
|
||||
public CButton(int partyModeId)
|
||||
{
|
||||
_PartyModeID = partyModeID;
|
||||
Text = new CText(_PartyModeID);
|
||||
_SelText = new CText(_PartyModeID);
|
||||
_PartyModeId = partyModeId;
|
||||
Text = new CText(_PartyModeId);
|
||||
_SelText = new CText(_PartyModeId);
|
||||
Selected = false;
|
||||
EditMode = false;
|
||||
}
|
||||
|
||||
public CButton(SThemeButton theme, int partyModeID, bool buttonText = false)
|
||||
public CButton(SThemeButton theme, int partyModeId, bool buttonText = false)
|
||||
{
|
||||
_PartyModeID = partyModeID;
|
||||
_PartyModeId = partyModeId;
|
||||
_Theme = theme;
|
||||
|
||||
Text = new CText(_Theme.Text, _PartyModeID, buttonText);
|
||||
_SelText = _Theme.SelText.HasValue ? new CText(_Theme.SelText.Value, _PartyModeID, buttonText) : null;
|
||||
Text = new CText(_Theme.Text, _PartyModeId, buttonText);
|
||||
_SelText = _Theme.SelText.HasValue ? new CText(_Theme.SelText.Value, _PartyModeId, buttonText) : null;
|
||||
|
||||
Selected = false;
|
||||
EditMode = false;
|
||||
@@ -124,12 +129,12 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
public CButton(CButton button)
|
||||
{
|
||||
_PartyModeID = button._PartyModeID;
|
||||
_PartyModeId = button._PartyModeId;
|
||||
_Theme = new SThemeButton
|
||||
{
|
||||
Skin = button._Theme.Skin,
|
||||
SkinSelected = button._Theme.SkinSelected
|
||||
};
|
||||
{
|
||||
Skin = button._Theme.Skin,
|
||||
SkinSelected = button._Theme.SkinSelected
|
||||
};
|
||||
|
||||
MaxRect = button.MaxRect;
|
||||
Color = button.Color;
|
||||
@@ -156,21 +161,27 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
_Theme.Text = (SThemeText)Text.GetTheme();
|
||||
if (_SelText == null)
|
||||
{
|
||||
_Theme.SelText = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
_Theme.SelText = (SThemeText)_SelText.GetTheme();
|
||||
}
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
if (!Visible && CBase.Settings.GetProgramState() != EProgramState.EditTheme)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CTextureRef texture;
|
||||
|
||||
if (!Selected && !Pressed || !_Selectable)
|
||||
{
|
||||
texture = Texture ?? CBase.Themes.GetSkinTexture(_Theme.Skin, _PartyModeID);
|
||||
texture = Texture ?? CBase.Themes.GetSkinTexture(_Theme.Skin, _PartyModeId);
|
||||
|
||||
CBase.Drawing.DrawTexture(texture, Rect, Color);
|
||||
|
||||
@@ -180,11 +191,13 @@ namespace VocaluxeLib.Menu
|
||||
Text.DrawRelative(Rect.X, Rect.Y, _ReflectionHeight, _ReflectionSpace, Rect.H);
|
||||
}
|
||||
else
|
||||
{
|
||||
Text.DrawRelative(Rect.X, Rect.Y);
|
||||
}
|
||||
}
|
||||
else if (_SelText == null)
|
||||
{
|
||||
texture = SelTexture ?? CBase.Themes.GetSkinTexture(_Theme.SkinSelected, _PartyModeID);
|
||||
texture = SelTexture ?? CBase.Themes.GetSkinTexture(_Theme.SkinSelected, _PartyModeId);
|
||||
|
||||
CBase.Drawing.DrawTexture(texture, Rect, SelColor);
|
||||
|
||||
@@ -194,11 +207,13 @@ namespace VocaluxeLib.Menu
|
||||
Text.DrawRelative(Rect.X, Rect.Y, _ReflectionHeight, _ReflectionSpace, Rect.H);
|
||||
}
|
||||
else
|
||||
{
|
||||
Text.DrawRelative(Rect.X, Rect.Y);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
texture = SelTexture ?? CBase.Themes.GetSkinTexture(_Theme.SkinSelected, _PartyModeID);
|
||||
texture = SelTexture ?? CBase.Themes.GetSkinTexture(_Theme.SkinSelected, _PartyModeId);
|
||||
|
||||
CBase.Drawing.DrawTexture(texture, Rect, SelColor);
|
||||
|
||||
@@ -208,33 +223,41 @@ namespace VocaluxeLib.Menu
|
||||
_SelText.DrawRelative(Rect.X, Rect.Y, _ReflectionHeight, _ReflectionSpace, Rect.H);
|
||||
}
|
||||
else
|
||||
{
|
||||
_SelText.DrawRelative(Rect.X, Rect.Y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void UnloadSkin()
|
||||
{
|
||||
if (!ThemeLoaded)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Text.UnloadSkin();
|
||||
}
|
||||
|
||||
public void LoadSkin()
|
||||
{
|
||||
if (!ThemeLoaded)
|
||||
{
|
||||
return;
|
||||
Text = new CText(_Theme.Text, _PartyModeID);
|
||||
}
|
||||
|
||||
Text = new CText(_Theme.Text, _PartyModeId);
|
||||
Text.LoadSkin();
|
||||
Text.Selected = Selected;
|
||||
|
||||
if (_Theme.SelText.HasValue)
|
||||
{
|
||||
_SelText = new CText(_Theme.SelText.Value, _PartyModeID);
|
||||
_SelText = new CText(_Theme.SelText.Value, _PartyModeId);
|
||||
_SelText.LoadSkin();
|
||||
}
|
||||
|
||||
_Theme.Color.Get(_PartyModeID, out Color);
|
||||
_Theme.SelColor.Get(_PartyModeID, out SelColor);
|
||||
_Theme.Color.Get(_PartyModeId, out Color);
|
||||
_Theme.SelColor.Get(_PartyModeId, out SelColor);
|
||||
|
||||
MaxRect = _Theme.Rect;
|
||||
|
||||
@@ -255,7 +278,9 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
|
||||
if (_Theme.Rect.Z < Text.Z)
|
||||
{
|
||||
Text.Z = _Theme.Rect.Z;
|
||||
}
|
||||
}
|
||||
|
||||
public void ReloadSkin()
|
||||
@@ -284,11 +309,15 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
W += stepW;
|
||||
if (W <= 0)
|
||||
{
|
||||
W = 1;
|
||||
}
|
||||
|
||||
H += stepH;
|
||||
if (H <= 0)
|
||||
{
|
||||
H = 1;
|
||||
}
|
||||
|
||||
_Theme.Rect.W = Rect.W;
|
||||
_Theme.Rect.H = Rect.H;
|
||||
|
||||
Reference in new issue
Block a user