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