CHelper now fully static
This commit is contained in:
1 parent
e6f70daf63
commit
78870ae26d
11 files changed
+30
-46
No files matched your search
@@ -15,7 +15,6 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
static class CBackgroundMusic
|
||||
{
|
||||
private static CHelper Helper = new CHelper();
|
||||
private static int _CurrentMusicStream = -1;
|
||||
private static int _PreviousMusicIndex = 0;
|
||||
private static PlaylistElement _CurrentPlaylistElement = new PlaylistElement();
|
||||
@@ -155,7 +154,7 @@ namespace Vocaluxe.Base
|
||||
|
||||
foreach(string ending in CSettings.MusicFileTypes)
|
||||
{
|
||||
templist.AddRange(Helper.ListFiles(CSettings.sFolderBackgroundMusic, ending, true, true));
|
||||
templist.AddRange(CHelper.ListFiles(CSettings.sFolderBackgroundMusic, ending, true, true));
|
||||
}
|
||||
|
||||
foreach (string path in templist)
|
||||
|
||||
@@ -157,9 +157,8 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
_CoverThemes.Clear();
|
||||
|
||||
CHelper Helper = new CHelper();
|
||||
string path = CSettings.sFolderCover;
|
||||
List<string> files = Helper.ListFiles(path, "*.xml", false);
|
||||
List<string> files = CHelper.ListFiles(path, "*.xml", false);
|
||||
|
||||
foreach (string file in files)
|
||||
{
|
||||
@@ -230,13 +229,12 @@ namespace Vocaluxe.Base
|
||||
}
|
||||
}
|
||||
|
||||
CHelper Helper = new CHelper();
|
||||
List<string> files = new List<string>();
|
||||
|
||||
files.AddRange(Helper.ListFiles(Path.Combine(CSettings.sFolderCover, coverTheme.Folder), "*.png", true, true));
|
||||
files.AddRange(Helper.ListFiles(Path.Combine(CSettings.sFolderCover, coverTheme.Folder), "*.jpg", true, true));
|
||||
files.AddRange(Helper.ListFiles(Path.Combine(CSettings.sFolderCover, coverTheme.Folder), "*.jpeg", true, true));
|
||||
files.AddRange(Helper.ListFiles(Path.Combine(CSettings.sFolderCover, coverTheme.Folder), "*.bmp", true, true));
|
||||
files.AddRange(CHelper.ListFiles(Path.Combine(CSettings.sFolderCover, coverTheme.Folder), "*.png", true, true));
|
||||
files.AddRange(CHelper.ListFiles(Path.Combine(CSettings.sFolderCover, coverTheme.Folder), "*.jpg", true, true));
|
||||
files.AddRange(CHelper.ListFiles(Path.Combine(CSettings.sFolderCover, coverTheme.Folder), "*.jpeg", true, true));
|
||||
files.AddRange(CHelper.ListFiles(Path.Combine(CSettings.sFolderCover, coverTheme.Folder), "*.bmp", true, true));
|
||||
|
||||
|
||||
foreach (string file in files)
|
||||
|
||||
@@ -28,7 +28,6 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
private static XmlWriterSettings _settings = new XmlWriterSettings();
|
||||
private static List<SLanguage> _Languages;
|
||||
private static CHelper Helper = new CHelper();
|
||||
private static int _CurrentLanguage = 0;
|
||||
private static int _FallbackLanguage = 0;
|
||||
|
||||
@@ -62,7 +61,7 @@ namespace Vocaluxe.Base
|
||||
_settings.ConformanceLevel = ConformanceLevel.Document;
|
||||
|
||||
List<string> files = new List<string>();
|
||||
files.AddRange(Helper.ListFiles(CSettings.sFolderLanguages, "*.xml", true, true));
|
||||
files.AddRange(CHelper.ListFiles(CSettings.sFolderLanguages, "*.xml", true, true));
|
||||
|
||||
foreach (string file in files)
|
||||
{
|
||||
@@ -228,7 +227,7 @@ namespace Vocaluxe.Base
|
||||
public static bool LoadPartyLanguageFiles(int PartyModeID, string Path)
|
||||
{
|
||||
List<string> files = new List<string>();
|
||||
files.AddRange(Helper.ListFiles(Path, "*.xml", true, true));
|
||||
files.AddRange(CHelper.ListFiles(Path, "*.xml", true, true));
|
||||
|
||||
foreach (string file in files)
|
||||
{
|
||||
|
||||
@@ -34,7 +34,6 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
const int PartyModeSystemVersion = 1;
|
||||
|
||||
private static CHelper Helper;
|
||||
private static Dictionary<int, SPartyMode> _PartyModes;
|
||||
private static Queue<int> _IDs;
|
||||
|
||||
@@ -44,7 +43,6 @@ namespace Vocaluxe.Base
|
||||
#region public stuff
|
||||
public static void Init()
|
||||
{
|
||||
Helper = new CHelper();
|
||||
_PartyModes = new Dictionary<int, SPartyMode>();
|
||||
_IDs = new Queue<int>(1000);
|
||||
|
||||
@@ -206,7 +204,7 @@ namespace Vocaluxe.Base
|
||||
private static void LoadPartyModes()
|
||||
{
|
||||
List<string> files = new List<string>();
|
||||
files.AddRange(Helper.ListFiles(CSettings.sFolderPartyModes, "*.xml", false, true));
|
||||
files.AddRange(CHelper.ListFiles(CSettings.sFolderPartyModes, "*.xml", false, true));
|
||||
|
||||
foreach (string file in files)
|
||||
{
|
||||
@@ -269,7 +267,7 @@ namespace Vocaluxe.Base
|
||||
string PathToCode = Path.Combine(Path.Combine(CSettings.sFolderPartyModes, pm.Folder), CSettings.sFolderPartyModeCode);
|
||||
|
||||
List<string> FilesToCompile = new List<string>();
|
||||
FilesToCompile.AddRange(Helper.ListFiles(PathToCode, "*.cs", false, true));
|
||||
FilesToCompile.AddRange(CHelper.ListFiles(PathToCode, "*.cs", false, true));
|
||||
|
||||
Assembly Output = CompileFiles(FilesToCompile.ToArray());
|
||||
if (Output == null)
|
||||
|
||||
@@ -15,7 +15,6 @@ namespace Vocaluxe.Base
|
||||
static class CPlaylists
|
||||
{
|
||||
private static List<CPlaylistFile> _Playlists;
|
||||
private static CHelper Helper = new CHelper();
|
||||
|
||||
public static CPlaylistFile[] Playlists
|
||||
{
|
||||
@@ -51,7 +50,7 @@ namespace Vocaluxe.Base
|
||||
public static void ConvertUSDXPlaylists()
|
||||
{
|
||||
List<string> files = new List<string>();
|
||||
files.AddRange(Helper.ListFiles(CSettings.sFolderPlaylists, "*.upl", true, true));
|
||||
files.AddRange(CHelper.ListFiles(CSettings.sFolderPlaylists, "*.upl", true, true));
|
||||
|
||||
foreach (string file in files)
|
||||
{
|
||||
@@ -65,7 +64,7 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
_Playlists = new List<CPlaylistFile>();
|
||||
List<string> files = new List<string>();
|
||||
files.AddRange(Helper.ListFiles(CSettings.sFolderPlaylists, "*.xml", true, true));
|
||||
files.AddRange(CHelper.ListFiles(CSettings.sFolderPlaylists, "*.xml", true, true));
|
||||
|
||||
foreach (string file in files)
|
||||
{
|
||||
|
||||
@@ -12,7 +12,6 @@ namespace Vocaluxe.Base
|
||||
static class CProfiles
|
||||
{
|
||||
private static XmlWriterSettings _settings = new XmlWriterSettings();
|
||||
private static CHelper Helper = new CHelper();
|
||||
private static List<SProfile> _Profiles;
|
||||
private static List<SAvatar> _Avatars = new List<SAvatar>();
|
||||
|
||||
@@ -86,7 +85,7 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
_Profiles = new List<SProfile>();
|
||||
List<string> files = new List<string>();
|
||||
files.AddRange(Helper.ListFiles(CSettings.sFolderProfiles, "*.xml", true, true));
|
||||
files.AddRange(CHelper.ListFiles(CSettings.sFolderProfiles, "*.xml", true, true));
|
||||
|
||||
foreach (string file in files)
|
||||
{
|
||||
@@ -106,10 +105,10 @@ namespace Vocaluxe.Base
|
||||
_Avatars.Clear();
|
||||
|
||||
List<string> files = new List<string>();
|
||||
files.AddRange(Helper.ListFiles(CSettings.sFolderProfiles, "*.png", true, true));
|
||||
files.AddRange(Helper.ListFiles(CSettings.sFolderProfiles, "*.jpg", true, true));
|
||||
files.AddRange(Helper.ListFiles(CSettings.sFolderProfiles, "*.jpeg", true, true));
|
||||
files.AddRange(Helper.ListFiles(CSettings.sFolderProfiles, "*.bmp", true, true));
|
||||
files.AddRange(CHelper.ListFiles(CSettings.sFolderProfiles, "*.png", true, true));
|
||||
files.AddRange(CHelper.ListFiles(CSettings.sFolderProfiles, "*.jpg", true, true));
|
||||
files.AddRange(CHelper.ListFiles(CSettings.sFolderProfiles, "*.jpeg", true, true));
|
||||
files.AddRange(CHelper.ListFiles(CSettings.sFolderProfiles, "*.bmp", true, true));
|
||||
|
||||
foreach (string file in files)
|
||||
{
|
||||
|
||||
@@ -41,7 +41,6 @@ namespace Vocaluxe.Base
|
||||
private static SongPointer[] _SongsSortList = new SongPointer[0];
|
||||
private static List<CSong> _SongsForRandom = new List<CSong>();
|
||||
|
||||
private static CHelper Helper = new CHelper();
|
||||
private static bool _SongsLoaded = false;
|
||||
private static bool _CoverLoaded = false;
|
||||
private static int _CoverLoadIndex = -1;
|
||||
@@ -707,8 +706,8 @@ namespace Vocaluxe.Base
|
||||
foreach (string p in CConfig.SongFolder)
|
||||
{
|
||||
string path = p;
|
||||
files.AddRange(Helper.ListFiles(path, "*.txt", true, true));
|
||||
files.AddRange(Helper.ListFiles(path, "*.txd", true, true));
|
||||
files.AddRange(CHelper.ListFiles(path, "*.txt", true, true));
|
||||
files.AddRange(CHelper.ListFiles(path, "*.txd", true, true));
|
||||
}
|
||||
CLog.StopBenchmark(2, "List Songs");
|
||||
|
||||
|
||||
@@ -406,11 +406,10 @@ namespace Vocaluxe.Base
|
||||
|
||||
private static void ListThemes()
|
||||
{
|
||||
CHelper Helper = new CHelper();
|
||||
_Themes.Clear();
|
||||
|
||||
string path = Path.Combine(Directory.GetCurrentDirectory(), CSettings.sFolderThemes);
|
||||
List<string> files = Helper.ListFiles(path, "*.xml", false);
|
||||
List<string> files = CHelper.ListFiles(path, "*.xml", false);
|
||||
|
||||
foreach (string file in files)
|
||||
{
|
||||
@@ -469,7 +468,6 @@ namespace Vocaluxe.Base
|
||||
|
||||
public static void ListSkins()
|
||||
{
|
||||
CHelper Helper = new CHelper();
|
||||
int themeIndex = GetThemeIndex(-1);
|
||||
_Skins.Clear();
|
||||
|
||||
@@ -483,8 +481,6 @@ namespace Vocaluxe.Base
|
||||
|
||||
public static void ListSkins(int ThemeIndex)
|
||||
{
|
||||
CHelper Helper = new CHelper();
|
||||
|
||||
if (ThemeIndex < 0 || ThemeIndex >= _Themes.Count)
|
||||
{
|
||||
CLog.LogError("Error List Skins. Can't find Theme index: " + ThemeIndex.ToString());
|
||||
@@ -494,7 +490,7 @@ namespace Vocaluxe.Base
|
||||
Theme theme = _Themes[ThemeIndex];
|
||||
|
||||
string path = Path.Combine(theme.Path, theme.SkinFolder);
|
||||
List<string> files = Helper.ListFiles(path, "*.xml", false);
|
||||
List<string> files = CHelper.ListFiles(path, "*.xml", false);
|
||||
|
||||
foreach (string file in files)
|
||||
{
|
||||
|
||||
@@ -14,7 +14,6 @@ namespace Vocaluxe.Lib.Playlist
|
||||
public class CPlaylistFile
|
||||
{
|
||||
private static XmlWriterSettings _settings = new XmlWriterSettings();
|
||||
private static CHelper Helper = new CHelper();
|
||||
|
||||
public string PlaylistName;
|
||||
public string PlaylistFile;
|
||||
|
||||
@@ -7,8 +7,9 @@ using System.Text;
|
||||
|
||||
namespace Vocaluxe.Menu
|
||||
{
|
||||
public class CHelper
|
||||
public static class CHelper
|
||||
{
|
||||
|
||||
public static int nCk(int n, int k)
|
||||
{
|
||||
if (k > n)
|
||||
@@ -128,17 +129,17 @@ namespace Vocaluxe.Menu
|
||||
|
||||
|
||||
|
||||
public List<string> ListFiles(string path, string cast)
|
||||
public static List<string> ListFiles(string path, string cast)
|
||||
{
|
||||
return ListFiles(path, cast, false, false);
|
||||
}
|
||||
|
||||
public List<string> ListFiles(string path, string cast, bool recursive)
|
||||
public static List<string> ListFiles(string path, string cast, bool recursive)
|
||||
{
|
||||
return ListFiles(path, cast, recursive, false);
|
||||
}
|
||||
|
||||
public List<string> ListFiles(string path, string cast, bool recursive, bool fullpath)
|
||||
public static List<string> ListFiles(string path, string cast, bool recursive, bool fullpath)
|
||||
{
|
||||
List<string> files = new List<string>();
|
||||
DirectoryInfo dir = new DirectoryInfo(path);
|
||||
@@ -151,7 +152,6 @@ namespace Vocaluxe.Menu
|
||||
if (!fullpath)
|
||||
files.Add(file.Name);
|
||||
else
|
||||
//files.Add(Path.Combine(file.DirectoryName, file.Name));
|
||||
files.Add(file.FullName);
|
||||
}
|
||||
|
||||
|
||||
@@ -818,11 +818,9 @@ namespace Vocaluxe.Menu.SongMenu
|
||||
|
||||
private void CheckFiles()
|
||||
{
|
||||
CHelper Helper = new CHelper();
|
||||
|
||||
if(this.CoverFileName == String.Empty){
|
||||
List<string> files = Helper.ListFiles(this.Folder, "*.jpg", false);
|
||||
files.AddRange(Helper.ListFiles(this.Folder, "*.png", false));
|
||||
List<string> files = CHelper.ListFiles(this.Folder, "*.jpg", false);
|
||||
files.AddRange(CHelper.ListFiles(this.Folder, "*.png", false));
|
||||
foreach(String file in files)
|
||||
{
|
||||
if (Regex.IsMatch(file, @".[CO].", RegexOptions.IgnoreCase) && (Regex.IsMatch(file, @"" + Regex.Escape(this.Title), RegexOptions.IgnoreCase) || Regex.IsMatch(file, @"" + Regex.Escape(this.Artist), RegexOptions.IgnoreCase)))
|
||||
@@ -834,8 +832,8 @@ namespace Vocaluxe.Menu.SongMenu
|
||||
|
||||
if (this.BackgroundFileName == String.Empty)
|
||||
{
|
||||
List<string> files = Helper.ListFiles(this.Folder, "*.jpg", false);
|
||||
files.AddRange(Helper.ListFiles(this.Folder, "*.png", false));
|
||||
List<string> files = CHelper.ListFiles(this.Folder, "*.jpg", false);
|
||||
files.AddRange(CHelper.ListFiles(this.Folder, "*.png", false));
|
||||
foreach (String file in files)
|
||||
{
|
||||
|
||||
|
||||
Reference in new issue
Block a user