Fix code issues (naming, unused stuff)

This commit is contained in:
Flamefire committed 2014-03-12 09:41:34 +01:00
1 parent 424cb826ed
commit 898819fcf5
34 files changed
+128 -141

No files matched your search

+2
View File
@@ -355,6 +355,7 @@ namespace VocaluxeLib
[Flags]
public enum EUserRole
{
// ReSharper disable InconsistentNaming
TR_USERROLE_GUEST = 0,
TR_USERROLE_NORMAL = 1,
TR_USERROLE_ADMIN = 2,
@@ -362,5 +363,6 @@ namespace VocaluxeLib
TR_USERROLE_ADDSONGSUSER = 8,
TR_USERROLE_PLAYLISTEDITOR = 16,
TR_USERROLE_PROFILEEDITOR = 32
// ReSharper restore InconsistentNaming
}
}
+1 -2
View File
@@ -19,11 +19,10 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
namespace VocaluxeLib
{
public static class Extensions
public static class CExtensions
{
/// <summary>
/// Resizes the given list to the given size. Removes elements or adds default values
+4 -5
View File
@@ -54,8 +54,8 @@ namespace VocaluxeLib.Menu
private bool _ThemeLoaded;
private int _SlideShowCurrent;
private Stopwatch _SlideShowTimer = new Stopwatch();
private List<CTexture> _SlideShowTextures = new List<CTexture>();
private readonly Stopwatch _SlideShowTimer = new Stopwatch();
private readonly List<CTexture> _SlideShowTextures = new List<CTexture>();
public SColorF Color;
@@ -69,8 +69,7 @@ namespace VocaluxeLib.Menu
{
_PartyModeID = partyModeID;
_ThemeLoaded = false;
_Theme = new SThemeBackground();
_Theme.SlideShowTextures = new List<string>();
_Theme = new SThemeBackground {SlideShowTextures = new List<string>()};
Color = new SColorF(0f, 0f, 0f, 1f);
}
@@ -102,11 +101,11 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= success;
}
string slideShow = "";
int i = 1;
while (xmlReader.ItemExists(item + "/SlideShow" + i))
{
string slideShow;
xmlReader.GetValue(item + "/SlideShow" + i, out slideShow, String.Empty);
if (slideShow != "")
_Theme.SlideShowTextures.Add(slideShow);
-2
View File
@@ -16,8 +16,6 @@
#endregion
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Xml;
using VocaluxeLib.Songs;
-1
View File
@@ -19,7 +19,6 @@ using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using VocaluxeLib.Draw;
+56 -19
View File
@@ -15,11 +15,8 @@
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using VocaluxeLib.PartyModes;
using VocaluxeLib.Draw;
using VocaluxeLib.Profile;
@@ -94,10 +91,7 @@ namespace VocaluxeLib.Menu
_NumPlayer = numPlayer;
_NumPlayerTeams = numPlayerTeams;
if (_NumTeams > 0)
_TeamList = new List<int>[_NumTeams];
else
_TeamList = new List<int>[1];
_TeamList = new List<int>[_NumTeams > 0 ? _NumTeams : 1];
if (_NumTeams != _NumPlayerTeams.Length)
_NumPlayerTeams = new int[_NumTeams];
@@ -126,7 +120,7 @@ namespace VocaluxeLib.Menu
{
//Handle left/right/up/down
_NameSelections[_NameSelection].HandleInput(keyEvent);
int numberPressed = -1;
int numPressed = -1;
bool resetSelection = false;
switch (keyEvent.Key)
{
@@ -157,20 +151,65 @@ namespace VocaluxeLib.Menu
case Keys.Back:
resetSelection = true;
break;
case Keys.D1:
case Keys.NumPad1:
numPressed = 1;
break;
case Keys.D2:
case Keys.NumPad2:
numPressed = 2;
break;
case Keys.D3:
case Keys.NumPad3:
numPressed = 3;
break;
case Keys.D4:
case Keys.NumPad4:
numPressed = 4;
break;
case Keys.D5:
case Keys.NumPad5:
numPressed = 5;
break;
case Keys.D6:
case Keys.NumPad6:
numPressed = 6;
break;
case Keys.D7:
case Keys.NumPad7:
numPressed = 7;
break;
case Keys.D8:
case Keys.NumPad8:
numPressed = 8;
break;
case Keys.D9:
case Keys.NumPad9:
numPressed = 9;
break;
}
if (numberPressed > 0 || resetSelection)
if (numPressed > 0 || resetSelection)
{
if (numberPressed == _SelectingFastPlayerNr || resetSelection)
if (numPressed == _SelectingFastPlayerNr || resetSelection)
{
//Reset all values
_SelectingFastPlayerNr = 0;
_SelectingKeyboardActive = false;
_NameSelections[_NameSelection].FastSelection(false, -1);
}
else if (numberPressed <= _NumPlayerTeams[_CurrentTeam])
else if (numPressed <= _NumPlayerTeams[_CurrentTeam])
{
_SelectingFastPlayerNr = numberPressed;
_NameSelections[_NameSelection].FastSelection(true, numberPressed);
_SelectingFastPlayerNr = numPressed;
_NameSelections[_NameSelection].FastSelection(true, numPressed);
}
_SelectingFast = false;
}
@@ -530,9 +569,7 @@ namespace VocaluxeLib.Menu
public SPartyNameOptions GetData()
{
SPartyNameOptions option = new SPartyNameOptions();
option.NumPlayerTeams = _NumPlayerTeams;
option.TeamList = _TeamList;
SPartyNameOptions option = new SPartyNameOptions {NumPlayerTeams = _NumPlayerTeams, TeamList = _TeamList};
return option;
}
@@ -692,7 +729,7 @@ namespace VocaluxeLib.Menu
{
if (_NumPlayerTeams[team] == _TeamList[team].Count && !_ChangePlayerNumDynamic)
return;
else if (_NumPlayerTeams[team] == _PartyMode.GetMaxPlayerPerTeam())
if (_NumPlayerTeams[team] == _PartyMode.GetMaxPlayerPerTeam())
return;
_NameSelections[_NameSelection].UseProfile(profileID);
@@ -707,8 +744,8 @@ namespace VocaluxeLib.Menu
{
List<int> ids = new List<int>();
ids.AddRange(_TeamList[t]);
for (int p = 0; p < ids.Count; p++)
_RemovePlayer(t, ids[p]);
foreach (int id in ids)
_RemovePlayer(t, id);
}
}
+1 -2
View File
@@ -94,7 +94,7 @@ namespace VocaluxeLib.Menu
private int _Player = -1;
private readonly List<int> _VisibleProfiles;
private List<int> _UsedProfiles;
private readonly List<int> _UsedProfiles;
private CStatic _PlayerSelector;
@@ -416,7 +416,6 @@ namespace VocaluxeLib.Menu
_Tiles[i].Avatar.Texture = CBase.Profiles.GetAvatar(_VisibleProfiles[i + offset * _Tiles.Count]);
_Tiles[i].Avatar.Color = new SColorF(1, 1, 1, 1);
_Tiles[i].Name.Text = CBase.Profiles.GetPlayerName(_VisibleProfiles[i + offset * _Tiles.Count]);
;
_Tiles[i].ProfileID = _VisibleProfiles[i + offset * _Tiles.Count];
}
else
+2 -3
View File
@@ -214,7 +214,8 @@ namespace VocaluxeLib.Menu.SongMenu
if (_SongMenu != null)
_SongMenu.OnHide();
switch (CBase.Config.GetSongMenuType())
_Type = CBase.Config.GetSongMenuType();
switch (_Type)
{
//case ESongMenu.TR_CONFIG_LIST:
// _SongMenu = new CSongMenuList();
@@ -231,8 +232,6 @@ namespace VocaluxeLib.Menu.SongMenu
// _SongMenu = new CSongMenuBook();
// break;
}
_Type = CBase.Config.GetSongMenuType();
}
}
}
+20 -21
View File
@@ -67,11 +67,11 @@ namespace VocaluxeLib.Menu.SongMenu
{
set
{
base._PlaySong(value);
base._PreviewIdInternal = value;
_PlaySong(value);
_PreviewIdInternal = value;
_UpdatePreview();
}
get { return base._PreviewIdInternal; }
get { return _PreviewIdInternal; }
}
public override int GetActualSelection()
@@ -138,7 +138,7 @@ namespace VocaluxeLib.Menu.SongMenu
}
if (_Length < 0 && CBase.Sound.GetLength(_PreviewSongStream) > 0 && CBase.Songs.IsInCategory())
UpdateLength(CBase.Songs.GetVisibleSong(_PreviewId));
_UpdateLength(CBase.Songs.GetVisibleSong(_PreviewId));
}
private void _UpdatePreview()
@@ -181,7 +181,7 @@ namespace VocaluxeLib.Menu.SongMenu
_MedleyCalcIcon.Visible = song.Medley.Source == EDataSource.Calculated;
_MedleyTagIcon.Visible = song.Medley.Source == EDataSource.Tag;
UpdateLength(song);
_UpdateLength(song);
}
else
{
@@ -198,23 +198,22 @@ namespace VocaluxeLib.Menu.SongMenu
}
}
private void UpdateLength(CSong song)
private void _UpdateLength(CSong song)
{
if (song != null)
{
float time = CBase.Sound.GetLength(_PreviewSongStream);
if (Math.Abs(song.Finish) > 0.001)
time = song.Finish;
if (song == null)
return;
float time = CBase.Sound.GetLength(_PreviewSongStream);
if (Math.Abs(song.Finish) > 0.001)
time = song.Finish;
// The audiobackend is not yet ready to return the length
if (time > 0)
{
time -= song.Start;
var min = (int)Math.Floor(time / 60f);
var sec = (int)(time - min * 60f);
_SongLength.Text = min.ToString("00") + ":" + sec.ToString("00");
_Length = time;
}
// The audiobackend is ready to return the length
if (time > 0)
{
time -= song.Start;
var min = (int)Math.Floor(time / 60f);
var sec = (int)(time - min * 60f);
_SongLength.Text = min.ToString("00") + ":" + sec.ToString("00");
_Length = time;
}
}
@@ -556,7 +555,7 @@ namespace VocaluxeLib.Menu.SongMenu
public override void SetSelectedSong(int visibleSongNr)
{
base._PlaySong(visibleSongNr);
_PlaySong(visibleSongNr);
base.SetSelectedSong(visibleSongNr);
if (visibleSongNr >= 0 && visibleSongNr < CBase.Songs.GetNumSongsVisible())
+1 -1
View File
@@ -49,7 +49,7 @@ namespace VocaluxeLib.Profile
CBase.Drawing.RemoveTexture(ref Texture);
}
public string getFileName()
public string GetFileName()
{
return FileName;
}
+6 -5
View File
@@ -17,7 +17,6 @@
using System;
using System.IO;
using System.Text;
using System.Xml;
namespace VocaluxeLib.Profile
@@ -71,9 +70,11 @@ namespace VocaluxeLib.Profile
FileName = String.Empty;
}
public bool LoadProfile()
public bool LoadProfile(string pathName, string fileName)
{
return LoadProfile(FilePath, FileName);
FilePath = pathName;
FileName = fileName;
return LoadProfile();
}
public bool LoadProfile(string file)
@@ -81,10 +82,10 @@ namespace VocaluxeLib.Profile
FileName = Path.GetFileName(file);
FilePath = Path.GetDirectoryName(file);
return LoadProfile(FilePath, FileName);
return LoadProfile();
}
public bool LoadProfile(string pathName, string fileName)
public bool LoadProfile()
{
CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(FilePath, FileName));
if (xmlReader == null)
+1 -2
View File
@@ -135,11 +135,10 @@ namespace VocaluxeLib.Songs
return false;
}
public bool IncLastNoteLength()
public void IncLastNoteLength()
{
if (_Notes.Count > 0)
_Notes[NoteCount - 1].Duration++;
return false;
}
public void DeleteAllNotes()
+1 -1
View File
@@ -97,7 +97,7 @@ namespace VocaluxeLib.Songs
public string MP3FileName = String.Empty;
public string CoverFileName = String.Empty;
public List<string> BackgroundFileNames = new List<string>();
public readonly List<string> BackgroundFileNames = new List<string>();
public string VideoFileName = String.Empty;
public EAspect VideoAspect = EAspect.Crop;
+1
View File
@@ -41,6 +41,7 @@ namespace VocaluxeLib.Songs
/// <param name="duration"></param>
/// <param name="tone"></param>
/// <param name="hitNote"></param>
/// <param name="points"></param>
public CSungNote(int startBeat, int duration, int tone, CSongNote hitNote, double points) : this(startBeat, duration, tone)
{
HitNote = hitNote;
+1 -3
View File
@@ -205,15 +205,13 @@ namespace VocaluxeLib.Songs
public void UpdateTimings()
{
CSongNote lastNote;
if (_Lines.Count == 0)
return;
_Lines[0].StartBeat = -10000;
for (int i = 1; i < _Lines.Count; i++)
{
lastNote = _Lines[i - 1].LastNote;
CSongNote lastNote = _Lines[i - 1].LastNote;
CSongNote firstNote = _Lines[i].FirstNote;
if ((lastNote != null) && (firstNote != null))