Merge branch 'develop' of github.com:Vocaluxe/Vocaluxe into develop

This commit is contained in:
Florian Küpper committed 2013-02-27 18:51:20 +01:00
commit fca2254267
17 files changed
+370 -769

No files matched your search

+4
View File
@@ -28,3 +28,7 @@ Output/Songs
/Vocaluxe/Vocaluxe.csproj.user
/Output/Config.xml
*.ipch
*.log
+1 -2
View File
@@ -15,7 +15,6 @@ namespace Vocaluxe.Base
{
static class CBackgroundMusic
{
private static CHelper Helper = new CHelper();
private static int _CurrentMusicStream = -1;
private static int _PreviousMusicIndex = 0;
private static PlaylistElement _CurrentPlaylistElement = new PlaylistElement();
@@ -155,7 +154,7 @@ namespace Vocaluxe.Base
foreach(string ending in CSettings.MusicFileTypes)
{
templist.AddRange(Helper.ListFiles(CSettings.sFolderBackgroundMusic, ending, true, true));
templist.AddRange(CHelper.ListFiles(CSettings.sFolderBackgroundMusic, ending, true, true));
}
foreach (string path in templist)
+2 -12
View File
@@ -122,19 +122,9 @@ namespace Vocaluxe.Base
public static bool LoadConfig()
{
#region Inits
CXMLReader xmlReader;
try
{
xmlReader = new CXMLReader(CSettings.sFileConfig);
}
catch (Exception e)
{
CLog.LogError("Error opening Config.xml " + CSettings.sFileConfig + ": " + e.Message);
CXMLReader xmlReader = CXMLReader.OpenFile(CSettings.sFileConfig);
if (xmlReader == null)
return false;
}
#endregion Inits
string value = string.Empty;
+5 -7
View File
@@ -157,9 +157,8 @@ namespace Vocaluxe.Base
{
_CoverThemes.Clear();
CHelper Helper = new CHelper();
string path = CSettings.sFolderCover;
List<string> files = Helper.ListFiles(path, "*.xml", false);
List<string> files = CHelper.ListFiles(path, "*.xml", false);
foreach (string file in files)
{
@@ -230,13 +229,12 @@ namespace Vocaluxe.Base
}
}
CHelper Helper = new CHelper();
List<string> files = new List<string>();
files.AddRange(Helper.ListFiles(Path.Combine(CSettings.sFolderCover, coverTheme.Folder), "*.png", true, true));
files.AddRange(Helper.ListFiles(Path.Combine(CSettings.sFolderCover, coverTheme.Folder), "*.jpg", true, true));
files.AddRange(Helper.ListFiles(Path.Combine(CSettings.sFolderCover, coverTheme.Folder), "*.jpeg", true, true));
files.AddRange(Helper.ListFiles(Path.Combine(CSettings.sFolderCover, coverTheme.Folder), "*.bmp", true, true));
files.AddRange(CHelper.ListFiles(Path.Combine(CSettings.sFolderCover, coverTheme.Folder), "*.png", true, true));
files.AddRange(CHelper.ListFiles(Path.Combine(CSettings.sFolderCover, coverTheme.Folder), "*.jpg", true, true));
files.AddRange(CHelper.ListFiles(Path.Combine(CSettings.sFolderCover, coverTheme.Folder), "*.jpeg", true, true));
files.AddRange(CHelper.ListFiles(Path.Combine(CSettings.sFolderCover, coverTheme.Folder), "*.bmp", true, true));
foreach (string file in files)
+3 -10
View File
@@ -673,17 +673,10 @@ namespace Vocaluxe.Base
/// <returns></returns>
private static bool LoadFontList()
{
CXMLReader xmlReader;
try
{
xmlReader = new CXMLReader(System.IO.Path.Combine(CSettings.sFolderFonts, CSettings.sFileFonts));
}
catch (Exception e)
{
CLog.LogError("Error loading default fonts: " + e.Message);
CXMLReader xmlReader = CXMLReader.OpenFile(System.IO.Path.Combine(CSettings.sFolderFonts, CSettings.sFileFonts));
if (xmlReader == null)
return false;
}
_Fonts.Clear();
string value = string.Empty;
+6 -23
View File
@@ -28,7 +28,6 @@ namespace Vocaluxe.Base
{
private static XmlWriterSettings _settings = new XmlWriterSettings();
private static List<SLanguage> _Languages;
private static CHelper Helper = new CHelper();
private static int _CurrentLanguage = 0;
private static int _FallbackLanguage = 0;
@@ -62,7 +61,7 @@ namespace Vocaluxe.Base
_settings.ConformanceLevel = ConformanceLevel.Document;
List<string> files = new List<string>();
files.AddRange(Helper.ListFiles(CSettings.sFolderLanguages, "*.xml", true, true));
files.AddRange(CHelper.ListFiles(CSettings.sFolderLanguages, "*.xml", true, true));
foreach (string file in files)
{
@@ -228,7 +227,7 @@ namespace Vocaluxe.Base
public static bool LoadPartyLanguageFiles(int PartyModeID, string Path)
{
List<string> files = new List<string>();
files.AddRange(Helper.ListFiles(Path, "*.xml", true, true));
files.AddRange(CHelper.ListFiles(Path, "*.xml", true, true));
foreach (string file in files)
{
@@ -240,17 +239,9 @@ namespace Vocaluxe.Base
private static bool LoadPartyLanguageFile(int PartyModeID, string file)
{
CXMLReader xmlReader;
try
{
xmlReader = new CXMLReader(file);
}
catch (Exception e)
{
CLog.LogError("Error opening Party Language File " + file + ": " + e.Message);
CXMLReader xmlReader = CXMLReader.OpenFile(file);
if (xmlReader == null)
return false;
}
string value = string.Empty;
if (xmlReader.GetValue("//resources/string[@name='language']", ref value, value))
@@ -296,17 +287,9 @@ namespace Vocaluxe.Base
SLanguage lang = new SLanguage();
lang.LanguageFilePath = Path.Combine(CSettings.sFolderLanguages, FileName);
CXMLReader xmlReader;
try
{
xmlReader = new CXMLReader(lang.LanguageFilePath);
}
catch (Exception e)
{
CLog.LogError("Error opening Language File " + FileName + ": " + e.Message);
CXMLReader xmlReader = CXMLReader.OpenFile(lang.LanguageFilePath);
if (xmlReader == null)
return;
}
string value = string.Empty;
if (xmlReader.GetValue("//resources/string[@name='language']", ref value, value))
+5 -14
View File
@@ -34,7 +34,6 @@ namespace Vocaluxe.Base
{
const int PartyModeSystemVersion = 1;
private static CHelper Helper;
private static Dictionary<int, SPartyMode> _PartyModes;
private static Queue<int> _IDs;
@@ -44,7 +43,6 @@ namespace Vocaluxe.Base
#region public stuff
public static void Init()
{
Helper = new CHelper();
_PartyModes = new Dictionary<int, SPartyMode>();
_IDs = new Queue<int>(1000);
@@ -206,7 +204,7 @@ namespace Vocaluxe.Base
private static void LoadPartyModes()
{
List<string> files = new List<string>();
files.AddRange(Helper.ListFiles(CSettings.sFolderPartyModes, "*.xml", false, true));
files.AddRange(CHelper.ListFiles(CSettings.sFolderPartyModes, "*.xml", false, true));
foreach (string file in files)
{
@@ -222,18 +220,11 @@ namespace Vocaluxe.Base
pm.ScreenFiles = new List<string>();
pm.NoErrors = false;
CXMLReader xmlReader;
try
{
xmlReader = new CXMLReader(file);
}
catch (Exception e)
{
CLog.LogError("Error opening party mode file " + file + ": " + e.Message);
CXMLReader xmlReader = CXMLReader.OpenFile(file);
//Error...
if (xmlReader == null)
return pm;
}
bool loaded = true;
@@ -269,7 +260,7 @@ namespace Vocaluxe.Base
string PathToCode = Path.Combine(Path.Combine(CSettings.sFolderPartyModes, pm.Folder), CSettings.sFolderPartyModeCode);
List<string> FilesToCompile = new List<string>();
FilesToCompile.AddRange(Helper.ListFiles(PathToCode, "*.cs", false, true));
FilesToCompile.AddRange(CHelper.ListFiles(PathToCode, "*.cs", false, true));
Assembly Output = CompileFiles(FilesToCompile.ToArray());
if (Output == null)
+2 -3
View File
@@ -15,7 +15,6 @@ namespace Vocaluxe.Base
static class CPlaylists
{
private static List<CPlaylistFile> _Playlists;
private static CHelper Helper = new CHelper();
public static CPlaylistFile[] Playlists
{
@@ -51,7 +50,7 @@ namespace Vocaluxe.Base
public static void ConvertUSDXPlaylists()
{
List<string> files = new List<string>();
files.AddRange(Helper.ListFiles(CSettings.sFolderPlaylists, "*.upl", true, true));
files.AddRange(CHelper.ListFiles(CSettings.sFolderPlaylists, "*.upl", true, true));
foreach (string file in files)
{
@@ -65,7 +64,7 @@ namespace Vocaluxe.Base
{
_Playlists = new List<CPlaylistFile>();
List<string> files = new List<string>();
files.AddRange(Helper.ListFiles(CSettings.sFolderPlaylists, "*.xml", true, true));
files.AddRange(CHelper.ListFiles(CSettings.sFolderPlaylists, "*.xml", true, true));
foreach (string file in files)
{
+7 -16
View File
@@ -12,7 +12,6 @@ namespace Vocaluxe.Base
static class CProfiles
{
private static XmlWriterSettings _settings = new XmlWriterSettings();
private static CHelper Helper = new CHelper();
private static List<SProfile> _Profiles;
private static List<SAvatar> _Avatars = new List<SAvatar>();
@@ -86,7 +85,7 @@ namespace Vocaluxe.Base
{
_Profiles = new List<SProfile>();
List<string> files = new List<string>();
files.AddRange(Helper.ListFiles(CSettings.sFolderProfiles, "*.xml", true, true));
files.AddRange(CHelper.ListFiles(CSettings.sFolderProfiles, "*.xml", true, true));
foreach (string file in files)
{
@@ -106,10 +105,10 @@ namespace Vocaluxe.Base
_Avatars.Clear();
List<string> files = new List<string>();
files.AddRange(Helper.ListFiles(CSettings.sFolderProfiles, "*.png", true, true));
files.AddRange(Helper.ListFiles(CSettings.sFolderProfiles, "*.jpg", true, true));
files.AddRange(Helper.ListFiles(CSettings.sFolderProfiles, "*.jpeg", true, true));
files.AddRange(Helper.ListFiles(CSettings.sFolderProfiles, "*.bmp", true, true));
files.AddRange(CHelper.ListFiles(CSettings.sFolderProfiles, "*.png", true, true));
files.AddRange(CHelper.ListFiles(CSettings.sFolderProfiles, "*.jpg", true, true));
files.AddRange(CHelper.ListFiles(CSettings.sFolderProfiles, "*.jpeg", true, true));
files.AddRange(CHelper.ListFiles(CSettings.sFolderProfiles, "*.bmp", true, true));
foreach (string file in files)
{
@@ -361,17 +360,9 @@ namespace Vocaluxe.Base
SProfile profile = new SProfile();
profile.ProfileFile = Path.Combine(CSettings.sFolderProfiles, FileName);
CXMLReader xmlReader;
try
{
xmlReader = new CXMLReader(profile.ProfileFile);
}
catch (Exception e)
{
CLog.LogError("Error opening Profile File " + FileName + ": " + e.Message);
CXMLReader xmlReader = CXMLReader.OpenFile(profile.ProfileFile);
if (xmlReader == null)
return;
}
string value = String.Empty;
if (xmlReader.GetValue("//root/Info/PlayerName", ref value, value))
+283 -589
View File
@@ -6,6 +6,7 @@ using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Reflection;
using Vocaluxe.Lib.Draw;
@@ -36,14 +37,15 @@ namespace Vocaluxe.Base
static class CSongs
{
private static List<CSong> _Songs = new List<CSong>();
private static List<CSong> _FilteredSongs = new List<CSong>();
private static SongPointer[] _SongsSortList = new SongPointer[0];
private static List<CSong> _SongsForRandom = new List<CSong>();
private static CHelper Helper = new CHelper();
private static bool _SongsLoaded = false;
private static bool _CoverLoaded = false;
private static int _CoverLoadIndex = -1;
private static int _CatIndex = -1;
private static bool _Init = false;
private static List<CCategory> _Categories = new List<CCategory>();
private static List<CCategory> _CategoriesForRandom = new List<CCategory>();
@@ -379,6 +381,276 @@ namespace Vocaluxe.Base
get { return _Categories.ToArray(); }
}
private static void _FilterSongs(String SearchFilter, bool ShowDuetSongs)
{
if (_Init && _SearchFilter == SearchFilter && _ShowDuetSongs == ShowDuetSongs)
return;
_Init = true;
_SearchFilter = SearchFilter;
_ShowDuetSongs = ShowDuetSongs;
_FilteredSongs.Clear();
string[] searchStrings = null;
if (_SearchFilter != String.Empty)
searchStrings = _SearchFilter.ToUpper().Split(new char[] { ' ' });
foreach (CSong song in _Songs)
{
if (!song.IsDuet || _ShowDuetSongs)
{
if (_SearchFilter == String.Empty)
_FilteredSongs.Add(song);
else if (searchStrings != null)
{
string search = song.Title.ToUpper() + " " + song.Artist.ToUpper() + " " + song.FolderName.ToUpper() + " " + song.FileName.ToUpper();
bool contains = true;
foreach (string str in searchStrings)
{
contains &= search.Contains(str);
}
if (contains)
_FilteredSongs.Add(song);
}
}
}
}
private static int _SortByFieldArtistTitle(SongPointer s1, SongPointer s2)
{
int res = s1.SortString.ToUpper().CompareTo(s2.SortString.ToUpper());
if (res == 0)
{
if (_IgnoreArticles == EOffOn.TR_CONFIG_ON)
{
res = _Songs[s1.SongID].ArtistSorting.ToUpper().CompareTo(_Songs[s2.SongID].ArtistSorting.ToUpper());
if (res == 0)
{
return _Songs[s1.SongID].TitleSorting.ToUpper().CompareTo(_Songs[s2.SongID].TitleSorting.ToUpper());
}
return res;
}
else
{
res = _Songs[s1.SongID].Artist.ToUpper().CompareTo(_Songs[s2.SongID].Artist.ToUpper());
if (res == 0)
{
return _Songs[s1.SongID].Title.ToUpper().CompareTo(_Songs[s2.SongID].Title.ToUpper());
}
return res;
}
}
return res;
}
private static int _SortByFieldTitle(SongPointer s1, SongPointer s2)
{
int res = s1.SortString.ToUpper().CompareTo(s2.SortString.ToUpper());
if (res == 0)
{
if (_IgnoreArticles == EOffOn.TR_CONFIG_ON)
return _Songs[s1.SongID].TitleSorting.ToUpper().CompareTo(_Songs[s2.SongID].TitleSorting.ToUpper());
else
return _Songs[s1.SongID].Title.ToUpper().CompareTo(_Songs[s2.SongID].Title.ToUpper());
}
return res;
}
private static List<SongPointer> _CreateSortList(string fieldName)
{
FieldInfo field = null;
bool isString = false;
List<SongPointer> SortList = new List<SongPointer>();
if (fieldName == String.Empty)
_FilteredSongs.ForEach((song) => SortList.Add(new SongPointer(song.ID, "")));
{
field = Type.GetType("Vocaluxe.Menu.SongMenu.CSong,VocaluxeLib").GetField(fieldName, BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public);
isString = field.FieldType == typeof(string);
if (!isString && field.FieldType != typeof(List<String>))
throw new Exception("Unkown sort field type");
foreach (CSong song in _FilteredSongs)
{
object value = field.GetValue(song);
if (isString)
SortList.Add(new SongPointer(song.ID, (String)value));
else
{
List<String> values = (List<String>)value;
if (values.Count == 0)
{
SortList.Add(new SongPointer(song.ID, ""));
}
else
{
foreach (String sortString in (List<String>)value)
{
SortList.Add(new SongPointer(song.ID, sortString));
}
}
}
}
}
return SortList;
}
private static void SortSongs()
{
String fieldName;
switch (_SongSorting)
{
case ESongSorting.TR_CONFIG_EDITION:
fieldName = "Edition";
break;
case ESongSorting.TR_CONFIG_GENRE:
fieldName = "Genre";
break;
case ESongSorting.TR_CONFIG_FOLDER:
fieldName = "FolderName";
break;
case ESongSorting.TR_CONFIG_ARTIST_LETTER:
case ESongSorting.TR_CONFIG_ARTIST:
if (_IgnoreArticles == EOffOn.TR_CONFIG_ON)
fieldName = "ArtistSorting";
else
fieldName = "Artist";
break;
case ESongSorting.TR_CONFIG_TITLE_LETTER:
if (_IgnoreArticles == EOffOn.TR_CONFIG_ON)
fieldName = "TitleSorting";
else
fieldName = "Title";
break;
case ESongSorting.TR_CONFIG_YEAR:
case ESongSorting.TR_CONFIG_DECADE:
fieldName = "Year";
break;
case ESongSorting.TR_CONFIG_LANGUAGE:
fieldName = "Language";
break;
default:
fieldName = "";
break;
}
List<SongPointer> SortList = _CreateSortList(fieldName);
switch (_SongSorting)
{
case ESongSorting.TR_CONFIG_ARTIST_LETTER:
case ESongSorting.TR_CONFIG_ARTIST:
case ESongSorting.TR_CONFIG_NONE:
SortList.Sort(_SortByFieldTitle);
break;
default:
SortList.Sort(_SortByFieldArtistTitle);
break;
}
_SongsSortList = SortList.ToArray();
}
private static void _CreateCategoriesLetter()
{
string category = "";
int NotLetterCat = -1;
for (int i = 0; i < _SongsSortList.Length; i++)
{
Char firstLetter = Char.ToUpper(_SongsSortList[i].SortString.Normalize(NormalizationForm.FormD)[0]);
if (!Char.IsLetter(firstLetter))
{
firstLetter = '#';
}
if (firstLetter.ToString() != category)
{
if (firstLetter != '#' || NotLetterCat == -1)
{
category = firstLetter.ToString();
_Categories.Add(new CCategory(category));
_SongsSortList[i].CatIndex = _Categories.Count - 1;
if (firstLetter == '#')
NotLetterCat = _SongsSortList[i].CatIndex;
}
else
_SongsSortList[i].CatIndex = NotLetterCat;
}
else
_SongsSortList[i].CatIndex = _Categories.Count - 1;
}
}
private static void _CreateCategoriesNormal(string NoCategoryName)
{
string category = "";
int NoCategoryIndex = -1;
for (int i = 0; i < _SongsSortList.Length; i++)
{
if (_SongsSortList[i].SortString.Length > 0)
{
if (_SongsSortList[i].SortString != category)
{
category = _SongsSortList[i].SortString;
_Categories.Add(new CCategory(category));
}
_SongsSortList[i].CatIndex = _Categories.Count - 1;
}
else
{
if (NoCategoryIndex < 0)
{
category = NoCategoryName;
_Categories.Add(new CCategory(category));
NoCategoryIndex = _Categories.Count - 1;
}
_SongsSortList[i].CatIndex = NoCategoryIndex;
}
}
}
private static void _FillCategories()
{
string NoCategoryName = "";
switch (_SongSorting)
{
case ESongSorting.TR_CONFIG_EDITION:
NoCategoryName = CLanguage.Translate("TR_SCREENSONG_NOEDITION");
break;
case ESongSorting.TR_CONFIG_GENRE:
NoCategoryName = CLanguage.Translate("TR_SCREENSONG_NOGENRE");
break;
case ESongSorting.TR_CONFIG_DECADE:
case ESongSorting.TR_CONFIG_YEAR:
NoCategoryName = CLanguage.Translate("TR_SCREENSONG_NOYEAR");
break;
case ESongSorting.TR_CONFIG_LANGUAGE:
NoCategoryName = CLanguage.Translate("TR_SCREENSONG_NOLANGUAGE");
break;
case ESongSorting.TR_CONFIG_NONE:
NoCategoryName = CLanguage.Translate("TR_SCREENSONG_ALLSONGS");
break;
}
if (_SongSorting == ESongSorting.TR_CONFIG_ARTIST_LETTER || _SongSorting == ESongSorting.TR_CONFIG_TITLE_LETTER)
_CreateCategoriesLetter();
else
{
if(_SongSorting==ESongSorting.TR_CONFIG_DECADE)
for (int i = 0; i < _SongsSortList.Length; i++)
{
string Year = _SongsSortList[i].SortString;
if (Year != "")
{
Year = Year.Substring(0, 3);
_SongsSortList[i].SortString = Year + "0 - " + Year + "9";
}
}
_CreateCategoriesNormal(NoCategoryName);
}
}
public static void Sort(ESongSorting Sorting, EOffOn Tabs, EOffOn IgnoreArticles, String SearchString)
{
_Sort(Sorting, Tabs, IgnoreArticles, SearchString, false, _ShowDuetSongs);
@@ -397,606 +669,28 @@ namespace Vocaluxe.Base
if (!force && Sorting == _SongSorting && Tabs == _Tabs && IgnoreArticles == _IgnoreArticles && SearchString == _SearchFilter && ShowDuetSongs == _ShowDuetSongs)
return; //nothing to do
_Categories.Clear();
string category = String.Empty;
_IgnoreArticles = IgnoreArticles;
_SongSorting = Sorting;
_Tabs = Tabs;
_ShowDuetSongs = ShowDuetSongs;
_SearchFilter = SearchString;
List<SongPointer> _SortList = new List<SongPointer>();
List<CSong> _SongList = new List<CSong>();
foreach (CSong song in _Songs)
{
if (!song.IsDuet || _ShowDuetSongs)
{
if (_SearchFilter == String.Empty)
_SongList.Add(song);
else
{
string search = song.Title.ToUpper() + " " + song.Artist.ToUpper() + " " + song.FolderName.ToUpper() + " " + song.FileName.ToUpper();
string[] searchStrings = _SearchFilter.ToUpper().Split(new char[]{' '});
bool contains = searchStrings != null;
foreach (string str in searchStrings)
{
contains &= search.Contains(str);
}
if (contains)
_SongList.Add(song);
}
}
}
switch (_SongSorting)
{
case ESongSorting.TR_CONFIG_EDITION:
foreach (CSong song in _SongList)
{
if (song.Edition.Count == 0)
_SortList.Add(new SongPointer(song.ID, String.Empty));
else
{
for (int i = 0; i < song.Edition.Count; i++)
{
_SortList.Add(new SongPointer(song.ID, song.Edition[i]));
}
}
}
_SortList.Sort(delegate(SongPointer s1, SongPointer s2)
{
int res = s1.SortString.ToUpper().CompareTo(s2.SortString.ToUpper());
if (res == 0)
{
if (_IgnoreArticles == EOffOn.TR_CONFIG_ON)
{
res = _Songs[s1.SongID].ArtistSorting.ToUpper().CompareTo(_Songs[s2.SongID].ArtistSorting.ToUpper());
if (res == 0)
{
return _Songs[s1.SongID].TitleSorting.ToUpper().CompareTo(_Songs[s2.SongID].TitleSorting.ToUpper());
}
return res;
}
else
{
res = _Songs[s1.SongID].Artist.ToUpper().CompareTo(_Songs[s2.SongID].Artist.ToUpper());
if (res == 0)
{
return _Songs[s1.SongID].Title.ToUpper().CompareTo(_Songs[s2.SongID].Title.ToUpper());
}
return res;
}
}
return res;
});
_SongsSortList = _SortList.ToArray();
_Categories.Clear();
for (int i = 0; i < _SongsSortList.Length; i++ )
{
if (_SongsSortList[i].SortString.Length > 0)
{
if (_SongsSortList[i].SortString != category)
{
category = _SongsSortList[i].SortString;
_Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1)));
}
_SongsSortList[i].CatIndex = _Categories.Count - 1;
}
else
{
if (CLanguage.Translate("TR_SCREENSONG_NOEDITION") != category)
{
category = CLanguage.Translate("TR_SCREENSONG_NOEDITION");
_Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1)));
}
_SongsSortList[i].CatIndex = _Categories.Count - 1;
}
}
break;
case ESongSorting.TR_CONFIG_GENRE:
foreach (CSong song in _SongList)
{
if (song.Genre.Count == 0)
_SortList.Add(new SongPointer(song.ID, String.Empty));
else
{
for (int i = 0; i < song.Genre.Count; i++)
{
_SortList.Add(new SongPointer(song.ID, song.Genre[i]));
}
}
}
_SortList.Sort(delegate(SongPointer s1, SongPointer s2)
{
int res = s1.SortString.ToUpper().CompareTo(s2.SortString.ToUpper());
if (res == 0)
{
if (_IgnoreArticles == EOffOn.TR_CONFIG_ON)
{
res = _Songs[s1.SongID].ArtistSorting.ToUpper().CompareTo(_Songs[s2.SongID].ArtistSorting.ToUpper());
if (res == 0)
{
return _Songs[s1.SongID].TitleSorting.ToUpper().CompareTo(_Songs[s2.SongID].TitleSorting.ToUpper());
}
return res;
}
else
{
res = _Songs[s1.SongID].Artist.ToUpper().CompareTo(_Songs[s2.SongID].Artist.ToUpper());
if (res == 0)
{
return _Songs[s1.SongID].Title.ToUpper().CompareTo(_Songs[s2.SongID].Title.ToUpper());
}
return res;
}
}
return res;
});
_SongsSortList = _SortList.ToArray();
_Categories.Clear();
for (int i = 0; i < _SongsSortList.Length; i++)
{
if (_SongsSortList[i].SortString.Length > 0)
{
if (_SongsSortList[i].SortString != category)
{
category = _SongsSortList[i].SortString;
_Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1)));
}
_SongsSortList[i].CatIndex = _Categories.Count - 1;
}
else
{
if (CLanguage.Translate("TR_SCREENSONG_NOGENRE") != category)
{
category = CLanguage.Translate("TR_SCREENSONG_NOGENRE");
_Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1)));
}
_SongsSortList[i].CatIndex = _Categories.Count - 1;
}
}
break;
case ESongSorting.TR_CONFIG_NONE:
foreach (CSong song in _SongList)
{
_SortList.Add(new SongPointer(song.ID, String.Empty));
}
_SortList.Sort(delegate(SongPointer s1, SongPointer s2)
{
int res = s1.SortString.ToUpper().CompareTo(s2.SortString.ToUpper());
if (res == 0)
{
return _Songs[s1.SongID].Title.ToUpper().CompareTo(_Songs[s2.SongID].Title.ToUpper());
}
return res;
});
_SongsSortList = _SortList.ToArray();
_Categories.Clear();
for (int i = 0; i < _SongsSortList.Length; i++)
{
_SongsSortList[i].CatIndex = 0;
}
category = CLanguage.Translate("TR_SCREENSONG_ALLSONGS");
_Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1)));
break;
case ESongSorting.TR_CONFIG_FOLDER:
foreach (CSong song in _SongList)
{
_SortList.Add(new SongPointer(song.ID, song.FolderName));
}
_SortList.Sort(delegate(SongPointer s1, SongPointer s2)
{
int res = s1.SortString.ToUpper().CompareTo(s2.SortString.ToUpper());
if (res == 0)
{
if (_IgnoreArticles == EOffOn.TR_CONFIG_ON)
{
res = _Songs[s1.SongID].ArtistSorting.ToUpper().CompareTo(_Songs[s2.SongID].ArtistSorting.ToUpper());
if (res == 0)
{
return _Songs[s1.SongID].TitleSorting.ToUpper().CompareTo(_Songs[s2.SongID].TitleSorting.ToUpper());
}
return res;
}
else
{
res = _Songs[s1.SongID].Artist.ToUpper().CompareTo(_Songs[s2.SongID].Artist.ToUpper());
if (res == 0)
{
return _Songs[s1.SongID].Title.ToUpper().CompareTo(_Songs[s2.SongID].Title.ToUpper());
}
return res;
}
}
return res;
});
_SongsSortList = _SortList.ToArray();
_Categories.Clear();
for (int i = 0; i < _SongsSortList.Length; i++)
{
if (_SongsSortList[i].SortString != category)
{
category = _SongsSortList[i].SortString;
_Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1)));
}
_SongsSortList[i].CatIndex = _Categories.Count - 1;
}
break;
case ESongSorting.TR_CONFIG_ARTIST:
foreach (CSong song in _SongList)
{
_SortList.Add(new SongPointer(song.ID, song.Artist));
}
_SortList.Sort(delegate(SongPointer s1, SongPointer s2)
{
if (_IgnoreArticles == EOffOn.TR_CONFIG_ON)
{
int res = _Songs[s1.SongID].ArtistSorting.ToUpper().CompareTo(_Songs[s2.SongID].ArtistSorting.ToUpper());
if (res == 0)
{
return _Songs[s1.SongID].TitleSorting.ToUpper().CompareTo(_Songs[s2.SongID].TitleSorting.ToUpper());
}
return res;
}
else
{
int res = s1.SortString.ToUpper().CompareTo(s2.SortString.ToUpper());
if (res == 0)
{
return _Songs[s1.SongID].Title.ToUpper().CompareTo(_Songs[s2.SongID].Title.ToUpper());
}
return res;
}
});
_SongsSortList = _SortList.ToArray();
_Categories.Clear();
for (int i = 0; i < _SongsSortList.Length; i++)
{
if (_SongsSortList[i].SortString != category)
{
category = _SongsSortList[i].SortString;
_Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1)));
}
_SongsSortList[i].CatIndex = _Categories.Count - 1;
}
break;
case ESongSorting.TR_CONFIG_ARTIST_LETTER:
foreach (CSong song in _SongList)
{
if (_IgnoreArticles == EOffOn.TR_CONFIG_ON)
_SortList.Add(new SongPointer(song.ID, song.ArtistSorting));
else
_SortList.Add(new SongPointer(song.ID, song.Artist));
}
_SortList.Sort(delegate(SongPointer s1, SongPointer s2)
{
int res = s1.SortString.ToUpper().CompareTo(s2.SortString.ToUpper());
if (res == 0)
{
if (_IgnoreArticles == EOffOn.TR_CONFIG_ON)
{
return _Songs[s1.SongID].TitleSorting.ToUpper().CompareTo(_Songs[s2.SongID].TitleSorting.ToUpper());
}
else
{
return _Songs[s1.SongID].Title.ToUpper().CompareTo(_Songs[s2.SongID].Title.ToUpper());
}
}
return res;
});
_SongsSortList = _SortList.ToArray();
_Categories.Clear();
int NotLetterCat = -1;
for (int i=0; i < _SongsSortList.Length; i++)
{
Char firstLetter = Char.ToUpper(_SongsSortList[i].SortString.Normalize(NormalizationForm.FormD)[0]);
if (!Char.IsLetter(firstLetter))
{
firstLetter = '#';
}
if (firstLetter.ToString() != category)
{
if (firstLetter != '#' || NotLetterCat == -1)
{
category = firstLetter.ToString();
_Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1)));
_SongsSortList[i].CatIndex = _Categories.Count - 1;
if (firstLetter == '#')
NotLetterCat = _SongsSortList[i].CatIndex;
}
else
_SongsSortList[i].CatIndex = NotLetterCat;
}
else
_SongsSortList[i].CatIndex = _Categories.Count - 1;
}
break;
case ESongSorting.TR_CONFIG_TITLE_LETTER:
foreach (CSong song in _SongList)
{
if (_IgnoreArticles == EOffOn.TR_CONFIG_ON)
_SortList.Add(new SongPointer(song.ID, song.TitleSorting));
else
_SortList.Add(new SongPointer(song.ID, song.Title));
}
_SortList.Sort(delegate(SongPointer s1, SongPointer s2)
{
int res = s1.SortString.ToUpper().CompareTo(s2.SortString.ToUpper());
if (res == 0)
{
if (_IgnoreArticles == EOffOn.TR_CONFIG_ON)
{
return _Songs[s1.SongID].ArtistSorting.ToUpper().CompareTo(_Songs[s2.SongID].ArtistSorting.ToUpper());
}
else
{
return _Songs[s1.SongID].Artist.ToUpper().CompareTo(_Songs[s2.SongID].Artist.ToUpper());
}
}
return res;
});
_SongsSortList = _SortList.ToArray();
_Categories.Clear();
NotLetterCat = -1;
for (int i=0; i < _SongsSortList.Length; i++)
{
Char firstLetter = Char.ToUpper(_SongsSortList[i].SortString.Normalize(NormalizationForm.FormD)[0]);
if (!Char.IsLetter(firstLetter))
{
firstLetter = '#';
}
if (firstLetter.ToString() != category)
{
if (firstLetter != '#' || NotLetterCat == -1)
{
category = firstLetter.ToString();
_Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1)));
_SongsSortList[i].CatIndex = _Categories.Count - 1;
if (firstLetter == '#')
NotLetterCat = _SongsSortList[i].CatIndex;
}
else
_SongsSortList[i].CatIndex = NotLetterCat;
}
else
_SongsSortList[i].CatIndex = _Categories.Count - 1;
}
break;
case ESongSorting.TR_CONFIG_DECADE:
foreach (CSong song in _SongList)
{
_SortList.Add(new SongPointer(song.ID, song.Year));
}
_SortList.Sort(delegate(SongPointer s1, SongPointer s2)
{
int res = s1.SortString.CompareTo(s2.SortString);
if (res == 0)
{
if (_IgnoreArticles == EOffOn.TR_CONFIG_ON)
{
res = _Songs[s1.SongID].ArtistSorting.ToUpper().CompareTo(_Songs[s2.SongID].ArtistSorting.ToUpper());
if (res == 0)
{
return _Songs[s1.SongID].TitleSorting.ToUpper().CompareTo(_Songs[s2.SongID].TitleSorting.ToUpper());
}
return res;
}
else
{
res = _Songs[s1.SongID].Artist.ToUpper().CompareTo(_Songs[s2.SongID].Artist.ToUpper());
if (res == 0)
{
return _Songs[s1.SongID].Title.ToUpper().CompareTo(_Songs[s2.SongID].Title.ToUpper());
}
return res;
}
}
return res;
});
_SongsSortList = _SortList.ToArray();
_Categories.Clear();
for (int i=0; i < _SongsSortList.Length; i++)
{
if (_SongsSortList[i].SortString.Length > 0 && !_SongsSortList[i].SortString.Equals("0000"))
{
String decade = _SongsSortList[i].SortString.Substring(0, 3) + "0 - " + _SongsSortList[i].SortString.Substring(0, 3) + "9";
if (decade != category)
{
category = decade;
_Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1)));
}
_SongsSortList[i].CatIndex = _Categories.Count - 1;
}
else
{
if (CLanguage.Translate("TR_SCREENSONG_NOYEAR") != category)
{
category = CLanguage.Translate("TR_SCREENSONG_NOYEAR");
_Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1)));
}
_SongsSortList[i].CatIndex = _Categories.Count - 1;
}
}
break;
case ESongSorting.TR_CONFIG_YEAR:
foreach (CSong song in _SongList)
{
_SortList.Add(new SongPointer(song.ID, song.Year));
}
_SortList.Sort(delegate(SongPointer s1, SongPointer s2)
{
int res = s1.SortString.CompareTo(s2.SortString);
if (res == 0)
{
if (_IgnoreArticles == EOffOn.TR_CONFIG_ON)
{
res = _Songs[s1.SongID].ArtistSorting.ToUpper().CompareTo(_Songs[s2.SongID].ArtistSorting.ToUpper());
if (res == 0)
{
return _Songs[s1.SongID].TitleSorting.ToUpper().CompareTo(_Songs[s2.SongID].TitleSorting.ToUpper());
}
return res;
}
else
{
res = _Songs[s1.SongID].Artist.ToUpper().CompareTo(_Songs[s2.SongID].Artist.ToUpper());
if (res == 0)
{
return _Songs[s1.SongID].Title.ToUpper().CompareTo(_Songs[s2.SongID].Title.ToUpper());
}
return res;
}
}
return res;
});
_SongsSortList = _SortList.ToArray();
_Categories.Clear();
for (int i=0; i < _SongsSortList.Length; i++)
{
if (_SongsSortList[i].SortString.Length > 0 && !_SongsSortList[i].SortString.Equals("0000"))
{
if (_SongsSortList[i].SortString != category)
{
category = _SongsSortList[i].SortString;
_Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1)));
}
_SongsSortList[i].CatIndex = _Categories.Count - 1;
}
else
{
if (CLanguage.Translate("TR_SCREENSONG_NOYEAR") != category)
{
category = CLanguage.Translate("TR_SCREENSONG_NOYEAR");
_Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1)));
}
_SongsSortList[i].CatIndex = _Categories.Count - 1;
}
}
break;
case ESongSorting.TR_CONFIG_LANGUAGE:
foreach (CSong song in _SongList)
{
if (song.Language.Count == 0)
_SortList.Add(new SongPointer(song.ID, String.Empty));
else
{
for (int i = 0; i < song.Language.Count; i++)
{
_SortList.Add(new SongPointer(song.ID, song.Language[i]));
}
}
}
_SortList.Sort(delegate(SongPointer s1, SongPointer s2)
{
int res = s1.SortString.CompareTo(s2.SortString);
if (res == 0)
{
if (_IgnoreArticles == EOffOn.TR_CONFIG_ON)
{
res = _Songs[s1.SongID].ArtistSorting.ToUpper().CompareTo(_Songs[s2.SongID].ArtistSorting.ToUpper());
if (res == 0)
{
return _Songs[s1.SongID].TitleSorting.ToUpper().CompareTo(_Songs[s2.SongID].TitleSorting.ToUpper());
}
return res;
}
else
{
res = _Songs[s1.SongID].Artist.ToUpper().CompareTo(_Songs[s2.SongID].Artist.ToUpper());
if (res == 0)
{
return _Songs[s1.SongID].Title.ToUpper().CompareTo(_Songs[s2.SongID].Title.ToUpper());
}
return res;
}
}
return res;
});
_SongsSortList = _SortList.ToArray();
_Categories.Clear();
for (int i=0; i < _SongsSortList.Length; i++)
{
if (_SongsSortList[i].SortString.Length > 0)
{
if (_SongsSortList[i].SortString != category)
{
category = _SongsSortList[i].SortString;
_Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1)));
}
_SongsSortList[i].CatIndex = _Categories.Count - 1;
}
else
{
if (CLanguage.Translate("TR_SCREENSONG_NOLANGUAGE") != category)
{
category = CLanguage.Translate("TR_SCREENSONG_NOLANGUAGE");
_Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1)));
}
_SongsSortList[i].CatIndex = _Categories.Count - 1;
}
}
break;
default:
break;
}
_FilterSongs(SearchString, ShowDuetSongs);
SortSongs();
_Categories.Clear();
if (_Tabs == EOffOn.TR_CONFIG_OFF)
{
_Categories.Clear();
_Categories.Add(new CCategory("", new STexture(-1), new STexture(-1)));
//No categories. So don't create them!
_Categories.Add(new CCategory(""));
for (int i = 0; i < _SongsSortList.Length; i++)
{
_SongsSortList[i].CatIndex = 0;
}
}
}else
_FillCategories();
foreach (CCategory cat in _Categories)
{
STexture cover = CCover.Cover(cat.Name);
cat.CoverTextureSmall = cover;
cat.CoverTextureSmall = CCover.Cover(cat.Name);
}
Category = _CatIndex;
}
@@ -1012,8 +706,8 @@ namespace Vocaluxe.Base
foreach (string p in CConfig.SongFolder)
{
string path = p;
files.AddRange(Helper.ListFiles(path, "*.txt", true, true));
files.AddRange(Helper.ListFiles(path, "*.txd", true, true));
files.AddRange(CHelper.ListFiles(path, "*.txt", true, true));
files.AddRange(CHelper.ListFiles(path, "*.txd", true, true));
}
CLog.StopBenchmark(2, "List Songs");
+10 -46
View File
@@ -147,17 +147,9 @@ namespace Vocaluxe.Base
public static bool LoadSkin(int SkinIndex)
{
CXMLReader xmlReader;
try
{
xmlReader = new CXMLReader(Path.Combine(_Skins[SkinIndex].Path, _Skins[SkinIndex].FileName));
}
catch (Exception e)
{
CLog.LogError("Error loading skin " + _Skins[SkinIndex].FileName + ": " + e.Message);
CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(_Skins[SkinIndex].Path, _Skins[SkinIndex].FileName));
if (xmlReader == null)
return false;
}
string value = String.Empty;
@@ -264,17 +256,9 @@ namespace Vocaluxe.Base
return false;
}
CXMLReader xmlReader;
try
{
xmlReader = new CXMLReader(Path.Combine(_Themes[ThemeIndex].Path, _Themes[ThemeIndex].FileName));
}
catch (Exception e)
{
CLog.LogError("Error loading theme " + _Themes[ThemeIndex].FileName + ": " + e.Message);
CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(_Themes[ThemeIndex].Path, _Themes[ThemeIndex].FileName));
if (xmlReader == null)
return false;
}
int skinIndex = GetSkinIndex(_Themes[ThemeIndex].PartyModeID);
@@ -406,11 +390,10 @@ namespace Vocaluxe.Base
private static void ListThemes()
{
CHelper Helper = new CHelper();
_Themes.Clear();
string path = Path.Combine(Directory.GetCurrentDirectory(), CSettings.sFolderThemes);
List<string> files = Helper.ListFiles(path, "*.xml", false);
List<string> files = CHelper.ListFiles(path, "*.xml", false);
foreach (string file in files)
{
@@ -420,17 +403,9 @@ namespace Vocaluxe.Base
public static bool AddTheme(string FilePath, int PartyModeID)
{
CXMLReader xmlReader;
try
{
xmlReader = new CXMLReader(FilePath);
}
catch (Exception e)
{
CLog.LogError("Error loading theme " + FilePath + ": " + e.Message);
CXMLReader xmlReader = CXMLReader.OpenFile(FilePath);
if (xmlReader == null)
return false;
}
Theme theme = new Theme();
@@ -469,7 +444,6 @@ namespace Vocaluxe.Base
public static void ListSkins()
{
CHelper Helper = new CHelper();
int themeIndex = GetThemeIndex(-1);
_Skins.Clear();
@@ -483,8 +457,6 @@ namespace Vocaluxe.Base
public static void ListSkins(int ThemeIndex)
{
CHelper Helper = new CHelper();
if (ThemeIndex < 0 || ThemeIndex >= _Themes.Count)
{
CLog.LogError("Error List Skins. Can't find Theme index: " + ThemeIndex.ToString());
@@ -494,21 +466,13 @@ namespace Vocaluxe.Base
Theme theme = _Themes[ThemeIndex];
string path = Path.Combine(theme.Path, theme.SkinFolder);
List<string> files = Helper.ListFiles(path, "*.xml", false);
List<string> files = CHelper.ListFiles(path, "*.xml", false);
foreach (string file in files)
{
CXMLReader xmlReader;
try
{
xmlReader = new CXMLReader(Path.Combine(path, file));
}
catch (Exception e)
{
CLog.LogError("Error loading skin " + file + ": " + e.Message);
CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(path, file));
if (xmlReader == null)
continue;
}
Skin skin = new Skin();
+2 -11
View File
@@ -14,7 +14,6 @@ namespace Vocaluxe.Lib.Playlist
public class CPlaylistFile
{
private static XmlWriterSettings _settings = new XmlWriterSettings();
private static CHelper Helper = new CHelper();
public string PlaylistName;
public string PlaylistFile;
@@ -121,17 +120,9 @@ namespace Vocaluxe.Lib.Playlist
private void LoadPlaylist()
{
CXMLReader xmlReader;
try
{
xmlReader = new CXMLReader(PlaylistFile);
}
catch (Exception e)
{
CLog.LogError("Error opening Playlist File " + PlaylistFile + ": " + e.Message);
CXMLReader xmlReader = CXMLReader.OpenFile(PlaylistFile);
if (xmlReader == null)
return;
}
string value = String.Empty;
if (xmlReader.GetValue("//root/Info/PlaylistName", ref value, value))
+5 -5
View File
@@ -7,8 +7,9 @@ using System.Text;
namespace Vocaluxe.Menu
{
public class CHelper
public static class CHelper
{
public static int nCk(int n, int k)
{
if (k > n)
@@ -128,17 +129,17 @@ namespace Vocaluxe.Menu
public List<string> ListFiles(string path, string cast)
public static List<string> ListFiles(string path, string cast)
{
return ListFiles(path, cast, false, false);
}
public List<string> ListFiles(string path, string cast, bool recursive)
public static List<string> ListFiles(string path, string cast, bool recursive)
{
return ListFiles(path, cast, recursive, false);
}
public List<string> ListFiles(string path, string cast, bool recursive, bool fullpath)
public static List<string> ListFiles(string path, string cast, bool recursive, bool fullpath)
{
List<string> files = new List<string>();
DirectoryInfo dir = new DirectoryInfo(path);
@@ -151,7 +152,6 @@ namespace Vocaluxe.Menu
if (!fullpath)
files.Add(file.Name);
else
//files.Add(Path.Combine(file.DirectoryName, file.Name));
files.Add(file.FullName);
}
+5 -16
View File
@@ -172,27 +172,16 @@ namespace Vocaluxe.Menu
{
string file = Path.Combine(XmlPath, _ThemeName + ".xml");
CXMLReader xmlReader = null;
try
{
xmlReader = new CXMLReader(file);
}
catch (Exception e)
{
if (xmlReader != null)
xmlReader = null;
CBase.Log.LogError("Error loading theme file " + file + ": " + e.Message);
}
CXMLReader xmlReader = CXMLReader.OpenFile(file);
if (xmlReader == null)
return;
bool VersionCheck = false;
if (xmlReader != null)
VersionCheck = CheckVersion(_ScreenVersion, xmlReader);
VersionCheck = CheckVersion(_ScreenVersion, xmlReader);
int SkinIndex = CBase.Theme.GetSkinIndex(_PartyModeID);
if (xmlReader != null && VersionCheck && SkinIndex != -1)
if (VersionCheck && SkinIndex != -1)
{
_ThemePath = XmlPath;
LoadThemeBasics(xmlReader, SkinIndex);
+4 -3
View File
@@ -9,7 +9,8 @@ namespace Vocaluxe.Menu
{
private XPathNavigator _Navigator;
public CXMLReader(string uri)
//Private method. Use OpenFile factory method to get an instance
private CXMLReader(string uri)
{
XPathDocument xPathDoc = new XPathDocument(uri);
_Navigator = xPathDoc.CreateNavigator();
@@ -26,9 +27,9 @@ namespace Vocaluxe.Menu
{
return new CXMLReader(sUri);
}
catch (Exception)
catch (Exception e)
{
CBase.Log.LogError("Can't open XML file: " + sUri);
CBase.Log.LogError("Can't open XML file: " + sUri + ": " + e.Message);
return null;
}
}
+12 -2
View File
@@ -530,7 +530,12 @@ namespace Vocaluxe.Menu.SingNotes
CBase.Drawing.DrawTexture(NoteBegin, new SRectF(r.X, r.Y, dx, r.H, r.Z), Color);
CBase.Drawing.DrawTexture(NoteMiddle, new SRectF(r.X + dx, r.Y, r.W - 2 * dx, r.H, r.Z), Color);
if (r.W - 2 * dx >= 2 * dx)
CBase.Drawing.DrawTexture(NoteMiddle, new SRectF(r.X + dx, r.Y, r.W - 2 * dx, r.H, r.Z), Color);
else
CBase.Drawing.DrawTexture(NoteMiddle, new SRectF(r.X + dx, r.Y, 2 * dx, r.H, r.Z), Color, new SRectF(r.X + dx, r.Y, r.W - 2 * dx, r.H, r.Z));
CBase.Drawing.DrawTexture(NoteEnd, new SRectF(r.X + r.W - dx, r.Y, dx, r.H, r.Z), Color);
}
@@ -573,7 +578,12 @@ namespace Vocaluxe.Menu.SingNotes
SColorF col = new SColorF(Color.R, Color.G, Color.B, Color.A * alpha);
CBase.Drawing.DrawTexture(NoteBackgroundBegin, new SRectF(r.X, r.Y, dx, r.H, r.Z), col);
CBase.Drawing.DrawTexture(NoteBackgroundMiddle, new SRectF(r.X + dx, r.Y, r.W - 2 * dx, r.H, r.Z), col);
if (r.W - 2 * dx >= 2 * dx)
CBase.Drawing.DrawTexture(NoteBackgroundMiddle, new SRectF(r.X + dx, r.Y, r.W - 2 * dx, r.H, r.Z), col);
else
CBase.Drawing.DrawTexture(NoteBackgroundMiddle, new SRectF(r.X + dx, r.Y, 2 * dx, r.H, r.Z), col, new SRectF(r.X + dx, r.Y, r.W - 2 * dx, r.H, r.Z));
CBase.Drawing.DrawTexture(NoteBackgroundEnd, new SRectF(r.X + r.W - dx, r.Y, dx, r.H, r.Z), col);
}
+14 -10
View File
@@ -31,10 +31,15 @@ namespace Vocaluxe.Menu.SongMenu
public class CCategory
{
public string Name = String.Empty;
private STexture _CoverTextureSmall = new STexture();
private STexture _CoverTextureBig = new STexture();
private STexture _CoverTextureSmall = new STexture(-1);
private STexture _CoverTextureBig = new STexture(-1);
private bool _CoverBigLoaded = false;
public CCategory(string name)
{
Name = name;
}
public STexture CoverTextureSmall
{
get { return _CoverTextureSmall; }
@@ -201,7 +206,8 @@ namespace Vocaluxe.Menu.SongMenu
public List<string> Edition = new List<string>();
public List<string> Genre = new List<string>();
public string Year = "0000";
public string Year = "";
public List<string> Language = new List<string>();
// Notes
@@ -474,7 +480,7 @@ namespace Vocaluxe.Menu.SongMenu
break;
case "YEAR":
int num = 0;
if (Value.Length == 4 && int.TryParse(Value, out num))
if (Value.Length == 4 && int.TryParse(Value, out num) && num != 0)
{
this.Year = Value;
}
@@ -842,11 +848,9 @@ namespace Vocaluxe.Menu.SongMenu
private void CheckFiles()
{
CHelper Helper = new CHelper();
if(this.CoverFileName == String.Empty){
List<string> files = Helper.ListFiles(this.Folder, "*.jpg", false);
files.AddRange(Helper.ListFiles(this.Folder, "*.png", false));
List<string> files = CHelper.ListFiles(this.Folder, "*.jpg", false);
files.AddRange(CHelper.ListFiles(this.Folder, "*.png", false));
foreach(String file in files)
{
if (Regex.IsMatch(file, @".[CO].", RegexOptions.IgnoreCase) && (Regex.IsMatch(file, @"" + Regex.Escape(this.Title), RegexOptions.IgnoreCase) || Regex.IsMatch(file, @"" + Regex.Escape(this.Artist), RegexOptions.IgnoreCase)))
@@ -858,8 +862,8 @@ namespace Vocaluxe.Menu.SongMenu
if (this.BackgroundFileName == String.Empty)
{
List<string> files = Helper.ListFiles(this.Folder, "*.jpg", false);
files.AddRange(Helper.ListFiles(this.Folder, "*.png", false));
List<string> files = CHelper.ListFiles(this.Folder, "*.jpg", false);
files.AddRange(CHelper.ListFiles(this.Folder, "*.png", false));
foreach (String file in files)
{