Merge branch 'release-0.3' into develop
Conflicts: Vocaluxe/Base/CConfig.cs Vocaluxe/Lib/Playlist/CPlaylistFile.cs Vocaluxe/Screens/CScreenSong.cs VocaluxeLib/CHelper.cs VocaluxeLib/Menu/CMenu.cs VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs
This commit is contained in:
commit
73e4a9fa74
15 files changed
+240
-272
No files matched your search
@@ -33,7 +33,15 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
static class CConfig
|
||||
{
|
||||
private static readonly XmlWriterSettings _Settings = new XmlWriterSettings();
|
||||
/// <summary>
|
||||
/// Uniform settings for writing XML files. ALWAYS use this!
|
||||
/// </summary>
|
||||
public static readonly XmlWriterSettings XMLSettings = new XmlWriterSettings
|
||||
{
|
||||
Indent = true,
|
||||
Encoding = Encoding.UTF8,
|
||||
ConformanceLevel = ConformanceLevel.Document
|
||||
};
|
||||
|
||||
// Debug
|
||||
public static EDebugLevel DebugLevel = EDebugLevel.TR_CONFIG_OFF;
|
||||
@@ -141,10 +149,6 @@ namespace Vocaluxe.Base
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
_Settings.Indent = true;
|
||||
_Settings.Encoding = Encoding.UTF8;
|
||||
_Settings.ConformanceLevel = ConformanceLevel.Document;
|
||||
|
||||
SongFolder.Add(Path.Combine(Directory.GetCurrentDirectory(), CSettings.FolderSongs));
|
||||
|
||||
#if INSTALLER
|
||||
@@ -304,7 +308,7 @@ namespace Vocaluxe.Base
|
||||
XmlWriter writer = null;
|
||||
try
|
||||
{
|
||||
writer = XmlWriter.Create(Path.Combine(CSettings.DataPath, CSettings.FileConfig), _Settings);
|
||||
writer = XmlWriter.Create(Path.Combine(CSettings.DataPath, CSettings.FileConfig), XMLSettings);
|
||||
writer.WriteStartDocument();
|
||||
writer.WriteStartElement("root");
|
||||
|
||||
|
||||
+14
-6
@@ -19,6 +19,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Drawing;
|
||||
using System.Xml;
|
||||
using Vocaluxe.Base.Fonts;
|
||||
using VocaluxeLib;
|
||||
using VocaluxeLib.Game;
|
||||
@@ -144,6 +145,11 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
return CConfig.GetMaxNumMics();
|
||||
}
|
||||
|
||||
public XmlWriterSettings GetXMLSettings()
|
||||
{
|
||||
return CConfig.XMLSettings;
|
||||
}
|
||||
}
|
||||
|
||||
class CBsettings : ISettings
|
||||
@@ -606,9 +612,14 @@ namespace Vocaluxe.Base
|
||||
return CSongs.NumCategories;
|
||||
}
|
||||
|
||||
public int NumSongsInCategory(int categoryIndex)
|
||||
public int GetNumSongsInCategory(int categoryIndex)
|
||||
{
|
||||
return CSongs.NumSongsInCategory(categoryIndex);
|
||||
return CSongs.GetNumSongsInCategory(categoryIndex);
|
||||
}
|
||||
|
||||
public int GetNumSongsNotSungInCategory(int categoryIndex)
|
||||
{
|
||||
return CSongs.GetNumSongsNotSungInCategory(categoryIndex);
|
||||
}
|
||||
|
||||
public bool IsInCategory()
|
||||
@@ -663,10 +674,7 @@ namespace Vocaluxe.Base
|
||||
|
||||
public CCategory GetCategory(int index)
|
||||
{
|
||||
if (index >= CSongs.NumCategories)
|
||||
return null;
|
||||
|
||||
return new CCategory(CSongs.Categories[index]);
|
||||
return CSongs.GetCategoryByIndex(index);
|
||||
}
|
||||
|
||||
public void AddPartySongSung(int songID)
|
||||
|
||||
+33
-6
@@ -64,7 +64,7 @@ namespace Vocaluxe.Base
|
||||
|
||||
public static int NumSongsVisible
|
||||
{
|
||||
get { return _CatIndex < 0 ? 0 : Categories[_CatIndex].Songs.Count(sp => !sp.IsSung); }
|
||||
get { return VisibleSongs.Count; }
|
||||
}
|
||||
|
||||
public static int NumCategories
|
||||
@@ -102,9 +102,19 @@ namespace Vocaluxe.Base
|
||||
/// </summary>
|
||||
/// <param name="catIndex">Category index</param>
|
||||
/// <returns></returns>
|
||||
public static int NumSongsInCategory(int catIndex)
|
||||
public static int GetNumSongsInCategory(int catIndex)
|
||||
{
|
||||
return _IsCatIndexValid(catIndex) ? Categories[catIndex].Songs.Count(sp => !sp.IsSung) : 0;
|
||||
return _IsCatIndexValid(catIndex) ? Categories[catIndex].Songs.Count : 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the number of song that are not sung in the category specified with CatIndex
|
||||
/// </summary>
|
||||
/// <param name="catIndex">Category index</param>
|
||||
/// <returns>Number of visible songs in that category</returns>
|
||||
public static int GetNumSongsNotSungInCategory(int catIndex)
|
||||
{
|
||||
return _IsCatIndexValid(catIndex) ? Categories[catIndex].GetNumSongsNotSung() : 0;
|
||||
}
|
||||
|
||||
public static void NextCategory()
|
||||
@@ -157,9 +167,8 @@ namespace Vocaluxe.Base
|
||||
foreach (CSongPointer song in category.Songs.Where(song => song.SongID == songID))
|
||||
{
|
||||
song.IsSung = true;
|
||||
int catIndex = _GetCategoryNumber(category);
|
||||
if (NumSongsInCategory(catIndex) == 0)
|
||||
ResetPartySongSung(catIndex);
|
||||
if (category.GetNumSongsNotSung() == 0)
|
||||
ResetPartySongSung(_GetCategoryNumber(category));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -269,6 +278,24 @@ namespace Vocaluxe.Base
|
||||
get { return Categorizer.Categories.AsReadOnly(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets category with given index or null for invalid index
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <returns>category with given index or null for invalid index</returns>
|
||||
public static CCategory GetCategoryByIndex(int index)
|
||||
{
|
||||
if (!_IsCatIndexValid(index))
|
||||
return null;
|
||||
|
||||
return Categorizer.Categories[index];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets visible song with given index or null for invalid index or song not visible
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <returns>visible song with given index or null for invalid index or song not visible</returns>
|
||||
public static CSong GetVisibleSongByIndex(int index)
|
||||
{
|
||||
if (index < 0)
|
||||
|
||||
@@ -105,7 +105,6 @@ namespace Vocaluxe.Base
|
||||
private const int _SkinSystemVersion = 3;
|
||||
|
||||
#region Vars
|
||||
private static readonly XmlWriterSettings _Settings = new XmlWriterSettings();
|
||||
private static readonly List<STheme> _Themes = new List<STheme>();
|
||||
public static string[] ThemeNames
|
||||
{
|
||||
@@ -146,10 +145,6 @@ namespace Vocaluxe.Base
|
||||
#region Theme and Skin loading and writing
|
||||
public static void InitTheme()
|
||||
{
|
||||
_Settings.Indent = true;
|
||||
_Settings.Encoding = Encoding.UTF8;
|
||||
_Settings.ConformanceLevel = ConformanceLevel.Document;
|
||||
|
||||
_ListThemes();
|
||||
ListSkins();
|
||||
|
||||
@@ -289,7 +284,7 @@ namespace Vocaluxe.Base
|
||||
private static void _SaveTheme(int themeIndex)
|
||||
{
|
||||
#region ThemeMainFile
|
||||
using (XmlWriter writer = XmlWriter.Create(Path.Combine(_Themes[themeIndex].Path, _Themes[themeIndex].FileName), _Settings))
|
||||
using (XmlWriter writer = XmlWriter.Create(Path.Combine(_Themes[themeIndex].Path, _Themes[themeIndex].FileName), CConfig.XMLSettings))
|
||||
{
|
||||
writer.WriteStartDocument();
|
||||
writer.WriteStartElement("root");
|
||||
@@ -331,7 +326,7 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
for (int skinIndex = 0; skinIndex < _Skins.Count; skinIndex++)
|
||||
{
|
||||
using (XmlWriter writer = XmlWriter.Create(Path.Combine(_Skins[skinIndex].Path, _Skins[skinIndex].FileName), _Settings))
|
||||
using (XmlWriter writer = XmlWriter.Create(Path.Combine(_Skins[skinIndex].Path, _Skins[skinIndex].FileName), CConfig.XMLSettings))
|
||||
{
|
||||
writer.WriteStartDocument();
|
||||
writer.WriteStartElement("root");
|
||||
|
||||
Reference in new issue
Block a user