Merge branch 'develop' of github.com:Flamefire/Vocaluxe into develop
This commit is contained in:
commit
4b02932bb4
38 files changed
+448
-487
No files matched your search
@@ -475,12 +475,12 @@ namespace VocaluxeLib.PartyModes.Challenge
|
|||||||
players[i].ProfileID = -1;
|
players[i].ProfileID = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
CBase.Songs.AddPartySongSung(songID);
|
|
||||||
CBase.Graphics.FadeTo(EScreens.ScreenSing);
|
CBase.Graphics.FadeTo(EScreens.ScreenSing);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void LeavingHighscore()
|
public override void LeavingHighscore()
|
||||||
{
|
{
|
||||||
|
CBase.Songs.AddPartySongSung(CBase.Game.GetSong(0).ID);
|
||||||
_GameData.CurrentRoundNr++;
|
_GameData.CurrentRoundNr++;
|
||||||
CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy);
|
CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -457,6 +457,8 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
|||||||
|
|
||||||
public override void LeavingHighscore()
|
public override void LeavingHighscore()
|
||||||
{
|
{
|
||||||
|
for (int i = 0; i < CBase.Game.GetNumSongs();i++ )
|
||||||
|
CBase.Songs.AddPartySongSung(CBase.Game.GetSong(i).ID);
|
||||||
_GameData.CurrentRoundNr++;
|
_GameData.CurrentRoundNr++;
|
||||||
CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy);
|
CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy);
|
||||||
}
|
}
|
||||||
@@ -542,7 +544,6 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
|||||||
{
|
{
|
||||||
int songID = ids[CBase.Game.GetRandom(ids.Count)];
|
int songID = ids[CBase.Game.GetRandom(ids.Count)];
|
||||||
CBase.Game.AddSong(songID, EGameMode.TR_GAMEMODE_MEDLEY);
|
CBase.Game.AddSong(songID, EGameMode.TR_GAMEMODE_MEDLEY);
|
||||||
CBase.Songs.AddPartySongSung(songID);
|
|
||||||
ids.Remove(songID);
|
ids.Remove(songID);
|
||||||
s++;
|
s++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -515,12 +515,12 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
|||||||
}
|
}
|
||||||
CBase.Game.AddSong(songID, gm);
|
CBase.Game.AddSong(songID, gm);
|
||||||
|
|
||||||
CBase.Songs.AddPartySongSung(songID);
|
|
||||||
CBase.Graphics.FadeTo(EScreens.ScreenSing);
|
CBase.Graphics.FadeTo(EScreens.ScreenSing);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void LeavingHighscore()
|
public override void LeavingHighscore()
|
||||||
{
|
{
|
||||||
|
CBase.Songs.AddPartySongSung(CBase.Game.GetSong(0).ID);
|
||||||
_UpdateScores();
|
_UpdateScores();
|
||||||
CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy);
|
CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy);
|
||||||
}
|
}
|
||||||
@@ -655,9 +655,9 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
|||||||
switch (_GameData.SongSource)
|
switch (_GameData.SongSource)
|
||||||
{
|
{
|
||||||
case ESongSource.TR_PLAYLIST:
|
case ESongSource.TR_PLAYLIST:
|
||||||
for (int i = 0; i < CBase.Playlist.GetPlaylistSongCount(_GameData.PlaylistID); i++)
|
for (int i = 0; i < CBase.Playlist.GetSongCount(_GameData.PlaylistID); i++)
|
||||||
{
|
{
|
||||||
int id = CBase.Playlist.GetPlaylistSong(_GameData.PlaylistID, i).SongID;
|
int id = CBase.Playlist.GetSong(_GameData.PlaylistID, i).SongID;
|
||||||
// ReSharper disable LoopCanBeConvertedToQuery
|
// ReSharper disable LoopCanBeConvertedToQuery
|
||||||
foreach (EGameMode mode in CBase.Songs.GetSongByID(id).AvailableGameModes)
|
foreach (EGameMode mode in CBase.Songs.GetSongByID(id).AvailableGameModes)
|
||||||
// ReSharper restore LoopCanBeConvertedToQuery
|
// ReSharper restore LoopCanBeConvertedToQuery
|
||||||
|
|||||||
@@ -180,11 +180,11 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
|||||||
_SelectSlides[_SelectSlideSongSource].Clear();
|
_SelectSlides[_SelectSlideSongSource].Clear();
|
||||||
_SelectSlides[_SelectSlideSongSource].SetValues<ESongSource>((int)_Data.ScreenConfig.SongSource);
|
_SelectSlides[_SelectSlideSongSource].SetValues<ESongSource>((int)_Data.ScreenConfig.SongSource);
|
||||||
|
|
||||||
List<string> playlists = CBase.Playlist.GetPlaylistNames();
|
List<string> playlists = CBase.Playlist.GetNames();
|
||||||
_SelectSlides[_SelectSlidePlaylist].Clear();
|
_SelectSlides[_SelectSlidePlaylist].Clear();
|
||||||
for (int i = 0; i < playlists.Count; i++)
|
for (int i = 0; i < playlists.Count; i++)
|
||||||
{
|
{
|
||||||
string value = playlists[i] + " (" + CBase.Playlist.GetPlaylistSongCount(i) + " " + CBase.Language.Translate("TR_SONGS", _PartyModeID) + ")";
|
string value = playlists[i] + " (" + CBase.Playlist.GetSongCount(i) + " " + CBase.Language.Translate("TR_SONGS", _PartyModeID) + ")";
|
||||||
_SelectSlides[_SelectSlidePlaylist].AddValue(value);
|
_SelectSlides[_SelectSlidePlaylist].AddValue(value);
|
||||||
}
|
}
|
||||||
_SelectSlides[_SelectSlidePlaylist].Selection = _Data.ScreenConfig.PlaylistID;
|
_SelectSlides[_SelectSlidePlaylist].Selection = _Data.ScreenConfig.PlaylistID;
|
||||||
@@ -241,12 +241,12 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
|||||||
{
|
{
|
||||||
if (CBase.Playlist.GetNumPlaylists() > 0)
|
if (CBase.Playlist.GetNumPlaylists() > 0)
|
||||||
{
|
{
|
||||||
if (CBase.Playlist.GetPlaylistSongCount(_Data.ScreenConfig.PlaylistID) > 0)
|
if (CBase.Playlist.GetSongCount(_Data.ScreenConfig.PlaylistID) > 0)
|
||||||
{
|
{
|
||||||
_ConfigOk = false;
|
_ConfigOk = false;
|
||||||
for (int i = 0; i < CBase.Playlist.GetPlaylistSongCount(_Data.ScreenConfig.PlaylistID); i++)
|
for (int i = 0; i < CBase.Playlist.GetSongCount(_Data.ScreenConfig.PlaylistID); i++)
|
||||||
{
|
{
|
||||||
int id = CBase.Playlist.GetPlaylistSong(_Data.ScreenConfig.PlaylistID, i).SongID;
|
int id = CBase.Playlist.GetSong(_Data.ScreenConfig.PlaylistID, i).SongID;
|
||||||
_ConfigOk = CBase.Songs.GetSongByID(id).AvailableGameModes.Any(mode => mode == gm);
|
_ConfigOk = CBase.Songs.GetSongByID(id).AvailableGameModes.Any(mode => mode == gm);
|
||||||
if (_ConfigOk)
|
if (_ConfigOk)
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ namespace ServerLib
|
|||||||
ProcessStartInfo info = new ProcessStartInfo
|
ProcessStartInfo info = new ProcessStartInfo
|
||||||
{
|
{
|
||||||
FileName = "VocaluxeServerConfig.exe",
|
FileName = "VocaluxeServerConfig.exe",
|
||||||
WorkingDirectory = Environment.CurrentDirectory,
|
WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory,
|
||||||
Arguments = port + " " + (_Encrypted ? "true" : "false") + (reserve ? " reserve" : ""),
|
Arguments = port + " " + (_Encrypted ? "true" : "false") + (reserve ? " reserve" : ""),
|
||||||
UseShellExecute = true,
|
UseShellExecute = true,
|
||||||
CreateNoWindow = true,
|
CreateNoWindow = true,
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ namespace Vocaluxe.Base
|
|||||||
if (_Initialized)
|
if (_Initialized)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
List<string> soundFiles = CHelper.ListSoundFiles(CSettings.FolderBackgroundMusic, true, true);
|
List<string> soundFiles = CHelper.ListSoundFiles(CSettings.FolderNameBackgroundMusic, true, true);
|
||||||
|
|
||||||
foreach (string path in soundFiles)
|
foreach (string path in soundFiles)
|
||||||
_BGMusicFiles.Add(new CPlaylistElement(path));
|
_BGMusicFiles.Add(new CPlaylistElement(path));
|
||||||
|
|||||||
+13
-17
@@ -46,11 +46,9 @@ namespace Vocaluxe.Base
|
|||||||
private static bool _Initialized;
|
private static bool _Initialized;
|
||||||
|
|
||||||
// Base file and folder names (formerly from CSettings but they can be changed)
|
// Base file and folder names (formerly from CSettings but they can be changed)
|
||||||
private const string _FolderProfiles = "Profiles"; //Use ProfileFolders for access
|
public static string FolderPlaylists = Path.Combine(CSettings.DataFolder, "Playlists");
|
||||||
private const string _FolderSongs = "Songs"; //Use SongFolders for access
|
public static string FileHighscoreDB = Path.Combine(CSettings.DataFolder, "HighscoreDB.sqlite");
|
||||||
public static string FolderPlaylists = "Playlists";
|
private static string _FileConfig = Path.Combine(CSettings.DataFolder, "Config.xml");
|
||||||
public static string FileHighscoreDB = "HighscoreDB.sqlite";
|
|
||||||
private static string _FileConfig = "Config.xml";
|
|
||||||
|
|
||||||
// Debug
|
// Debug
|
||||||
public static EDebugLevel DebugLevel = EDebugLevel.TR_CONFIG_OFF;
|
public static EDebugLevel DebugLevel = EDebugLevel.TR_CONFIG_OFF;
|
||||||
@@ -108,10 +106,10 @@ namespace Vocaluxe.Base
|
|||||||
//Folders
|
//Folders
|
||||||
public static readonly List<string> SongFolders = new List<string>
|
public static readonly List<string> SongFolders = new List<string>
|
||||||
{
|
{
|
||||||
Path.Combine(Directory.GetCurrentDirectory(), _FolderSongs)
|
Path.Combine(CSettings.ProgramFolder, CSettings.FolderNameSongs)
|
||||||
|
|
||||||
#if INSTALLER
|
#if INSTALLER
|
||||||
,Path.Combine(CSettings.DataPath, CSettings.FolderSongs);
|
,Path.Combine(CSettings.DataFolder, CSettings.FolderNameSongs);
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -121,9 +119,9 @@ namespace Vocaluxe.Base
|
|||||||
public static readonly List<string> ProfileFolders = new List<string>
|
public static readonly List<string> ProfileFolders = new List<string>
|
||||||
{
|
{
|
||||||
#if INSTALLER
|
#if INSTALLER
|
||||||
Path.Combine(Environment.CurrentDirectory, CSettings.FolderProfiles),
|
Path.Combine(Environment.CurrentDirectory, CSettings.FolderNameProfiles),
|
||||||
#endif
|
#endif
|
||||||
Path.Combine(CSettings.DataPath, _FolderProfiles)
|
Path.Combine(CSettings.DataFolder, CSettings.FolderNameProfiles)
|
||||||
};
|
};
|
||||||
|
|
||||||
// Game
|
// Game
|
||||||
@@ -202,7 +200,7 @@ namespace Vocaluxe.Base
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Init config file
|
// Init config file
|
||||||
if (!File.Exists(Path.Combine(CSettings.DataPath, _FileConfig)))
|
if (!File.Exists(_FileConfig))
|
||||||
SaveConfig();
|
SaveConfig();
|
||||||
else
|
else
|
||||||
_LoadConfig();
|
_LoadConfig();
|
||||||
@@ -212,7 +210,7 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
private static void _LoadConfig()
|
private static void _LoadConfig()
|
||||||
{
|
{
|
||||||
CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(CSettings.DataPath, _FileConfig));
|
CXMLReader xmlReader = CXMLReader.OpenFile(_FileConfig);
|
||||||
if (xmlReader == null)
|
if (xmlReader == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -357,7 +355,7 @@ namespace Vocaluxe.Base
|
|||||||
XmlWriter writer = null;
|
XmlWriter writer = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
writer = XmlWriter.Create(Path.Combine(CSettings.DataPath, _FileConfig), XMLSettings);
|
writer = XmlWriter.Create(_FileConfig, XMLSettings);
|
||||||
writer.WriteStartDocument();
|
writer.WriteStartDocument();
|
||||||
writer.WriteStartElement("root");
|
writer.WriteStartElement("root");
|
||||||
|
|
||||||
@@ -373,7 +371,7 @@ namespace Vocaluxe.Base
|
|||||||
writer.WriteElementString("Screens", Screen.AllScreens.Length.ToString());
|
writer.WriteElementString("Screens", Screen.AllScreens.Length.ToString());
|
||||||
writer.WriteElementString("PrimaryScreenResolution", Screen.PrimaryScreen.Bounds.Size.ToString());
|
writer.WriteElementString("PrimaryScreenResolution", Screen.PrimaryScreen.Bounds.Size.ToString());
|
||||||
|
|
||||||
writer.WriteElementString("Directory", Environment.CurrentDirectory);
|
writer.WriteElementString("Directory", CSettings.ProgramFolder);
|
||||||
|
|
||||||
writer.WriteEndElement();
|
writer.WriteEndElement();
|
||||||
|
|
||||||
@@ -806,10 +804,8 @@ namespace Vocaluxe.Base
|
|||||||
//Check each parameter
|
//Check each parameter
|
||||||
for (int i = 0; i < _Params.Count; i++)
|
for (int i = 0; i < _Params.Count; i++)
|
||||||
{
|
{
|
||||||
//Switch parameter as lower case
|
//Switch parameter to lower case
|
||||||
string param = _Params[i];
|
string param = _Params[i].ToLower();
|
||||||
|
|
||||||
param = param.ToLower();
|
|
||||||
|
|
||||||
string value = _Values[i];
|
string value = _Values[i];
|
||||||
|
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ namespace Vocaluxe.Base
|
|||||||
{
|
{
|
||||||
_CoverThemes.Clear();
|
_CoverThemes.Clear();
|
||||||
|
|
||||||
const string path = CSettings.FolderCover;
|
string path = Path.Combine(CSettings.ProgramFolder, CSettings.FolderNameCover);
|
||||||
List<string> files = CHelper.ListFiles(path, "*.xml");
|
List<string> files = CHelper.ListFiles(path, "*.xml");
|
||||||
|
|
||||||
foreach (string file in files)
|
foreach (string file in files)
|
||||||
@@ -179,10 +179,10 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
var ignoreList = new List<string>();
|
var ignoreList = new List<string>();
|
||||||
|
|
||||||
string coverPath = Path.Combine(CSettings.FolderCover, coverTheme.Folder);
|
string coverPath = Path.Combine(CSettings.ProgramFolder, CSettings.FolderNameCover, coverTheme.Folder);
|
||||||
List<string> files = CHelper.ListImageFiles(coverPath, true, true);
|
List<string> files = CHelper.ListImageFiles(coverPath, true, true);
|
||||||
|
|
||||||
CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(CSettings.FolderCover, coverTheme.File));
|
CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(CSettings.ProgramFolder, CSettings.FolderNameCover, coverTheme.File));
|
||||||
lock (_Covers)
|
lock (_Covers)
|
||||||
{
|
{
|
||||||
if (xmlReader != null)
|
if (xmlReader != null)
|
||||||
@@ -195,7 +195,7 @@ namespace Vocaluxe.Base
|
|||||||
string filePath;
|
string filePath;
|
||||||
xmlReader.GetValue("//root/Cover/" + coverName + "/Name", out name, String.Empty);
|
xmlReader.GetValue("//root/Cover/" + coverName + "/Name", out name, String.Empty);
|
||||||
xmlReader.GetValue("//root/Cover/" + coverName + "/Path", out filePath, String.Empty);
|
xmlReader.GetValue("//root/Cover/" + coverName + "/Path", out filePath, String.Empty);
|
||||||
string coverFilePath = Path.Combine(CSettings.FolderCover, Path.Combine(coverTheme.Folder, filePath));
|
string coverFilePath = Path.Combine(CSettings.ProgramFolder, CSettings.FolderNameCover, coverTheme.Folder, filePath);
|
||||||
if (!File.Exists(coverFilePath))
|
if (!File.Exists(coverFilePath))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|||||||
@@ -32,9 +32,9 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
public static bool Init()
|
public static bool Init()
|
||||||
{
|
{
|
||||||
_HighscoreDB = new CHighscoreDB(Path.Combine(Environment.CurrentDirectory, CConfig.FileHighscoreDB));
|
_HighscoreDB = new CHighscoreDB(CConfig.FileHighscoreDB);
|
||||||
_CoverDB = new CCoverDB(Path.Combine(Environment.CurrentDirectory, CSettings.FileCoverDB));
|
_CoverDB = new CCoverDB(Path.Combine(CSettings.DataFolder, CSettings.FileNameCoverDB));
|
||||||
_ResourceDB = new CResourceDB(Path.Combine(Environment.CurrentDirectory, CSettings.FileCreditsRessourcesDB));
|
_ResourceDB = new CResourceDB(Path.Combine(CSettings.ProgramFolder, CSettings.FileNameCreditsRessourcesDB));
|
||||||
|
|
||||||
if (!_HighscoreDB.Init())
|
if (!_HighscoreDB.Init())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ namespace Vocaluxe.Base
|
|||||||
_Languages = new List<SLanguage>();
|
_Languages = new List<SLanguage>();
|
||||||
|
|
||||||
var files = new List<string>();
|
var files = new List<string>();
|
||||||
files.AddRange(CHelper.ListFiles(CSettings.FolderLanguages, "*.xml", true, true));
|
files.AddRange(CHelper.ListFiles(CSettings.FolderNameLanguages, "*.xml", true, true));
|
||||||
|
|
||||||
foreach (string file in files)
|
foreach (string file in files)
|
||||||
_LoadLanguageFile(file);
|
_LoadLanguageFile(file);
|
||||||
@@ -214,7 +214,7 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
private static void _LoadLanguageFile(string fileName)
|
private static void _LoadLanguageFile(string fileName)
|
||||||
{
|
{
|
||||||
var lang = new SLanguage {LanguageFilePath = Path.Combine(CSettings.FolderLanguages, fileName)};
|
var lang = new SLanguage {LanguageFilePath = Path.Combine(CSettings.ProgramFolder, CSettings.FolderNameLanguages, fileName)};
|
||||||
|
|
||||||
CXMLReader xmlReader = CXMLReader.OpenFile(lang.LanguageFilePath);
|
CXMLReader xmlReader = CXMLReader.OpenFile(lang.LanguageFilePath);
|
||||||
if (xmlReader == null)
|
if (xmlReader == null)
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ namespace Vocaluxe.Base
|
|||||||
{
|
{
|
||||||
if (_LogFile != null)
|
if (_LogFile != null)
|
||||||
return;
|
return;
|
||||||
_LogFile = new StreamWriter(Path.Combine(CSettings.DataPath, _LogFileName), false, Encoding.UTF8);
|
_LogFile = new StreamWriter(Path.Combine(CSettings.DataFolder, _LogFileName), false, Encoding.UTF8);
|
||||||
|
|
||||||
_LogFile.WriteLine(_LogName + " " + CSettings.GetFullVersionText() + " " + DateTime.Now);
|
_LogFile.WriteLine(_LogName + " " + CSettings.GetFullVersionText() + " " + DateTime.Now);
|
||||||
_LogFile.WriteLine("----------------------------------------");
|
_LogFile.WriteLine("----------------------------------------");
|
||||||
@@ -117,11 +117,11 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
_ErrorLog = new CErrorLogFile(CSettings.FileErrorLog, "Error-Log");
|
_ErrorLog = new CErrorLogFile(CSettings.FileNameErrorLog, "Error-Log");
|
||||||
_PerformanceLog = new CLogFile(CSettings.FilePerformanceLog, "Performance-Log");
|
_PerformanceLog = new CLogFile(CSettings.FileNamePerformanceLog, "Performance-Log");
|
||||||
_BenchmarkLog = new CLogFile(CSettings.FileBenchmarkLog, "Benchmark-Log");
|
_BenchmarkLog = new CLogFile(CSettings.FileNameBenchmarkLog, "Benchmark-Log");
|
||||||
_DebugLog = new CLogFile(CSettings.FileDebugLog, "Debug-Log");
|
_DebugLog = new CLogFile(CSettings.FileNameDebugLog, "Debug-Log");
|
||||||
_SongInfoLog = new CLogFile(CSettings.FileSongInfoLog, "Song-Information-Log");
|
_SongInfoLog = new CLogFile(CSettings.FileNameSongInfoLog, "Song-Information-Log");
|
||||||
|
|
||||||
_BenchmarkTimer = new Stopwatch[_MaxBenchmarks];
|
_BenchmarkTimer = new Stopwatch[_MaxBenchmarks];
|
||||||
for (int i = 0; i < _BenchmarkTimer.Length; i++)
|
for (int i = 0; i < _BenchmarkTimer.Length; i++)
|
||||||
|
|||||||
+44
-29
@@ -231,7 +231,7 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
public string GetDataPath()
|
public string GetDataPath()
|
||||||
{
|
{
|
||||||
return CSettings.DataPath;
|
return CSettings.DataFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float GetSlideShowImageTime()
|
public float GetSlideShowImageTime()
|
||||||
@@ -577,6 +577,16 @@ namespace Vocaluxe.Base
|
|||||||
{
|
{
|
||||||
return CGame.GetNumSongs();
|
return CGame.GetNumSongs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CSong GetSong()
|
||||||
|
{
|
||||||
|
return CGame.GetSong();
|
||||||
|
}
|
||||||
|
|
||||||
|
public CSong GetSong(int round)
|
||||||
|
{
|
||||||
|
return CGame.GetSong(round);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class CBprofiles : IProfiles
|
class CBprofiles : IProfiles
|
||||||
@@ -855,29 +865,34 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
class CBplaylist : IPlaylist
|
class CBplaylist : IPlaylist
|
||||||
{
|
{
|
||||||
public void SetPlaylistName(int playlistID, string name)
|
public void SetName(int playlistID, string name)
|
||||||
{
|
{
|
||||||
CPlaylists.SetPlaylistName(playlistID, name);
|
CPlaylists.SetName(playlistID, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<string> GetPlaylistNames()
|
public List<string> GetNames()
|
||||||
{
|
{
|
||||||
return CPlaylists.PlaylistNames;
|
return CPlaylists.Names;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetPlaylistName(int playlistID)
|
public bool Exists(int playlistID)
|
||||||
{
|
{
|
||||||
return CPlaylists.GetPlaylistName(playlistID);
|
return CPlaylists.Get(playlistID) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DeletePlaylist(int playlistID)
|
public string GetName(int playlistID)
|
||||||
{
|
{
|
||||||
CPlaylists.DeletePlaylist(playlistID);
|
return CPlaylists.GetName(playlistID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SavePlaylist(int playlistID)
|
public void Delete(int playlistID)
|
||||||
{
|
{
|
||||||
CPlaylists.SavePlaylist(playlistID);
|
CPlaylists.Delete(playlistID);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Save(int playlistID)
|
||||||
|
{
|
||||||
|
CPlaylists.Save(playlistID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetNumPlaylists()
|
public int GetNumPlaylists()
|
||||||
@@ -885,49 +900,49 @@ namespace Vocaluxe.Base
|
|||||||
return CPlaylists.NumPlaylists;
|
return CPlaylists.NumPlaylists;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddPlaylistSong(int playlistID, int songID)
|
public void AddSong(int playlistID, int songID)
|
||||||
{
|
{
|
||||||
CPlaylists.AddPlaylistSong(playlistID, songID);
|
CPlaylists.AddSong(playlistID, songID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddPlaylistSong(int playlistID, int songID, EGameMode gameMode)
|
public void AddSong(int playlistID, int songID, EGameMode gameMode)
|
||||||
{
|
{
|
||||||
CPlaylists.AddPlaylistSong(playlistID, songID, gameMode);
|
CPlaylists.AddSong(playlistID, songID, gameMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InsertPlaylistSong(int playlistID, int positionIndex, int songID, EGameMode gameMode)
|
public void InsertSong(int playlistID, int positionIndex, int songID, EGameMode gameMode)
|
||||||
{
|
{
|
||||||
CPlaylists.InsertPlaylistSong(playlistID, positionIndex, songID, gameMode);
|
CPlaylists.InsertSong(playlistID, positionIndex, songID, gameMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MovePlaylistSong(int playlistID, int sourceIndex, int destIndex)
|
public void MoveSong(int playlistID, int sourceIndex, int destIndex)
|
||||||
{
|
{
|
||||||
CPlaylists.MovePlaylistSong(playlistID, sourceIndex, destIndex);
|
CPlaylists.MoveSong(playlistID, sourceIndex, destIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MovePlaylistSongDown(int playlistID, int songIndex)
|
public void MoveSongDown(int playlistID, int songIndex)
|
||||||
{
|
{
|
||||||
CPlaylists.MovePlaylistSongDown(playlistID, songIndex);
|
CPlaylists.MovePSongDown(playlistID, songIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MovePlaylistSongUp(int playlistID, int songIndex)
|
public void MoveSongUp(int playlistID, int songIndex)
|
||||||
{
|
{
|
||||||
CPlaylists.MovePlaylistSongUp(playlistID, songIndex);
|
CPlaylists.MoveSongUp(playlistID, songIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DeletePlaylistSong(int playlistID, int songIndex)
|
public void DeleteSong(int playlistID, int songIndex)
|
||||||
{
|
{
|
||||||
CPlaylists.DeletePlaylistSong(playlistID, songIndex);
|
CPlaylists.DeleteSong(playlistID, songIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetPlaylistSongCount(int playlistID)
|
public int GetSongCount(int playlistID)
|
||||||
{
|
{
|
||||||
return CPlaylists.GetPlaylistSongCount(playlistID);
|
return CPlaylists.GetSongCount(playlistID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CPlaylistSong GetPlaylistSong(int playlistID, int songIndex)
|
public CPlaylistSong GetSong(int playlistID, int songIndex)
|
||||||
{
|
{
|
||||||
return CPlaylists.GetPlaylistSong(playlistID, songIndex);
|
return CPlaylists.GetSong(playlistID, songIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -218,7 +218,7 @@ namespace Vocaluxe.Base
|
|||||||
private static void _LoadPartyModes()
|
private static void _LoadPartyModes()
|
||||||
{
|
{
|
||||||
var files = new List<string>();
|
var files = new List<string>();
|
||||||
files.AddRange(CHelper.ListFiles(CSettings.FolderPartyModes, "*.xml", false, true));
|
files.AddRange(CHelper.ListFiles(CSettings.FolderNamePartyModes, "*.xml", false, true));
|
||||||
|
|
||||||
foreach (string file in files)
|
foreach (string file in files)
|
||||||
{
|
{
|
||||||
@@ -269,7 +269,8 @@ namespace Vocaluxe.Base
|
|||||||
return pm;
|
return pm;
|
||||||
}
|
}
|
||||||
|
|
||||||
string pathToCode = Path.Combine(Path.Combine(CSettings.FolderPartyModes, pm.Folder), CSettings.FolderPartyModeCode);
|
string pathToPm = Path.Combine(CSettings.ProgramFolder, CSettings.FolderNamePartyModes, pm.Folder);
|
||||||
|
string pathToCode = Path.Combine(pathToPm, CSettings.FolderNamePartyModeCode);
|
||||||
|
|
||||||
var filesToCompile = new List<string>();
|
var filesToCompile = new List<string>();
|
||||||
filesToCompile.AddRange(CHelper.ListFiles(pathToCode, "*.cs", false, true));
|
filesToCompile.AddRange(CHelper.ListFiles(pathToCode, "*.cs", false, true));
|
||||||
@@ -278,7 +279,7 @@ namespace Vocaluxe.Base
|
|||||||
if (output == null)
|
if (output == null)
|
||||||
return pm;
|
return pm;
|
||||||
|
|
||||||
if (!CLanguage.LoadPartyLanguageFiles(pm.PartyModeID, Path.Combine(Path.Combine(CSettings.FolderPartyModes, pm.Folder), CSettings.FolderPartyModeLanguages)))
|
if (!CLanguage.LoadPartyLanguageFiles(pm.PartyModeID, Path.Combine(pathToPm, CSettings.FolderNamePartyModeLanguages)))
|
||||||
{
|
{
|
||||||
CLog.LogError("Error loading language files for PartyMode: " + file);
|
CLog.LogError("Error loading language files for PartyMode: " + file);
|
||||||
return pm;
|
return pm;
|
||||||
@@ -301,9 +302,9 @@ namespace Vocaluxe.Base
|
|||||||
return pm;
|
return pm;
|
||||||
}
|
}
|
||||||
pm.PartyMode.Initialize();
|
pm.PartyMode.Initialize();
|
||||||
pm.PartyMode.SetFolder(Path.Combine(Directory.GetCurrentDirectory(), Path.Combine(CSettings.FolderPartyModes, pm.Folder)));
|
pm.PartyMode.SetFolder(pathToPm);
|
||||||
|
|
||||||
if (!CTheme.AddTheme(Path.Combine(pm.PartyMode.GetFolder(), "Theme.xml"), pm.PartyModeID))
|
if (!CTheme.AddTheme(Path.Combine(pathToPm, "Theme.xml"), pm.PartyModeID))
|
||||||
return pm;
|
return pm;
|
||||||
|
|
||||||
int themeIndex = CTheme.GetThemeIndex(pm.PartyModeID);
|
int themeIndex = CTheme.GetThemeIndex(pm.PartyModeID);
|
||||||
@@ -318,7 +319,7 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
foreach (string screenfile in pm.ScreenFiles)
|
foreach (string screenfile in pm.ScreenFiles)
|
||||||
{
|
{
|
||||||
string xmlPath = Path.Combine(Path.Combine(CSettings.FolderPartyModes, pm.Folder), CSettings.FolderPartyModeScreens);
|
string xmlPath = Path.Combine(pathToPm, CSettings.FolderNamePartyModeScreens);
|
||||||
CMenuParty screen = _GetPartyScreenInstance(output, screenfile, pm.Folder);
|
CMenuParty screen = _GetPartyScreenInstance(output, screenfile, pm.Folder);
|
||||||
|
|
||||||
if (screen != null)
|
if (screen != null)
|
||||||
|
|||||||
+86
-99
@@ -31,15 +31,16 @@ namespace Vocaluxe.Base
|
|||||||
static class CPlaylists
|
static class CPlaylists
|
||||||
{
|
{
|
||||||
private static List<CPlaylistFile> _Playlists;
|
private static List<CPlaylistFile> _Playlists;
|
||||||
|
private static int _NextID;
|
||||||
|
|
||||||
public static CPlaylistFile[] Playlists
|
public static IEnumerable<CPlaylistFile> Playlists
|
||||||
{
|
{
|
||||||
get { return _Playlists.ToArray(); }
|
get { return _Playlists.AsReadOnly(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<string> PlaylistNames
|
public static List<string> Names
|
||||||
{
|
{
|
||||||
get { return _Playlists.Select(t => t.PlaylistName).ToList(); }
|
get { return _Playlists.Select(t => t.Name).ToList(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int NumPlaylists
|
public static int NumPlaylists
|
||||||
@@ -49,176 +50,169 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
LoadPlaylists();
|
Load();
|
||||||
_ConvertUSDXPlaylists();
|
_ConvertUSDXPlaylists();
|
||||||
|
|
||||||
_SortPlaylistsByName();
|
_SortByName();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void _ConvertUSDXPlaylists()
|
private static void _ConvertUSDXPlaylists()
|
||||||
{
|
{
|
||||||
var files = new List<string>();
|
var files = new List<string>();
|
||||||
files.AddRange(CHelper.ListFiles(Path.Combine(CSettings.DataPath, CConfig.FolderPlaylists), "*.upl", true, true));
|
files.AddRange(CHelper.ListFiles(Path.Combine(CSettings.DataFolder, CConfig.FolderPlaylists), "*.upl", true, true));
|
||||||
|
|
||||||
foreach (string file in files)
|
foreach (string file in files)
|
||||||
{
|
{
|
||||||
CPlaylistFile playlist = _ConvertUSDXPlaylist(file);
|
CPlaylistFile playlist = _ConvertUSDXPlaylist(file);
|
||||||
playlist.SavePlaylist();
|
playlist.Save();
|
||||||
_Playlists.Add(playlist);
|
_Playlists.Add(playlist);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void LoadPlaylists()
|
public static void Load()
|
||||||
{
|
{
|
||||||
_Playlists = new List<CPlaylistFile>();
|
_Playlists = new List<CPlaylistFile>();
|
||||||
|
|
||||||
var files = new List<string>();
|
var files = new List<string>();
|
||||||
files.AddRange(CHelper.ListFiles(Path.Combine(CSettings.DataPath, CConfig.FolderPlaylists), "*.xml", true, true));
|
files.AddRange(CHelper.ListFiles(Path.Combine(CSettings.DataFolder, CConfig.FolderPlaylists), "*.xml", true, true));
|
||||||
|
|
||||||
foreach (string file in files)
|
foreach (string file in files)
|
||||||
{
|
{
|
||||||
CPlaylistFile playlist = new CPlaylistFile(file, files.IndexOf(file));
|
CPlaylistFile playlist = new CPlaylistFile(files.IndexOf(file), file);
|
||||||
_Playlists.Add(playlist);
|
_Playlists.Add(playlist);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetPlaylistName(int playlistID)
|
public static CPlaylistFile Get(int playlistID)
|
||||||
{
|
{
|
||||||
if (playlistID >= _Playlists.Count || playlistID < 0)
|
return _Playlists.FirstOrDefault(pl => pl.Id == playlistID);
|
||||||
return "Error: Can't find Playlist";
|
|
||||||
|
|
||||||
return _Playlists[playlistID].PlaylistName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SetPlaylistName(int playlistID, string name)
|
public static string GetName(int playlistID)
|
||||||
{
|
{
|
||||||
if (playlistID >= _Playlists.Count || playlistID < 0)
|
CPlaylistFile pl = Get(playlistID);
|
||||||
return;
|
return pl == null ? "Error: Can't find Playlist" : pl.Name;
|
||||||
|
|
||||||
_Playlists[playlistID].PlaylistName = name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DeletePlaylist(int playlistID)
|
public static void SetName(int playlistID, string name)
|
||||||
{
|
{
|
||||||
if (playlistID < 0 || playlistID >= _Playlists.Count)
|
CPlaylistFile pl = Get(playlistID);
|
||||||
|
|
||||||
|
if (pl != null)
|
||||||
|
pl.Name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Delete(int playlistID)
|
||||||
|
{
|
||||||
|
CPlaylistFile pl = Get(playlistID);
|
||||||
|
if (pl == null)
|
||||||
return;
|
return;
|
||||||
if (_Playlists[playlistID].PlaylistFile != "")
|
if (pl.File != "" && File.Exists(pl.File))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
File.Delete(_Playlists[playlistID].PlaylistFile);
|
File.Delete(pl.File);
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
CLog.LogError("Can't delete Playlist File " + _Playlists[playlistID].PlaylistFile + ".xml");
|
CLog.LogError("Can't delete Playlist File " + _Playlists[playlistID].File + ".xml");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_Playlists.RemoveAt(playlistID);
|
_Playlists.Remove(pl);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SavePlaylist(int playlistID)
|
public static void Save(int playlistID)
|
||||||
{
|
{
|
||||||
if (playlistID < 0 || playlistID >= _Playlists.Count)
|
CPlaylistFile pl = Get(playlistID);
|
||||||
return;
|
if (pl != null)
|
||||||
_Playlists[playlistID].SavePlaylist();
|
pl.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int NewPlaylist()
|
public static int NewPlaylist(string name = "New Playlist")
|
||||||
{
|
{
|
||||||
CPlaylistFile pl = new CPlaylistFile {PlaylistName = "New Playlist", Id = _Playlists.Count};
|
CPlaylistFile pl = new CPlaylistFile(_NextID++) {Name = name};
|
||||||
_Playlists.Add(pl);
|
_Playlists.Add(pl);
|
||||||
return _Playlists.Count - 1;
|
return pl.Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AddPlaylistSong(int playlistID, int songID)
|
public static void AddSong(int playlistID, int songID)
|
||||||
{
|
{
|
||||||
if (playlistID >= _Playlists.Count || playlistID < 0)
|
CPlaylistFile pl = Get(playlistID);
|
||||||
return;
|
if (pl != null)
|
||||||
|
pl.AddSong(songID);
|
||||||
_Playlists[playlistID].AddSong(songID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AddPlaylistSong(int playlistID, int songID, EGameMode gameMode)
|
public static void AddSong(int playlistID, int songID, EGameMode gameMode)
|
||||||
{
|
{
|
||||||
if (playlistID >= _Playlists.Count || playlistID < 0)
|
CPlaylistFile pl = Get(playlistID);
|
||||||
return;
|
if (pl != null)
|
||||||
|
pl.AddSong(songID, gameMode);
|
||||||
_Playlists[playlistID].AddSong(songID, gameMode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void InsertPlaylistSong(int playlistID, int positionIndex, int songID, EGameMode gameMode)
|
public static void InsertSong(int playlistID, int positionIndex, int songID, EGameMode gameMode)
|
||||||
{
|
{
|
||||||
if (playlistID >= _Playlists.Count || playlistID < 0)
|
CPlaylistFile pl = Get(playlistID);
|
||||||
return;
|
if (pl != null)
|
||||||
|
pl.InsertSong(positionIndex, songID, gameMode);
|
||||||
_Playlists[playlistID].SongInsert(positionIndex, songID, gameMode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void MovePlaylistSong(int playlistID, int sourceIndex, int destIndex)
|
public static void MoveSong(int playlistID, int sourceIndex, int destIndex)
|
||||||
{
|
{
|
||||||
if (playlistID >= _Playlists.Count || playlistID < 0)
|
CPlaylistFile pl = Get(playlistID);
|
||||||
return;
|
if (pl != null)
|
||||||
|
pl.MoveSong(sourceIndex, destIndex);
|
||||||
_Playlists[playlistID].SongMove(sourceIndex, destIndex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void MovePlaylistSongDown(int playlistID, int songIndex)
|
public static void MovePSongDown(int playlistID, int songIndex)
|
||||||
{
|
{
|
||||||
if (playlistID >= _Playlists.Count || playlistID < 0)
|
CPlaylistFile pl = Get(playlistID);
|
||||||
return;
|
if (pl != null)
|
||||||
|
pl.MoveSongDown(songIndex);
|
||||||
_Playlists[playlistID].SongDown(songIndex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void MovePlaylistSongUp(int playlistID, int songIndex)
|
public static void MoveSongUp(int playlistID, int songIndex)
|
||||||
{
|
{
|
||||||
if (playlistID >= _Playlists.Count || playlistID < 0)
|
CPlaylistFile pl = Get(playlistID);
|
||||||
return;
|
if (pl != null)
|
||||||
|
pl.MoveSongUp(songIndex);
|
||||||
_Playlists[playlistID].SongUp(songIndex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DeletePlaylistSong(int playlistID, int songIndex)
|
public static void DeleteSong(int playlistID, int songIndex)
|
||||||
{
|
{
|
||||||
if (playlistID >= _Playlists.Count || playlistID < 0)
|
CPlaylistFile pl = Get(playlistID);
|
||||||
return;
|
if (pl != null)
|
||||||
|
pl.DeleteSong(songIndex);
|
||||||
_Playlists[playlistID].DeleteSong(songIndex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int GetPlaylistSongCount(int playlistID)
|
public static int GetSongCount(int playlistID)
|
||||||
{
|
{
|
||||||
if (playlistID >= _Playlists.Count || playlistID < 0)
|
CPlaylistFile pl = Get(playlistID);
|
||||||
return 0;
|
return pl != null ? pl.Songs.Count : -1;
|
||||||
|
|
||||||
return _Playlists[playlistID].Songs.Count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CPlaylistSong GetPlaylistSong(int playlistID, int songIndex)
|
public static CPlaylistSong GetSong(int playlistID, int songIndex)
|
||||||
{
|
{
|
||||||
if (playlistID >= _Playlists.Count || playlistID < 0)
|
CPlaylistFile pl = Get(playlistID);
|
||||||
|
if (pl == null || songIndex >= pl.Songs.Count)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
if (songIndex >= _Playlists[playlistID].Songs.Count)
|
return pl.Songs[songIndex];
|
||||||
return null;
|
|
||||||
|
|
||||||
return _Playlists[playlistID].Songs[songIndex];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region private methods
|
#region private methods
|
||||||
private static void _SortPlaylistsByName()
|
private static void _SortByName()
|
||||||
{
|
{
|
||||||
_Playlists.Sort(_CompareByPlaylistName);
|
_Playlists.Sort(_CompareByName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int _CompareByPlaylistName(CPlaylistFile a, CPlaylistFile b)
|
private static int _CompareByName(CPlaylistFile a, CPlaylistFile b)
|
||||||
{
|
{
|
||||||
return String.CompareOrdinal(a.PlaylistName, b.PlaylistName);
|
return String.CompareOrdinal(a.Name, b.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static CPlaylistFile _ConvertUSDXPlaylist(string file)
|
private static CPlaylistFile _ConvertUSDXPlaylist(string file)
|
||||||
{
|
{
|
||||||
var pl = new CPlaylistFile();
|
var pl = new CPlaylistFile(_NextID++);
|
||||||
ReadOnlyCollection<CSong> allSongs = CSongs.AllSongs;
|
ReadOnlyCollection<CSong> allSongs = CSongs.AllSongs;
|
||||||
|
|
||||||
if (!File.Exists(file))
|
if (!File.Exists(file))
|
||||||
@@ -234,30 +228,23 @@ namespace Vocaluxe.Base
|
|||||||
int pos = line.IndexOf(":", StringComparison.Ordinal);
|
int pos = line.IndexOf(":", StringComparison.Ordinal);
|
||||||
if (pos <= 0)
|
if (pos <= 0)
|
||||||
continue;
|
continue;
|
||||||
//Name or comment
|
|
||||||
if (line[0] == '#')
|
if (line[0] == '#')
|
||||||
{
|
{
|
||||||
|
//Name or comment
|
||||||
string identifier = line.Substring(1, pos - 1).Trim();
|
string identifier = line.Substring(1, pos - 1).Trim();
|
||||||
string value = line.Substring(pos + 1, line.Length - pos - 1).Trim();
|
string value = line.Substring(pos + 1, line.Length - pos - 1).Trim();
|
||||||
if (identifier.ToUpper() == "NAME")
|
if (identifier.ToUpper() == "NAME")
|
||||||
pl.PlaylistName = value;
|
pl.Name = value;
|
||||||
}
|
}
|
||||||
//Song
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
//Song
|
||||||
string artist = line.Substring(0, pos - 1).Trim();
|
string artist = line.Substring(0, pos - 1).Trim();
|
||||||
string title = line.Substring(pos + 1, line.Length - pos - 1).Trim();
|
string title = line.Substring(pos + 1, line.Length - pos - 1).Trim();
|
||||||
bool found = false;
|
CSong plSong = allSongs.FirstOrDefault(song => song.Artist == artist && song.Title == title);
|
||||||
foreach (CSong song in allSongs)
|
if (plSong != null)
|
||||||
{
|
pl.AddSong(plSong.ID);
|
||||||
if (song.Artist == artist && song.Title == title)
|
else
|
||||||
{
|
|
||||||
pl.AddSong(song.ID);
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!found)
|
|
||||||
CLog.LogError("Can't find song '" + title + "' from '" + artist + "' in playlist file: " + file);
|
CLog.LogError("Can't find song '" + title + "' from '" + artist + "' in playlist file: " + file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+42
-36
@@ -71,45 +71,51 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
public const int VertexBufferElements = 10000;
|
public const int VertexBufferElements = 10000;
|
||||||
|
|
||||||
|
public static readonly string ProgramFolder = AppDomain.CurrentDomain.BaseDirectory;
|
||||||
|
|
||||||
#if INSTALLER
|
#if INSTALLER
|
||||||
public static readonly string DataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Vocaluxe");
|
public static readonly string DataFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Vocaluxe");
|
||||||
#else
|
#else
|
||||||
public static readonly string DataPath = Environment.CurrentDirectory;
|
public static readonly string DataFolder = ProgramFolder;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public const string Icon = "Vocaluxe.ico";
|
|
||||||
public const string Logo = "Logo.png";
|
|
||||||
public const string FallbackLanguage = "English";
|
public const string FallbackLanguage = "English";
|
||||||
public const string FileFonts = "Fonts.xml";
|
|
||||||
|
|
||||||
public const string FileOldHighscoreDB = "Ultrastar.db";
|
public const string FileNameIcon = "Vocaluxe.ico";
|
||||||
public const string FileCoverDB = "CoverDB.sqlite";
|
public const string FileNameLogo = "Logo.png";
|
||||||
public const string FileCreditsRessourcesDB = "CreditsRessourcesDB.sqlite";
|
public const string FileNameFonts = "Fonts.xml";
|
||||||
public const string FilePerformanceLog = "Performance.log";
|
|
||||||
public const string FileErrorLog = "Error.log";
|
|
||||||
public const string FileBenchmarkLog = "Benchmark.log";
|
|
||||||
public const string FileDebugLog = "Debug.log";
|
|
||||||
public const string FileSongInfoLog = "SongInformation.log";
|
|
||||||
|
|
||||||
public const string SoundT440 = "440Hz.mp3";
|
public const string FileNameOldHighscoreDB = "Ultrastar.db";
|
||||||
|
public const string FileNameCoverDB = "CoverDB.sqlite";
|
||||||
|
public const string FileNameCreditsRessourcesDB = "CreditsRessourcesDB.sqlite";
|
||||||
|
|
||||||
public const string FolderCover = "Cover";
|
public const string FileNamePerformanceLog = "Performance.log";
|
||||||
public const string FolderGraphics = "Graphics";
|
public const string FileNameErrorLog = "Error.log";
|
||||||
public const string FolderFonts = "Fonts";
|
public const string FileNameBenchmarkLog = "Benchmark.log";
|
||||||
public const string FolderThemes = "Themes";
|
public const string FileNameDebugLog = "Debug.log";
|
||||||
public const string FolderThemeFonts = "Fonts";
|
public const string FileNameSongInfoLog = "SongInformation.log";
|
||||||
public const string FolderScreens = "Screens";
|
|
||||||
public const string FolderPhotos = "Photos";
|
|
||||||
public const string FolderSounds = "Sounds";
|
|
||||||
public const string FolderLanguages = "Languages";
|
|
||||||
public const string FolderScreenshots = "Screenshots";
|
|
||||||
public const string FolderBackgroundMusic = "BackgroundMusic";
|
|
||||||
|
|
||||||
public const string FolderPartyModes = "PartyModes";
|
public const string FileNameSoundT440 = "440Hz.mp3";
|
||||||
public const string FolderPartyModeCode = "Code";
|
|
||||||
public const string FolderPartyModeScreens = "Screens";
|
public const string FolderNameSongs = "Songs";
|
||||||
public const string FolderPartyModeLanguages = "Languages";
|
public const string FolderNameProfiles = "Profiles";
|
||||||
public const string FolderPartyModeFonts = "Fonts";
|
public const string FolderNameCover = "Cover";
|
||||||
|
public const string FolderNameGraphics = "Graphics";
|
||||||
|
public const string FolderNameFonts = "Fonts";
|
||||||
|
public const string FolderNameThemes = "Themes";
|
||||||
|
public const string FolderNameThemeFonts = "Fonts";
|
||||||
|
public const string FolderNameScreens = "Screens";
|
||||||
|
public const string FolderNamePhotos = "Photos";
|
||||||
|
public const string FolderNameSounds = "Sounds";
|
||||||
|
public const string FolderNameLanguages = "Languages";
|
||||||
|
public const string FolderNameScreenshots = "Screenshots";
|
||||||
|
public const string FolderNameBackgroundMusic = "BackgroundMusic";
|
||||||
|
|
||||||
|
public const string FolderNamePartyModes = "PartyModes";
|
||||||
|
public const string FolderNamePartyModeCode = "Code";
|
||||||
|
public const string FolderNamePartyModeScreens = "Screens";
|
||||||
|
public const string FolderNamePartyModeLanguages = "Languages";
|
||||||
|
public const string FolderNamePartyModeFonts = "Fonts";
|
||||||
|
|
||||||
public const string LinkAndroidApp = "https://build.phonegap.com/apps/639714/download/android/?qr_key=uY98ymvTr6K144RyTdhs";
|
public const string LinkAndroidApp = "https://build.phonegap.com/apps/639714/download/android/?qr_key=uY98ymvTr6K144RyTdhs";
|
||||||
public const string LinkSymbianApp = "https://build.phonegap.com/apps/639714/download/symbian/?qr_key=uY98ymvTr6K144RyTdhs";
|
public const string LinkSymbianApp = "https://build.phonegap.com/apps/639714/download/symbian/?qr_key=uY98ymvTr6K144RyTdhs";
|
||||||
@@ -211,12 +217,12 @@ namespace Vocaluxe.Base
|
|||||||
{
|
{
|
||||||
var folders = new List<string>
|
var folders = new List<string>
|
||||||
{
|
{
|
||||||
Path.Combine(Environment.CurrentDirectory, FolderCover),
|
Path.Combine(ProgramFolder, FolderNameCover),
|
||||||
Path.Combine(Environment.CurrentDirectory, FolderFonts),
|
Path.Combine(ProgramFolder, FolderNameFonts),
|
||||||
Path.Combine(DataPath, FolderScreenshots),
|
Path.Combine(DataFolder, FolderNameScreenshots),
|
||||||
Path.Combine(Environment.CurrentDirectory, FolderBackgroundMusic),
|
Path.Combine(ProgramFolder, FolderNameBackgroundMusic),
|
||||||
Path.Combine(Environment.CurrentDirectory, FolderSounds),
|
Path.Combine(ProgramFolder, FolderNameSounds),
|
||||||
Path.Combine(DataPath, CConfig.FolderPlaylists)
|
Path.Combine(DataFolder, CConfig.FolderPlaylists)
|
||||||
};
|
};
|
||||||
folders.AddRange(CConfig.ProfileFolders);
|
folders.AddRange(CConfig.ProfileFolders);
|
||||||
folders.AddRange(CConfig.SongFolders);
|
folders.AddRange(CConfig.SongFolders);
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ namespace Vocaluxe.Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
#region Stream Handling
|
#region Stream Handling
|
||||||
public static int Load(string media, bool loop=false, bool prescan=false)
|
public static int Load(string media, bool loop = false, bool prescan = false)
|
||||||
{
|
{
|
||||||
return _Playback.Load(media, loop, prescan);
|
return _Playback.Load(media, loop, prescan);
|
||||||
}
|
}
|
||||||
@@ -176,11 +176,11 @@ namespace Vocaluxe.Base
|
|||||||
#region Sounds
|
#region Sounds
|
||||||
public static int PlaySound(ESounds sound, bool fade = true)
|
public static int PlaySound(ESounds sound, bool fade = true)
|
||||||
{
|
{
|
||||||
string file = Path.Combine(Environment.CurrentDirectory, CSettings.FolderSounds);
|
string file = Path.Combine(CSettings.ProgramFolder, CSettings.FolderNameSounds);
|
||||||
switch (sound)
|
switch (sound)
|
||||||
{
|
{
|
||||||
case ESounds.T440:
|
case ESounds.T440:
|
||||||
file = Path.Combine(file, CSettings.SoundT440);
|
file = Path.Combine(file, CSettings.FileNameSoundT440);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@@ -266,13 +266,13 @@ namespace Vocaluxe.Base
|
|||||||
{
|
{
|
||||||
CFonts.LoadThemeFonts(
|
CFonts.LoadThemeFonts(
|
||||||
_Themes[themeIndex].Name,
|
_Themes[themeIndex].Name,
|
||||||
Path.Combine(Path.Combine(_Themes[themeIndex].Path, _Themes[themeIndex].SkinFolder), CSettings.FolderThemeFonts),
|
Path.Combine(Path.Combine(_Themes[themeIndex].Path, _Themes[themeIndex].SkinFolder), CSettings.FolderNameThemeFonts),
|
||||||
xmlReader);
|
xmlReader);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CFonts.LoadPartyModeFonts(_Themes[themeIndex].PartyModeID,
|
CFonts.LoadPartyModeFonts(_Themes[themeIndex].PartyModeID,
|
||||||
Path.Combine(_Themes[themeIndex].Path, CSettings.FolderPartyModeFonts),
|
Path.Combine(_Themes[themeIndex].Path, CSettings.FolderNamePartyModeFonts),
|
||||||
xmlReader);
|
xmlReader);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -385,11 +385,11 @@ namespace Vocaluxe.Base
|
|||||||
{
|
{
|
||||||
_Themes.Clear();
|
_Themes.Clear();
|
||||||
|
|
||||||
string path = Path.Combine(Directory.GetCurrentDirectory(), CSettings.FolderThemes);
|
string path = Path.Combine(CSettings.ProgramFolder, CSettings.FolderNameThemes);
|
||||||
List<string> files = CHelper.ListFiles(path, "*.xml");
|
List<string> files = CHelper.ListFiles(path, "*.xml", false, true);
|
||||||
|
|
||||||
foreach (string file in files)
|
foreach (string file in files)
|
||||||
AddTheme(Path.Combine(path, file), -1);
|
AddTheme(file, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool AddTheme(string filePath, int partyModeID)
|
public static bool AddTheme(string filePath, int partyModeID)
|
||||||
@@ -546,7 +546,7 @@ namespace Vocaluxe.Base
|
|||||||
if (themeIndex != -1)
|
if (themeIndex != -1)
|
||||||
{
|
{
|
||||||
path = Path.Combine(_Themes[themeIndex].Path, _Themes[themeIndex].SkinFolder);
|
path = Path.Combine(_Themes[themeIndex].Path, _Themes[themeIndex].SkinFolder);
|
||||||
path = Path.Combine(path, CSettings.FolderScreens);
|
path = Path.Combine(path, CSettings.FolderNameScreens);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
CLog.LogError("Can't find current Theme");
|
CLog.LogError("Can't find current Theme");
|
||||||
|
|||||||
@@ -341,11 +341,11 @@ namespace Vocaluxe.Base.Fonts
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private static void _LoadFontList()
|
private static void _LoadFontList()
|
||||||
{
|
{
|
||||||
CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(CSettings.FolderFonts, CSettings.FileFonts));
|
CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(CSettings.ProgramFolder, CSettings.FolderNameFonts, CSettings.FileNameFonts));
|
||||||
if (xmlReader == null)
|
if (xmlReader == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_LoadFontFiles(xmlReader, Path.Combine(Directory.GetCurrentDirectory(), CSettings.FolderFonts));
|
_LoadFontFiles(xmlReader, Path.Combine(CSettings.ProgramFolder, CSettings.FolderNameFonts));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -342,7 +342,7 @@ namespace Vocaluxe.Base.Server
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
string name = DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss");
|
string name = DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss");
|
||||||
string filePath = _SaveImage(photoData.Photo, name, CSettings.FolderPhotos);
|
string filePath = _SaveImage(photoData.Photo, name, CSettings.FolderNamePhotos);
|
||||||
if (!string.IsNullOrEmpty(filePath))
|
if (!string.IsNullOrEmpty(filePath))
|
||||||
{
|
{
|
||||||
_PhotosOfThisRound.Add(filePath);
|
_PhotosOfThisRound.Add(filePath);
|
||||||
@@ -461,20 +461,20 @@ namespace Vocaluxe.Base.Server
|
|||||||
|
|
||||||
private static SPlaylistInfo _GetPlaylist(int playlistId)
|
private static SPlaylistInfo _GetPlaylist(int playlistId)
|
||||||
{
|
{
|
||||||
if (CPlaylists.Playlists.Length <= playlistId || playlistId < 0)
|
if (CPlaylists.Get(playlistId) == null)
|
||||||
throw new ArgumentException("invalid playlistId");
|
throw new ArgumentException("invalid playlistId");
|
||||||
return _GetPlaylistInfo(CPlaylists.Playlists[playlistId]);
|
return _GetPlaylistInfo(CPlaylists.Get(playlistId));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void _AddSongToPlaylist(int songId, int playlistId, bool allowDuplicates)
|
private static void _AddSongToPlaylist(int songId, int playlistId, bool allowDuplicates)
|
||||||
{
|
{
|
||||||
if (CPlaylists.Playlists.Length <= playlistId || playlistId < 0)
|
if (CPlaylists.Get(playlistId) == null)
|
||||||
throw new ArgumentException("invalid playlistId");
|
throw new ArgumentException("invalid playlistId");
|
||||||
|
|
||||||
if (allowDuplicates || !_PlaylistContainsSong(songId, playlistId))
|
if (allowDuplicates || !_PlaylistContainsSong(songId, playlistId))
|
||||||
{
|
{
|
||||||
CPlaylists.AddPlaylistSong(playlistId, songId);
|
CPlaylists.AddSong(playlistId, songId);
|
||||||
CPlaylists.SavePlaylist(playlistId);
|
CPlaylists.Save(playlistId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw new ArgumentException("song exists in this playlist");
|
throw new ArgumentException("song exists in this playlist");
|
||||||
@@ -482,45 +482,49 @@ namespace Vocaluxe.Base.Server
|
|||||||
|
|
||||||
private static void _RemoveSongFromPlaylist(int position, int playlistId, int songId)
|
private static void _RemoveSongFromPlaylist(int position, int playlistId, int songId)
|
||||||
{
|
{
|
||||||
if (CPlaylists.Playlists.Length <= playlistId || playlistId < 0)
|
CPlaylistFile pl = CPlaylists.Get(playlistId);
|
||||||
|
if (pl == null)
|
||||||
throw new ArgumentException("invalid playlistId");
|
throw new ArgumentException("invalid playlistId");
|
||||||
if (!_PlaylistContainsSong(songId, playlistId))
|
if (!_PlaylistContainsSong(songId, playlistId))
|
||||||
throw new ArgumentException("invalid songId");
|
throw new ArgumentException("invalid songId");
|
||||||
if (position < 0 || CPlaylists.Playlists[playlistId].Songs.Count <= position
|
if (position < 0 || pl.Songs.Count <= position
|
||||||
|| CPlaylists.Playlists[playlistId].Songs[position].SongID != songId)
|
|| pl.Songs[position].SongID != songId)
|
||||||
throw new ArgumentException("invalid position");
|
throw new ArgumentException("invalid position");
|
||||||
CPlaylists.Playlists[playlistId].DeleteSong(position);
|
pl.DeleteSong(position);
|
||||||
CPlaylists.SavePlaylist(playlistId);
|
pl.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void _MoveSongInPlaylist(int newPosition, int playlistId, int songId)
|
private static void _MoveSongInPlaylist(int newPosition, int playlistId, int songId)
|
||||||
{
|
{
|
||||||
if (CPlaylists.Playlists.Length <= playlistId || playlistId < 0)
|
CPlaylistFile pl = CPlaylists.Get(playlistId);
|
||||||
|
if (pl == null)
|
||||||
throw new ArgumentException("invalid playlistId");
|
throw new ArgumentException("invalid playlistId");
|
||||||
if (!_PlaylistContainsSong(songId, playlistId))
|
if (!_PlaylistContainsSong(songId, playlistId))
|
||||||
throw new ArgumentException("invalid songId");
|
throw new ArgumentException("invalid songId");
|
||||||
|
|
||||||
if (CPlaylists.Playlists[playlistId].Songs.Count < newPosition)
|
if (pl.Songs.Count < newPosition)
|
||||||
throw new ArgumentException("invalid newPosition");
|
throw new ArgumentException("invalid newPosition");
|
||||||
|
|
||||||
int oldPosition = CPlaylists.Playlists[playlistId].Songs.FindIndex(s => s.SongID == songId);
|
int oldPosition = pl.Songs.FindIndex(s => s.SongID == songId);
|
||||||
CPlaylists.MovePlaylistSong(playlistId, oldPosition, newPosition);
|
pl.MoveSong(oldPosition, newPosition);
|
||||||
CPlaylists.SavePlaylist(playlistId);
|
pl.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool _PlaylistContainsSong(int songId, int playlistId)
|
private static bool _PlaylistContainsSong(int songId, int playlistId)
|
||||||
{
|
{
|
||||||
if (CPlaylists.Playlists.Length <= playlistId || playlistId < 0)
|
CPlaylistFile pl = CPlaylists.Get(playlistId);
|
||||||
|
if (pl == null)
|
||||||
throw new ArgumentException("invalid playlistId");
|
throw new ArgumentException("invalid playlistId");
|
||||||
return CPlaylists.Playlists[playlistId].Songs.Any(s => s.SongID == songId);
|
return pl.Songs.Any(s => s.SongID == songId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static SPlaylistSongInfo[] _GetPlaylistSongs(int playlistId)
|
private static SPlaylistSongInfo[] _GetPlaylistSongs(int playlistId)
|
||||||
{
|
{
|
||||||
if (CPlaylists.Playlists.Length <= playlistId || playlistId < 0)
|
CPlaylistFile pl = CPlaylists.Get(playlistId);
|
||||||
|
if (pl == null)
|
||||||
throw new ArgumentException("invalid playlistId");
|
throw new ArgumentException("invalid playlistId");
|
||||||
|
|
||||||
return _GetPlaylistSongInfos(CPlaylists.Playlists[playlistId]);
|
return _GetPlaylistSongInfos(pl);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static SPlaylistSongInfo _GetPlaylistSongInfo(CPlaylistSong playlistSong, int playlistId, int playlistPos)
|
private static SPlaylistSongInfo _GetPlaylistSongInfo(CPlaylistSong playlistSong, int playlistId, int playlistPos)
|
||||||
@@ -549,7 +553,7 @@ namespace Vocaluxe.Base.Server
|
|||||||
return new SPlaylistInfo
|
return new SPlaylistInfo
|
||||||
{
|
{
|
||||||
PlaylistId = playlist.Id,
|
PlaylistId = playlist.Id,
|
||||||
PlaylistName = playlist.PlaylistName,
|
PlaylistName = playlist.Name,
|
||||||
SongCount = playlist.Songs.Count,
|
SongCount = playlist.Songs.Count,
|
||||||
LastChanged = DateTime.Now.ToLongDateString()
|
LastChanged = DateTime.Now.ToLongDateString()
|
||||||
};
|
};
|
||||||
@@ -557,16 +561,15 @@ namespace Vocaluxe.Base.Server
|
|||||||
|
|
||||||
private static void _RemovePlaylist(int playlistId)
|
private static void _RemovePlaylist(int playlistId)
|
||||||
{
|
{
|
||||||
if (CPlaylists.Playlists.Length <= playlistId || playlistId < 0)
|
if (CPlaylists.Get(playlistId) == null)
|
||||||
throw new ArgumentException("invalid playlistId");
|
throw new ArgumentException("invalid playlistId");
|
||||||
CPlaylists.DeletePlaylist(playlistId);
|
CPlaylists.Delete(playlistId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int _AddPlaylist(string playlistName)
|
private static int _AddPlaylist(string playlistName)
|
||||||
{
|
{
|
||||||
int newPlaylistId = CPlaylists.NewPlaylist();
|
int newPlaylistId = CPlaylists.NewPlaylist(playlistName);
|
||||||
CPlaylists.Playlists[newPlaylistId].PlaylistName = playlistName;
|
CPlaylists.Save(newPlaylistId);
|
||||||
CPlaylists.SavePlaylist(newPlaylistId);
|
|
||||||
|
|
||||||
return newPlaylistId;
|
return newPlaylistId;
|
||||||
}
|
}
|
||||||
@@ -682,19 +685,10 @@ namespace Vocaluxe.Base.Server
|
|||||||
if (!Directory.Exists(folder))
|
if (!Directory.Exists(folder))
|
||||||
Directory.CreateDirectory(folder);
|
Directory.CreateDirectory(folder);
|
||||||
|
|
||||||
string filename = Path.Combine(folder, name);
|
string file = CHelper.GetUniqueFileName(folder, name + "." + extension);
|
||||||
if (File.Exists(filename + "." + extension))
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
while (File.Exists(filename + "_" + i + "." + extension))
|
|
||||||
i++;
|
|
||||||
filename = filename + "_" + i + "." + extension;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
filename = filename + "." + extension;
|
|
||||||
|
|
||||||
avatarImage.Save(filename);
|
avatarImage.Save(file);
|
||||||
return filename;
|
return file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -29,7 +29,7 @@ namespace Vocaluxe
|
|||||||
|
|
||||||
public CSplashScreen()
|
public CSplashScreen()
|
||||||
{
|
{
|
||||||
string path = Path.Combine(Environment.CurrentDirectory, Path.Combine(CSettings.FolderGraphics, CSettings.Logo));
|
string path = Path.Combine(CSettings.ProgramFolder, CSettings.FolderNameGraphics, CSettings.FileNameLogo);
|
||||||
if (File.Exists(path))
|
if (File.Exists(path))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -45,7 +45,7 @@ namespace Vocaluxe
|
|||||||
else
|
else
|
||||||
CLog.LogError("Can't find " + path);
|
CLog.LogError("Can't find " + path);
|
||||||
|
|
||||||
path = Path.Combine(Environment.CurrentDirectory, CSettings.Icon);
|
path = Path.Combine(CSettings.ProgramFolder, CSettings.FileNameIcon);
|
||||||
if (File.Exists(path))
|
if (File.Exists(path))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ namespace Vocaluxe.Lib.Database
|
|||||||
|
|
||||||
public override bool Init()
|
public override bool Init()
|
||||||
{
|
{
|
||||||
string oldDBFilePath = Path.Combine(Environment.CurrentDirectory, CSettings.FileOldHighscoreDB);
|
string oldDBFilePath = Path.Combine(CSettings.DataFolder, CSettings.FileNameOldHighscoreDB);
|
||||||
if (File.Exists(oldDBFilePath))
|
if (File.Exists(oldDBFilePath))
|
||||||
{
|
{
|
||||||
if (File.Exists(_FilePath))
|
if (File.Exists(_FilePath))
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ namespace Vocaluxe.Lib.Database
|
|||||||
{
|
{
|
||||||
foreach (string file in _FilesV1)
|
foreach (string file in _FilesV1)
|
||||||
{
|
{
|
||||||
string filePath = Path.Combine(Environment.CurrentDirectory, file);
|
string filePath = Path.Combine(CSettings.ProgramFolder, file);
|
||||||
if (!_AddImageToCreditsDB(filePath, transaction))
|
if (!_AddImageToCreditsDB(filePath, transaction))
|
||||||
{
|
{
|
||||||
transaction.Rollback();
|
transaction.Rollback();
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public CDirect3D()
|
public CDirect3D()
|
||||||
{
|
{
|
||||||
Icon = new Icon(Path.Combine(Environment.CurrentDirectory, CSettings.Icon));
|
Icon = new Icon(Path.Combine(CSettings.ProgramFolder, CSettings.FileNameIcon));
|
||||||
|
|
||||||
//Fill Queue with 100000 IDs
|
//Fill Queue with 100000 IDs
|
||||||
for (int i = 0; i < _MaxID; i++)
|
for (int i = 0; i < _MaxID; i++)
|
||||||
@@ -730,18 +730,13 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void MakeScreenShot()
|
public void MakeScreenShot()
|
||||||
{
|
{
|
||||||
const string file = "Screenshot_";
|
string file = CHelper.GetUniqueFileName(Path.Combine(CSettings.DataFolder, CSettings.FolderNameScreenshots), "Screenshot.bmp");
|
||||||
string path = Path.Combine(CSettings.DataPath, CSettings.FolderScreenshots);
|
|
||||||
|
|
||||||
int i = 0;
|
|
||||||
while (File.Exists(Path.Combine(path, file + i.ToString("00000") + ".bmp")))
|
|
||||||
i++;
|
|
||||||
|
|
||||||
//create a surface of the frame
|
//create a surface of the frame
|
||||||
using (Surface surface = _Device.GetBackBuffer(0, 0))
|
using (Surface surface = _Device.GetBackBuffer(0, 0))
|
||||||
{
|
{
|
||||||
var screen = new Bitmap(Surface.ToStream(surface, ImageFileFormat.Bmp));
|
var screen = new Bitmap(Surface.ToStream(surface, ImageFileFormat.Bmp));
|
||||||
screen.Save(Path.Combine(path, file + i.ToString("00000") + ".bmp"), ImageFormat.Bmp);
|
screen.Save(file, ImageFormat.Bmp);
|
||||||
screen.Dispose();
|
screen.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
|
|
||||||
public CDrawWinForm()
|
public CDrawWinForm()
|
||||||
{
|
{
|
||||||
Icon = new Icon(Path.Combine(Environment.CurrentDirectory, CSettings.Icon));
|
Icon = new Icon(Path.Combine(CSettings.ProgramFolder, CSettings.FileNameIcon));
|
||||||
|
|
||||||
_Keys = new CKeys();
|
_Keys = new CKeys();
|
||||||
_Mouse = new CMouse();
|
_Mouse = new CMouse();
|
||||||
@@ -304,14 +304,9 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
|
|
||||||
public void MakeScreenShot()
|
public void MakeScreenShot()
|
||||||
{
|
{
|
||||||
const string file = "Screenshot_";
|
string file = CHelper.GetUniqueFileName(Path.Combine(CSettings.DataFolder, CSettings.FolderNameScreenshots), "Screenshot.bmp");
|
||||||
string path = Path.Combine(CSettings.DataPath, CSettings.FolderScreenshots);
|
|
||||||
|
|
||||||
int i = 0;
|
_Backbuffer.Save(file, ImageFormat.Png);
|
||||||
while (File.Exists(Path.Combine(path, file + i.ToString("00000") + ".png")))
|
|
||||||
i++;
|
|
||||||
|
|
||||||
_Backbuffer.Save(Path.Combine(path, file + i.ToString("00000") + ".png"), ImageFormat.Png);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DrawLine(int a, int r, int g, int b, int w, int x1, int y1, int x2, int y2)
|
public void DrawLine(int a, int r, int g, int b, int w, int x1, int y1, int x2, int y2)
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
|
|
||||||
public COpenGL()
|
public COpenGL()
|
||||||
{
|
{
|
||||||
Icon = new Icon(Path.Combine(Environment.CurrentDirectory, CSettings.Icon));
|
Icon = new Icon(Path.Combine(CSettings.ProgramFolder, CSettings.FileNameIcon));
|
||||||
|
|
||||||
for (int i = 1; i < _MaxID; i++)
|
for (int i = 1; i < _MaxID; i++)
|
||||||
_IDs.Enqueue(i);
|
_IDs.Enqueue(i);
|
||||||
@@ -534,12 +534,7 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
|
|
||||||
public void MakeScreenShot()
|
public void MakeScreenShot()
|
||||||
{
|
{
|
||||||
const string file = "Screenshot_";
|
string file = CHelper.GetUniqueFileName(Path.Combine(CSettings.DataFolder, CSettings.FolderNameScreenshots), "Screenshot.bmp");
|
||||||
string path = Path.Combine(CSettings.DataPath, CSettings.FolderScreenshots);
|
|
||||||
|
|
||||||
int i = 0;
|
|
||||||
while (File.Exists(Path.Combine(path, file + i.ToString("00000") + ".bmp")))
|
|
||||||
i++;
|
|
||||||
|
|
||||||
int width = GetScreenWidth();
|
int width = GetScreenWidth();
|
||||||
int height = GetScreenHeight();
|
int height = GetScreenHeight();
|
||||||
@@ -552,7 +547,7 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
screen.UnlockBits(bmpData);
|
screen.UnlockBits(bmpData);
|
||||||
|
|
||||||
screen.RotateFlip(RotateFlipType.RotateNoneFlipY);
|
screen.RotateFlip(RotateFlipType.RotateNoneFlipY);
|
||||||
screen.Save(Path.Combine(path, file + i.ToString("00000") + ".bmp"), ImageFormat.Bmp);
|
screen.Save(file, ImageFormat.Bmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using Vocaluxe.Base;
|
using Vocaluxe.Base;
|
||||||
using VocaluxeLib;
|
using VocaluxeLib;
|
||||||
@@ -28,31 +29,26 @@ namespace Vocaluxe.Lib.Playlist
|
|||||||
{
|
{
|
||||||
public class CPlaylistFile
|
public class CPlaylistFile
|
||||||
{
|
{
|
||||||
public string PlaylistName;
|
public string Name = "";
|
||||||
public string PlaylistFile;
|
public string File;
|
||||||
public int Id = -1;
|
public readonly int Id = -1;
|
||||||
public List<CPlaylistSong> Songs = new List<CPlaylistSong>();
|
public List<CPlaylistSong> Songs = new List<CPlaylistSong>();
|
||||||
|
|
||||||
public CPlaylistFile()
|
public CPlaylistFile(int id, string file = "")
|
||||||
{
|
|
||||||
PlaylistName = string.Empty;
|
|
||||||
PlaylistFile = string.Empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CPlaylistFile(string file, int id)
|
|
||||||
{
|
{
|
||||||
Id = id;
|
Id = id;
|
||||||
PlaylistFile = file;
|
File = file;
|
||||||
_LoadPlaylist();
|
if (File != "")
|
||||||
|
_Load();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SavePlaylist()
|
public void Save()
|
||||||
{
|
{
|
||||||
if (PlaylistFile == "")
|
if (File == "")
|
||||||
{
|
{
|
||||||
string filename = string.Empty;
|
string filename = string.Empty;
|
||||||
// ReSharper disable LoopCanBeConvertedToQuery
|
// ReSharper disable LoopCanBeConvertedToQuery
|
||||||
foreach (char chr in PlaylistName)
|
foreach (char chr in Name)
|
||||||
// ReSharper restore LoopCanBeConvertedToQuery
|
// ReSharper restore LoopCanBeConvertedToQuery
|
||||||
{
|
{
|
||||||
if (char.IsLetter(chr))
|
if (char.IsLetter(chr))
|
||||||
@@ -62,25 +58,17 @@ namespace Vocaluxe.Lib.Playlist
|
|||||||
if (filename == "")
|
if (filename == "")
|
||||||
filename = "1";
|
filename = "1";
|
||||||
|
|
||||||
int i = 0;
|
File = CHelper.GetUniqueFileName(Path.Combine(CSettings.DataFolder, CConfig.FolderPlaylists), filename + ".xml");
|
||||||
while (File.Exists(Path.Combine(CSettings.DataPath, CConfig.FolderPlaylists, filename + ".xml")))
|
|
||||||
{
|
|
||||||
i++;
|
|
||||||
if (!File.Exists(Path.Combine(CSettings.DataPath, CConfig.FolderPlaylists, filename + i + ".xml")))
|
|
||||||
filename += i;
|
|
||||||
}
|
|
||||||
|
|
||||||
PlaylistFile = Path.Combine(CSettings.DataPath, CConfig.FolderPlaylists, filename + ".xml");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
XmlWriter writer;
|
XmlWriter writer;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
writer = XmlWriter.Create(PlaylistFile, CConfig.XMLSettings);
|
writer = XmlWriter.Create(File, CConfig.XMLSettings);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
CLog.LogError("Error creating/opening Playlist File " + PlaylistFile + ": " + e.Message);
|
CLog.LogError("Error creating/opening Playlist File " + File + ": " + e.Message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,7 +78,7 @@ namespace Vocaluxe.Lib.Playlist
|
|||||||
writer.WriteStartElement("root");
|
writer.WriteStartElement("root");
|
||||||
|
|
||||||
writer.WriteStartElement("Info");
|
writer.WriteStartElement("Info");
|
||||||
writer.WriteElementString("PlaylistName", PlaylistName);
|
writer.WriteElementString("PlaylistName", Name);
|
||||||
writer.WriteEndElement();
|
writer.WriteEndElement();
|
||||||
|
|
||||||
writer.WriteStartElement("Songs");
|
writer.WriteStartElement("Songs");
|
||||||
@@ -121,51 +109,42 @@ namespace Vocaluxe.Lib.Playlist
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void _LoadPlaylist()
|
private void _Load()
|
||||||
{
|
{
|
||||||
CXMLReader xmlReader = CXMLReader.OpenFile(PlaylistFile);
|
CXMLReader xmlReader = CXMLReader.OpenFile(File);
|
||||||
if (xmlReader == null)
|
if (xmlReader == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
string value = String.Empty;
|
string value;
|
||||||
if (xmlReader.GetValue("//root/Info/PlaylistName", out value, value))
|
if (xmlReader.GetValue("//root/Info/PlaylistName", out value, ""))
|
||||||
{
|
{
|
||||||
PlaylistName = value;
|
Name = value;
|
||||||
|
|
||||||
Songs = new List<CPlaylistSong>();
|
Songs = new List<CPlaylistSong>();
|
||||||
|
|
||||||
List<string> songs = xmlReader.GetValues("Songs");
|
List<string> songs = xmlReader.GetValues("Songs");
|
||||||
var gm = EGameMode.TR_GAMEMODE_NORMAL;
|
|
||||||
|
|
||||||
foreach (string song in songs)
|
foreach (string songEntry in songs)
|
||||||
{
|
{
|
||||||
string artist;
|
string artist;
|
||||||
string title;
|
string title;
|
||||||
xmlReader.GetValue("//root/Songs/" + song + "/Artist", out artist, String.Empty);
|
xmlReader.GetValue("//root/Songs/" + songEntry + "/Artist", out artist, String.Empty);
|
||||||
xmlReader.GetValue("//root/Songs/" + song + "/Title", out title, String.Empty);
|
xmlReader.GetValue("//root/Songs/" + songEntry + "/Title", out title, String.Empty);
|
||||||
xmlReader.TryGetEnumValue("//root/Songs/" + song + "/GameMode", ref gm);
|
EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL;
|
||||||
|
xmlReader.TryGetEnumValue("//root/Songs/" + songEntry + "/GameMode", ref gm);
|
||||||
|
|
||||||
var playlistSong = new CPlaylistSong {SongID = -1};
|
CSong plSong = CSongs.AllSongs.FirstOrDefault(song => song.Artist == artist && song.Title == title);
|
||||||
|
if (plSong != null)
|
||||||
foreach (CSong curSong in CSongs.AllSongs)
|
|
||||||
{
|
{
|
||||||
if (curSong.Artist != artist || curSong.Title != title)
|
var playlistSong = new CPlaylistSong(plSong.ID, gm);
|
||||||
continue;
|
|
||||||
playlistSong.SongID = curSong.ID;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (playlistSong.SongID != -1)
|
|
||||||
{
|
|
||||||
playlistSong.GameMode = gm;
|
|
||||||
Songs.Add(playlistSong);
|
Songs.Add(playlistSong);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
CLog.LogError("Can't find song '" + title + "' from '" + artist + "' in playlist file: " + PlaylistFile);
|
CLog.LogError("Can't find song '" + title + "' from '" + artist + "' in playlist file: " + File);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
CLog.LogError("Can't find PlaylistName in Playlist File: " + PlaylistFile);
|
CLog.LogError("Can't find PlaylistName in Playlist File: " + File);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddSong(int songID)
|
public void AddSong(int songID)
|
||||||
@@ -181,7 +160,7 @@ namespace Vocaluxe.Lib.Playlist
|
|||||||
|
|
||||||
public void AddSong(int songID, EGameMode gm)
|
public void AddSong(int songID, EGameMode gm)
|
||||||
{
|
{
|
||||||
var song = new CPlaylistSong {SongID = songID, GameMode = gm};
|
var song = new CPlaylistSong(songID, gm);
|
||||||
|
|
||||||
Songs.Add(song);
|
Songs.Add(song);
|
||||||
}
|
}
|
||||||
@@ -191,31 +170,31 @@ namespace Vocaluxe.Lib.Playlist
|
|||||||
Songs.RemoveAt(songNr);
|
Songs.RemoveAt(songNr);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SongUp(int songNr)
|
public void MoveSongUp(int songNr)
|
||||||
{
|
{
|
||||||
if (songNr < Songs.Count - 1 && songNr > 0)
|
if (songNr < Songs.Count && songNr > 0)
|
||||||
Songs.Reverse(songNr - 1, 2);
|
Songs.Reverse(songNr - 1, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SongDown(int songNr)
|
public void MoveSongDown(int songNr)
|
||||||
{
|
{
|
||||||
if (songNr < Songs.Count - 1 && songNr >= 0)
|
if (songNr < Songs.Count - 1 && songNr >= 0)
|
||||||
Songs.Reverse(songNr, 2);
|
Songs.Reverse(songNr, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SongMove(int sourceNr, int destNr)
|
public void MoveSong(int sourceNr, int destNr)
|
||||||
{
|
{
|
||||||
if (sourceNr < 0 || destNr < 0 || sourceNr == destNr || sourceNr > Songs.Count - 1 || destNr > Songs.Count - 1)
|
if (sourceNr < 0 || destNr < 0 || sourceNr == destNr || sourceNr >= Songs.Count || destNr >= Songs.Count)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var ps = new CPlaylistSong(Songs[sourceNr]);
|
CPlaylistSong song = Songs[sourceNr];
|
||||||
Songs.RemoveAt(sourceNr);
|
Songs.RemoveAt(sourceNr);
|
||||||
Songs.Insert(destNr, ps);
|
Songs.Insert(destNr, song);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SongInsert(int destNr, int songID, EGameMode gm)
|
public void InsertSong(int destNr, int songID, EGameMode gm)
|
||||||
{
|
{
|
||||||
if (destNr < 0 || destNr > Songs.Count - 1)
|
if (destNr < 0 || destNr >= Songs.Count)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CPlaylistSong ps = new CPlaylistSong(songID, gm);
|
CPlaylistSong ps = new CPlaylistSong(songID, gm);
|
||||||
|
|||||||
@@ -142,10 +142,7 @@ namespace Vocaluxe.Lib.Sound.Playback
|
|||||||
{
|
{
|
||||||
int index = _GetStreamIndex(streamID);
|
int index = _GetStreamIndex(streamID);
|
||||||
if (index >= 0)
|
if (index >= 0)
|
||||||
{
|
|
||||||
_Streams[index].Close();
|
_Streams[index].Close();
|
||||||
_Streams.RemoveAt(index);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+12
-13
@@ -301,6 +301,7 @@ namespace Vocaluxe
|
|||||||
if (args.Name.IndexOf(".resources", StringComparison.Ordinal) >= 0)
|
if (args.Name.IndexOf(".resources", StringComparison.Ordinal) >= 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
Assembly assembly = null;
|
||||||
string[] arr = args.Name.Split(new char[] {','});
|
string[] arr = args.Name.Split(new char[] {','});
|
||||||
if (arr.Length > 0)
|
if (arr.Length > 0)
|
||||||
{
|
{
|
||||||
@@ -311,27 +312,25 @@ namespace Vocaluxe
|
|||||||
#if ARCH_X64
|
#if ARCH_X64
|
||||||
string path = "x64";
|
string path = "x64";
|
||||||
#endif
|
#endif
|
||||||
path = Path.Combine(path, arr[0] + ".dll");
|
path = Path.Combine(CSettings.ProgramFolder, path, arr[0] + ".dll");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Assembly assembly;
|
assembly = Assembly.LoadFrom(path);
|
||||||
|
}
|
||||||
|
catch (FileLoadException e1)
|
||||||
|
{
|
||||||
|
//possibly loading from network, this would work always but better use the normal LoadFrom for more specific errors
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
assembly = Assembly.LoadFrom(path);
|
|
||||||
}
|
|
||||||
catch (FileLoadException)
|
|
||||||
{
|
|
||||||
//possibly loading from network, this would work always but better use the normal LoadFrom for more specific errors
|
|
||||||
assembly = Assembly.Load(File.ReadAllBytes(path));
|
assembly = Assembly.Load(File.ReadAllBytes(path));
|
||||||
}
|
}
|
||||||
return assembly;
|
catch (Exception e)
|
||||||
}
|
{
|
||||||
catch (Exception e)
|
CLog.LogError("Cannot load assembly " + args.Name + " from " + path + ": " + e + "\r\nOuter Error: " + e1);
|
||||||
{
|
}
|
||||||
CLog.LogError("Cannot load assembly " + args.Name + " from " + path + ": " + e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return assembly;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static readonly Mutex _Mutex = new Mutex(false, Application.ProductName + "-SingleInstanceMutex");
|
private static readonly Mutex _Mutex = new Mutex(false, Application.ProductName + "-SingleInstanceMutex");
|
||||||
|
|||||||
@@ -345,13 +345,8 @@ namespace Vocaluxe.Screens
|
|||||||
|
|
||||||
private void _OnSaveSnapshot()
|
private void _OnSaveSnapshot()
|
||||||
{
|
{
|
||||||
string filename = Path.Combine(CSettings.DataPath, CConfig.ProfileFolders[0], "snapshot");
|
string file = CHelper.GetUniqueFileName(Path.Combine(CSettings.DataFolder, CConfig.ProfileFolders[0]), "snapshot.png");
|
||||||
int i = 0;
|
_Snapshot.Save(file, ImageFormat.Png);
|
||||||
while (File.Exists(filename + i + ".png"))
|
|
||||||
i++;
|
|
||||||
|
|
||||||
filename = filename + i + ".png";
|
|
||||||
_Snapshot.Save(filename, ImageFormat.Png);
|
|
||||||
|
|
||||||
_Snapshot = null;
|
_Snapshot = null;
|
||||||
CDraw.RemoveTexture(ref _WebcamTexture);
|
CDraw.RemoveTexture(ref _WebcamTexture);
|
||||||
@@ -361,7 +356,7 @@ namespace Vocaluxe.Screens
|
|||||||
_Buttons[_ButtonTakeSnapshot].Visible = false;
|
_Buttons[_ButtonTakeSnapshot].Visible = false;
|
||||||
_Buttons[_ButtonWebcam].Visible = CWebcam.IsDeviceAvailable();
|
_Buttons[_ButtonWebcam].Visible = CWebcam.IsDeviceAvailable();
|
||||||
|
|
||||||
int id = CProfiles.NewAvatar(filename);
|
int id = CProfiles.NewAvatar(file);
|
||||||
CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].ValueIndex, id);
|
CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].ValueIndex, id);
|
||||||
_LoadAvatars(false);
|
_LoadAvatars(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1265,9 +1265,8 @@ namespace Vocaluxe.Screens
|
|||||||
|
|
||||||
private void _OpenPlaylist(int playlistID)
|
private void _OpenPlaylist(int playlistID)
|
||||||
{
|
{
|
||||||
if (CPlaylists.Playlists.Length > playlistID && playlistID >= 0)
|
if (_Playlist.LoadPlaylist(playlistID))
|
||||||
{
|
{
|
||||||
_Playlist.LoadPlaylist(playlistID);
|
|
||||||
_SongMenu.SmallView = true;
|
_SongMenu.SmallView = true;
|
||||||
_Playlist.Visible = true;
|
_Playlist.Visible = true;
|
||||||
}
|
}
|
||||||
@@ -1289,17 +1288,17 @@ namespace Vocaluxe.Screens
|
|||||||
{
|
{
|
||||||
_SelectSlides[_SelectSlideOptionsPlaylistAdd].Clear();
|
_SelectSlides[_SelectSlideOptionsPlaylistAdd].Clear();
|
||||||
_SelectSlides[_SelectSlideOptionsPlaylistAdd].AddValue("TR_SCREENSONG_NEWPLAYLIST");
|
_SelectSlides[_SelectSlideOptionsPlaylistAdd].AddValue("TR_SCREENSONG_NEWPLAYLIST");
|
||||||
_SelectSlides[_SelectSlideOptionsPlaylistAdd].AddValues(CPlaylists.PlaylistNames);
|
_SelectSlides[_SelectSlideOptionsPlaylistAdd].AddValues(CPlaylists.Names);
|
||||||
_SelectSlides[_SelectSlideOptionsPlaylistOpen].Clear();
|
_SelectSlides[_SelectSlideOptionsPlaylistOpen].Clear();
|
||||||
_SelectSlides[_SelectSlideOptionsPlaylistOpen].AddValues(CPlaylists.PlaylistNames);
|
_SelectSlides[_SelectSlideOptionsPlaylistOpen].AddValues(CPlaylists.Names);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void _OpenAndAddPlaylistAction()
|
private void _OpenAndAddPlaylistAction()
|
||||||
{
|
{
|
||||||
//Open an existing playlist and add song
|
|
||||||
if (_Playlist.ActivePlaylistID != (_SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1) &&
|
if (_Playlist.ActivePlaylistID != (_SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1) &&
|
||||||
(_SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1) != -1)
|
(_SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1) != -1)
|
||||||
{
|
{
|
||||||
|
//Open an existing playlist and add song
|
||||||
//Check selected game-mode
|
//Check selected game-mode
|
||||||
EGameMode gm;
|
EGameMode gm;
|
||||||
if (_AvailableGameModes.Count >= _SelectSlides[_SelectSlideOptionsMode].Selection)
|
if (_AvailableGameModes.Count >= _SelectSlides[_SelectSlideOptionsMode].Selection)
|
||||||
@@ -1315,7 +1314,7 @@ namespace Vocaluxe.Screens
|
|||||||
_Playlist.ActivePlaylistID = _SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1;
|
_Playlist.ActivePlaylistID = _SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1;
|
||||||
|
|
||||||
//Add song to playlist
|
//Add song to playlist
|
||||||
CPlaylists.Playlists[_Playlist.ActivePlaylistID].AddSong(CSongs.VisibleSongs[_SongMenu.GetPreviewSongNr()].ID, gm);
|
CPlaylists.AddSong(_Playlist.ActivePlaylistID, CSongs.VisibleSongs[_SongMenu.GetPreviewSongNr()].ID, gm);
|
||||||
|
|
||||||
//Open playlist
|
//Open playlist
|
||||||
_OpenPlaylist(_Playlist.ActivePlaylistID);
|
_OpenPlaylist(_Playlist.ActivePlaylistID);
|
||||||
@@ -1323,9 +1322,9 @@ namespace Vocaluxe.Screens
|
|||||||
_Playlist.ScrollToBottom();
|
_Playlist.ScrollToBottom();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Create a new playlist and add song
|
|
||||||
else if ((_SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1) == -1)
|
else if ((_SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1) == -1)
|
||||||
{
|
{
|
||||||
|
//Create a new playlist and add song
|
||||||
//Check selected game-mode
|
//Check selected game-mode
|
||||||
EGameMode gm;
|
EGameMode gm;
|
||||||
if (_AvailableGameModes.Count >= _SelectSlides[_SelectSlideOptionsMode].Selection)
|
if (_AvailableGameModes.Count >= _SelectSlides[_SelectSlideOptionsMode].Selection)
|
||||||
@@ -1339,18 +1338,18 @@ namespace Vocaluxe.Screens
|
|||||||
_Playlist.ActivePlaylistID = CPlaylists.NewPlaylist();
|
_Playlist.ActivePlaylistID = CPlaylists.NewPlaylist();
|
||||||
|
|
||||||
//Add song to playlist
|
//Add song to playlist
|
||||||
CPlaylists.Playlists[_Playlist.ActivePlaylistID].AddSong(CSongs.VisibleSongs[_SongMenu.GetPreviewSongNr()].ID, gm);
|
CPlaylists.AddSong(_Playlist.ActivePlaylistID, CSongs.VisibleSongs[_SongMenu.GetPreviewSongNr()].ID, gm);
|
||||||
|
|
||||||
//Open playlist
|
//Open playlist
|
||||||
_OpenPlaylist(_Playlist.ActivePlaylistID);
|
_OpenPlaylist(_Playlist.ActivePlaylistID);
|
||||||
|
|
||||||
//Add new playlist to select-slide
|
//Add new playlist to select-slide
|
||||||
_SelectSlides[_SelectSlideOptionsPlaylistAdd].AddValue(CPlaylists.Playlists[_Playlist.ActivePlaylistID].PlaylistName);
|
_SelectSlides[_SelectSlideOptionsPlaylistAdd].AddValue(CPlaylists.GetName(_Playlist.ActivePlaylistID));
|
||||||
_SelectSlides[_SelectSlideOptionsPlaylistOpen].AddValue(CPlaylists.Playlists[_Playlist.ActivePlaylistID].PlaylistName);
|
_SelectSlides[_SelectSlideOptionsPlaylistOpen].AddValue(CPlaylists.GetName(_Playlist.ActivePlaylistID));
|
||||||
}
|
}
|
||||||
//Add song to loaded playlist
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
//Add song to loaded playlist
|
||||||
//Check selected game-mode
|
//Check selected game-mode
|
||||||
EGameMode gm;
|
EGameMode gm;
|
||||||
if (_AvailableGameModes.Count >= _SelectSlides[_SelectSlideOptionsMode].Selection)
|
if (_AvailableGameModes.Count >= _SelectSlides[_SelectSlideOptionsMode].Selection)
|
||||||
@@ -1359,7 +1358,7 @@ namespace Vocaluxe.Screens
|
|||||||
gm = EGameMode.TR_GAMEMODE_DUET;
|
gm = EGameMode.TR_GAMEMODE_DUET;
|
||||||
else
|
else
|
||||||
gm = EGameMode.TR_GAMEMODE_NORMAL;
|
gm = EGameMode.TR_GAMEMODE_NORMAL;
|
||||||
CPlaylists.Playlists[_Playlist.ActivePlaylistID].AddSong(CSongs.VisibleSongs[_SongMenu.GetPreviewSongNr()].ID, gm);
|
CPlaylists.AddSong(_Playlist.ActivePlaylistID, CSongs.VisibleSongs[_SongMenu.GetPreviewSongNr()].ID, gm);
|
||||||
_Playlist.UpdatePlaylist();
|
_Playlist.UpdatePlaylist();
|
||||||
_Playlist.ScrollToBottom();
|
_Playlist.ScrollToBottom();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ namespace Vocaluxe.SongQueue
|
|||||||
_SongQueue[_CurrentRound].GameMode);
|
_SongQueue[_CurrentRound].GameMode);
|
||||||
}
|
}
|
||||||
_CurrentRound++;
|
_CurrentRound++;
|
||||||
_CurrentSong = CGameModes.Get(GetCurrentGameMode()).GetSong(_SongQueue[_CurrentRound].SongID);
|
_CurrentSong = IsFinished() ? null : CGameModes.Get(GetCurrentGameMode()).GetSong(_SongQueue[_CurrentRound].SongID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsFinished()
|
public bool IsFinished()
|
||||||
|
|||||||
@@ -273,6 +273,30 @@ namespace VocaluxeLib
|
|||||||
{
|
{
|
||||||
return (bounds.X <= x) && (bounds.X + bounds.W >= x) && (bounds.Y <= y) && (bounds.Y + bounds.H >= y);
|
return (bounds.X <= x) && (bounds.X + bounds.W >= x) && (bounds.Y <= y) && (bounds.Y + bounds.H >= y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a filename that is unique in that path
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="path">Path in which the file should be stored</param>
|
||||||
|
/// <param name="filename">filename (including extension)</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string GetUniqueFileName(string path, string filename, bool withPath = true)
|
||||||
|
{
|
||||||
|
string ext = Path.GetExtension(filename);
|
||||||
|
filename = Path.GetFileNameWithoutExtension(filename);
|
||||||
|
if (filename == null)
|
||||||
|
filename = "1";
|
||||||
|
if (File.Exists(Path.Combine(path, filename + ext)))
|
||||||
|
{
|
||||||
|
int i = 1;
|
||||||
|
while (File.Exists(Path.Combine(path, filename + "_" + i + ext)))
|
||||||
|
i++;
|
||||||
|
filename += "_" + i;
|
||||||
|
}
|
||||||
|
if (withPath)
|
||||||
|
filename = Path.Combine(path, filename);
|
||||||
|
return filename + ext;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static class CEncoding
|
static class CEncoding
|
||||||
|
|||||||
@@ -62,10 +62,7 @@ namespace VocaluxeLib
|
|||||||
{
|
{
|
||||||
string val;
|
string val;
|
||||||
if (GetValue(cast, out val, Enum.GetName(typeof(T), value)))
|
if (GetValue(cast, out val, Enum.GetName(typeof(T), value)))
|
||||||
{
|
return CHelper.TryParse(val, out value, true);
|
||||||
CHelper.TryParse(val, out value, true);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+17
-14
@@ -196,6 +196,8 @@ namespace VocaluxeLib
|
|||||||
void Reset();
|
void Reset();
|
||||||
void ClearSongs();
|
void ClearSongs();
|
||||||
int GetNumSongs();
|
int GetNumSongs();
|
||||||
|
CSong GetSong();
|
||||||
|
CSong GetSong(int round);
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface IRecording
|
public interface IRecording
|
||||||
@@ -288,24 +290,25 @@ namespace VocaluxeLib
|
|||||||
|
|
||||||
public interface IPlaylist
|
public interface IPlaylist
|
||||||
{
|
{
|
||||||
string GetPlaylistName(int playlistID);
|
bool Exists(int playlistID);
|
||||||
List<string> GetPlaylistNames();
|
string GetName(int playlistID);
|
||||||
|
List<string> GetNames();
|
||||||
|
|
||||||
void SetPlaylistName(int playlistID, string name);
|
void SetName(int playlistID, string name);
|
||||||
void DeletePlaylist(int playlistID);
|
void Delete(int playlistID);
|
||||||
void SavePlaylist(int playlistID);
|
void Save(int playlistID);
|
||||||
int GetNumPlaylists();
|
int GetNumPlaylists();
|
||||||
|
|
||||||
void AddPlaylistSong(int playlistID, int songID);
|
void AddSong(int playlistID, int songID);
|
||||||
void AddPlaylistSong(int playlistID, int songID, EGameMode gameMode);
|
void AddSong(int playlistID, int songID, EGameMode gameMode);
|
||||||
void InsertPlaylistSong(int playlistID, int positionIndex, int songID, EGameMode gameMode);
|
void InsertSong(int playlistID, int positionIndex, int songID, EGameMode gameMode);
|
||||||
|
|
||||||
void MovePlaylistSong(int playlistID, int sourceIndex, int destIndex);
|
void MoveSong(int playlistID, int sourceIndex, int destIndex);
|
||||||
void MovePlaylistSongDown(int playlistID, int songIndex);
|
void MoveSongDown(int playlistID, int songIndex);
|
||||||
void MovePlaylistSongUp(int playlistID, int songIndex);
|
void MoveSongUp(int playlistID, int songIndex);
|
||||||
void DeletePlaylistSong(int playlistID, int songIndex);
|
void DeleteSong(int playlistID, int songIndex);
|
||||||
|
|
||||||
int GetPlaylistSongCount(int playlistID);
|
int GetSongCount(int playlistID);
|
||||||
CPlaylistSong GetPlaylistSong(int playlistID, int songIndex);
|
CPlaylistSong GetSong(int playlistID, int songIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -176,7 +176,7 @@ namespace VocaluxeLib.Menu
|
|||||||
{
|
{
|
||||||
if (EditMode == EEditMode.ChangeOrder && _ChangeOrderSource != -1 && _PlaylistElements.Count > _ChangeOrderSource)
|
if (EditMode == EEditMode.ChangeOrder && _ChangeOrderSource != -1 && _PlaylistElements.Count > _ChangeOrderSource)
|
||||||
{
|
{
|
||||||
CBase.Playlist.DeletePlaylistSong(ActivePlaylistID, _PlaylistElements[_ChangeOrderSource].Content);
|
CBase.Playlist.DeleteSong(ActivePlaylistID, _PlaylistElements[_ChangeOrderSource].Content);
|
||||||
UpdatePlaylist();
|
UpdatePlaylist();
|
||||||
}
|
}
|
||||||
_ChangeOrderSource = -1;
|
_ChangeOrderSource = -1;
|
||||||
@@ -503,13 +503,13 @@ namespace VocaluxeLib.Menu
|
|||||||
switch (keyEvent.Key)
|
switch (keyEvent.Key)
|
||||||
{
|
{
|
||||||
case Keys.Enter:
|
case Keys.Enter:
|
||||||
CBase.Playlist.SetPlaylistName(ActivePlaylistID, _Theme.ButtonPlaylistName.Text.Text);
|
CBase.Playlist.SetName(ActivePlaylistID, _Theme.ButtonPlaylistName.Text.Text);
|
||||||
CBase.Playlist.SavePlaylist(ActivePlaylistID);
|
CBase.Playlist.Save(ActivePlaylistID);
|
||||||
EditMode = EEditMode.None;
|
EditMode = EEditMode.None;
|
||||||
_Theme.ButtonPlaylistName.EditMode = false;
|
_Theme.ButtonPlaylistName.EditMode = false;
|
||||||
break;
|
break;
|
||||||
case Keys.Escape:
|
case Keys.Escape:
|
||||||
_Theme.ButtonPlaylistName.Text.Text = CBase.Playlist.GetPlaylistName(ActivePlaylistID);
|
_Theme.ButtonPlaylistName.Text.Text = CBase.Playlist.GetName(ActivePlaylistID);
|
||||||
EditMode = EEditMode.None;
|
EditMode = EEditMode.None;
|
||||||
_Theme.ButtonPlaylistName.EditMode = false;
|
_Theme.ButtonPlaylistName.EditMode = false;
|
||||||
break;
|
break;
|
||||||
@@ -600,7 +600,7 @@ namespace VocaluxeLib.Menu
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Keys.Delete:
|
case Keys.Delete:
|
||||||
CBase.Playlist.DeletePlaylistSong(ActivePlaylistID, _PlaylistElements[CurrentPlaylistElement].Content);
|
CBase.Playlist.DeleteSong(ActivePlaylistID, _PlaylistElements[CurrentPlaylistElement].Content);
|
||||||
UpdatePlaylist();
|
UpdatePlaylist();
|
||||||
|
|
||||||
if (Offset > 0)
|
if (Offset > 0)
|
||||||
@@ -626,7 +626,7 @@ namespace VocaluxeLib.Menu
|
|||||||
case Keys.Add: //move the selected song up
|
case Keys.Add: //move the selected song up
|
||||||
if (_PlaylistElementContents.Count > 1 && (CurrentPlaylistElement > 0 || Offset > 0))
|
if (_PlaylistElementContents.Count > 1 && (CurrentPlaylistElement > 0 || Offset > 0))
|
||||||
{
|
{
|
||||||
CBase.Playlist.MovePlaylistSongUp(ActivePlaylistID, CurrentPlaylistElement + Offset);
|
CBase.Playlist.MoveSongUp(ActivePlaylistID, CurrentPlaylistElement + Offset);
|
||||||
UpdatePlaylist();
|
UpdatePlaylist();
|
||||||
|
|
||||||
var key = new SKeyEvent {Key = Keys.Up};
|
var key = new SKeyEvent {Key = Keys.Up};
|
||||||
@@ -655,7 +655,7 @@ namespace VocaluxeLib.Menu
|
|||||||
case Keys.Subtract: //move the selected song down
|
case Keys.Subtract: //move the selected song down
|
||||||
if (_PlaylistElementContents.Count > 1 && CurrentPlaylistElement + Offset < _PlaylistElementContents.Count - 1)
|
if (_PlaylistElementContents.Count > 1 && CurrentPlaylistElement + Offset < _PlaylistElementContents.Count - 1)
|
||||||
{
|
{
|
||||||
CBase.Playlist.MovePlaylistSongDown(ActivePlaylistID, CurrentPlaylistElement + Offset);
|
CBase.Playlist.MoveSongDown(ActivePlaylistID, CurrentPlaylistElement + Offset);
|
||||||
UpdatePlaylist();
|
UpdatePlaylist();
|
||||||
|
|
||||||
var key = new SKeyEvent {Key = Keys.Down};
|
var key = new SKeyEvent {Key = Keys.Down};
|
||||||
@@ -724,7 +724,7 @@ namespace VocaluxeLib.Menu
|
|||||||
|
|
||||||
if (CurrentPlaylistElement != -1)
|
if (CurrentPlaylistElement != -1)
|
||||||
{
|
{
|
||||||
CBase.Playlist.GetPlaylistSong(ActivePlaylistID, CurrentPlaylistElement + Offset).GameMode =
|
CBase.Playlist.GetSong(ActivePlaylistID, CurrentPlaylistElement + Offset).GameMode =
|
||||||
_PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[_PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection];
|
_PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[_PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection];
|
||||||
UpdatePlaylist();
|
UpdatePlaylist();
|
||||||
}
|
}
|
||||||
@@ -736,7 +736,7 @@ namespace VocaluxeLib.Menu
|
|||||||
|
|
||||||
if (CurrentPlaylistElement != -1)
|
if (CurrentPlaylistElement != -1)
|
||||||
{
|
{
|
||||||
CBase.Playlist.GetPlaylistSong(ActivePlaylistID, CurrentPlaylistElement + Offset).GameMode =
|
CBase.Playlist.GetSong(ActivePlaylistID, CurrentPlaylistElement + Offset).GameMode =
|
||||||
_PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[_PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection];
|
_PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[_PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection];
|
||||||
UpdatePlaylist();
|
UpdatePlaylist();
|
||||||
}
|
}
|
||||||
@@ -764,10 +764,10 @@ namespace VocaluxeLib.Menu
|
|||||||
else if (_Theme.ButtonPlaylistSing.Selected)
|
else if (_Theme.ButtonPlaylistSing.Selected)
|
||||||
_StartPlaylistSongs();
|
_StartPlaylistSongs();
|
||||||
else if (_Theme.ButtonPlaylistSave.Selected)
|
else if (_Theme.ButtonPlaylistSave.Selected)
|
||||||
CBase.Playlist.SavePlaylist(ActivePlaylistID);
|
CBase.Playlist.Save(ActivePlaylistID);
|
||||||
else if (_Theme.ButtonPlaylistDelete.Selected)
|
else if (_Theme.ButtonPlaylistDelete.Selected)
|
||||||
{
|
{
|
||||||
CBase.Playlist.DeletePlaylist(ActivePlaylistID);
|
CBase.Playlist.Delete(ActivePlaylistID);
|
||||||
ClosePlaylist();
|
ClosePlaylist();
|
||||||
}
|
}
|
||||||
else if (_Theme.ButtonPlaylistName.Selected)
|
else if (_Theme.ButtonPlaylistName.Selected)
|
||||||
@@ -888,7 +888,7 @@ namespace VocaluxeLib.Menu
|
|||||||
//Delete Entry with RB
|
//Delete Entry with RB
|
||||||
if (CHelper.IsInBounds(_PlaylistElements[i].Background.Rect, mouseEvent) && mouseEvent.RB && _PlaylistElements[i].Content != -1)
|
if (CHelper.IsInBounds(_PlaylistElements[i].Background.Rect, mouseEvent) && mouseEvent.RB && _PlaylistElements[i].Content != -1)
|
||||||
{
|
{
|
||||||
CBase.Playlist.DeletePlaylistSong(ActivePlaylistID, _PlaylistElements[i].Content);
|
CBase.Playlist.DeleteSong(ActivePlaylistID, _PlaylistElements[i].Content);
|
||||||
UpdatePlaylist();
|
UpdatePlaylist();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -906,7 +906,7 @@ namespace VocaluxeLib.Menu
|
|||||||
{
|
{
|
||||||
if (CurrentPlaylistElement != -1)
|
if (CurrentPlaylistElement != -1)
|
||||||
{
|
{
|
||||||
CBase.Playlist.GetPlaylistSong(ActivePlaylistID, CurrentPlaylistElement + Offset).GameMode =
|
CBase.Playlist.GetSong(ActivePlaylistID, CurrentPlaylistElement + Offset).GameMode =
|
||||||
_PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[_PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection];
|
_PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[_PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection];
|
||||||
UpdatePlaylist();
|
UpdatePlaylist();
|
||||||
}
|
}
|
||||||
@@ -922,12 +922,12 @@ namespace VocaluxeLib.Menu
|
|||||||
}
|
}
|
||||||
if (_Theme.ButtonPlaylistSave.Selected)
|
if (_Theme.ButtonPlaylistSave.Selected)
|
||||||
{
|
{
|
||||||
CBase.Playlist.SavePlaylist(ActivePlaylistID);
|
CBase.Playlist.Save(ActivePlaylistID);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (_Theme.ButtonPlaylistDelete.Selected)
|
if (_Theme.ButtonPlaylistDelete.Selected)
|
||||||
{
|
{
|
||||||
CBase.Playlist.DeletePlaylist(ActivePlaylistID);
|
CBase.Playlist.Delete(ActivePlaylistID);
|
||||||
ClosePlaylist();
|
ClosePlaylist();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -981,14 +981,14 @@ namespace VocaluxeLib.Menu
|
|||||||
|
|
||||||
if (CurrentPlaylistElement != -1)
|
if (CurrentPlaylistElement != -1)
|
||||||
{
|
{
|
||||||
CBase.Playlist.InsertPlaylistSong(ActivePlaylistID, CurrentPlaylistElement + Offset, DragAndDropSongID, gm);
|
CBase.Playlist.InsertSong(ActivePlaylistID, CurrentPlaylistElement + Offset, DragAndDropSongID, gm);
|
||||||
UpdatePlaylist();
|
UpdatePlaylist();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (mouseEvent.Y < _PlaylistElements[0].Background.Rect.Y && Offset == 0)
|
if (mouseEvent.Y < _PlaylistElements[0].Background.Rect.Y && Offset == 0)
|
||||||
{
|
{
|
||||||
CBase.Playlist.InsertPlaylistSong(ActivePlaylistID, 0, DragAndDropSongID, gm);
|
CBase.Playlist.InsertSong(ActivePlaylistID, 0, DragAndDropSongID, gm);
|
||||||
UpdatePlaylist();
|
UpdatePlaylist();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1007,7 +1007,7 @@ namespace VocaluxeLib.Menu
|
|||||||
|
|
||||||
if (mouseEvent.Y > min)
|
if (mouseEvent.Y > min)
|
||||||
{
|
{
|
||||||
CBase.Playlist.AddPlaylistSong(ActivePlaylistID, DragAndDropSongID, gm);
|
CBase.Playlist.AddSong(ActivePlaylistID, DragAndDropSongID, gm);
|
||||||
UpdatePlaylist();
|
UpdatePlaylist();
|
||||||
ScrollToBottom();
|
ScrollToBottom();
|
||||||
}
|
}
|
||||||
@@ -1028,8 +1028,8 @@ namespace VocaluxeLib.Menu
|
|||||||
{
|
{
|
||||||
if (_Theme.ButtonPlaylistName.Selected)
|
if (_Theme.ButtonPlaylistName.Selected)
|
||||||
{
|
{
|
||||||
CBase.Playlist.SetPlaylistName(ActivePlaylistID, _Theme.ButtonPlaylistName.Text.Text);
|
CBase.Playlist.SetName(ActivePlaylistID, _Theme.ButtonPlaylistName.Text.Text);
|
||||||
CBase.Playlist.SavePlaylist(ActivePlaylistID);
|
CBase.Playlist.Save(ActivePlaylistID);
|
||||||
EditMode = EEditMode.None;
|
EditMode = EEditMode.None;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1038,7 +1038,7 @@ namespace VocaluxeLib.Menu
|
|||||||
{
|
{
|
||||||
if (_Theme.ButtonPlaylistName.Selected)
|
if (_Theme.ButtonPlaylistName.Selected)
|
||||||
{
|
{
|
||||||
_Theme.ButtonPlaylistName.Text.Text = CBase.Playlist.GetPlaylistName(ActivePlaylistID);
|
_Theme.ButtonPlaylistName.Text.Text = CBase.Playlist.GetName(ActivePlaylistID);
|
||||||
EditMode = EEditMode.None;
|
EditMode = EEditMode.None;
|
||||||
_Theme.ButtonPlaylistName.EditMode = false;
|
_Theme.ButtonPlaylistName.EditMode = false;
|
||||||
return true;
|
return true;
|
||||||
@@ -1058,13 +1058,13 @@ namespace VocaluxeLib.Menu
|
|||||||
{
|
{
|
||||||
if (CurrentPlaylistElement != -1 && CurrentPlaylistElement + Offset != _ChangeOrderSource)
|
if (CurrentPlaylistElement != -1 && CurrentPlaylistElement + Offset != _ChangeOrderSource)
|
||||||
{
|
{
|
||||||
CBase.Playlist.MovePlaylistSong(ActivePlaylistID, _ChangeOrderSource, CurrentPlaylistElement + Offset);
|
CBase.Playlist.MoveSong(ActivePlaylistID, _ChangeOrderSource, CurrentPlaylistElement + Offset);
|
||||||
UpdatePlaylist();
|
UpdatePlaylist();
|
||||||
}
|
}
|
||||||
else if (CurrentPlaylistElement == -1)
|
else if (CurrentPlaylistElement == -1)
|
||||||
{
|
{
|
||||||
if (mouseEvent.Y < _PlaylistElements[0].Background.Rect.Y && Offset == 0)
|
if (mouseEvent.Y < _PlaylistElements[0].Background.Rect.Y && Offset == 0)
|
||||||
CBase.Playlist.MovePlaylistSong(ActivePlaylistID, _ChangeOrderSource, 0);
|
CBase.Playlist.MoveSong(ActivePlaylistID, _ChangeOrderSource, 0);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (_PlaylistElements.Count + Offset >= _PlaylistElementContents.Count)
|
if (_PlaylistElements.Count + Offset >= _PlaylistElementContents.Count)
|
||||||
@@ -1080,7 +1080,7 @@ namespace VocaluxeLib.Menu
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mouseEvent.Y > min)
|
if (mouseEvent.Y > min)
|
||||||
CBase.Playlist.MovePlaylistSong(ActivePlaylistID, _ChangeOrderSource, _PlaylistElementContents.Count - 1);
|
CBase.Playlist.MoveSong(ActivePlaylistID, _ChangeOrderSource, _PlaylistElementContents.Count - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1134,35 +1134,33 @@ namespace VocaluxeLib.Menu
|
|||||||
|
|
||||||
public bool LoadPlaylist(int playlistID)
|
public bool LoadPlaylist(int playlistID)
|
||||||
{
|
{
|
||||||
if (playlistID > -1 && playlistID < CBase.Playlist.GetNumPlaylists())
|
if (!CBase.Playlist.Exists(playlistID))
|
||||||
|
return false;
|
||||||
|
ActivePlaylistID = playlistID;
|
||||||
|
_Theme.ButtonPlaylistName.Text.Text = CBase.Playlist.GetName(ActivePlaylistID);
|
||||||
|
_PlaylistElementContents.Clear();
|
||||||
|
for (int i = 0; i < CBase.Playlist.GetSongCount(ActivePlaylistID); i++)
|
||||||
{
|
{
|
||||||
ActivePlaylistID = playlistID;
|
var pec = new CPlaylistElementContent
|
||||||
_Theme.ButtonPlaylistName.Text.Text = CBase.Playlist.GetPlaylistName(ActivePlaylistID);
|
{
|
||||||
_PlaylistElementContents.Clear();
|
SongID = CBase.Playlist.GetSong(ActivePlaylistID, i).SongID,
|
||||||
for (int i = 0; i < CBase.Playlist.GetPlaylistSongCount(ActivePlaylistID); i++)
|
Modes = CBase.Songs.GetSongByID(CBase.Playlist.GetSong(ActivePlaylistID, i).SongID).AvailableGameModes,
|
||||||
{
|
Mode = CBase.Playlist.GetSong(ActivePlaylistID, i).GameMode
|
||||||
var pec = new CPlaylistElementContent
|
};
|
||||||
{
|
_PlaylistElementContents.Add(pec);
|
||||||
SongID = CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).SongID,
|
|
||||||
Modes = CBase.Songs.GetSongByID(CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).SongID).AvailableGameModes,
|
|
||||||
Mode = CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).GameMode
|
|
||||||
};
|
|
||||||
_PlaylistElementContents.Add(pec);
|
|
||||||
}
|
|
||||||
Update();
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
Update();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdatePlaylist()
|
public void UpdatePlaylist()
|
||||||
{
|
{
|
||||||
_PlaylistElementContents.Clear();
|
_PlaylistElementContents.Clear();
|
||||||
for (int i = 0; i < CBase.Playlist.GetPlaylistSongCount(ActivePlaylistID); i++)
|
for (int i = 0; i < CBase.Playlist.GetSongCount(ActivePlaylistID); i++)
|
||||||
{
|
{
|
||||||
var pec = new CPlaylistElementContent {SongID = CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).SongID};
|
var pec = new CPlaylistElementContent {SongID = CBase.Playlist.GetSong(ActivePlaylistID, i).SongID};
|
||||||
pec.Modes = CBase.Songs.GetSongByID(pec.SongID).AvailableGameModes;
|
pec.Modes = CBase.Songs.GetSongByID(pec.SongID).AvailableGameModes;
|
||||||
pec.Mode = CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).GameMode;
|
pec.Mode = CBase.Playlist.GetSong(ActivePlaylistID, i).GameMode;
|
||||||
_PlaylistElementContents.Add(pec);
|
_PlaylistElementContents.Add(pec);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1181,10 +1179,10 @@ namespace VocaluxeLib.Menu
|
|||||||
CBase.Game.Reset();
|
CBase.Game.Reset();
|
||||||
CBase.Game.ClearSongs();
|
CBase.Game.ClearSongs();
|
||||||
|
|
||||||
if (ActivePlaylistID > -1 && ActivePlaylistID < CBase.Playlist.GetNumPlaylists())
|
if (CBase.Playlist.Exists(ActivePlaylistID))
|
||||||
{
|
{
|
||||||
for (int i = 0; i < CBase.Playlist.GetPlaylistSongCount(ActivePlaylistID); i++)
|
for (int i = 0; i < CBase.Playlist.GetSongCount(ActivePlaylistID); i++)
|
||||||
CBase.Game.AddSong(CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).SongID, CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).GameMode);
|
CBase.Game.AddSong(CBase.Playlist.GetSong(ActivePlaylistID, i).SongID, CBase.Playlist.GetSong(ActivePlaylistID, i).GameMode);
|
||||||
if (CBase.Game.GetNumSongs() > 0)
|
if (CBase.Game.GetNumSongs() > 0)
|
||||||
CBase.Graphics.FadeTo(EScreens.ScreenNames); //TODO: What is if someone uses that in PartyMode?
|
CBase.Graphics.FadeTo(EScreens.ScreenNames); //TODO: What is if someone uses that in PartyMode?
|
||||||
}
|
}
|
||||||
@@ -1195,7 +1193,7 @@ namespace VocaluxeLib.Menu
|
|||||||
CBase.Game.Reset();
|
CBase.Game.Reset();
|
||||||
CBase.Game.ClearSongs();
|
CBase.Game.ClearSongs();
|
||||||
|
|
||||||
CBase.Game.AddSong(CBase.Playlist.GetPlaylistSong(ActivePlaylistID, selected).SongID, CBase.Playlist.GetPlaylistSong(ActivePlaylistID, selected).GameMode);
|
CBase.Game.AddSong(CBase.Playlist.GetSong(ActivePlaylistID, selected).SongID, CBase.Playlist.GetSong(ActivePlaylistID, selected).GameMode);
|
||||||
|
|
||||||
if (CBase.Game.GetNumSongs() > 0)
|
if (CBase.Game.GetNumSongs() > 0)
|
||||||
CBase.Graphics.FadeTo(EScreens.ScreenNames);
|
CBase.Graphics.FadeTo(EScreens.ScreenNames);
|
||||||
@@ -1203,7 +1201,7 @@ namespace VocaluxeLib.Menu
|
|||||||
|
|
||||||
public void Update()
|
public void Update()
|
||||||
{
|
{
|
||||||
if (ActivePlaylistID > -1 && ActivePlaylistID < CBase.Playlist.GetNumPlaylists())
|
if (CBase.Playlist.Exists(ActivePlaylistID))
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _PlaylistElements.Count; i++)
|
for (int i = 0; i < _PlaylistElements.Count; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
|||||||
private int _LastKnownNumSongs;
|
private int _LastKnownNumSongs;
|
||||||
private int _LastKnownCategory = -1;
|
private int _LastKnownCategory = -1;
|
||||||
|
|
||||||
private bool _MouseWasInRect = false;
|
private bool _MouseWasInRect;
|
||||||
|
|
||||||
public override float SelectedTileZoomFactor
|
public override float SelectedTileZoomFactor
|
||||||
{
|
{
|
||||||
@@ -76,14 +76,19 @@ namespace VocaluxeLib.Menu.SongMenu
|
|||||||
//Update list in case we scrolled
|
//Update list in case we scrolled
|
||||||
_UpdateList();
|
_UpdateList();
|
||||||
|
|
||||||
foreach (CStatic tile in _Tiles)
|
_UpdateTileSelection();
|
||||||
tile.Selected = false;
|
|
||||||
int tileNr = _SelectionNr - _Offset;
|
|
||||||
if (tileNr >= 0 && tileNr < _Tiles.Count)
|
|
||||||
_Tiles[tileNr].Selected = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void _UpdateTileSelection()
|
||||||
|
{
|
||||||
|
foreach (CStatic tile in _Tiles)
|
||||||
|
tile.Selected = false;
|
||||||
|
int tileNr = _SelectionNr - _Offset;
|
||||||
|
if (tileNr >= 0 && tileNr < _Tiles.Count)
|
||||||
|
_Tiles[tileNr].Selected = true;
|
||||||
|
}
|
||||||
|
|
||||||
public override bool SmallView
|
public override bool SmallView
|
||||||
{
|
{
|
||||||
set
|
set
|
||||||
@@ -93,6 +98,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
|||||||
base.SmallView = value;
|
base.SmallView = value;
|
||||||
_InitTiles();
|
_InitTiles();
|
||||||
_UpdateList(true);
|
_UpdateList(true);
|
||||||
|
_UpdateTileSelection();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -262,19 +268,9 @@ namespace VocaluxeLib.Menu.SongMenu
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (CBase.Songs.IsInCategory())
|
if (CBase.Songs.IsInCategory())
|
||||||
{
|
SetSelectedSong(_SelectionNr < 0 ? 0 : _SelectionNr);
|
||||||
if (_SelectionNr < 0)
|
|
||||||
SetSelectedSong(0);
|
|
||||||
else
|
|
||||||
SetSelectedSong(_SelectionNr);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
SetSelectedCategory(_SelectionNr < 0 ? 0 : _SelectionNr);
|
||||||
if (_SelectionNr < 0)
|
|
||||||
SetSelectedCategory(0);
|
|
||||||
else
|
|
||||||
SetSelectedCategory(_SelectionNr);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
_PreviewNr = _SelectionNr;
|
_PreviewNr = _SelectionNr;
|
||||||
_AfterCategoryChange();
|
_AfterCategoryChange();
|
||||||
|
|||||||
@@ -120,20 +120,9 @@ namespace VocaluxeLib.Profile
|
|||||||
if (filename == "")
|
if (filename == "")
|
||||||
filename = "1";
|
filename = "1";
|
||||||
|
|
||||||
int i = 0;
|
FileName = CHelper.GetUniqueFileName(FilePath, filename + ".xml", false);
|
||||||
while (File.Exists(Path.Combine(FilePath, filename + ".xml")))
|
|
||||||
{
|
|
||||||
i++;
|
|
||||||
if (!File.Exists(Path.Combine(FilePath, filename + i + ".xml")))
|
|
||||||
filename += i;
|
|
||||||
}
|
|
||||||
|
|
||||||
FileName = filename + ".xml";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FileName == String.Empty)
|
|
||||||
return;
|
|
||||||
|
|
||||||
XmlWriter writer;
|
XmlWriter writer;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ namespace WebserverInitalConfig
|
|||||||
ProcessStartInfo proc = new ProcessStartInfo
|
ProcessStartInfo proc = new ProcessStartInfo
|
||||||
{
|
{
|
||||||
UseShellExecute = true,
|
UseShellExecute = true,
|
||||||
WorkingDirectory = Environment.CurrentDirectory,
|
WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory,
|
||||||
FileName = Process.GetCurrentProcess().MainModule.FileName,
|
FileName = Process.GetCurrentProcess().MainModule.FileName,
|
||||||
Arguments = args[0] + " " + args[1],
|
Arguments = args[0] + " " + args[1],
|
||||||
Verb = "runas",
|
Verb = "runas",
|
||||||
|
|||||||
Reference in new issue
Block a user