Small cleanup (join declarations)

This commit is contained in:
Flamefire committed 2013-04-23 22:14:53 +02:00
1 parent b8fe334153
commit f53e08607b
18 files changed
+33 -40

No files matched your search

@@ -237,7 +237,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
return false;
}
public bool IsAvailableAll(List<int> playerIndices)
public bool IsAvailableAll(IEnumerable<int> playerIndices)
{
bool result = true;
foreach (int p in playerIndices)
@@ -245,7 +245,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
return result;
}
public bool IsAvailableSomeone(List<int> playerIndices)
public bool IsAvailableSomeone(IEnumerable<int> playerIndices)
{
bool result = false;
foreach (int p in playerIndices)
+1 -1
View File
@@ -1415,10 +1415,10 @@ namespace Vocaluxe.Base
{
const int chunkSize = 2 * 1024;
byte[] buffer = new byte[chunkSize];
long bytesRead;
long fieldOffset = 0;
using (MemoryStream stream = new MemoryStream())
{
long bytesRead;
while ((bytesRead = reader.GetBytes(0, fieldOffset, buffer, 0, buffer.Length)) > 0)
{
byte[] actualRead = new byte[bytesRead];
+1 -2
View File
@@ -794,8 +794,7 @@ namespace Vocaluxe.Base
if (CTheme.Cursor.Color != "")
{
SColorF color;
color = CTheme.GetColor(CTheme.Cursor.Color, -1);
SColorF color = CTheme.GetColor(CTheme.Cursor.Color, -1);
CTheme.Cursor.R = color.R;
CTheme.Cursor.G = color.G;
CTheme.Cursor.B = color.B;
+2 -2
View File
@@ -63,7 +63,7 @@ namespace Vocaluxe.Base
return _Languages[lang].Name;
}
public static string[] GetLanguageNames()
public static IEnumerable<string> GetLanguageNames()
{
string[] languages = new string[_Languages.Count];
@@ -179,7 +179,7 @@ namespace Vocaluxe.Base
private static bool _LoadLanguageEntries(CXMLReader xmlReader, out Dictionary<string, string> texts)
{
texts = new Dictionary<string, string>();
List<string> names = xmlReader.GetAttributes("resources", "name");
IEnumerable<string> names = xmlReader.GetAttributes("resources", "name");
foreach (string name in names)
{
string value;
+6 -6
View File
@@ -27,11 +27,11 @@ namespace Vocaluxe.Base
{
static class CMain
{
public static IConfig Config = new CBconfig();
public static ISettings Settings = new CBsettings();
public static ITheme Theme = new CBtheme();
public static IBackgroundMusic BackgroundMusic = new CBbackgroundMusic();
public static IDrawing Draw = new CBdraw();
public static readonly IConfig Config = new CBconfig();
public static readonly ISettings Settings = new CBsettings();
public static readonly ITheme Theme = new CBtheme();
public static readonly IBackgroundMusic BackgroundMusic = new CBbackgroundMusic();
public static readonly IDrawing Draw = new CBdraw();
public static IGraphics Graphics = new CBGraphics();
public static ILog Log = new CBlog();
public static IFonts Fonts = new CBfonts();
@@ -113,7 +113,7 @@ namespace Vocaluxe.Base
return CConfig.CoverSize;
}
public List<string> GetSongFolder()
public IEnumerable<string> GetSongFolder()
{
return CConfig.SongFolder;
}
+3 -3
View File
@@ -36,7 +36,7 @@ namespace Vocaluxe.Base
get { return _Playlists.ToArray(); }
}
public static string[] PlaylistNames
public static IEnumerable<string> PlaylistNames
{
get
{
@@ -227,7 +227,7 @@ namespace Vocaluxe.Base
private static int _CompareByPlaylistName(CPlaylistFile a, CPlaylistFile b)
{
return String.Compare(a.PlaylistName, b.PlaylistName);
return System.String.CompareOrdinal(a.PlaylistName, b.PlaylistName);
}
private static CPlaylistFile _ConvertUSDXPlaylist(string file)
@@ -237,9 +237,9 @@ namespace Vocaluxe.Base
if (!File.Exists(file))
return null;
StreamReader sr;
try
{
StreamReader sr;
using (sr = new StreamReader(file, Encoding.Default, true))
{
string line;
+1 -1
View File
@@ -282,7 +282,7 @@ namespace Vocaluxe.Base
private static int _CompareByPlayerName(SProfile a, SProfile b)
{
return String.Compare(a.PlayerName, b.PlayerName);
return System.String.CompareOrdinal(a.PlayerName, b.PlayerName);
}
#region private methods
+1 -2
View File
@@ -383,13 +383,12 @@ namespace Vocaluxe.Lib.Sound
// Buffer type must match this.waveFormat.FormatTag and this.waveFormat.BitsPerSample
byte[] bufferPortion = new byte[bufferPortionSamples];
int bufferPortionIndex;
_CaptureBuffer.Start(true);
while (_Running)
{
bufferPortionIndex = WaitHandle.WaitAny(_WaitHandles);
int bufferPortionIndex = WaitHandle.WaitAny(_WaitHandles);
_CaptureBuffer.Read(
bufferPortion,
+4 -7
View File
@@ -152,13 +152,10 @@ namespace Vocaluxe.Screens
_ParagraphTexts = new List<CText>();
_Paragraphs = new List<string[]>();
string paragraph;
string[] words;
paragraph = "Inspired by the achievements of UltraStar Deluxe and its variants and pursuing the goal of making " +
"a good thing even better, we ended up rewriting the game from scratch. And a new implementation in a new " +
"programming language called for a new name - and VOCALUXE [ˈvoʊˈkəˈlʌks] it is!";
words = paragraph.Split(new char[] {' '});
string paragraph = "Inspired by the achievements of UltraStar Deluxe and its variants and pursuing the goal of making " +
"a good thing even better, we ended up rewriting the game from scratch. And a new implementation in a new " +
"programming language called for a new name - and VOCALUXE [ˈvoʊˈkəˈlʌks] it is!";
string[] words = paragraph.Split(new char[] {' '});
_Paragraphs.Add(words);
paragraph = "This first public version has already implemented many of the original features and it is fully " +
+1 -2
View File
@@ -819,8 +819,7 @@ namespace Vocaluxe.Screens
{
if (CSongs.Category >= 0 && songNr >= 0 && CSongs.NumVisibleSongs > songNr)
{
EGameMode gm;
gm = CSongs.VisibleSongs[songNr].IsDuet ? EGameMode.TR_GAMEMODE_DUET : EGameMode.TR_GAMEMODE_NORMAL;
EGameMode gm = CSongs.VisibleSongs[songNr].IsDuet ? EGameMode.TR_GAMEMODE_DUET : EGameMode.TR_GAMEMODE_NORMAL;
CGame.Reset();
CGame.ClearSongs();
+1 -1
View File
@@ -26,7 +26,7 @@ namespace VocaluxeLib.Menu
{
protected IPartyMode _PartyMode;
public CMenuParty()
protected CMenuParty()
{
_PartyMode = new CPartyModeNone();
}
+1 -1
View File
@@ -556,7 +556,7 @@ namespace VocaluxeLib.Menu
_ValueBounds.Clear();
}
public void AddValues(string[] values)
public void AddValues(IEnumerable<string> values)
{
foreach (string value in values)
_AddValue(value, new STexture(-1), _PartyModeID);
+2 -3
View File
@@ -141,7 +141,7 @@ namespace VocaluxeLib.Menu
return values;
}
public List<string> GetAttributes(string cast, string attribute)
public IEnumerable<string> GetAttributes(string cast, string attribute)
{
List<string> values = new List<string>();
@@ -180,11 +180,10 @@ namespace VocaluxeLib.Menu
public bool ItemExists(string cast)
{
XPathNodeIterator iterator;
int results = 0;
_Navigator.MoveToFirstChild();
iterator = _Navigator.Select(cast);
XPathNodeIterator iterator = _Navigator.Select(cast);
while (iterator.MoveNext())
results++;
+1 -1
View File
@@ -86,7 +86,7 @@ namespace VocaluxeLib.Menu
int GetCoverSize();
List<string> GetSongFolder();
IEnumerable<string> GetSongFolder();
ESongSorting GetSongSorting();
EOffOn GetTabs();
EOffOn GetIgnoreArticles();
+3 -3
View File
@@ -707,7 +707,6 @@ namespace VocaluxeLib.Menu.SingNotes
public void UpdateTimings()
{
CNote lastNote;
int min, max, s;
if (_Lines.Count > 0)
_Lines[0].StartBeat = -10000;
@@ -719,9 +718,10 @@ namespace VocaluxeLib.Menu.SingNotes
if ((lastNote != null) && (firstNote != null))
{
min = lastNote.EndBeat;
max = firstNote.StartBeat;
int min = lastNote.EndBeat;
int max = firstNote.StartBeat;
int s;
switch (max - min)
{
case 0:
+1 -1
View File
@@ -74,7 +74,7 @@ namespace VocaluxeLib.Menu.SingNotes
/// </remarks>
public SRectF[,] BarPos { get; set; }
public CSingNotes(int partyModeID)
protected CSingNotes(int partyModeID)
{
_PartyModeID = partyModeID;
_Theme = new SThemeSingBar();
@@ -234,7 +234,7 @@ namespace VocaluxeLib.Menu.SongMenu
_Visible = visible;
}
public CSongMenuFramework(int partyModeID)
protected CSongMenuFramework(int partyModeID)
{
_PartyModeID = partyModeID;
_Theme = new SThemeSongMenu
+1 -1
View File
@@ -28,7 +28,7 @@ namespace VocaluxeLib.PartyModes
protected SScreenSongOptions _ScreenSongOptions;
protected readonly Dictionary<string, CMenuParty> _Screens;
public CPartyMode()
protected CPartyMode()
{
_Screens = new Dictionary<string, CMenuParty>();
_ScreenSongOptions = new SScreenSongOptions {Selection = new SSelectionOptions(), Sorting = new SSortingOptions()};