Merge branch 'develop' into HelpMessage_SongScreen
This commit is contained in:
3 files changed
+167
-7
No files matched your search
@@ -427,6 +427,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
_ScreenSongOptions.Sorting.Tabs = CBase.Config.GetTabs();
|
||||
_ScreenSongOptions.Sorting.FilterPlaylistID = -1;
|
||||
|
||||
_ScreenSongOptions.Selection.SongIndex = -1;
|
||||
_ScreenSongOptions.Selection.CategoryIndex = -1;
|
||||
_ScreenSongOptions.Selection.CategoryChangeAllowed = true;
|
||||
break;
|
||||
@@ -718,4 +719,4 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
#region license
|
||||
#region license
|
||||
// This file is part of Vocaluxe.
|
||||
//
|
||||
// Vocaluxe is free software: you can redistribute it and/or modify
|
||||
@@ -93,6 +93,89 @@ namespace Vocaluxe.Base
|
||||
if (_SearchString != "")
|
||||
searchStrings = _SearchString.ToUpper().Split(new char[] {' '});
|
||||
|
||||
String searchForArtist = null; // a:
|
||||
String searchForTitle = null; // t:
|
||||
String searchForGenre = null; // g:
|
||||
String searchForYear = null; // y:
|
||||
String searchForLanguage = null; // l:
|
||||
String searchForCreator = null; // c:
|
||||
String searchForEdition = null; // e:
|
||||
String searchForAlbum = null; // al:
|
||||
String searchForFileName = null; // fi:
|
||||
String searchForFolderName = null; // fo:
|
||||
bool expertSearch = false;
|
||||
|
||||
if (searchStrings != null)
|
||||
{
|
||||
foreach (String searchToken in searchStrings)
|
||||
{
|
||||
if (searchToken.Length < 3)
|
||||
continue;
|
||||
|
||||
String temp = searchToken.Substring(0, 2);
|
||||
bool foundIt = true;
|
||||
|
||||
switch (temp)
|
||||
{
|
||||
case "A:":
|
||||
searchForArtist = searchToken.Substring(2);
|
||||
break;
|
||||
case "T:":
|
||||
searchForTitle = searchToken.Substring(2);
|
||||
break;
|
||||
case "G:":
|
||||
searchForGenre = searchToken.Substring(2);
|
||||
break;
|
||||
case "Y:":
|
||||
searchForYear = searchToken.Substring(2);
|
||||
break;
|
||||
case "L:":
|
||||
searchForLanguage = searchToken.Substring(2);
|
||||
break;
|
||||
case "C:":
|
||||
searchForCreator = searchToken.Substring(2);
|
||||
break;
|
||||
case "E:":
|
||||
searchForEdition = searchToken.Substring(2);
|
||||
break;
|
||||
default:
|
||||
foundIt = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (foundIt)
|
||||
{
|
||||
if (!expertSearch) expertSearch = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (searchToken.Length < 4)
|
||||
continue;
|
||||
|
||||
foundIt = true;
|
||||
temp = searchToken.Substring(0, 3);
|
||||
|
||||
switch (temp)
|
||||
{
|
||||
case "AL:":
|
||||
searchForAlbum = searchToken.Substring(3);
|
||||
break;
|
||||
case "FI:":
|
||||
searchForFileName = searchToken.Substring(3);
|
||||
break;
|
||||
case "FO:":
|
||||
searchForFolderName = searchToken.Substring(3);
|
||||
break;
|
||||
default:
|
||||
foundIt = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (foundIt && !expertSearch)
|
||||
expertSearch = true;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (CSong song in CSongs.Songs)
|
||||
{
|
||||
if (_PlaylistID != -1 && !CBase.Playlist.ContainsSong(_PlaylistID, song.ID))
|
||||
@@ -102,9 +185,85 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
if (searchStrings == null)
|
||||
_FilteredSongs.Add(song);
|
||||
else if (expertSearch)
|
||||
{
|
||||
// Stefan1200: Stop at a maximum of 500 search result to prevent performance issues
|
||||
if (_FilteredSongs.Count >= 500)
|
||||
break;
|
||||
|
||||
if (searchForAlbum != null && song.Album.ToUpper().Contains(searchForAlbum))
|
||||
_FilteredSongs.Add(song);
|
||||
if (searchForArtist != null && song.Artist.ToUpper().Contains(searchForArtist))
|
||||
_FilteredSongs.Add(song);
|
||||
if (searchForTitle != null && song.Title.ToUpper().Contains(searchForTitle))
|
||||
_FilteredSongs.Add(song);
|
||||
if (searchForCreator != null && song.Creator.ToUpper().Contains(searchForCreator))
|
||||
_FilteredSongs.Add(song);
|
||||
if (searchForFileName != null && song.FileName.ToUpper().Contains(searchForFileName))
|
||||
_FilteredSongs.Add(song);
|
||||
if (searchForFolderName != null && song.FolderName.ToUpper().Contains(searchForFolderName))
|
||||
_FilteredSongs.Add(song);
|
||||
|
||||
if (searchForGenre != null)
|
||||
{
|
||||
foreach (String genre in song.Genres)
|
||||
{
|
||||
if (genre.ToUpper().Contains(searchForGenre))
|
||||
_FilteredSongs.Add(song);
|
||||
}
|
||||
}
|
||||
|
||||
if (searchForLanguage != null)
|
||||
{
|
||||
foreach (String language in song.Languages)
|
||||
{
|
||||
if (language.ToUpper().Contains(searchForLanguage))
|
||||
_FilteredSongs.Add(song);
|
||||
}
|
||||
}
|
||||
|
||||
if (searchForEdition != null)
|
||||
{
|
||||
foreach (String edition in song.Editions)
|
||||
{
|
||||
if (edition.ToUpper().Contains(searchForEdition))
|
||||
_FilteredSongs.Add(song);
|
||||
}
|
||||
}
|
||||
|
||||
if (searchForYear != null)
|
||||
{
|
||||
int pos = searchForYear.IndexOf("-");
|
||||
if (pos == -1)
|
||||
{
|
||||
if (song.Year.Contains(searchForYear))
|
||||
_FilteredSongs.Add(song);
|
||||
}
|
||||
else if (searchForYear.Length == 9)
|
||||
{
|
||||
int yearStart = -1;
|
||||
int yearEnd = -1;
|
||||
if (!Int32.TryParse(searchForYear.Substring(0, pos), out yearStart))
|
||||
continue;
|
||||
if (!Int32.TryParse(searchForYear.Substring(pos + 1), out yearEnd))
|
||||
continue;
|
||||
|
||||
// Stefan1200: Prevent searches like 0000-9999, limit for a max distance of 100 years
|
||||
if (yearEnd - yearStart > 100)
|
||||
continue;
|
||||
|
||||
int yearSearch = -1;
|
||||
if (!Int32.TryParse(song.Year, out yearSearch))
|
||||
continue;
|
||||
|
||||
if (yearSearch >= yearStart && yearSearch <= yearEnd)
|
||||
_FilteredSongs.Add(song);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string search = song.Title.ToUpper() + " " + song.Artist.ToUpper() + " " + song.FolderName.ToUpper() + " " + song.FileName.ToUpper();
|
||||
string search = song.Title.ToUpper() + " " + song.Artist.ToUpper();
|
||||
|
||||
if (searchStrings.All(search.Contains))
|
||||
_FilteredSongs.Add(song);
|
||||
@@ -114,4 +273,4 @@ namespace Vocaluxe.Base
|
||||
_Changed = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -9,7 +9,7 @@ platform:
|
||||
clone_depth: 15
|
||||
environment:
|
||||
GitHubKey:
|
||||
secure: JSlN/em0JdspVn8jwaQ4IjugY6OQi0au4Qq0rhctJmcfGMaEGnUAOmDFULI48REW
|
||||
secure: sGetWh2XUYs95VBT+QYNPtDW9Rh2/JBuxNNYXytpn7mMudUMcjSKDGErkCTum+ZE
|
||||
init:
|
||||
- git config --global core.autocrlf true
|
||||
install:
|
||||
@@ -135,7 +135,7 @@ deploy:
|
||||
release: $(APPVEYOR_REPO_TAG_NAME)
|
||||
description: $(APPVEYOR_REPO_COMMIT)
|
||||
auth_token:
|
||||
secure: JSlN/em0JdspVn8jwaQ4IjugY6OQi0au4Qq0rhctJmcfGMaEGnUAOmDFULI48REW
|
||||
secure: sGetWh2XUYs95VBT+QYNPtDW9Rh2/JBuxNNYXytpn7mMudUMcjSKDGErkCTum+ZE
|
||||
artifact: ReleaseZip
|
||||
prerelease: $(IS_BETA_RELEASE)
|
||||
on:
|
||||
@@ -147,7 +147,7 @@ deploy:
|
||||
release: Latest Nightly build
|
||||
description: $(APPVEYOR_REPO_COMMIT)
|
||||
auth_token:
|
||||
secure: JSlN/em0JdspVn8jwaQ4IjugY6OQi0au4Qq0rhctJmcfGMaEGnUAOmDFULI48REW
|
||||
secure: sGetWh2XUYs95VBT+QYNPtDW9Rh2/JBuxNNYXytpn7mMudUMcjSKDGErkCTum+ZE
|
||||
artifact: ReleaseZip
|
||||
prerelease: true
|
||||
on:
|
||||
|
||||
Reference in new issue
Block a user