Merge branch 'Flamefire/develop' into develop
Conflicts: VocaluxeLib/Menu/SongMenu/CSong.cs
This commit is contained in:
commit
c3fcd71589
16 files changed
+358
-767
No files matched your search
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
|
||||
Reference in new issue
Block a user